Bug 529750 part 4. Move GetImportantRule to css::StyleRule. r=dbaron
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 23 May 2011 16:45:44 -0400
changeset 70632 99cff4d7f93475a5ca24a098eb95c3668c8abc48
parent 70631 a5cfc3f56f62d36c9837446258f9479171083d03
child 70633 7827bde9f8d1efd93a87c735246905d9f8307c47
push id159
push usereakhgari@mozilla.com
push dateTue, 16 Aug 2011 17:53:11 +0000
treeherdermozilla-beta@8786e3e49240 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs529750
milestone6.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 529750 part 4. Move GetImportantRule to css::StyleRule. r=dbaron
layout/style/StyleRule.cpp
layout/style/StyleRule.h
layout/style/nsIStyleRule.h
--- a/layout/style/StyleRule.cpp
+++ b/layout/style/StyleRule.cpp
@@ -873,41 +873,16 @@ nsCSSSelectorList::Clone(PRBool aDeep) c
   return result;
 }
 
 // -- ImportantRule ----------------------------------
 
 namespace mozilla {
 namespace css {
 
-class StyleRule;
-
-class ImportantRule : public nsIStyleRule {
-public:
-  ImportantRule(Declaration *aDeclaration);
-
-  NS_DECL_ISUPPORTS
-
-  // nsIStyleRule interface
-  virtual void MapRuleInfoInto(nsRuleData* aRuleData);
-#ifdef DEBUG
-  virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
-#endif
-
-protected:
-  virtual ~ImportantRule();
-
-  // Not an owning reference; the StyleRule that owns this
-  // ImportantRule also owns the mDeclaration, and any rule node
-  // pointing to this rule keeps that StyleRule alive as well.
-  Declaration* mDeclaration;
-
-  friend class css::StyleRule;
-};
-
 ImportantRule::ImportantRule(Declaration* aDeclaration)
   : mDeclaration(aDeclaration)
 {
 }
 
 ImportantRule::~ImportantRule()
 {
 }
@@ -1302,21 +1277,16 @@ NS_INTERFACE_MAP_BEGIN(StyleRule)
   else
   NS_INTERFACE_MAP_ENTRY(nsIStyleRule)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIStyleRule)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_ADDREF_INHERITED(StyleRule, Rule)
 NS_IMPL_RELEASE_INHERITED(StyleRule, Rule)
 
-nsIStyleRule* StyleRule::GetImportantRule()
-{
-  return mImportantRule;
-}
-
 void
 StyleRule::RuleMatched()
 {
   if (!mWasMatched) {
     NS_ABORT_IF_FALSE(!mImportantRule, "should not have important rule yet");
 
     mWasMatched = PR_TRUE;
     mDeclaration->SetImmutable();
--- a/layout/style/StyleRule.h
+++ b/layout/style/StyleRule.h
@@ -286,19 +286,43 @@ private:
 #define NS_CSS_STYLE_RULE_IMPL_CID \
 { 0x464bab7a, 0x2fce, 0x4f30, \
   { 0xab, 0x44, 0xb7, 0xa5, 0xf3, 0xaa, 0xe5, 0x7d } }
 
 namespace mozilla {
 namespace css {
 
 class Declaration;
-class ImportantRule;
 class DOMCSSStyleRule;
 
+class StyleRule;
+
+class ImportantRule : public nsIStyleRule {
+public:
+  ImportantRule(Declaration *aDeclaration);
+
+  NS_DECL_ISUPPORTS
+
+  // nsIStyleRule interface
+  virtual void MapRuleInfoInto(nsRuleData* aRuleData);
+#ifdef DEBUG
+  virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
+#endif
+
+protected:
+  virtual ~ImportantRule();
+
+  // Not an owning reference; the StyleRule that owns this
+  // ImportantRule also owns the mDeclaration, and any rule node
+  // pointing to this rule keeps that StyleRule alive as well.
+  Declaration* mDeclaration;
+
+  friend class StyleRule;
+};
+
 class NS_FINAL_CLASS StyleRule : public Rule
 {
  public:
   StyleRule(nsCSSSelectorList* aSelector,
             Declaration *aDeclaration);
 private:
   // for |Clone|
   StyleRule(const StyleRule& aCopy);
@@ -325,17 +349,17 @@ public:
    * the declaration is modified.
    *
    * |DeclarationChanged| handles replacing the object in the container
    * sheet or group rule if |aHandleContainer| is true.
    */
   already_AddRefed<StyleRule>
   DeclarationChanged(Declaration* aDecl, PRBool aHandleContainer);
 
-  nsIStyleRule* GetImportantRule();
+  nsIStyleRule* GetImportantRule() const { return mImportantRule; }
 
   /**
    * The rule processor must call this method before calling
    * nsRuleWalker::Forward on this rule during rule matching.
    */
   void RuleMatched();
 
   // hooks for DOM rule
--- a/layout/style/nsIStyleRule.h
+++ b/layout/style/nsIStyleRule.h
@@ -98,18 +98,16 @@ public:
    * into the appropriate data struct in |aRuleData|.  It is important
    * that only empty data are filled in, since the rule tree is walked
    * from highest priority rule to least, so that the walk can stop if
    * all needed data are found.  Thus overwriting non-empty data will
    * break CSS cascading rules.
    */
   virtual void MapRuleInfoInto(nsRuleData* aRuleData)=0;
 
-  virtual nsIStyleRule* GetImportantRule(void) { return nsnull; }
-
 #ifdef DEBUG
   virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0;
 #endif
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIStyleRule, NS_ISTYLE_RULE_IID)
 
 #endif /* nsIStyleRule_h___ */