Bug 1451289 - Part 9: Merge ServoDocumentRule and CSSMozDocumentRule r?emilio draft
authorNazım Can Altınova <canaltinova@gmail.com>
Tue, 05 Jun 2018 17:16:51 +0200
changeset 805177 a3485c0a8b9f6139528c3ada87aeeb7a4469b134
parent 805176 33f9529131c9b9e292f00d1eb27dc75fc9853dc2
child 805178 3d49bc37a8f1ba0b2af04c8093384f80b4a77186
child 807034 7a63c8f3ff98546576d17123143efca032dd4c54
child 807060 d80f3a371a9a0e0357243f0ad45bf22dbd9647ae
child 807063 54e0929bda647bc8b8a6848025dbb555e36a88da
push id112583
push userbmo:canaltinova@gmail.com
push dateThu, 07 Jun 2018 11:56:39 +0000
reviewersemilio
bugs1451289
milestone62.0a1
Bug 1451289 - Part 9: Merge ServoDocumentRule and CSSMozDocumentRule r?emilio MozReview-Commit-ID: BkMMXBWdsfz
layout/style/CSSMozDocumentRule.cpp
layout/style/CSSMozDocumentRule.h
layout/style/ServoArcTypeList.h
layout/style/ServoBindingList.h
layout/style/ServoCSSRuleList.cpp
layout/style/ServoDocumentRule.cpp
layout/style/ServoDocumentRule.h
layout/style/moz.build
layout/style/nsMediaFeatures.h
servo/components/style/gecko/arc_types.rs
servo/ports/geckolib/glue.rs
--- a/layout/style/CSSMozDocumentRule.cpp
+++ b/layout/style/CSSMozDocumentRule.cpp
@@ -62,10 +62,64 @@ CSSMozDocumentRule::Match(nsIDocument* a
         return true;
       }
     } break;
   }
 
   return false;
 }
 
+CSSMozDocumentRule::CSSMozDocumentRule(RefPtr<RawServoMozDocumentRule> aRawRule,
+                                       uint32_t aLine, uint32_t aColumn)
+  : css::ConditionRule(Servo_MozDocumentRule_GetRules(aRawRule).Consume(),
+                       aLine, aColumn)
+  , mRawRule(std::move(aRawRule))
+{
+}
+
+NS_IMPL_ADDREF_INHERITED(CSSMozDocumentRule, css::ConditionRule)
+NS_IMPL_RELEASE_INHERITED(CSSMozDocumentRule, css::ConditionRule)
+
+// QueryInterface implementation for MozDocumentRule
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CSSMozDocumentRule)
+NS_INTERFACE_MAP_END_INHERITING(css::ConditionRule)
+
+#ifdef DEBUG
+/* virtual */ void
+CSSMozDocumentRule::List(FILE* out, int32_t aIndent) const
+{
+  nsAutoCString str;
+  for (int32_t i = 0; i < aIndent; i++) {
+    str.AppendLiteral("  ");
+  }
+  Servo_MozDocumentRule_Debug(mRawRule, &str);
+  fprintf_stderr(out, "%s\n", str.get());
+}
+#endif
+
+void
+CSSMozDocumentRule::GetConditionText(nsAString& aConditionText)
+{
+  Servo_MozDocumentRule_GetConditionText(mRawRule, &aConditionText);
+}
+
+void
+CSSMozDocumentRule::SetConditionText(const nsAString& aConditionText,
+                                     ErrorResult& aRv)
+{
+  aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
+}
+
+/* virtual */ void
+CSSMozDocumentRule::GetCssText(nsAString& aCssText) const
+{
+  Servo_MozDocumentRule_GetCssText(mRawRule, &aCssText);
+}
+
+/* virtual */ size_t
+CSSMozDocumentRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
+{
+  // TODO Implement this!
+  return aMallocSizeOf(this);
+}
+
 } // namespace dom
 } // namespace mozilla
--- a/layout/style/CSSMozDocumentRule.h
+++ b/layout/style/CSSMozDocumentRule.h
@@ -4,36 +4,56 @@
  * 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_dom_CSSMozDocumentRule_h
 #define mozilla_dom_CSSMozDocumentRule_h
 
 #include "mozilla/css/GroupRule.h"
 #include "mozilla/css/URLMatchingFunction.h"
