Bug 1451289 - Part 4: Rename ServoStyleRule to CSSStyleRule r?emilio draft
authorNazım Can Altınova <canaltinova@gmail.com>
Mon, 04 Jun 2018 15:35:50 +0200
changeset 805172 534d3a7a6abb0afbd508bb8e134ff57422cdf7fe
parent 805171 cbafb31c9e9b2d5d247eff9022435839f7c6a589
child 805173 999a9c09ca78c66f682ade3d79da2a6dac452afc
push id112583
push userbmo:canaltinova@gmail.com
push dateThu, 07 Jun 2018 11:56:39 +0000
reviewersemilio
bugs1451289
milestone62.0a1
Bug 1451289 - Part 4: Rename ServoStyleRule to CSSStyleRule r?emilio MozReview-Commit-ID: L0IH55XNdyE
layout/inspector/InspectorUtils.cpp
layout/inspector/ServoStyleRuleMap.cpp
layout/inspector/ServoStyleRuleMap.h
layout/style/CSSStyleRule.cpp
layout/style/CSSStyleRule.h
layout/style/ServoCSSRuleList.cpp
layout/style/ServoCSSRuleList.h
layout/style/ServoStyleRule.cpp
layout/style/ServoStyleRule.h
layout/style/moz.build
--- a/layout/inspector/InspectorUtils.cpp
+++ b/layout/inspector/InspectorUtils.cpp
@@ -26,26 +26,26 @@
 #include "nsComputedDOMStyle.h"
 #include "mozilla/EventStateManager.h"
 #include "nsAtom.h"
 #include "nsRange.h"
 #include "mozilla/StyleSheetInlines.h"
 #include "mozilla/dom/CharacterData.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/CSSLexer.h"
+#include "mozilla/dom/CSSStyleRule.h"
 #include "mozilla/dom/InspectorUtilsBinding.h"
 #include "mozilla/dom/ToJSValue.h"
 #include "nsCSSProps.h"
 #include "nsCSSValue.h"
 #include "nsColor.h"
 #include "mozilla/ServoStyleSet.h"
 #include "nsStyleUtil.h"
 #include "nsQueryObject.h"
 #include "mozilla/ServoBindings.h"
-#include "mozilla/ServoStyleRule.h"
 #include "mozilla/ServoStyleRuleMap.h"
 #include "mozilla/ServoCSSParser.h"
 #include "mozilla/dom/InspectorUtils.h"
 #include "mozilla/dom/InspectorFontFace.h"
 
 using namespace mozilla;
 using namespace mozilla::css;
 using namespace mozilla::dom;
