Bug 591303 - Part 2: Add getCSSRule function to nsIDOMCSSRule. r=bz
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Mon, 14 Jul 2014 15:57:46 -0700
changeset 215866 785257a95e363df9238b4ffc7fdc78eabe1b2369
parent 215865 89311542468d3f9269cfe25e4adc68af54dbc00c
child 215867 8acc3d0aa7108642b0d1230072acc68f8221c673
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs591303
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 591303 - Part 2: Add getCSSRule function to nsIDOMCSSRule. r=bz
dom/interfaces/css/nsIDOMCSSCharsetRule.idl
dom/interfaces/css/nsIDOMCSSConditionRule.idl
dom/interfaces/css/nsIDOMCSSCounterStyleRule.idl
dom/interfaces/css/nsIDOMCSSFontFaceRule.idl
dom/interfaces/css/nsIDOMCSSFontFeatureValuesRule.idl
dom/interfaces/css/nsIDOMCSSGroupingRule.idl
dom/interfaces/css/nsIDOMCSSImportRule.idl
dom/interfaces/css/nsIDOMCSSMediaRule.idl
dom/interfaces/css/nsIDOMCSSMozDocumentRule.idl
dom/interfaces/css/nsIDOMCSSPageRule.idl
dom/interfaces/css/nsIDOMCSSRule.idl
dom/interfaces/css/nsIDOMCSSStyleRule.idl
dom/interfaces/css/nsIDOMCSSSupportsRule.idl
dom/interfaces/css/nsIDOMCSSUnknownRule.idl
dom/interfaces/css/nsIDOMMozCSSKeyframeRule.idl
dom/interfaces/css/nsIDOMMozCSSKeyframesRule.idl
layout/inspector/inDOMUtils.cpp
layout/inspector/inIDOMUtils.idl
layout/style/Rule.h
layout/style/StyleRule.cpp
layout/style/nsCSSRules.cpp
--- a/dom/interfaces/css/nsIDOMCSSCharsetRule.idl
+++ b/dom/interfaces/css/nsIDOMCSSCharsetRule.idl
@@ -1,13 +1,13 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "nsIDOMCSSRule.idl"
 
-[scriptable, uuid(19fe78cc-65ff-4b1d-a5d7-9ea89692cec6)]
+[scriptable, uuid(756c326c-eb38-4342-95e5-5eabea809174)]
 interface nsIDOMCSSCharsetRule : nsIDOMCSSRule
 {
   attribute DOMString        encoding;
                                         // raises(DOMException) on setting
 };
--- a/dom/interfaces/css/nsIDOMCSSConditionRule.idl
+++ b/dom/interfaces/css/nsIDOMCSSConditionRule.idl
@@ -4,13 +4,13 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsIDOMCSSGroupingRule.idl"
 
 /**
  * Interface in the CSS OM for at-rules that conditionally apply their
  * child rules.
  */
-[scriptable, uuid(942754f2-2c0e-461b-9c10-c0e929504fe1)]
+[scriptable, uuid(44da41b2-5660-415d-8692-eae805776103)]
 interface nsIDOMCSSConditionRule : nsIDOMCSSGroupingRule
 {
   attribute DOMString conditionText;
 };
--- a/dom/interfaces/css/nsIDOMCSSCounterStyleRule.idl
+++ b/dom/interfaces/css/nsIDOMCSSCounterStyleRule.idl
@@ -1,17 +1,17 @@
 /* -*- Mode: IDL; tab-width: 2; 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/. */
 
 #include "nsIDOMCSSRule.idl"
 