+#include "mozilla/ServoBindingTypes.h"
 
 namespace mozilla {
 namespace dom {
 
-class CSSMozDocumentRule : public css::ConditionRule
+class CSSMozDocumentRule final : public css::ConditionRule
 {
-protected:
-  using ConditionRule::ConditionRule;
-  virtual ~CSSMozDocumentRule() {}
+public:
+  CSSMozDocumentRule(RefPtr<RawServoMozDocumentRule> aRawRule,
+                     uint32_t aLine, uint32_t aColumn);
 
-public:
+  NS_DECL_ISUPPORTS_INHERITED
+
   static bool Match(nsIDocument* aDoc,
                     nsIURI* aDocURI,
                     const nsACString& aDocURISpec,
                     const nsACString& aPattern,
                     css::URLMatchingFunction aUrlMatchingFunction);
 
+#ifdef DEBUG
+  void List(FILE* out = stdout, int32_t aIndent = 0) const final;
+#endif
+
+  RawServoMozDocumentRule* Raw() const { return mRawRule; }
+
   // WebIDL interface
   uint16_t Type() const final { return CSSRuleBinding::DOCUMENT_RULE; }
+  void GetCssText(nsAString& aCssText) const final;
+  void GetConditionText(nsAString& aConditionText) final;
+  void SetConditionText(const nsAString& aConditionText,
+                        ErrorResult& aRv) final;
+
+  size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
+    const override;
 
   JSObject* WrapObject(JSContext* aCx,
                        JS::Handle<JSObject*> aGivenProto) override;
+
+private:
+  ~CSSMozDocumentRule() = default;
+
+  RefPtr<RawServoMozDocumentRule> mRawRule;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_CSSMozDocumentRule_h
--- a/layout/style/ServoArcTypeList.h
+++ b/layout/style/ServoArcTypeList.h
@@ -14,13 +14,13 @@ SERVO_ARC_TYPE(ImportRule, RawServoImpor
 SERVO_ARC_TYPE(AnimationValue, RawServoAnimationValue)
 SERVO_ARC_TYPE(Keyframe, RawServoKeyframe)
 SERVO_ARC_TYPE(KeyframesRule, RawServoKeyframesRule)
 SERVO_ARC_TYPE(MediaList, RawServoMediaList)
 SERVO_ARC_TYPE(MediaRule, RawServoMediaRule)
 SERVO_ARC_TYPE(NamespaceRule, RawServoNamespaceRule)
 SERVO_ARC_TYPE(PageRule, RawServoPageRule)
 SERVO_ARC_TYPE(SupportsRule, RawServoSupportsRule)
-SERVO_ARC_TYPE(DocumentRule, RawServoDocumentRule)
+SERVO_ARC_TYPE(DocumentRule, RawServoMozDocumentRule)
 SERVO_ARC_TYPE(FontFeatureValuesRule, RawServoFontFeatureValuesRule)
 SERVO_ARC_TYPE(RuleNode, RawServoRuleNode)
 SERVO_ARC_TYPE(FontFaceRule, RawServoFontFaceRule)
 SERVO_ARC_TYPE(CounterStyleRule, RawServoCounterStyleRule)
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -265,20 +265,20 @@ SERVO_BINDING_FUNC(Servo_CssRules_Delete
   SERVO_BINDING_FUNC(Servo_##type_##Rule_GetRules, ServoCssRulesStrong, \
                      RawServo##type_##RuleBorrowed rule)
 
 BASIC_RULE_FUNCS(Style)
 BASIC_RULE_FUNCS(Import)
 BASIC_RULE_FUNCS_WITHOUT_GETTER(Keyframe)
 BASIC_RULE_FUNCS(Keyframes)
 GROUP_RULE_FUNCS(Media)
+GROUP_RULE_FUNCS(MozDocument)
 BASIC_RULE_FUNCS(Namespace)
 BASIC_RULE_FUNCS(Page)
 GROUP_RULE_FUNCS(Supports)
-GROUP_RULE_FUNCS(Document)
 BASIC_RULE_FUNCS(FontFeatureValues)
 BASIC_RULE_FUNCS(FontFace)
 BASIC_RULE_FUNCS(CounterStyle)
 #undef GROUP_RULE_FUNCS
 #undef BASIC_RULE_FUNCS
 #undef BASIC_RULE_FUNCS_WITHOUT_GETTER
 SERVO_BINDING_FUNC(Servo_StyleRule_GetStyle, RawServoDeclarationBlockStrong,
                    RawServoStyleRuleBorrowed rule)
@@ -348,18 +348,18 @@ SERVO_BINDING_FUNC(Servo_NamespaceRule_G
                    RawServoNamespaceRuleBorrowed rule)
 SERVO_BINDING_FUNC(Servo_PageRule_GetStyle, RawServoDeclarationBlockStrong,
                    RawServoPageRuleBorrowed rule)
 SERVO_BINDING_FUNC(Servo_PageRule_SetStyle, void,
                    RawServoPageRuleBorrowed rule,
                    RawServoDeclarationBlockBorrowed declarations)
 SERVO_BINDING_FUNC(Servo_SupportsRule_GetConditionText, void,
                    RawServoSupportsRuleBorrowed rule, nsAString* result)
-SERVO_BINDING_FUNC(Servo_DocumentRule_GetConditionText, void,
-                   RawServoDocumentRuleBorrowed rule, nsAString* result)
+SERVO_BINDING_FUNC(Servo_MozDocumentRule_GetConditionText, void,
+                   RawServoMozDocumentRuleBorrowed rule, nsAString* result)
 SERVO_BINDING_FUNC(Servo_FontFeatureValuesRule_GetFontFamily, void,
                    RawServoFontFeatureValuesRuleBorrowed rule,
                    nsAString* result)
 SERVO_BINDING_FUNC(Servo_FontFeatureValuesRule_GetValueText, void,
                    RawServoFontFeatureValuesRuleBorrowed rule,
                    nsAString* result)
 SERVO_BINDING_FUNC(Servo_FontFaceRule_CreateEmpty, RawServoFontFaceRuleStrong)
 SERVO_BINDING_FUNC(Servo_FontFaceRule_Clone, RawServoFontFaceRuleStrong,
--- a/layout/style/ServoCSSRuleList.cpp
+++ b/layout/style/ServoCSSRuleList.cpp
@@ -7,23 +7,23 @@
 /* representation of CSSRuleList for stylo */
 
 #include "mozilla/ServoCSSRuleList.h"
 
 #include "mozilla/dom/CSSCounterStyleRule.h"
 #include "mozilla/dom/CSSFontFaceRule.h"
 #include "mozilla/dom/CSSKeyframesRule.h"
 #include "mozilla/dom/CSSMediaRule.h"
+#include "mozilla/dom/CSSMozDocumentRule.h"
 #include "mozilla/dom/CSSNamespaceRule.h"
 #include "mozilla/dom/CSSPageRule.h"
 #include "mozilla/dom/CSSStyleRule.h"
 #include "mozilla/dom/CSSSupportsRule.h"
 #include "mozilla/IntegerRange.h"
 #include "mozilla/ServoBindings.h"
-#include "mozilla/ServoDocumentRule.h"
 #include "mozilla/ServoImportRule.h"
 #include "mozilla/ServoFontFeatureValuesRule.h"
 #include "mozilla/StyleSheet.h"
 
 using namespace mozilla::dom;
 
 namespace mozilla {
 
@@ -105,17 +105,17 @@ ServoCSSRuleList::GetRule(uint32_t aInde
         break;                                                              \
       }
       CASE_RULE_CSS(STYLE, Style)
       CASE_RULE_CSS(KEYFRAMES, Keyframes)
       CASE_RULE_CSS(MEDIA, Media)
       CASE_RULE_CSS(NAMESPACE, Namespace)
       CASE_RULE_CSS(PAGE, Page)
       CASE_RULE_CSS(SUPPORTS, Supports)
-      CASE_RULE(DOCUMENT, Document)
+      CASE_RULE_CSS(DOCUMENT, MozDocument)
       CASE_RULE(IMPORT, Import)
       CASE_RULE(FONT_FEATURE_VALUES, FontFeatureValues)
       CASE_RULE_CSS(FONT_FACE, FontFace)
       CASE_RULE_CSS(COUNTER_STYLE, CounterStyle)
 #undef CASE_RULE
       case CSSRuleBinding::KEYFRAME_RULE:
         MOZ_ASSERT_UNREACHABLE("keyframe rule cannot be here");
         return nullptr;
deleted file mode 100644
--- a/layout/style/ServoDocumentRule.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- 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 CSSMozDocumentRule for stylo */
-
-#include "mozilla/ServoBindings.h"
-#include "mozilla/ServoDocumentRule.h"
-
-using namespace mozilla::dom;
-
-namespace mozilla {
-
-ServoDocumentRule::ServoDocumentRule(RefPtr<RawServoDocumentRule> aRawRule,
-                                     uint32_t aLine, uint32_t aColumn)
-  : CSSMozDocumentRule(Servo_DocumentRule_GetRules(aRawRule).Consume(),
-                       aLine, aColumn)
-  , mRawRule(std::move(aRawRule))
-{
-}
-
-ServoDocumentRule::~ServoDocumentRule()
-{
-}
-
-NS_IMPL_ADDREF_INHERITED(ServoDocumentRule, CSSMozDocumentRule)
-NS_IMPL_RELEASE_INHERITED(ServoDocumentRule, CSSMozDocumentRule)
-
-// QueryInterface implementation for MozDocumentRule
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ServoDocumentRule)
-NS_INTERFACE_MAP_END_INHERITING(CSSMozDocumentRule)
-
-#ifdef DEBUG
-/* virtual */ void
-ServoDocumentRule::List(FILE* out, int32_t aIndent) const
-{
-  nsAutoCString str;
-  for (int32_t i = 0; i < aIndent; i++) {
-    str.AppendLiteral("  ");
-  }
-  Servo_DocumentRule_Debug(mRawRule, &str);
-  fprintf_stderr(out, "%s\n", str.get());
-}
-#endif
-
-void
-ServoDocumentRule::GetConditionText(nsAString& aConditionText)
-{
-  Servo_DocumentRule_GetConditionText(mRawRule, &aConditionText);
-}
-
-void
-ServoDocumentRule::SetConditionText(const nsAString& aConditionText,
-                                    ErrorResult& aRv)
-{
-  aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
-}
-
-/* virtual */ void
-ServoDocumentRule::GetCssText(nsAString& aCssText) const
-{
-  Servo_DocumentRule_GetCssText(mRawRule, &aCssText);
-}
-
-/* virtual */ size_t
-ServoDocumentRule::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
-  const
-{
-  // TODO Implement this!
-  return aMallocSizeOf(this);
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/layout/style/ServoDocumentRule.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- 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 CSSMozDocumentRule for stylo */
-
-#ifndef mozilla_ServoMozDocumentRule_h
-#define mozilla_ServoMozDocumentRule_h
-
-#include "mozilla/dom/CSSMozDocumentRule.h"
-#include "mozilla/ServoBindingTypes.h"
-
-namespace mozilla {
-
-class ServoDocumentRule final : public dom::CSSMozDocumentRule
-{
-public:
-  ServoDocumentRule(RefPtr<RawServoDocumentRule> aRawRule,
-                    uint32_t aLine, uint32_t aColumn);
-
-  NS_DECL_ISUPPORTS_INHERITED
-
-#ifdef DEBUG
-  void List(FILE* out = stdout, int32_t aIndent = 0) const final;
-#endif
-
-  RawServoDocumentRule* Raw() const { return mRawRule; }
-
-  // WebIDL interface
-  void GetCssText(nsAString& aCssText) const final;
-  void GetConditionText(nsAString& aConditionText) final;
-  void SetConditionText(const nsAString& aConditionText,
-                        ErrorResult& aRv) final;
-
-  size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
-    const override;
-
-private:
-  virtual ~ServoDocumentRule();
-
-  RefPtr<RawServoDocumentRule> mRawRule;
-};
-
-} // namespace mozilla
-
-#endif // mozilla_ServoDocumentRule_h
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -79,17 +79,16 @@ EXPORTS.mozilla += [
     'ServoArcTypeList.h',
     'ServoBindingList.h',
     'ServoBindings.h',
     'ServoBindingTypes.h',
     'ServoComputedData.h',
     'ServoComputedDataInlines.h',
     'ServoCSSParser.h',
     'ServoCSSRuleList.h',
-    'ServoDocumentRule.h',
     'ServoElementSnapshot.h',
     'ServoElementSnapshotTable.h',
     'ServoFontFeatureValuesRule.h',
     'ServoImportRule.h',
     'ServoSpecifiedValues.h',
     'ServoStyleSet.h',
     'ServoStyleSetInlines.h',
     'ServoTraversalStatistics.h',
@@ -197,17 +196,16 @@ UNIFIED_SOURCES += [
     'nsStyleUtil.cpp',
     'nsTransitionManager.cpp',
     'PostTraversalTask.cpp',
     'PreloadedStyleSheet.cpp',
     'Rule.cpp',
     'ServoBindings.cpp',
     'ServoCSSParser.cpp',
     'ServoCSSRuleList.cpp',
-    'ServoDocumentRule.cpp',
     'ServoElementSnapshot.cpp',
     'ServoFontFeatureValuesRule.cpp',
     'ServoImportRule.cpp',
     'ServoSpecifiedValues.cpp',
     'ServoStyleSet.cpp',
     'StreamLoader.cpp',
     'StyleAnimationValue.cpp',
     'StyleComplexColor.cpp',
--- a/layout/style/nsMediaFeatures.h
+++ b/layout/style/nsMediaFeatures.h
@@ -4,16 +4,18 @@
  * 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/. */
 
 /* the features that media queries can test */
 
 #ifndef nsMediaFeatures_h_
 #define nsMediaFeatures_h_
 
+#include <stdint.h>
+
 class nsAtom;
 class nsIDocument;
 struct nsCSSKTableEntry;
 class nsCSSValue;
 class nsStaticAtom;
 
 struct nsMediaFeature;
 typedef void (*nsMediaFeatureValueGetter)(nsIDocument* aDocument,
--- a/servo/components/style/gecko/arc_types.rs
+++ b/servo/components/style/gecko/arc_types.rs
@@ -4,22 +4,22 @@
 
 //! This file lists all arc FFI types and defines corresponding addref
 //! and release functions. This list corresponds to ServoArcTypeList.h
 //! file in Gecko.
 
 #![allow(non_snake_case, missing_docs)]
 
 use gecko_bindings::bindings::RawServoCounterStyleRule;
-use gecko_bindings::bindings::RawServoDocumentRule;
 use gecko_bindings::bindings::RawServoFontFeatureValuesRule;
 use gecko_bindings::bindings::RawServoImportRule;
 use gecko_bindings::bindings::RawServoKeyframe;
 use gecko_bindings::bindings::RawServoKeyframesRule;
 use gecko_bindings::bindings::RawServoMediaRule;
+use gecko_bindings::bindings::RawServoMozDocumentRule;
 use gecko_bindings::bindings::RawServoNamespaceRule;
 use gecko_bindings::bindings::RawServoPageRule;
 use gecko_bindings::bindings::RawServoRuleNode;
 use gecko_bindings::bindings::RawServoRuleNodeStrong;
 use gecko_bindings::bindings::RawServoSupportsRule;
 use gecko_bindings::bindings::ServoCssRules;
 use gecko_bindings::structs::RawServoAnimationValue;
 use gecko_bindings::structs::RawServoDeclarationBlock;
@@ -93,17 +93,17 @@ impl_arc_ffi!(Locked<NamespaceRule> => R
               [Servo_NamespaceRule_AddRef, Servo_NamespaceRule_Release]);
 
 impl_arc_ffi!(Locked<PageRule> => RawServoPageRule
               [Servo_PageRule_AddRef, Servo_PageRule_Release]);
 
 impl_arc_ffi!(Locked<SupportsRule> => RawServoSupportsRule
               [Servo_SupportsRule_AddRef, Servo_SupportsRule_Release]);
 
-impl_arc_ffi!(Locked<DocumentRule> => RawServoDocumentRule
+impl_arc_ffi!(Locked<DocumentRule> => RawServoMozDocumentRule
               [Servo_DocumentRule_AddRef, Servo_DocumentRule_Release]);
 
 impl_arc_ffi!(Locked<FontFeatureValuesRule> => RawServoFontFeatureValuesRule
               [Servo_FontFeatureValuesRule_AddRef, Servo_FontFeatureValuesRule_Release]);
 
 impl_arc_ffi!(Locked<FontFaceRule> => RawServoFontFaceRule
               [Servo_FontFaceRule_AddRef, Servo_FontFaceRule_Release]);
 
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -36,24 +36,24 @@ use style::gecko::traversal::RecalcStyle
 use style::gecko::wrapper::{GeckoElement, GeckoNode};
 use style::gecko_bindings::bindings;
 use style::gecko_bindings::bindings::{RawGeckoElementBorrowed, RawGeckoElementBorrowedOrNull, RawGeckoNodeBorrowed};
 use style::gecko_bindings::bindings::{RawGeckoKeyframeListBorrowed, RawGeckoKeyframeListBorrowedMut};
 use style::gecko_bindings::bindings::{RawServoAuthorStyles, RawServoAuthorStylesBorrowed};
 use style::gecko_bindings::bindings::{RawServoAuthorStylesBorrowedMut, RawServoAuthorStylesOwned};
 use style::gecko_bindings::bindings::{RawServoCounterStyleRule, RawServoCounterStyleRuleBorrowed};
 use style::gecko_bindings::bindings::{RawServoDeclarationBlockBorrowed, RawServoDeclarationBlockStrong};
-use style::gecko_bindings::bindings::{RawServoDocumentRule, RawServoDocumentRuleBorrowed};
 use style::gecko_bindings::bindings::{RawServoFontFaceRuleBorrowed, RawServoFontFaceRuleStrong};
 use style::gecko_bindings::bindings::{RawServoFontFeatureValuesRule, RawServoFontFeatureValuesRuleBorrowed};
 use style::gecko_bindings::bindings::{RawServoImportRule, RawServoImportRuleBorrowed};
 use style::gecko_bindings::bindings::{RawServoKeyframe, RawServoKeyframeBorrowed, RawServoKeyframeStrong};
 use style::gecko_bindings::bindings::{RawServoKeyframesRule, RawServoKeyframesRuleBorrowed};
 use style::gecko_bindings::bindings::{RawServoMediaListBorrowed, RawServoMediaListStrong};
 use style::gecko_bindings::bindings::{RawServoMediaRule, RawServoMediaRuleBorrowed};
+use style::gecko_bindings::bindings::{RawServoMozDocumentRule, RawServoMozDocumentRuleBorrowed};
 use style::gecko_bindings::bindings::{RawServoNamespaceRule, RawServoNamespaceRuleBorrowed};
 use style::gecko_bindings::bindings::{RawServoPageRule, RawServoPageRuleBorrowed};
 use style::gecko_bindings::bindings::{RawServoSelectorListBorrowed, RawServoSelectorListOwned};
 use style::gecko_bindings::bindings::{RawServoSourceSizeListBorrowedOrNull, RawServoSourceSizeListOwned};
 use style::gecko_bindings::bindings::{RawServoStyleSetBorrowed, RawServoStyleSetBorrowedOrNull, RawServoStyleSetOwned};
 use style::gecko_bindings::bindings::{RawServoStyleSheetContentsBorrowed, ServoComputedDataBorrowed};
 use style::gecko_bindings::bindings::{RawServoStyleSheetContentsStrong, ComputedStyleBorrowed};
 use style::gecko_bindings::bindings::{RawServoSupportsRule, RawServoSupportsRuleBorrowed};
@@ -1822,21 +1822,21 @@ impl_basic_rule_funcs! { (Page, PageRule
 
 impl_group_rule_funcs! { (Supports, SupportsRule, RawServoSupportsRule),
     get_rules: Servo_SupportsRule_GetRules,
     getter: Servo_CssRules_GetSupportsRuleAt,
     debug: Servo_SupportsRule_Debug,
     to_css: Servo_SupportsRule_GetCssText,
 }
 
-impl_group_rule_funcs! { (Document, DocumentRule, RawServoDocumentRule),
-    get_rules: Servo_DocumentRule_GetRules,
-    getter: Servo_CssRules_GetDocumentRuleAt,
-    debug: Servo_DocumentRule_Debug,
-    to_css: Servo_DocumentRule_GetCssText,
+impl_group_rule_funcs! { (Document, DocumentRule, RawServoMozDocumentRule),
+    get_rules: Servo_MozDocumentRule_GetRules,
+    getter: Servo_CssRules_GetMozDocumentRuleAt,
+    debug: Servo_MozDocumentRule_Debug,
+    to_css: Servo_MozDocumentRule_GetCssText,
 }
 
 impl_basic_rule_funcs! { (FontFeatureValues, FontFeatureValuesRule, RawServoFontFeatureValuesRule),
     getter: Servo_CssRules_GetFontFeatureValuesRuleAt,
     debug: Servo_FontFeatureValuesRule_Debug,
     to_css: Servo_FontFeatureValuesRule_GetCssText,
 }
 
@@ -2275,18 +2275,18 @@ pub extern "C" fn Servo_SupportsRule_Get
     result: *mut nsAString,
 ) {
     read_locked_arc(rule, |rule: &SupportsRule| {
         rule.condition.to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() })).unwrap();
     })
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_DocumentRule_GetConditionText(
-    rule: RawServoDocumentRuleBorrowed,
+pub extern "C" fn Servo_MozDocumentRule_GetConditionText(
+    rule: RawServoMozDocumentRuleBorrowed,
     result: *mut nsAString,
 ) {
     read_locked_arc(rule, |rule: &DocumentRule| {
         rule.condition.to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() })).unwrap();
     })
 }
 
 #[no_mangle]