@@ -218,17 +218,17 @@ InspectorUtils::GetCSSStyleRules(GlobalO
   for (auto* shadow = aElement.GetContainingShadow();
        shadow;
        shadow = shadow->Host()->GetContainingShadow()) {
     maps.AppendElement(&shadow->ServoStyleRuleMap());
   }
 
   // Find matching rules in the table.
   for (const RawServoStyleRule* rawRule : Reversed(rawRuleList)) {
-    ServoStyleRule* rule = nullptr;
+    CSSStyleRule* rule = nullptr;
     for (ServoStyleRuleMap* map : maps) {
       rule = map->Lookup(rawRule);
       if (rule) {
         break;
       }
     }
     if (rule) {
       aResult.AppendElement(rule);
--- a/layout/inspector/ServoStyleRuleMap.cpp
+++ b/layout/inspector/ServoStyleRuleMap.cpp
@@ -3,18 +3,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/ServoStyleRuleMap.h"
 
 #include "mozilla/css/GroupRule.h"
 #include "mozilla/dom/CSSRuleBinding.h"
+#include "mozilla/dom/CSSStyleRule.h"
 #include "mozilla/IntegerRange.h"
-#include "mozilla/ServoStyleRule.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/ServoImportRule.h"
 #include "mozilla/StyleSheetInlines.h"
 #include "nsDocument.h"
 #include "nsStyleSheetService.h"
 
 namespace mozilla {
 
@@ -87,17 +87,17 @@ ServoStyleRuleMap::RuleRemoved(StyleShee
                                css::Rule& aStyleRule)
 {
   if (IsEmpty()) {
     return;
   }
 
   switch (aStyleRule.Type()) {
     case CSSRuleBinding::STYLE_RULE: {
-      auto& rule = static_cast<ServoStyleRule&>(aStyleRule);
+      auto& rule = static_cast<CSSStyleRule&>(aStyleRule);
       mTable.Remove(rule.Raw());
       break;
     }
     case CSSRuleBinding::IMPORT_RULE:
     case CSSRuleBinding::MEDIA_RULE:
     case CSSRuleBinding::SUPPORTS_RULE:
     case CSSRuleBinding::DOCUMENT_RULE: {
       // See the comment in StyleSheetRemoved.
@@ -125,17 +125,17 @@ ServoStyleRuleMap::SizeOfIncludingThis(M
   return n;
 }
 
 void
 ServoStyleRuleMap::FillTableFromRule(css::Rule& aRule)
 {
   switch (aRule.Type()) {
     case CSSRuleBinding::STYLE_RULE: {
-      auto& rule = static_cast<ServoStyleRule&>(aRule);
+      auto& rule = static_cast<CSSStyleRule&>(aRule);
       mTable.Put(rule.Raw(), &rule);
       break;
     }
     case CSSRuleBinding::MEDIA_RULE:
     case CSSRuleBinding::SUPPORTS_RULE:
     case CSSRuleBinding::DOCUMENT_RULE: {
       auto& rule = static_cast<css::GroupRule&>(aRule);
       auto ruleList = static_cast<ServoCSSRuleList*>(rule.CssRules());
--- a/layout/inspector/ServoStyleRuleMap.h
+++ b/layout/inspector/ServoStyleRuleMap.h
@@ -2,17 +2,17 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_ServoStyleRuleMap_h
 #define mozilla_ServoStyleRuleMap_h
 
-#include "mozilla/ServoStyleRule.h"
+#include "mozilla/dom/CSSStyleRule.h"
 #include "mozilla/StyleSheet.h"
 
 #include "nsDataHashtable.h"
 
 struct RawServoStyleRule;
 class nsXBLPrototypeResources;
 
 namespace mozilla {
@@ -28,17 +28,17 @@ class ServoStyleRuleMap
 {
 public:
   ServoStyleRuleMap() = default;
 
   void EnsureTable(ServoStyleSet&);
   void EnsureTable(nsXBLPrototypeResources&);
   void EnsureTable(dom::ShadowRoot&);
 
-  ServoStyleRule* Lookup(const RawServoStyleRule* aRawRule) const
+  dom::CSSStyleRule* Lookup(const RawServoStyleRule* aRawRule) const
   {
     return mTable.Get(aRawRule);
   }
 
   void SheetAdded(StyleSheet&);
   void SheetRemoved(StyleSheet&);
 
   void RuleAdded(StyleSheet& aStyleSheet, css::Rule&);
@@ -54,15 +54,15 @@ private:
   // all stylesheets to fill the table.
   bool IsEmpty() const { return mTable.Count() == 0; }
 
   void FillTableFromRule(css::Rule&);
   void FillTableFromRuleList(ServoCSSRuleList&);
   void FillTableFromStyleSheet(StyleSheet&);
 
   typedef nsDataHashtable<nsPtrHashKey<const RawServoStyleRule>,
-                          WeakPtr<ServoStyleRule>> Hashtable;
+                          WeakPtr<dom::CSSStyleRule>> Hashtable;
   Hashtable mTable;
 };
 
 } // namespace mozilla
 
 #endif // mozilla_ServoStyleRuleMap_h
rename from layout/style/ServoStyleRule.cpp
rename to layout/style/CSSStyleRule.cpp
--- a/layout/style/ServoStyleRule.cpp
+++ b/layout/style/CSSStyleRule.cpp
@@ -1,240 +1,239 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-/* representation of CSSStyleRule for stylo */
-
-#include "mozilla/ServoStyleRule.h"
+#include "mozilla/dom/CSSStyleRule.h"
 
 #include "mozilla/DeclarationBlock.h"
 #include "mozilla/ServoBindings.h"
 #include "mozilla/dom/CSSStyleRuleBinding.h"
 
 #include "mozAutoDocUpdate.h"
 
 using namespace mozilla::dom;
 
 namespace mozilla {
+namespace dom {
 
-// -- ServoStyleRuleDeclaration ---------------------------------------
+// -- CSSStyleRuleDeclaration ---------------------------------------
 
-ServoStyleRuleDeclaration::ServoStyleRuleDeclaration(
+CSSStyleRuleDeclaration::CSSStyleRuleDeclaration(
   already_AddRefed<RawServoDeclarationBlock> aDecls)
   : mDecls(new DeclarationBlock(std::move(aDecls)))
 {
 }
 
-ServoStyleRuleDeclaration::~ServoStyleRuleDeclaration()
+CSSStyleRuleDeclaration::~CSSStyleRuleDeclaration()
 {
   mDecls->SetOwningRule(nullptr);
 }
 
-// QueryInterface implementation for ServoStyleRuleDeclaration
-NS_INTERFACE_MAP_BEGIN(ServoStyleRuleDeclaration)
+// QueryInterface implementation for CSSStyleRuleDeclaration
+NS_INTERFACE_MAP_BEGIN(CSSStyleRuleDeclaration)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   // We forward the cycle collection interfaces to Rule(), which is
   // never null (in fact, we're part of that object!)
   if (aIID.Equals(NS_GET_IID(nsCycleCollectionISupports)) ||
       aIID.Equals(NS_GET_IID(nsXPCOMCycleCollectionParticipant))) {
     return Rule()->QueryInterface(aIID, aInstancePtr);
   }
   else
 NS_IMPL_QUERY_TAIL_INHERITING(nsDOMCSSDeclaration)
 
-NS_IMPL_ADDREF_USING_AGGREGATOR(ServoStyleRuleDeclaration, Rule())
-NS_IMPL_RELEASE_USING_AGGREGATOR(ServoStyleRuleDeclaration, Rule())
+NS_IMPL_ADDREF_USING_AGGREGATOR(CSSStyleRuleDeclaration, Rule())
+NS_IMPL_RELEASE_USING_AGGREGATOR(CSSStyleRuleDeclaration, Rule())
 
 /* nsDOMCSSDeclaration implementation */
 
 css::Rule*
-ServoStyleRuleDeclaration::GetParentRule()
+CSSStyleRuleDeclaration::GetParentRule()
 {
   return Rule();
 }
 
 nsINode*
-ServoStyleRuleDeclaration::GetParentObject()
+CSSStyleRuleDeclaration::GetParentObject()
 {
   return Rule()->GetParentObject();
 }
 
 DeclarationBlock*
-ServoStyleRuleDeclaration::GetCSSDeclaration(Operation aOperation)
+CSSStyleRuleDeclaration::GetCSSDeclaration(Operation aOperation)
 {
   return mDecls;
 }
 
 nsresult
-ServoStyleRuleDeclaration::SetCSSDeclaration(DeclarationBlock* aDecl)
+CSSStyleRuleDeclaration::SetCSSDeclaration(DeclarationBlock* aDecl)
 {
-  ServoStyleRule* rule = Rule();
+  CSSStyleRule* rule = Rule();
   if (RefPtr<StyleSheet> sheet = rule->GetStyleSheet()) {
     if (aDecl != mDecls) {
       mDecls->SetOwningRule(nullptr);
       RefPtr<DeclarationBlock> decls = aDecl;
       Servo_StyleRule_SetStyle(rule->Raw(), decls->Raw());
       mDecls = decls.forget();
       mDecls->SetOwningRule(rule);
     }
     sheet->RuleChanged(rule);
   }
   return NS_OK;
 }
 
 nsIDocument*
-ServoStyleRuleDeclaration::DocToUpdate()
+CSSStyleRuleDeclaration::DocToUpdate()
 {
   return nullptr;
 }
 
 nsDOMCSSDeclaration::ParsingEnvironment
-ServoStyleRuleDeclaration::GetParsingEnvironment(
+CSSStyleRuleDeclaration::GetParsingEnvironment(
   nsIPrincipal* aSubjectPrincipal) const
 {
   return GetParsingEnvironmentForRule(Rule());
 }
 
-// -- ServoStyleRule --------------------------------------------------
+// -- CSSStyleRule --------------------------------------------------
 
-ServoStyleRule::ServoStyleRule(already_AddRefed<RawServoStyleRule> aRawRule,
+CSSStyleRule::CSSStyleRule(already_AddRefed<RawServoStyleRule> aRawRule,
                                uint32_t aLine, uint32_t aColumn)
   : BindingStyleRule(aLine, aColumn)
   , mRawRule(aRawRule)
   , mDecls(Servo_StyleRule_GetStyle(mRawRule).Consume())
 {
 }
 
-NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(ServoStyleRule, css::Rule)
+NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(CSSStyleRule, css::Rule)
 
-NS_IMPL_CYCLE_COLLECTION_CLASS(ServoStyleRule)
+NS_IMPL_CYCLE_COLLECTION_CLASS(CSSStyleRule)
 
-NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(ServoStyleRule, css::Rule)
+NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(CSSStyleRule, css::Rule)
   // Keep this in sync with IsCCLeaf.
 
   // Trace the wrapper for our declaration.  This just expands out
   // NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER which we can't use
   // directly because the wrapper is on the declaration, not on us.
   tmp->mDecls.TraceWrapper(aCallbacks, aClosure);
 NS_IMPL_CYCLE_COLLECTION_TRACE_END
 
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(ServoStyleRule, css::Rule)
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(CSSStyleRule, css::Rule)
   // Keep this in sync with IsCCLeaf.
 
   // Unlink the wrapper for our declaraton.  This just expands out
   // NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER which we can't use
   // directly because the wrapper is on the declaration, not on us.
   tmp->mDecls.ReleaseWrapper(static_cast<nsISupports*>(p));
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(ServoStyleRule, css::Rule)
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(CSSStyleRule, css::Rule)
   // Keep this in sync with IsCCLeaf.
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 bool
-ServoStyleRule::IsCCLeaf() const
+CSSStyleRule::IsCCLeaf() const
 {
   if (!Rule::IsCCLeaf()) {
     return false;
   }
 
   return !mDecls.PreservingWrapper();
 }
 
 size_t
-ServoStyleRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
+CSSStyleRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
 {
   size_t n = aMallocSizeOf(this);
 
   // Measurement of the following members may be added later if DMD finds it is
   // worthwhile:
   // - mRawRule
   // - mDecls
 
   return n;
 }
 
 #ifdef DEBUG
 void
-ServoStyleRule::List(FILE* out, int32_t aIndent) const
+CSSStyleRule::List(FILE* out, int32_t aIndent) const
 {
   nsAutoCString str;
   for (int32_t i = 0; i < aIndent; i++) {
     str.AppendLiteral("  ");
   }
   Servo_StyleRule_Debug(mRawRule, &str);
   fprintf_stderr(out, "%s\n", str.get());
 }
 #endif
 
 /* CSSRule implementation */
 
 void
-ServoStyleRule::GetCssText(nsAString& aCssText) const
+CSSStyleRule::GetCssText(nsAString& aCssText) const
 {
   Servo_StyleRule_GetCssText(mRawRule, &aCssText);
 }
 
 nsICSSDeclaration*
-ServoStyleRule::Style()
+CSSStyleRule::Style()
 {
   return &mDecls;
 }
 
 /* CSSStyleRule implementation */
 
 void
-ServoStyleRule::GetSelectorText(nsAString& aSelectorText)
+CSSStyleRule::GetSelectorText(nsAString& aSelectorText)
 {
   Servo_StyleRule_GetSelectorText(mRawRule, &aSelectorText);
 }
 
 void
-ServoStyleRule::SetSelectorText(const nsAString& aSelectorText)
+CSSStyleRule::SetSelectorText(const nsAString& aSelectorText)
 {
   if (RefPtr<StyleSheet> sheet = GetStyleSheet()) {
     // StyleRule lives inside of the Inner, it is unsafe to call WillDirty
     // if sheet does not already have a unique Inner.
     sheet->AssertHasUniqueInner();
     sheet->WillDirty();
 
     const RawServoStyleSheetContents* contents = sheet->RawContents();
     if (Servo_StyleRule_SetSelectorText(contents, mRawRule, &aSelectorText)) {
       sheet->RuleChanged(this);
     }
   }
 }
 
 uint32_t
-ServoStyleRule::GetSelectorCount()
+CSSStyleRule::GetSelectorCount()
 {
   uint32_t aCount;
   Servo_StyleRule_GetSelectorCount(mRawRule, &aCount);
   return aCount;
 }
 
 nsresult
-ServoStyleRule::GetSelectorText(uint32_t aSelectorIndex, nsAString& aText)
+CSSStyleRule::GetSelectorText(uint32_t aSelectorIndex, nsAString& aText)
 {
   Servo_StyleRule_GetSelectorTextAtIndex(mRawRule, aSelectorIndex, &aText);
   return NS_OK;
 }
 
 nsresult
-ServoStyleRule::GetSpecificity(uint32_t aSelectorIndex, uint64_t* aSpecificity)
+CSSStyleRule::GetSpecificity(uint32_t aSelectorIndex, uint64_t* aSpecificity)
 {
   Servo_StyleRule_GetSpecificityAtIndex(mRawRule, aSelectorIndex, aSpecificity);
   return NS_OK;
 }
 
 nsresult
-ServoStyleRule::SelectorMatchesElement(Element* aElement,
+CSSStyleRule::SelectorMatchesElement(Element* aElement,
                                        uint32_t aSelectorIndex,
                                        const nsAString& aPseudo,
                                        bool* aMatches)
 {
   CSSPseudoElementType pseudoType = CSSPseudoElementType::NotPseudo;
   if (!aPseudo.IsEmpty()) {
     RefPtr<nsAtom> pseudoElt = NS_Atomize(aPseudo);
     pseudoType = nsCSSPseudoElements::GetPseudoType(
@@ -248,14 +247,15 @@ ServoStyleRule::SelectorMatchesElement(E
 
   *aMatches = Servo_StyleRule_SelectorMatchesElement(mRawRule, aElement,
                                                      aSelectorIndex, pseudoType);
 
   return NS_OK;
 }
 
 NotNull<DeclarationBlock*>
-ServoStyleRule::GetDeclarationBlock() const
+CSSStyleRule::GetDeclarationBlock() const
 {
   return WrapNotNull(mDecls.mDecls);
 }
 
+} // namespace dom
 } // namespace mozilla
rename from layout/style/ServoStyleRule.h
rename to layout/style/CSSStyleRule.h
--- a/layout/style/ServoStyleRule.h
+++ b/layout/style/CSSStyleRule.h
@@ -1,76 +1,73 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-/* representation of CSSStyleRule for stylo */
-
-#ifndef mozilla_ServoStyleRule_h
-#define mozilla_ServoStyleRule_h
+#ifndef mozilla_CSSStyleRule_h
+#define mozilla_CSSStyleRule_h
 
 #include "mozilla/BindingStyleRule.h"
 #include "mozilla/ServoBindingTypes.h"
 #include "mozilla/WeakPtr.h"
 
 #include "nsDOMCSSDeclaration.h"
 
 namespace mozilla {
 
+class DeclarationBlock;
+
 namespace dom {
 class DocGroup;
-} // namespace dom
+class CSSStyleRule;
 
-class DeclarationBlock;
-class ServoStyleRule;
-
-class ServoStyleRuleDeclaration final : public nsDOMCSSDeclaration
+class CSSStyleRuleDeclaration final : public nsDOMCSSDeclaration
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
 
   css::Rule* GetParentRule() final;
   nsINode* GetParentObject() final;
 
 protected:
   DeclarationBlock* GetCSSDeclaration(Operation aOperation) final;
   nsresult SetCSSDeclaration(DeclarationBlock* aDecl) final;
   nsIDocument* DocToUpdate() final;
   ParsingEnvironment
   GetParsingEnvironment(nsIPrincipal* aSubjectPrincipal) const final;
 
 private:
   // For accessing the constructor.
-  friend class ServoStyleRule;
+  friend class CSSStyleRule;
 
-  explicit ServoStyleRuleDeclaration(
+  explicit CSSStyleRuleDeclaration(
     already_AddRefed<RawServoDeclarationBlock> aDecls);
-  ~ServoStyleRuleDeclaration();
+  ~CSSStyleRuleDeclaration();
 
-  inline ServoStyleRule* Rule();
-  inline const ServoStyleRule* Rule() const;
+  inline CSSStyleRule* Rule();
+  inline const CSSStyleRule* Rule() const;
 
   RefPtr<DeclarationBlock> mDecls;
 };
 
-class ServoStyleRule final : public BindingStyleRule
-                           , public SupportsWeakPtr<ServoStyleRule>
+class CSSStyleRule final : public BindingStyleRule
+                           , public SupportsWeakPtr<CSSStyleRule>
 {
 public:
-  ServoStyleRule(already_AddRefed<RawServoStyleRule> aRawRule,
+  CSSStyleRule(already_AddRefed<RawServoStyleRule> aRawRule,
                  uint32_t aLine, uint32_t aColumn);
 
   NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(ServoStyleRule,
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(CSSStyleRule,
                                                          css::Rule)
   bool IsCCLeaf() const final MOZ_MUST_OVERRIDE;
 
-  MOZ_DECLARE_WEAKREFERENCE_TYPENAME(ServoStyleRule)
+  MOZ_DECLARE_WEAKREFERENCE_TYPENAME(CSSStyleRule)
 
   uint32_t GetSelectorCount() override;
   nsresult GetSelectorText(uint32_t aSelectorIndex,
                            nsAString& aText) override;
   nsresult GetSpecificity(uint32_t aSelectorIndex,
                           uint64_t* aSpecificity) override;
   nsresult SelectorMatchesElement(dom::Element* aElement,
                                   uint32_t aSelectorIndex,
@@ -89,34 +86,35 @@ public:
 
   // Methods of mozilla::css::Rule
   size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const final;
 #ifdef DEBUG
   void List(FILE* out = stdout, int32_t aIndent = 0) const final;
 #endif
 
 private:
-  ~ServoStyleRule() {}
+  ~CSSStyleRule() {}
 
   // For computing the offset of mDecls.
-  friend class ServoStyleRuleDeclaration;
+  friend class CSSStyleRuleDeclaration;
 
   RefPtr<RawServoStyleRule> mRawRule;
-  ServoStyleRuleDeclaration mDecls;
+  CSSStyleRuleDeclaration mDecls;
 };
 
-ServoStyleRule*
-ServoStyleRuleDeclaration::Rule()
+CSSStyleRule*
+CSSStyleRuleDeclaration::Rule()
 {
-  return reinterpret_cast<ServoStyleRule*>(
-    reinterpret_cast<uint8_t*>(this) - offsetof(ServoStyleRule, mDecls));
+  return reinterpret_cast<CSSStyleRule*>(
+    reinterpret_cast<uint8_t*>(this) - offsetof(CSSStyleRule, mDecls));
 }
 
-const ServoStyleRule*
-ServoStyleRuleDeclaration::Rule() const
+const CSSStyleRule*
+CSSStyleRuleDeclaration::Rule() const
 {
-  return reinterpret_cast<const ServoStyleRule*>(
-    reinterpret_cast<const uint8_t*>(this) - offsetof(ServoStyleRule, mDecls));
+  return reinterpret_cast<const CSSStyleRule*>(
+    reinterpret_cast<const uint8_t*>(this) - offsetof(CSSStyleRule, mDecls));
 }
 
+} // namespace dom
 } // namespace mozilla
 
-#endif // mozilla_ServoStyleRule_h
+#endif // mozilla_CSSStyleRule_h
--- a/layout/style/ServoCSSRuleList.cpp
+++ b/layout/style/ServoCSSRuleList.cpp
@@ -6,25 +6,25 @@
 
 /* representation of CSSRuleList for stylo */
 
 #include "mozilla/ServoCSSRuleList.h"
 
 #include "mozilla/dom/CSSKeyframesRule.h"
 #include "mozilla/dom/CSSMediaRule.h"
 #include "mozilla/dom/CSSNamespaceRule.h"
+#include "mozilla/dom/CSSStyleRule.h"
 #include "mozilla/IntegerRange.h"
 #include "mozilla/ServoBindings.h"
 #include "mozilla/ServoCounterStyleRule.h"
 #include "mozilla/ServoDocumentRule.h"
 #include "mozilla/ServoImportRule.h"
 #include "mozilla/ServoFontFaceRule.h"
 #include "mozilla/ServoFontFeatureValuesRule.h"
 #include "mozilla/ServoPageRule.h"
-#include "mozilla/ServoStyleRule.h"
 #include "mozilla/ServoSupportsRule.h"
 #include "mozilla/StyleSheet.h"
 
 using namespace mozilla::dom;
 
 namespace mozilla {
 
 ServoCSSRuleList::ServoCSSRuleList(already_AddRefed<ServoCssRules> aRawRules,
@@ -99,17 +99,17 @@ ServoCSSRuleList::GetRule(uint32_t aInde
         RefPtr<RawServo##name_##Rule> rule =                                \
           Servo_CssRules_Get##name_##RuleAt(                                \
               mRawRules, aIndex, &line, &column                             \
           ).Consume();                                                      \
         MOZ_ASSERT(rule);                                                   \
         ruleObj = new CSS##name_##Rule(rule.forget(), line, column);        \
         break;                                                              \
       }
-      CASE_RULE(STYLE, Style)
+      CASE_RULE_CSS(STYLE, Style)
       CASE_RULE_CSS(KEYFRAMES, Keyframes)
       CASE_RULE_CSS(MEDIA, Media)
       CASE_RULE_CSS(NAMESPACE, Namespace)
       CASE_RULE(PAGE, Page)
       CASE_RULE(SUPPORTS, Supports)
       CASE_RULE(DOCUMENT, Document)
       CASE_RULE(IMPORT, Import)
       CASE_RULE(FONT_FEATURE_VALUES, FontFeatureValues)
--- a/layout/style/ServoCSSRuleList.h
+++ b/layout/style/ServoCSSRuleList.h
@@ -10,17 +10,19 @@
 #define mozilla_ServoCSSRuleList_h
 
 #include "mozilla/ServoBindingTypes.h"
 #include "mozilla/dom/CSSRuleList.h"
 #include "nsDataHashtable.h"
 
 namespace mozilla {
 
-class ServoStyleRule;
+namespace dom {
+class CSSStyleRule;
+} // namespace dom
 class StyleSheet;
 namespace css {
 class GroupRule;
 class Rule;
 } // namespace css
 
 class ServoCSSRuleList final : public dom::CSSRuleList
 {
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -88,17 +88,16 @@ EXPORTS.mozilla += [
     'ServoDocumentRule.h',
     'ServoElementSnapshot.h',
     'ServoElementSnapshotTable.h',
     'ServoFontFaceRule.h',
     'ServoFontFeatureValuesRule.h',
     'ServoImportRule.h',
     'ServoPageRule.h',
     'ServoSpecifiedValues.h',
-    'ServoStyleRule.h',
     'ServoStyleSet.h',
     'ServoStyleSetInlines.h',
     'ServoSupportsRule.h',
     'ServoTraversalStatistics.h',
     'ServoTypes.h',
     'ServoUtils.h',
     'SheetType.h',
     'StyleAnimationValue.h',
@@ -116,16 +115,17 @@ EXPORTS.mozilla.dom += [
     'CSSKeyframeRule.h',
     'CSSKeyframesRule.h',
     'CSSLexer.h',
     'CSSMediaRule.h',
     'CSSMozDocumentRule.h',
     'CSSNamespaceRule.h',
     'CSSPageRule.h',
     'CSSRuleList.h',
+    'CSSStyleRule.h',
     'CSSSupportsRule.h',
     'CSSValue.h',
     'FontFace.h',
     'FontFaceSet.h',
     'FontFaceSetIterator.h',
     'MediaList.h',
     'MediaQueryList.h',
 ]
@@ -154,16 +154,17 @@ UNIFIED_SOURCES += [
     'CSSKeyframeRule.cpp',
     'CSSKeyframesRule.cpp',
     'CSSLexer.cpp',
     'CSSMediaRule.cpp',
     'CSSMozDocumentRule.cpp',
     'CSSNamespaceRule.cpp',
     'CSSPageRule.cpp',
     'CSSRuleList.cpp',
+    'CSSStyleRule.cpp',
     'CSSSupportsRule.cpp',
     'DeclarationBlock.cpp',
     'DocumentStyleRootIterator.cpp',
     'ErrorReporter.cpp',
     'FontFace.cpp',
     'FontFaceSet.cpp',
     'FontFaceSetIterator.cpp',
     'GroupRule.cpp',
@@ -204,17 +205,16 @@ UNIFIED_SOURCES += [
     'ServoCSSRuleList.cpp',
     'ServoDocumentRule.cpp',
     'ServoElementSnapshot.cpp',
     'ServoFontFaceRule.cpp',
     'ServoFontFeatureValuesRule.cpp',
     'ServoImportRule.cpp',
     'ServoPageRule.cpp',
     'ServoSpecifiedValues.cpp',
-    'ServoStyleRule.cpp',
     'ServoStyleSet.cpp',
     'ServoSupportsRule.cpp',
     'StreamLoader.cpp',
     'StyleAnimationValue.cpp',
     'StyleComplexColor.cpp',
     'StyleSheet.cpp',
     'URLExtraData.cpp',
 ]