diff --git a/layout/style/BindingStyleRule.h b/layout/style/BindingStyleRule.h index 91613db85aa2..96cf386d92e5 100644 --- a/layout/style/BindingStyleRule.h +++ b/layout/style/BindingStyleRule.h @@ -9,6 +9,7 @@ #include "nscore.h" #include "nsStringGlue.h" #include "mozilla/css/Rule.h" +#include "mozilla/NotNull.h" /** * Shared superclass for mozilla::css::StyleRule and mozilla::ServoStyleRule, @@ -18,6 +19,7 @@ class nsICSSDeclaration; namespace mozilla { +class DeclarationBlock; namespace dom { class Element; } @@ -54,6 +56,7 @@ public: uint32_t aSelectorIndex, const nsAString& aPseudo, bool* aMatches) = 0; + virtual NotNull GetDeclarationBlock() const = 0; // WebIDL API // For GetSelectorText/SetSelectorText, we purposefully use a signature that diff --git a/layout/style/ServoStyleRule.cpp b/layout/style/ServoStyleRule.cpp index e4e6c5a43a60..1d7470eef037 100644 --- a/layout/style/ServoStyleRule.cpp +++ b/layout/style/ServoStyleRule.cpp @@ -298,4 +298,10 @@ ServoStyleRule::SelectorMatchesElement(Element* aElement, return NS_OK; } +NotNull +ServoStyleRule::GetDeclarationBlock() const +{ + return WrapNotNull(mDecls.mDecls); +} + } // namespace mozilla diff --git a/layout/style/ServoStyleRule.h b/layout/style/ServoStyleRule.h index 30c0d640a08f..cf10aba03232 100644 --- a/layout/style/ServoStyleRule.h +++ b/layout/style/ServoStyleRule.h @@ -80,6 +80,7 @@ public: uint32_t aSelectorIndex, const nsAString& aPseudo, bool* aMatches) override; + NotNull GetDeclarationBlock() const override; // WebIDL interface uint16_t Type() const final; diff --git a/layout/style/StyleRule.cpp b/layout/style/StyleRule.cpp index 6df39aeeba61..8c4b210523fd 100644 --- a/layout/style/StyleRule.cpp +++ b/layout/style/StyleRule.cpp @@ -1513,5 +1513,11 @@ StyleRule::SelectorMatchesElement(Element* aElement, return NS_OK; } +NotNull +StyleRule::GetDeclarationBlock() const +{ + return WrapNotNull(mDeclaration); +} + } // namespace css } // namespace mozilla diff --git a/layout/style/StyleRule.h b/layout/style/StyleRule.h index 499638d296df..a9f436e55445 100644 --- a/layout/style/StyleRule.h +++ b/layout/style/StyleRule.h @@ -347,6 +347,7 @@ public: uint32_t aSelectorIndex, const nsAString& aPseudo, bool* aMatches) override; + mozilla::NotNull GetDeclarationBlock() const override; // WebIDL interface uint16_t Type() const override;