From 6e9ab08423114002c66dfc2381026c3d371f6883 Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Thu, 19 Oct 2017 15:55:42 +0800 Subject: [PATCH] Bug 1408311 - Part 2: Add GetDeclarationBlock method to BindingStyleRule. r=xidorn MozReview-Commit-ID: 5adkbeTOHQU --HG-- extra : rebase_source : 67d196ac36b5f6daca8e20f6ec6063b3f2f8c84d --- layout/style/BindingStyleRule.h | 3 +++ layout/style/ServoStyleRule.cpp | 6 ++++++ layout/style/ServoStyleRule.h | 1 + layout/style/StyleRule.cpp | 6 ++++++ layout/style/StyleRule.h | 1 + 5 files changed, 17 insertions(+) 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;