Bug 577976 - Part 3: Rename nsCSSRule and put in css namespace, r=bzbarsky

--HG--
rename : layout/style/nsCSSRule.h => layout/style/Rule.h
This commit is contained in:
Craig Topper 2011-03-06 19:59:03 -08:00
parent f7b0f4c555
commit 8ef5f341e8
8 changed files with 52 additions and 45 deletions

View File

@ -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();

View File

@ -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

View File

@ -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:

View File

@ -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<class T> 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<nsIStyleSheet> 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___ */

View File

@ -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),

View File

@ -46,7 +46,7 @@
#define mozilla_css_StyleRule_h__
//#include <stdio.h>
#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,

View File

@ -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<nsIStyleSheet>
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<GroupRule&>(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

View File

@ -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