From 8ef5f341e8b471d22f73dc407bc53d9ea703c239 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sun, 6 Mar 2011 19:59:03 -0800 Subject: [PATCH] Bug 577976 - Part 3: Rename nsCSSRule and put in css namespace, r=bzbarsky --HG-- rename : layout/style/nsCSSRule.h => layout/style/Rule.h --- layout/style/GroupRule.h | 6 ++-- layout/style/ImportRule.h | 6 ++-- layout/style/NameSpaceRule.h | 4 +-- layout/style/{nsCSSRule.h => Rule.h} | 23 +++++++-------- layout/style/StyleRule.cpp | 6 ++-- layout/style/StyleRule.h | 4 +-- layout/style/nsCSSRules.cpp | 42 ++++++++++++++++------------ layout/style/nsCSSRules.h | 6 ++-- 8 files changed, 52 insertions(+), 45 deletions(-) rename layout/style/{nsCSSRule.h => Rule.h} (88%) diff --git a/layout/style/GroupRule.h b/layout/style/GroupRule.h index 088018f17b9e..aa95809ddf75 100644 --- a/layout/style/GroupRule.h +++ b/layout/style/GroupRule.h @@ -43,7 +43,7 @@ #ifndef mozilla_css_GroupRule_h__ #define mozilla_css_GroupRule_h__ -#include "nsCSSRule.h" +#include "Rule.h" #include "nsCOMArray.h" #include "nsAutoPtr.h" @@ -55,9 +55,9 @@ namespace css { class GroupRuleRuleList; -// inherits from nsCSSRule so it can be shared between +// inherits from Rule so it can be shared between // MediaRule and DocumentRule -class GroupRule : public nsCSSRule +class GroupRule : public Rule { protected: GroupRule(); diff --git a/layout/style/ImportRule.h b/layout/style/ImportRule.h index 3006a99d9ae5..ed80701a278e 100644 --- a/layout/style/ImportRule.h +++ b/layout/style/ImportRule.h @@ -40,7 +40,7 @@ #ifndef mozilla_css_ImportRule_h__ #define mozilla_css_ImportRule_h__ -#include "nsCSSRule.h" +#include "Rule.h" #include "nsIDOMCSSImportRule.h" #include "nsCSSRules.h" @@ -50,7 +50,7 @@ class nsString; namespace mozilla { namespace css { -class NS_FINAL_CLASS ImportRule : public nsCSSRule, +class NS_FINAL_CLASS ImportRule : public Rule, public nsIDOMCSSImportRule { public: @@ -65,7 +65,7 @@ public: DECL_STYLE_RULE_INHERIT #ifdef HAVE_CPP_AMBIGUITY_RESOLVING_USING - using nsCSSRule::GetStyleSheet; // unhide since nsIDOMCSSImportRule has its own GetStyleSheet + using Rule::GetStyleSheet; // unhide since nsIDOMCSSImportRule has its own GetStyleSheet #endif // nsIStyleRule methods diff --git a/layout/style/NameSpaceRule.h b/layout/style/NameSpaceRule.h index b743498a0192..80ff28d59867 100644 --- a/layout/style/NameSpaceRule.h +++ b/layout/style/NameSpaceRule.h @@ -40,7 +40,7 @@ #ifndef mozilla_css_NameSpaceRule_h__ #define mozilla_css_NameSpaceRule_h__ -#include "nsCSSRule.h" +#include "Rule.h" #include "nsIDOMCSSRule.h" class nsIAtom; @@ -53,7 +53,7 @@ class nsIAtom; namespace mozilla { namespace css { -class NS_FINAL_CLASS NameSpaceRule : public nsCSSRule, +class NS_FINAL_CLASS NameSpaceRule : public Rule, public nsIDOMCSSRule { public: diff --git a/layout/style/nsCSSRule.h b/layout/style/Rule.h similarity index 88% rename from layout/style/nsCSSRule.h rename to layout/style/Rule.h index 078bb1a0cd61..5a787f79b8b3 100644 --- a/layout/style/nsCSSRule.h +++ b/layout/style/Rule.h @@ -37,8 +37,8 @@ /* base class for all rule types in a CSS style sheet */ -#ifndef nsCSSRule_h___ -#define nsCSSRule_h___ +#ifndef mozilla_css_Rule_h___ +#define mozilla_css_Rule_h___ #include "nsICSSRule.h" @@ -50,8 +50,6 @@ template struct already_AddRefed; namespace mozilla { namespace css { class GroupRule; -} -} #define DECL_STYLE_RULE_INHERIT_NO_DOMRULE \ virtual void MapRuleInfoInto(nsRuleData* aRuleData); @@ -60,15 +58,15 @@ virtual void MapRuleInfoInto(nsRuleData* aRuleData); DECL_STYLE_RULE_INHERIT_NO_DOMRULE \ virtual nsIDOMCSSRule* GetDOMRuleWeak(nsresult* aResult); -class nsCSSRule : public nsICSSRule { +class Rule : public nsICSSRule { protected: - nsCSSRule() + Rule() : mSheet(nsnull), mParentRule(nsnull) { } - nsCSSRule(const nsCSSRule& aCopy) + Rule(const Rule& aCopy) : mSheet(aCopy.mSheet), mParentRule(aCopy.mParentRule) { @@ -79,11 +77,14 @@ public: virtual already_AddRefed GetStyleSheet() const; virtual void SetStyleSheet(nsCSSStyleSheet* aSheet); - virtual void SetParentRule(mozilla::css::GroupRule* aRule); + virtual void SetParentRule(GroupRule* aRule); protected: - nsCSSStyleSheet* mSheet; - mozilla::css::GroupRule* mParentRule; + nsCSSStyleSheet* mSheet; + GroupRule* mParentRule; }; -#endif /* nsCSSRule_h___ */ +} // namespace css +} // namespace mozilla + +#endif /* mozilla_css_Rule_h___ */ diff --git a/layout/style/StyleRule.cpp b/layout/style/StyleRule.cpp index e3913e35bf05..678662fb5789 100644 --- a/layout/style/StyleRule.cpp +++ b/layout/style/StyleRule.cpp @@ -1279,7 +1279,7 @@ namespace css { StyleRule::StyleRule(nsCSSSelectorList* aSelector, Declaration* aDeclaration) - : nsCSSRule(), + : Rule(), mSelector(aSelector), mDeclaration(aDeclaration), mImportantRule(nsnull), @@ -1291,7 +1291,7 @@ StyleRule::StyleRule(nsCSSSelectorList* aSelector, // for |Clone| StyleRule::StyleRule(const StyleRule& aCopy) - : nsCSSRule(aCopy), + : Rule(aCopy), mSelector(aCopy.mSelector ? aCopy.mSelector->Clone() : nsnull), mDeclaration(new Declaration(*aCopy.mDeclaration)), mImportantRule(nsnull), @@ -1305,7 +1305,7 @@ StyleRule::StyleRule(const StyleRule& aCopy) // for |SetCSSDeclaration| StyleRule::StyleRule(StyleRule& aCopy, Declaration* aDeclaration) - : nsCSSRule(aCopy), + : Rule(aCopy), mSelector(aCopy.mSelector), mDeclaration(aDeclaration), mImportantRule(nsnull), diff --git a/layout/style/StyleRule.h b/layout/style/StyleRule.h index 90365182c7ee..c90deac0cf69 100644 --- a/layout/style/StyleRule.h +++ b/layout/style/StyleRule.h @@ -46,7 +46,7 @@ #define mozilla_css_StyleRule_h__ //#include -#include "nsCSSRule.h" +#include "Rule.h" #include "nsString.h" #include "nsCOMPtr.h" #include "nsCSSPseudoElements.h" @@ -294,7 +294,7 @@ class Declaration; class ImportantRule; class DOMCSSStyleRule; -class NS_FINAL_CLASS StyleRule : public nsCSSRule +class NS_FINAL_CLASS StyleRule : public Rule { public: StyleRule(nsCSSSelectorList* aSelector, diff --git a/layout/style/nsCSSRules.cpp b/layout/style/nsCSSRules.cpp index 8ce09e0edce2..297baa6a3ccb 100644 --- a/layout/style/nsCSSRules.cpp +++ b/layout/style/nsCSSRules.cpp @@ -80,15 +80,18 @@ nsIDOMCSSRule* _class::GetDOMRuleWeak(nsresult *aResult) { *aResult = NS_OK; ret // base class for all rule types in a CSS style sheet +namespace mozilla { +namespace css { + /* virtual */ already_AddRefed -nsCSSRule::GetStyleSheet() const +Rule::GetStyleSheet() const { NS_IF_ADDREF(mSheet); return mSheet; } /* virtual */ void -nsCSSRule::SetStyleSheet(nsCSSStyleSheet* aSheet) +Rule::SetStyleSheet(nsCSSStyleSheet* aSheet) { // We don't reference count this up reference. The style sheet // will tell us when it's going away or when we're detached from @@ -97,7 +100,7 @@ nsCSSRule::SetStyleSheet(nsCSSStyleSheet* aSheet) } /* virtual */ void -nsCSSRule::SetParentRule(css::GroupRule* aRule) +Rule::SetParentRule(css::GroupRule* aRule) { // We don't reference count this up reference. The group rule // will tell us when it's going away or when we're detached from @@ -105,6 +108,9 @@ nsCSSRule::SetParentRule(css::GroupRule* aRule) mParentRule = aRule; } +} // namespace css +} // namespace mozilla + // ------------------------------- // Style Rule List for group rules @@ -206,7 +212,7 @@ DOMCI_DATA(CSSGroupRuleRuleList, css::GroupRuleRuleList) // ------------------------------------------- // CharsetRule // -class NS_FINAL_CLASS CSSCharsetRuleImpl : public nsCSSRule, +class NS_FINAL_CLASS CSSCharsetRuleImpl : public css::Rule, public nsIDOMCSSCharsetRule { public: @@ -240,13 +246,13 @@ protected: }; CSSCharsetRuleImpl::CSSCharsetRuleImpl(const nsAString& aEncoding) - : nsCSSRule(), + : css::Rule(), mEncoding(aEncoding) { } CSSCharsetRuleImpl::CSSCharsetRuleImpl(const CSSCharsetRuleImpl& aCopy) - : nsCSSRule(aCopy), + : css::Rule(aCopy), mEncoding(aCopy.mEncoding) { } @@ -266,7 +272,7 @@ NS_INTERFACE_MAP_BEGIN(CSSCharsetRuleImpl) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSCharsetRule) NS_INTERFACE_MAP_END -IMPL_STYLE_RULE_INHERIT(CSSCharsetRuleImpl, nsCSSRule) +IMPL_STYLE_RULE_INHERIT(CSSCharsetRuleImpl, css::Rule) #ifdef DEBUG /* virtual */ void @@ -377,7 +383,7 @@ namespace mozilla { namespace css { ImportRule::ImportRule(nsMediaList* aMedia) - : nsCSSRule() + : Rule() , mURLSpec() , mMedia(aMedia) { @@ -387,7 +393,7 @@ ImportRule::ImportRule(nsMediaList* aMedia) } ImportRule::ImportRule(const ImportRule& aCopy) - : nsCSSRule(aCopy), + : Rule(aCopy), mURLSpec(aCopy.mURLSpec) { // Whether or not an @import rule has a null sheet is a permanent @@ -421,7 +427,7 @@ NS_INTERFACE_MAP_BEGIN(ImportRule) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSImportRule) NS_INTERFACE_MAP_END -IMPL_STYLE_RULE_INHERIT(ImportRule, nsCSSRule) +IMPL_STYLE_RULE_INHERIT(ImportRule, Rule) #ifdef DEBUG /* virtual */ void @@ -602,7 +608,7 @@ namespace mozilla { namespace css { GroupRule::GroupRule() - : nsCSSRule() + : Rule() { } @@ -615,7 +621,7 @@ SetParentRuleReference(nsICSSRule* aRule, void* aParentRule) } GroupRule::GroupRule(const GroupRule& aCopy) - : nsCSSRule(aCopy) + : Rule(aCopy) { const_cast(aCopy).mRules.EnumerateForwards(CloneRuleInto, &mRules); mRules.EnumerateForwards(SetParentRuleReference, this); @@ -632,7 +638,7 @@ GroupRule::~GroupRule() NS_IMPL_ADDREF(GroupRule) NS_IMPL_RELEASE(GroupRule) -IMPL_STYLE_RULE_INHERIT2(GroupRule, nsCSSRule) +IMPL_STYLE_RULE_INHERIT2(GroupRule, Rule) static PRBool SetStyleSheetReference(nsICSSRule* aRule, void* aSheet) @@ -646,7 +652,7 @@ SetStyleSheetReference(nsICSSRule* aRule, void* aSheet) GroupRule::SetStyleSheet(nsCSSStyleSheet* aSheet) { mRules.EnumerateForwards(SetStyleSheetReference, aSheet); - nsCSSRule::SetStyleSheet(aSheet); + Rule::SetStyleSheet(aSheet); } #ifdef DEBUG @@ -1189,14 +1195,14 @@ namespace mozilla { namespace css { NameSpaceRule::NameSpaceRule() - : nsCSSRule(), + : Rule(), mPrefix(nsnull), mURLSpec() { } NameSpaceRule::NameSpaceRule(const NameSpaceRule& aCopy) - : nsCSSRule(aCopy), + : Rule(aCopy), mPrefix(aCopy.mPrefix), mURLSpec(aCopy.mURLSpec) { @@ -1224,7 +1230,7 @@ NS_INTERFACE_MAP_BEGIN(NameSpaceRule) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSNameSpaceRule) NS_INTERFACE_MAP_END -IMPL_STYLE_RULE_INHERIT(NameSpaceRule, nsCSSRule) +IMPL_STYLE_RULE_INHERIT(NameSpaceRule, Rule) #ifdef DEBUG /* virtual */ void @@ -1686,7 +1692,7 @@ NS_INTERFACE_MAP_BEGIN(nsCSSFontFaceRule) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSFontFaceRule) NS_INTERFACE_MAP_END -IMPL_STYLE_RULE_INHERIT(nsCSSFontFaceRule, nsCSSRule) +IMPL_STYLE_RULE_INHERIT(nsCSSFontFaceRule, Rule) #ifdef DEBUG void diff --git a/layout/style/nsCSSRules.h b/layout/style/nsCSSRules.h index 158548cf3be7..c6f443c98f17 100644 --- a/layout/style/nsCSSRules.h +++ b/layout/style/nsCSSRules.h @@ -43,7 +43,7 @@ #ifndef nsCSSRules_h_ #define nsCSSRules_h_ -#include "nsCSSRule.h" +#include "Rule.h" #include "mozilla/css/GroupRule.h" #include "nsIDOMCSSMediaRule.h" #include "nsIDOMCSSMozDocumentRule.h" @@ -201,7 +201,7 @@ private: void* operator new(size_t size) CPP_THROW_NEW; }; -class NS_FINAL_CLASS nsCSSFontFaceRule : public nsCSSRule, +class NS_FINAL_CLASS nsCSSFontFaceRule : public mozilla::css::Rule, public nsIDOMCSSFontFaceRule { public: @@ -209,7 +209,7 @@ public: nsCSSFontFaceRule(const nsCSSFontFaceRule& aCopy) // copy everything except our reference count - : nsCSSRule(aCopy), mDecl(aCopy.mDecl) {} + : mozilla::css::Rule(aCopy), mDecl(aCopy.mDecl) {} NS_DECL_ISUPPORTS