-[scriptable, uuid(5f9f2068-743b-42e3-becb-10ffa994d1e3)]
+[scriptable, uuid(9b5e48ce-d84c-4e31-aff5-34e9f4141313)]
 interface nsIDOMCSSCounterStyleRule : nsIDOMCSSRule
 {
   attribute DOMString name;
   attribute DOMString system;
   attribute DOMString symbols;
   attribute DOMString additiveSymbols;
   attribute DOMString negative;
   attribute DOMString prefix;
--- a/dom/interfaces/css/nsIDOMCSSFontFaceRule.idl
+++ b/dom/interfaces/css/nsIDOMCSSFontFaceRule.idl
@@ -1,12 +1,12 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "nsIDOMCSSRule.idl"
 
-[scriptable, uuid(a6cf90bb-15b3-11d2-932e-00805f8add32)]
+[scriptable, uuid(db971017-fe0c-4529-972c-8217f2fee217)]
 interface nsIDOMCSSFontFaceRule : nsIDOMCSSRule
 {
   readonly attribute nsIDOMCSSStyleDeclaration  style;
 };
--- a/dom/interfaces/css/nsIDOMCSSFontFeatureValuesRule.idl
+++ b/dom/interfaces/css/nsIDOMCSSFontFeatureValuesRule.idl
@@ -1,16 +1,16 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "nsIDOMCSSRule.idl"
 
-[scriptable, uuid(f4cb1776-389d-4f52-a4d8-68bea5bd00c1)]
+[scriptable, uuid(a343d27f-1da6-4fc3-9355-d4ca434f958e)]
 interface nsIDOMCSSFontFeatureValuesRule : nsIDOMCSSRule
 {
   attribute DOMString fontFamily;
                       // raises(DOMException) on setting
 
   attribute DOMString valueText;
                       // raises(DOMException) on setting
 };
--- a/dom/interfaces/css/nsIDOMCSSGroupingRule.idl
+++ b/dom/interfaces/css/nsIDOMCSSGroupingRule.idl
@@ -3,17 +3,17 @@
  * 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 "nsIDOMCSSRule.idl"
 
 /**
  * Interface for at-rules that have child rules in the CSS OM.
  */
-[scriptable, uuid(ab013eed-fa21-4c6a-bba3-79e8780f583e)]
+[scriptable, uuid(a0e3324a-f911-4baf-9591-5322c76cbb0d)]
 interface nsIDOMCSSGroupingRule : nsIDOMCSSRule
 {
   readonly attribute nsIDOMCSSRuleList cssRules;
 
   unsigned long      insertRule(in DOMString rule,
                                 in unsigned long index)
                                         raises(DOMException);
   void               deleteRule(in unsigned long index)
--- a/dom/interfaces/css/nsIDOMCSSImportRule.idl
+++ b/dom/interfaces/css/nsIDOMCSSImportRule.idl
@@ -1,14 +1,14 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "nsIDOMCSSRule.idl"
 
-[scriptable, uuid(a6cf90cf-15b3-11d2-932e-00805f8add32)]
+[scriptable, uuid(d3b2b914-01ef-4663-beda-a6475a26f491)]
 interface nsIDOMCSSImportRule : nsIDOMCSSRule
 {
   readonly attribute DOMString           href;
   readonly attribute nsIDOMMediaList     media;
   readonly attribute nsIDOMCSSStyleSheet styleSheet;
 };
--- a/dom/interfaces/css/nsIDOMCSSMediaRule.idl
+++ b/dom/interfaces/css/nsIDOMCSSMediaRule.idl
@@ -3,13 +3,13 @@
  * 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 "nsIDOMCSSConditionRule.idl"
 
 /**
  * Interface for @media rules in the CSS OM.
  */
-[scriptable, uuid(1f491b05-932b-4aa1-a1f1-466505d70898)]
+[scriptable, uuid(6cf9c5b2-fa0f-43c0-aa50-ef85b4756e3a)]
 interface nsIDOMCSSMediaRule : nsIDOMCSSConditionRule
 {
   readonly attribute nsIDOMMediaList   media;
 };
--- a/dom/interfaces/css/nsIDOMCSSMozDocumentRule.idl
+++ b/dom/interfaces/css/nsIDOMCSSMozDocumentRule.idl
@@ -3,13 +3,13 @@
  * 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 "nsIDOMCSSConditionRule.idl"
 
 /**
  * Interface for @-moz-document rules in the CSS OM.
  */
-[scriptable, uuid(f118a5a8-ac36-464f-b993-18cf6fe76fda)]
+[scriptable, uuid(2d0cef9d-c1b2-4c6c-9003-fa83040626d1)]
 interface nsIDOMCSSMozDocumentRule : nsIDOMCSSConditionRule
 {
   // XXX Add access to the URL list.
 };
--- a/dom/interfaces/css/nsIDOMCSSPageRule.idl
+++ b/dom/interfaces/css/nsIDOMCSSPageRule.idl
@@ -1,15 +1,15 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "nsIDOMCSSRule.idl"
 
-[scriptable, uuid(6126024d-d716-4ad8-bc53-24dd6d5846b1)]
+[scriptable, uuid(c119072b-7d2f-4aeb-a90d-e2d6b606c32a)]
 interface nsIDOMCSSPageRule : nsIDOMCSSRule
 {
            //attribute DOMString        selectorText;
                                         // raises(DOMException) on setting
 
   readonly attribute nsIDOMCSSStyleDeclaration  style;
 };
--- a/dom/interfaces/css/nsIDOMCSSRule.idl
+++ b/dom/interfaces/css/nsIDOMCSSRule.idl
@@ -1,24 +1,34 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "domstubs.idl"
 
+%{C++
+namespace mozilla {
+namespace css {
+class Rule;
+}
+}
+%}
+
+[ptr] native Rule(mozilla::css::Rule);
+
 /**
  * The nsIDOMCSSRule interface is a datatype for a CSS style rule in
  * the Document Object Model.
  *
  * For more information on this interface please see
  * http://www.w3.org/TR/DOM-Level-2-Style
  */
 
-[scriptable, uuid(2938307a-9d70-4b63-8afc-0197e82318ad)]
+[scriptable, uuid(4d6b3bad-f53c-4585-82f6-62982e27ede8)]
 interface nsIDOMCSSRule : nsISupports
 {
   // RuleType
   const unsigned short      UNKNOWN_RULE                   = 0;
   const unsigned short      STYLE_RULE                     = 1;
   const unsigned short      CHARSET_RULE                   = 2;
   const unsigned short      IMPORT_RULE                    = 3;
   const unsigned short      MEDIA_RULE                     = 4;
@@ -36,9 +46,11 @@ interface nsIDOMCSSRule : nsISupports
   const unsigned short      FONT_FEATURE_VALUES_RULE       = 14;
 
   readonly attribute unsigned short      type;
            attribute DOMString           cssText;
                                         // raises(DOMException) on setting
 
   readonly attribute nsIDOMCSSStyleSheet parentStyleSheet;
   readonly attribute nsIDOMCSSRule       parentRule;
+
+  [noscript, nostdcall, notxpcom] Rule getCSSRule();
 };
--- a/dom/interfaces/css/nsIDOMCSSStyleRule.idl
+++ b/dom/interfaces/css/nsIDOMCSSStyleRule.idl
@@ -1,15 +1,15 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "nsIDOMCSSRule.idl"
 
-[scriptable, uuid(a6cf90bf-15b3-11d2-932e-00805f8add32)]
+[scriptable, uuid(b5e9af48-a7c2-4f88-aae3-58307af4b5a5)]
 interface nsIDOMCSSStyleRule : nsIDOMCSSRule
 {
            attribute DOMString        selectorText;
                                         // raises(DOMException) on setting
 
   readonly attribute nsIDOMCSSStyleDeclaration  style;
 };
--- a/dom/interfaces/css/nsIDOMCSSSupportsRule.idl
+++ b/dom/interfaces/css/nsIDOMCSSSupportsRule.idl
@@ -3,12 +3,12 @@
  * 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 "nsIDOMCSSConditionRule.idl"
 
 /**
  * Interface for @supports rules in the CSS OM.
  */
-[scriptable, uuid(5f409a4d-92f9-4a62-8e8a-cc1c02c32918)]
+[scriptable, uuid(0b9e63a1-1bd7-4caf-850e-148b762b14d2)]
 interface nsIDOMCSSSupportsRule : nsIDOMCSSConditionRule
 {
 };
--- a/dom/interfaces/css/nsIDOMCSSUnknownRule.idl
+++ b/dom/interfaces/css/nsIDOMCSSUnknownRule.idl
@@ -1,11 +1,11 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "nsIDOMCSSRule.idl"
 
-[scriptable, uuid(a6cf90d0-15b3-11d2-932e-00805f8add32)]
+[scriptable, uuid(98f4c27b-fb35-4355-8fd9-546c4697d71a)]
 interface nsIDOMCSSUnknownRule : nsIDOMCSSRule
 {
 };
--- a/dom/interfaces/css/nsIDOMMozCSSKeyframeRule.idl
+++ b/dom/interfaces/css/nsIDOMMozCSSKeyframeRule.idl
@@ -1,13 +1,13 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "nsIDOMCSSRule.idl"
 
-[scriptable, uuid(38a19612-dc58-414a-954c-233183808484)]
+[scriptable, uuid(a281a8b4-eaa2-49a8-8b97-acc2814a57c9)]
 interface nsIDOMMozCSSKeyframeRule : nsIDOMCSSRule
 {
            attribute DOMString                 keyText;
   readonly attribute nsIDOMCSSStyleDeclaration style;
 };
--- a/dom/interfaces/css/nsIDOMMozCSSKeyframesRule.idl
+++ b/dom/interfaces/css/nsIDOMMozCSSKeyframesRule.idl
@@ -1,16 +1,16 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "nsIDOMCSSRule.idl"
 
-[scriptable, uuid(aa4ea11f-791b-4671-b192-b931e6539669)]
+[scriptable, uuid(400f4b70-ad0a-4047-aba4-ee8019f6b907)]
 interface nsIDOMMozCSSKeyframesRule : nsIDOMCSSRule
 {
            attribute DOMString         name;
   readonly attribute nsIDOMCSSRuleList cssRules;
 
   void                     appendRule(in DOMString rule);
   void                     deleteRule(in DOMString key);
   nsIDOMMozCSSKeyframeRule findRule(in DOMString key);
--- a/layout/inspector/inDOMUtils.cpp
+++ b/layout/inspector/inDOMUtils.cpp
@@ -254,36 +254,39 @@ GetRuleFromDOMRule(nsIDOMCSSStyleRule *a
 
   if (!cssrule) {
     rv.Throw(NS_ERROR_FAILURE);
   }
   return cssrule.forget();
 }
 
 NS_IMETHODIMP
-inDOMUtils::GetRuleLine(nsIDOMCSSStyleRule *aRule, uint32_t *_retval)
+inDOMUtils::GetRuleLine(nsIDOMCSSRule* aRule, uint32_t* _retval)
 {
-  ErrorResult rv;
-  nsRefPtr<StyleRule> rule = GetRuleFromDOMRule(aRule, rv);
-  if (rv.Failed()) {
-    return rv.ErrorCode();
+  NS_ENSURE_ARG_POINTER(aRule);
+
+  Rule* rule = aRule->GetCSSRule();
+  if (!rule) {
+    return NS_ERROR_FAILURE;
   }
 
   *_retval = rule->GetLineNumber();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-inDOMUtils::GetRuleColumn(nsIDOMCSSStyleRule *aRule, uint32_t *_retval)
+inDOMUtils::GetRuleColumn(nsIDOMCSSRule* aRule, uint32_t* _retval)
 {
-  ErrorResult rv;
-  nsRefPtr<StyleRule> rule = GetRuleFromDOMRule(aRule, rv);
-  if (rv.Failed()) {
-    return rv.ErrorCode();
+  NS_ENSURE_ARG_POINTER(aRule);
+
+  Rule* rule = aRule->GetCSSRule();
+  if (!rule) {
+    return NS_ERROR_FAILURE;
   }
+
   *_retval = rule->GetColumnNumber();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 inDOMUtils::GetSelectorCount(nsIDOMCSSStyleRule* aRule, uint32_t *aCount)
 {
   ErrorResult rv;
--- a/layout/inspector/inIDOMUtils.idl
+++ b/layout/inspector/inIDOMUtils.idl
@@ -4,33 +4,34 @@
 
 #include "nsISupports.idl"
 
 interface nsIArray;
 interface nsISupportsArray;
 interface nsIDOMCharacterData;
 interface nsIDOMElement;
 interface nsIDOMDocument;
+interface nsIDOMCSSRule;
 interface nsIDOMCSSStyleRule;
 interface nsIDOMNode;
 interface nsIDOMNodeList;
 interface nsIDOMFontFaceList;
 interface nsIDOMRange;
 interface nsIDOMCSSStyleSheet;
 
-[scriptable, uuid(5d8a1458-4b76-4aee-bf46-4eca223a01b2)]
+[scriptable, uuid(fd529e53-f734-4d15-83ce-d545a631d668)]
 interface inIDOMUtils : nsISupports
 {
   // CSS utilities
   void getAllStyleSheets (in nsIDOMDocument aDoc,
                           [optional] out unsigned long aLength,
                           [array, size_is (aLength), retval] out nsISupports aSheets);
   nsISupportsArray getCSSStyleRules(in nsIDOMElement aElement, [optional] in DOMString aPseudo);
-  unsigned long getRuleLine(in nsIDOMCSSStyleRule aRule);
-  unsigned long getRuleColumn(in nsIDOMCSSStyleRule aRule);
+  unsigned long getRuleLine(in nsIDOMCSSRule aRule);
+  unsigned long getRuleColumn(in nsIDOMCSSRule aRule);
 
   // Utilities for working with selectors.  We don't have a JS OM representation
   // of a single selector or a selector list yet, but given a rule we can index
   // into the selector list.
   //
   // This is a somewhat backwards API; once we move StyleRule to WebIDL we
   // should consider using [ChromeOnly] APIs on that.
   unsigned long getSelectorCount(in nsIDOMCSSStyleRule aRule);
--- a/layout/style/Rule.h
+++ b/layout/style/Rule.h
@@ -114,16 +114,17 @@ public:
   virtual nsIDOMCSSRule* GetDOMRule() = 0;
 
   // Like GetDOMRule(), but won't create one if we don't have one yet
   virtual nsIDOMCSSRule* GetExistingDOMRule() = 0;
 
   // to implement methods on nsIDOMCSSRule
   nsresult GetParentRule(nsIDOMCSSRule** aParentRule);
   nsresult GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet);
+  Rule* GetCSSRule();
 
   // This is pure virtual because all of Rule's data members are non-owning and
   // thus measured elsewhere.
   virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
     const MOZ_MUST_OVERRIDE = 0;
 
   // This is used to measure nsCOMArray<Rule>s.
   static size_t SizeOfCOMArrayElementIncludingThis(css::Rule* aElement,
--- a/layout/style/StyleRule.cpp
+++ b/layout/style/StyleRule.cpp
@@ -1253,16 +1253,22 @@ DOMCSSStyleRule::GetParentRule(nsIDOMCSS
 {
   if (!Rule()) {
     *aParentRule = nullptr;
     return NS_OK;
   }
   return Rule()->GetParentRule(aParentRule);
 }
 
+css::Rule*
+DOMCSSStyleRule::GetCSSRule()
+{
+  return Rule();
+}
+
 NS_IMETHODIMP
 DOMCSSStyleRule::GetSelectorText(nsAString& aSelectorText)
 {
   if (!Rule()) {
     aSelectorText.Truncate();
   } else {
     Rule()->GetSelectorText(aSelectorText);
   }
--- a/layout/style/nsCSSRules.cpp
+++ b/layout/style/nsCSSRules.cpp
@@ -112,16 +112,22 @@ nsresult
 Rule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
 {
   NS_ENSURE_ARG_POINTER(aSheet);
 
   NS_IF_ADDREF(*aSheet = GetStyleSheet());
   return NS_OK;
 }
 
+css::Rule*
+Rule::GetCSSRule()
+{
+  return this;
+}
+
 size_t
 Rule::SizeOfCOMArrayElementIncludingThis(css::Rule* aElement,
                                          MallocSizeOf aMallocSizeOf,
                                          void* aData)
 {
   return aElement->SizeOfIncludingThis(aMallocSizeOf);
 }
 
@@ -305,16 +311,22 @@ CharsetRule::GetParentStyleSheet(nsIDOMC
 }
 
 NS_IMETHODIMP
 CharsetRule::GetParentRule(nsIDOMCSSRule** aParentRule)
 {
   return Rule::GetParentRule(aParentRule);
 }
 
+css::Rule*
+CharsetRule::GetCSSRule()
+{
+  return Rule::GetCSSRule();
+}
+
 /* virtual */ size_t
 CharsetRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
 {
   return aMallocSizeOf(this);
 
   // Measurement of the following members may be added later if DMD finds it is
   // worthwhile:
   // - mEncoding
@@ -453,16 +465,22 @@ ImportRule::GetParentStyleSheet(nsIDOMCS
 }
 
 NS_IMETHODIMP
 ImportRule::GetParentRule(nsIDOMCSSRule** aParentRule)
 {
   return Rule::GetParentRule(aParentRule);
 }
 
+css::Rule*
+ImportRule::GetCSSRule()
+{
+  return Rule::GetCSSRule();
+}
+
 NS_IMETHODIMP
 ImportRule::GetHref(nsAString & aHref)
 {
   aHref = mURLSpec;
   return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -871,16 +889,22 @@ MediaRule::GetParentStyleSheet(nsIDOMCSS
 }
 
 NS_IMETHODIMP
 MediaRule::GetParentRule(nsIDOMCSSRule** aParentRule)
 {
   return GroupRule::GetParentRule(aParentRule);
 }
 
+css::Rule*
+MediaRule::GetCSSRule()
+{
+  return Rule::GetCSSRule();
+}
+
 // nsIDOMCSSGroupingRule methods
 NS_IMETHODIMP
 MediaRule::GetCssRules(nsIDOMCSSRuleList* *aRuleList)
 {
   return GroupRule::GetCssRules(aRuleList);
 }
 
 NS_IMETHODIMP
@@ -1079,16 +1103,22 @@ DocumentRule::GetParentStyleSheet(nsIDOM
 }
 
 NS_IMETHODIMP
 DocumentRule::GetParentRule(nsIDOMCSSRule** aParentRule)
 {
   return GroupRule::GetParentRule(aParentRule);
 }
 
+css::Rule*
+DocumentRule::GetCSSRule()
+{
+  return Rule::GetCSSRule();
+}
+
 // nsIDOMCSSGroupingRule methods
 NS_IMETHODIMP
 DocumentRule::GetCssRules(nsIDOMCSSRuleList* *aRuleList)
 {
   return GroupRule::GetCssRules(aRuleList);
 }
 
 NS_IMETHODIMP
@@ -1327,16 +1357,22 @@ NameSpaceRule::GetParentStyleSheet(nsIDO
 }
 
 NS_IMETHODIMP
 NameSpaceRule::GetParentRule(nsIDOMCSSRule** aParentRule)
 {
   return Rule::GetParentRule(aParentRule);
 }
 
+css::Rule*
+NameSpaceRule::GetCSSRule()
+{
+  return Rule::GetCSSRule();
+}
+
 /* virtual */ size_t
 NameSpaceRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
 {
   return aMallocSizeOf(this);
 
   // Measurement of the following members may be added later if DMD finds it is
   // worthwhile:
   // - mPrefix
@@ -1806,16 +1842,22 @@ nsCSSFontFaceRule::GetParentStyleSheet(n
 }
 
 NS_IMETHODIMP
 nsCSSFontFaceRule::GetParentRule(nsIDOMCSSRule** aParentRule)
 {
   return Rule::GetParentRule(aParentRule);
 }
 
+css::Rule*
+nsCSSFontFaceRule::GetCSSRule()
+{
+  return Rule::GetCSSRule();
+}
+
 NS_IMETHODIMP
 nsCSSFontFaceRule::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
 {
   NS_IF_ADDREF(*aStyle = &mDecl);
   return NS_OK;
 }
 
 // Arguably these should forward to nsCSSFontFaceStyleDecl methods.
@@ -1992,16 +2034,22 @@ nsCSSFontFeatureValuesRule::GetParentSty
 }
 
 NS_IMETHODIMP
 nsCSSFontFeatureValuesRule::GetParentRule(nsIDOMCSSRule** aParentRule)
 {
   return Rule::GetParentRule(aParentRule);
 }
 
+css::Rule*
+nsCSSFontFeatureValuesRule::GetCSSRule()
+{
+  return Rule::GetCSSRule();
+}
+
 NS_IMETHODIMP
 nsCSSFontFeatureValuesRule::GetFontFamily(nsAString& aFamilyListStr)
 {
   nsStyleUtil::AppendEscapedCSSFontFamilyList(mFamilyList, aFamilyListStr);
   return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -2275,16 +2323,22 @@ nsCSSKeyframeRule::GetParentStyleSheet(n
 }
 
 NS_IMETHODIMP
 nsCSSKeyframeRule::GetParentRule(nsIDOMCSSRule** aParentRule)
 {
   return Rule::GetParentRule(aParentRule);
 }
 
+css::Rule*
+nsCSSKeyframeRule::GetCSSRule()
+{
+  return Rule::GetCSSRule();
+}
+
 NS_IMETHODIMP
 nsCSSKeyframeRule::GetKeyText(nsAString& aKeyText)
 {
   DoGetKeyText(aKeyText);
   return NS_OK;
 }
 
 void
@@ -2472,16 +2526,22 @@ nsCSSKeyframesRule::GetParentStyleSheet(
 }
 
 NS_IMETHODIMP
 nsCSSKeyframesRule::GetParentRule(nsIDOMCSSRule** aParentRule)
 {
   return GroupRule::GetParentRule(aParentRule);
 }
 
+css::Rule*
+nsCSSKeyframesRule::GetCSSRule()
+{
+  return GroupRule::GetCSSRule();
+}
+
 NS_IMETHODIMP
 nsCSSKeyframesRule::GetName(nsAString& aName)
 {
   aName = mName;
   return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -2797,16 +2857,22 @@ nsCSSPageRule::GetParentStyleSheet(nsIDO
 }
 
 NS_IMETHODIMP
 nsCSSPageRule::GetParentRule(nsIDOMCSSRule** aParentRule)
 {
   return Rule::GetParentRule(aParentRule);
 }
 
+css::Rule*
+nsCSSPageRule::GetCSSRule()
+{
+  return Rule::GetCSSRule();
+}
+
 css::ImportantRule*
 nsCSSPageRule::GetImportantRule()
 {
   if (!mDeclaration->HasImportantData()) {
     return nullptr;
   }
   if (!mImportantRule) {
     mImportantRule = new css::ImportantRule(mDeclaration);
@@ -2948,16 +3014,22 @@ CSSSupportsRule::GetParentStyleSheet(nsI
 }
 
 NS_IMETHODIMP
 CSSSupportsRule::GetParentRule(nsIDOMCSSRule** aParentRule)
 {
   return css::GroupRule::GetParentRule(aParentRule);
 }
 
+css::Rule*
+CSSSupportsRule::GetCSSRule()
+{
+  return css::GroupRule::GetCSSRule();
+}
+
 // nsIDOMCSSGroupingRule methods
 NS_IMETHODIMP
 CSSSupportsRule::GetCssRules(nsIDOMCSSRuleList* *aRuleList)
 {
   return css::GroupRule::GetCssRules(aRuleList);
 }
 
 NS_IMETHODIMP
@@ -3113,16 +3185,22 @@ nsCSSCounterStyleRule::GetParentStyleShe
 }
 
 NS_IMETHODIMP
 nsCSSCounterStyleRule::GetParentRule(nsIDOMCSSRule** aParentRule)
 {
   return Rule::GetParentRule(aParentRule);
 }
 
+css::Rule*
+nsCSSCounterStyleRule::GetCSSRule()
+{
+  return Rule::GetCSSRule();
+}
+
 // nsIDOMCSSCounterStyleRule methods
 NS_IMETHODIMP
 nsCSSCounterStyleRule::GetName(nsAString& aName)
 {
   aName.Truncate();
   nsStyleUtil::AppendEscapedCSSIdent(mName, aName);
   return NS_OK;
 }