mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Remove nsIStyleRule::GetStyleSheet (and move it to nsICSSRule). b=266991 r+sr=bzbarsky
This commit is contained in:
parent
0570feff32
commit
976fc758a4
@ -85,8 +85,6 @@ class nsIStyleRule : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTYLE_RULE_IID)
|
||||
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const = 0;
|
||||
|
||||
/**
|
||||
* |nsIStyleRule::MapRuleInfoInto| is a request to copy all stylistic
|
||||
* data represented by the rule that:
|
||||
|
@ -181,14 +181,6 @@ nsMappedAttributes::HashValue() const
|
||||
return value;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMappedAttributes::GetStyleSheet(nsIStyleSheet*& aSheet) const
|
||||
{
|
||||
aSheet = mSheet;
|
||||
NS_IF_ADDREF(aSheet);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsMappedAttributes::SetStyleSheet(nsHTMLStyleSheet* aSheet)
|
||||
{
|
||||
|
@ -96,7 +96,6 @@ public:
|
||||
|
||||
|
||||
// nsIStyleRule
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const;
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
#ifdef DEBUG
|
||||
NS_METHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
@ -69,22 +69,18 @@ class nsHTMLBodyElement;
|
||||
|
||||
class BodyRule: public nsIStyleRule {
|
||||
public:
|
||||
BodyRule(nsHTMLBodyElement* aPart, nsHTMLStyleSheet* aSheet);
|
||||
BodyRule(nsHTMLBodyElement* aPart);
|
||||
virtual ~BodyRule();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const;
|
||||
|
||||
// The new mapping function.
|
||||
// nsIStyleRule interface
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
#endif
|
||||
|
||||
nsHTMLBodyElement* mPart; // not ref-counted, cleared by content
|
||||
nsHTMLStyleSheet* mSheet; // not ref-counted, cleared by content
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@ -126,10 +122,9 @@ protected:
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
BodyRule::BodyRule(nsHTMLBodyElement* aPart, nsHTMLStyleSheet* aSheet)
|
||||
BodyRule::BodyRule(nsHTMLBodyElement* aPart)
|
||||
{
|
||||
mPart = aPart;
|
||||
mSheet = aSheet;
|
||||
}
|
||||
|
||||
BodyRule::~BodyRule()
|
||||
@ -138,14 +133,6 @@ BodyRule::~BodyRule()
|
||||
|
||||
NS_IMPL_ISUPPORTS1(BodyRule, nsIStyleRule)
|
||||
|
||||
NS_IMETHODIMP
|
||||
BodyRule::GetStyleSheet(nsIStyleSheet*& aSheet) const
|
||||
{
|
||||
NS_IF_ADDREF(mSheet);
|
||||
aSheet = mSheet;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BodyRule::MapRuleInfoInto(nsRuleData* aData)
|
||||
{
|
||||
@ -303,7 +290,6 @@ nsHTMLBodyElement::~nsHTMLBodyElement()
|
||||
{
|
||||
if (mContentStyleRule) {
|
||||
mContentStyleRule->mPart = nsnull;
|
||||
mContentStyleRule->mSheet = nsnull;
|
||||
NS_RELEASE(mContentStyleRule);
|
||||
}
|
||||
}
|
||||
@ -435,7 +421,6 @@ nsHTMLBodyElement::SetDocument(nsIDocument* aDocument, PRBool aDeep,
|
||||
nsIDocument *document = GetCurrentDoc();
|
||||
if (aDocument != document && mContentStyleRule) {
|
||||
mContentStyleRule->mPart = nsnull;
|
||||
mContentStyleRule->mSheet = nsnull;
|
||||
|
||||
// destroy old style rule since the sheet will probably change
|
||||
NS_RELEASE(mContentStyleRule);
|
||||
@ -504,8 +489,7 @@ nsHTMLBodyElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
if (!mContentStyleRule && IsInDoc()) {
|
||||
// XXXbz should this use GetOwnerDoc() or GetCurrentDoc()?
|
||||
// sXBL/XBL2 issue!
|
||||
mContentStyleRule = new BodyRule(this,
|
||||
GetOwnerDoc()->GetAttributeStyleSheet());
|
||||
mContentStyleRule = new BodyRule(this);
|
||||
NS_IF_ADDREF(mContentStyleRule);
|
||||
}
|
||||
if (aRuleWalker && mContentStyleRule) {
|
||||
|
@ -818,15 +818,12 @@ class CSSStyleRuleImpl;
|
||||
|
||||
class CSSImportantRule : public nsIStyleRule {
|
||||
public:
|
||||
CSSImportantRule(nsICSSStyleSheet* aSheet, nsCSSDeclaration* aDeclaration);
|
||||
CSSImportantRule(nsCSSDeclaration* aDeclaration);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const;
|
||||
|
||||
// The new mapping function.
|
||||
// nsIStyleRule interface
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
#endif
|
||||
@ -835,14 +832,12 @@ protected:
|
||||
virtual ~CSSImportantRule(void);
|
||||
|
||||
nsCSSDeclaration* mDeclaration;
|
||||
nsICSSStyleSheet* mSheet;
|
||||
|
||||
friend class CSSStyleRuleImpl;
|
||||
friend class CSSStyleRuleImpl;
|
||||
};
|
||||
|
||||
CSSImportantRule::CSSImportantRule(nsICSSStyleSheet* aSheet, nsCSSDeclaration* aDeclaration)
|
||||
: mDeclaration(aDeclaration),
|
||||
mSheet(aSheet)
|
||||
CSSImportantRule::CSSImportantRule(nsCSSDeclaration* aDeclaration)
|
||||
: mDeclaration(aDeclaration)
|
||||
{
|
||||
}
|
||||
|
||||
@ -853,14 +848,6 @@ CSSImportantRule::~CSSImportantRule(void)
|
||||
|
||||
NS_IMPL_ISUPPORTS1(CSSImportantRule, nsIStyleRule)
|
||||
|
||||
NS_IMETHODIMP
|
||||
CSSImportantRule::GetStyleSheet(nsIStyleSheet*& aSheet) const
|
||||
{
|
||||
NS_IF_ADDREF(mSheet);
|
||||
aSheet = mSheet;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CSSImportantRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
{
|
||||
@ -1331,7 +1318,6 @@ CSSStyleRuleImpl::~CSSStyleRuleImpl(void)
|
||||
mDeclaration = nsnull;
|
||||
}
|
||||
if (nsnull != mImportantRule) {
|
||||
mImportantRule->mSheet = nsnull;
|
||||
NS_RELEASE(mImportantRule);
|
||||
mImportantRule = nsnull;
|
||||
}
|
||||
@ -1375,7 +1361,7 @@ nsCSSDeclaration* CSSStyleRuleImpl::GetDeclaration(void) const
|
||||
already_AddRefed<nsIStyleRule> CSSStyleRuleImpl::GetImportantRule(void)
|
||||
{
|
||||
if (!mImportantRule && mDeclaration->HasImportantData()) {
|
||||
mImportantRule = new CSSImportantRule(mSheet, mDeclaration);
|
||||
mImportantRule = new CSSImportantRule(mDeclaration);
|
||||
NS_IF_ADDREF(mImportantRule);
|
||||
}
|
||||
NS_IF_ADDREF(mImportantRule);
|
||||
@ -1391,11 +1377,7 @@ CSSStyleRuleImpl::GetStyleSheet(nsIStyleSheet*& aSheet) const
|
||||
NS_IMETHODIMP
|
||||
CSSStyleRuleImpl::SetStyleSheet(nsICSSStyleSheet* aSheet)
|
||||
{
|
||||
nsCSSRule::SetStyleSheet(aSheet);
|
||||
if (nsnull != mImportantRule) { // we're responsible for this guy too
|
||||
mImportantRule->mSheet = aSheet;
|
||||
}
|
||||
return NS_OK;
|
||||
return nsCSSRule::SetStyleSheet(aSheet);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -64,13 +64,11 @@
|
||||
|
||||
class CSSDisablePropsRule : public nsIStyleRule {
|
||||
public:
|
||||
CSSDisablePropsRule(nsIHTMLCSSStyleSheet* aSheet);
|
||||
CSSDisablePropsRule();
|
||||
virtual ~CSSDisablePropsRule();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const;
|
||||
|
||||
// Call this something else so that this class still has pure virtual
|
||||
// functions.
|
||||
void CommonMapRuleInfoInto(nsRuleData* aRuleData);
|
||||
@ -78,27 +76,22 @@ public:
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
#endif
|
||||
|
||||
nsIHTMLCSSStyleSheet* mSheet;
|
||||
};
|
||||
|
||||
CSSDisablePropsRule::CSSDisablePropsRule(nsIHTMLCSSStyleSheet* aSheet)
|
||||
: mSheet(aSheet)
|
||||
CSSDisablePropsRule::CSSDisablePropsRule()
|
||||
{
|
||||
}
|
||||
|
||||
class CSSFirstLineRule : public CSSDisablePropsRule {
|
||||
public:
|
||||
CSSFirstLineRule(nsIHTMLCSSStyleSheet* aSheet)
|
||||
: CSSDisablePropsRule(aSheet) {}
|
||||
CSSFirstLineRule() {}
|
||||
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
};
|
||||
|
||||
class CSSFirstLetterRule : public CSSDisablePropsRule {
|
||||
public:
|
||||
CSSFirstLetterRule(nsIHTMLCSSStyleSheet* aSheet)
|
||||
: CSSDisablePropsRule(aSheet) {}
|
||||
CSSFirstLetterRule() {}
|
||||
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
};
|
||||
@ -109,14 +102,6 @@ CSSDisablePropsRule::~CSSDisablePropsRule()
|
||||
|
||||
NS_IMPL_ISUPPORTS1(CSSDisablePropsRule, nsIStyleRule)
|
||||
|
||||
NS_IMETHODIMP
|
||||
CSSDisablePropsRule::GetStyleSheet(nsIStyleSheet*& aSheet) const
|
||||
{
|
||||
NS_IF_ADDREF(mSheet);
|
||||
aSheet = mSheet;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHODIMP
|
||||
CSSDisablePropsRule::List(FILE* out, PRInt32 aIndent) const
|
||||
@ -412,14 +397,9 @@ HTMLCSSStyleSheetImpl::HTMLCSSStyleSheetImpl()
|
||||
HTMLCSSStyleSheetImpl::~HTMLCSSStyleSheetImpl()
|
||||
{
|
||||
NS_RELEASE(mURL);
|
||||
if (nsnull != mFirstLineRule) {
|
||||
mFirstLineRule->mSheet = nsnull;
|
||||
NS_RELEASE(mFirstLineRule);
|
||||
}
|
||||
if (nsnull != mFirstLetterRule) {
|
||||
mFirstLetterRule->mSheet = nsnull;
|
||||
NS_RELEASE(mFirstLetterRule);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mFirstLineRule);
|
||||
NS_IF_RELEASE(mFirstLetterRule);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS3(HTMLCSSStyleSheetImpl,
|
||||
@ -455,7 +435,7 @@ HTMLCSSStyleSheetImpl::RulesMatching(PseudoRuleProcessorData* aData)
|
||||
nsIAtom* pseudoTag = aData->mPseudoTag;
|
||||
if (pseudoTag == nsCSSPseudoElements::firstLine) {
|
||||
if (!mFirstLineRule) {
|
||||
mFirstLineRule = new CSSFirstLineRule(this);
|
||||
mFirstLineRule = new CSSFirstLineRule();
|
||||
if (!mFirstLineRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mFirstLineRule);
|
||||
@ -464,7 +444,7 @@ HTMLCSSStyleSheetImpl::RulesMatching(PseudoRuleProcessorData* aData)
|
||||
}
|
||||
else if (pseudoTag == nsCSSPseudoElements::firstLetter) {
|
||||
if (!mFirstLetterRule) {
|
||||
mFirstLetterRule = new CSSFirstLetterRule(this);
|
||||
mFirstLetterRule = new CSSFirstLetterRule();
|
||||
if (!mFirstLetterRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mFirstLetterRule);
|
||||
@ -516,14 +496,9 @@ HTMLCSSStyleSheetImpl::Reset(nsIURI* aURL)
|
||||
NS_IF_RELEASE(mURL);
|
||||
mURL = aURL;
|
||||
NS_ADDREF(mURL);
|
||||
if (nsnull != mFirstLineRule) {
|
||||
mFirstLineRule->mSheet = nsnull;
|
||||
NS_RELEASE(mFirstLineRule);
|
||||
}
|
||||
if (nsnull != mFirstLetterRule) {
|
||||
mFirstLetterRule->mSheet = nsnull;
|
||||
NS_RELEASE(mFirstLetterRule);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mFirstLineRule);
|
||||
NS_IF_RELEASE(mFirstLetterRule);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -65,25 +65,8 @@
|
||||
#include "nsRuleWalker.h"
|
||||
#include "nsRuleData.h"
|
||||
|
||||
nsHTMLStyleSheet::HTMLColorRule::HTMLColorRule(nsHTMLStyleSheet* aSheet)
|
||||
: mSheet(aSheet)
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::HTMLColorRule::~HTMLColorRule()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsHTMLStyleSheet::HTMLColorRule, nsIStyleRule)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyleSheet::HTMLColorRule::GetStyleSheet(nsIStyleSheet*& aSheet) const
|
||||
{
|
||||
NS_IF_ADDREF(mSheet);
|
||||
aSheet = mSheet;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyleSheet::HTMLColorRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
{
|
||||
@ -102,24 +85,8 @@ nsHTMLStyleSheet::HTMLColorRule::List(FILE* out, PRInt32 aIndent) const
|
||||
}
|
||||
#endif
|
||||
|
||||
nsHTMLStyleSheet::GenericTableRule::GenericTableRule(nsHTMLStyleSheet* aSheet)
|
||||
{
|
||||
mSheet = aSheet;
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::GenericTableRule::~GenericTableRule()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsHTMLStyleSheet::GenericTableRule, nsIStyleRule)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyleSheet::GenericTableRule::GetStyleSheet(nsIStyleSheet*& aSheet) const
|
||||
{
|
||||
aSheet = mSheet;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyleSheet::GenericTableRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
{
|
||||
@ -135,15 +102,6 @@ nsHTMLStyleSheet::GenericTableRule::List(FILE* out, PRInt32 aIndent) const
|
||||
}
|
||||
#endif
|
||||
|
||||
nsHTMLStyleSheet::TableTHRule::TableTHRule(nsHTMLStyleSheet* aSheet)
|
||||
: GenericTableRule(aSheet)
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::TableTHRule::~TableTHRule()
|
||||
{
|
||||
}
|
||||
|
||||
static void PostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData)
|
||||
{
|
||||
nsStyleText* text = (nsStyleText*)aStyleStruct;
|
||||
@ -253,15 +211,6 @@ ProcessTableRulesAttribute(nsStyleStruct* aStyleStruct,
|
||||
}
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::TableTbodyRule::TableTbodyRule(nsHTMLStyleSheet* aSheet)
|
||||
: GenericTableRule(aSheet)
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::TableTbodyRule::~TableTbodyRule()
|
||||
{
|
||||
}
|
||||
|
||||
static void TbodyPostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData)
|
||||
{
|
||||
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_TOP, PR_TRUE, NS_STYLE_TABLE_RULES_ALL,
|
||||
@ -281,15 +230,6 @@ nsHTMLStyleSheet::TableTbodyRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
}
|
||||
// -----------------------------------------------------------
|
||||
|
||||
nsHTMLStyleSheet::TableRowRule::TableRowRule(nsHTMLStyleSheet* aSheet)
|
||||
: GenericTableRule(aSheet)
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::TableRowRule::~TableRowRule()
|
||||
{
|
||||
}
|
||||
|
||||
static void RowPostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData)
|
||||
{
|
||||
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_TOP, PR_FALSE, NS_STYLE_TABLE_RULES_ALL,
|
||||
@ -308,15 +248,6 @@ nsHTMLStyleSheet::TableRowRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::TableColgroupRule::TableColgroupRule(nsHTMLStyleSheet* aSheet)
|
||||
: GenericTableRule(aSheet)
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::TableColgroupRule::~TableColgroupRule()
|
||||
{
|
||||
}
|
||||
|
||||
static void ColgroupPostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData)
|
||||
{
|
||||
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_LEFT, PR_TRUE, NS_STYLE_TABLE_RULES_ALL,
|
||||
@ -335,15 +266,6 @@ nsHTMLStyleSheet::TableColgroupRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::TableColRule::TableColRule(nsHTMLStyleSheet* aSheet)
|
||||
: GenericTableRule(aSheet)
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::TableColRule::~TableColRule()
|
||||
{
|
||||
}
|
||||
|
||||
static void ColPostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData)
|
||||
{
|
||||
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_LEFT, PR_FALSE, NS_STYLE_TABLE_RULES_ALL,
|
||||
@ -425,27 +347,27 @@ nsHTMLStyleSheet::nsHTMLStyleSheet(void)
|
||||
nsresult
|
||||
nsHTMLStyleSheet::Init()
|
||||
{
|
||||
mTableTbodyRule = new TableTbodyRule(this);
|
||||
mTableTbodyRule = new TableTbodyRule();
|
||||
if (!mTableTbodyRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mTableTbodyRule);
|
||||
|
||||
mTableRowRule = new TableRowRule(this);
|
||||
mTableRowRule = new TableRowRule();
|
||||
if (!mTableRowRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mTableRowRule);
|
||||
|
||||
mTableColgroupRule = new TableColgroupRule(this);
|
||||
mTableColgroupRule = new TableColgroupRule();
|
||||
if (!mTableColgroupRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mTableColgroupRule);
|
||||
|
||||
mTableColRule = new TableColRule(this);
|
||||
mTableColRule = new TableColRule();
|
||||
if (!mTableColRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mTableColRule);
|
||||
|
||||
mTableTHRule = new TableTHRule(this);
|
||||
mTableTHRule = new TableTHRule();
|
||||
if (!mTableTHRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mTableTHRule);
|
||||
@ -456,42 +378,17 @@ nsHTMLStyleSheet::Init()
|
||||
nsHTMLStyleSheet::~nsHTMLStyleSheet()
|
||||
{
|
||||
NS_IF_RELEASE(mURL);
|
||||
if (nsnull != mLinkRule) {
|
||||
mLinkRule->mSheet = nsnull;
|
||||
NS_RELEASE(mLinkRule);
|
||||
}
|
||||
if (nsnull != mVisitedRule) {
|
||||
mVisitedRule->mSheet = nsnull;
|
||||
NS_RELEASE(mVisitedRule);
|
||||
}
|
||||
if (nsnull != mActiveRule) {
|
||||
mActiveRule->mSheet = nsnull;
|
||||
NS_RELEASE(mActiveRule);
|
||||
}
|
||||
if (nsnull != mDocumentColorRule) {
|
||||
mDocumentColorRule->mSheet = nsnull;
|
||||
NS_RELEASE(mDocumentColorRule);
|
||||
}
|
||||
if (nsnull != mTableTbodyRule) {
|
||||
mTableTbodyRule->mSheet = nsnull;
|
||||
NS_RELEASE(mTableTbodyRule);
|
||||
}
|
||||
if (nsnull != mTableRowRule) {
|
||||
mTableRowRule->mSheet = nsnull;
|
||||
NS_RELEASE(mTableRowRule);
|
||||
}
|
||||
if (nsnull != mTableColgroupRule) {
|
||||
mTableColgroupRule->mSheet = nsnull;
|
||||
NS_RELEASE(mTableColgroupRule);
|
||||
}
|
||||
if (nsnull != mTableColRule) {
|
||||
mTableColRule->mSheet = nsnull;
|
||||
NS_RELEASE(mTableColRule);
|
||||
}
|
||||
if (nsnull != mTableTHRule) {
|
||||
mTableTHRule->mSheet = nsnull;
|
||||
NS_RELEASE(mTableTHRule);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mLinkRule);
|
||||
NS_IF_RELEASE(mVisitedRule);
|
||||
NS_IF_RELEASE(mActiveRule);
|
||||
NS_IF_RELEASE(mDocumentColorRule);
|
||||
NS_IF_RELEASE(mTableTbodyRule);
|
||||
NS_IF_RELEASE(mTableRowRule);
|
||||
NS_IF_RELEASE(mTableColgroupRule);
|
||||
NS_IF_RELEASE(mTableColRule);
|
||||
NS_IF_RELEASE(mTableTHRule);
|
||||
|
||||
if (mMappedAttrTable.ops)
|
||||
PL_DHashTableFinish(&mMappedAttrTable);
|
||||
}
|
||||
@ -572,11 +469,8 @@ nsHTMLStyleSheet::RulesMatching(ElementRuleProcessorData* aData)
|
||||
&bodyColor);
|
||||
if (NS_SUCCEEDED(rv) &&
|
||||
(!mDocumentColorRule || bodyColor != mDocumentColorRule->mColor)) {
|
||||
if (mDocumentColorRule) {
|
||||
mDocumentColorRule->mSheet = nsnull;
|
||||
NS_RELEASE(mDocumentColorRule);
|
||||
}
|
||||
mDocumentColorRule = new HTMLColorRule(this);
|
||||
NS_IF_RELEASE(mDocumentColorRule);
|
||||
mDocumentColorRule = new HTMLColorRule();
|
||||
if (mDocumentColorRule) {
|
||||
NS_ADDREF(mDocumentColorRule);
|
||||
mDocumentColorRule->mColor = bodyColor;
|
||||
@ -784,22 +678,10 @@ nsHTMLStyleSheet::Reset(nsIURI* aURL)
|
||||
mURL = aURL;
|
||||
NS_ADDREF(mURL);
|
||||
|
||||
if (mLinkRule) {
|
||||
mLinkRule->mSheet = nsnull;
|
||||
NS_RELEASE(mLinkRule);
|
||||
}
|
||||
if (mVisitedRule) {
|
||||
mVisitedRule->mSheet = nsnull;
|
||||
NS_RELEASE(mVisitedRule);
|
||||
}
|
||||
if (mActiveRule) {
|
||||
mActiveRule->mSheet = nsnull;
|
||||
NS_RELEASE(mActiveRule);
|
||||
}
|
||||
if (mDocumentColorRule) {
|
||||
mDocumentColorRule->mSheet = nsnull;
|
||||
NS_RELEASE(mDocumentColorRule);
|
||||
}
|
||||
NS_IF_RELEASE(mLinkRule);
|
||||
NS_IF_RELEASE(mVisitedRule);
|
||||
NS_IF_RELEASE(mActiveRule);
|
||||
NS_IF_RELEASE(mDocumentColorRule);
|
||||
|
||||
if (mMappedAttrTable.ops) {
|
||||
PL_DHashTableFinish(&mMappedAttrTable);
|
||||
@ -851,11 +733,10 @@ nsHTMLStyleSheet::SetLinkColor(nscolor aColor)
|
||||
if (mLinkRule) {
|
||||
if (mLinkRule->mColor == aColor)
|
||||
return NS_OK;
|
||||
mLinkRule->mSheet = nsnull;
|
||||
NS_RELEASE(mLinkRule);
|
||||
}
|
||||
|
||||
mLinkRule = new HTMLColorRule(this);
|
||||
mLinkRule = new HTMLColorRule();
|
||||
if (!mLinkRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mLinkRule);
|
||||
@ -871,11 +752,10 @@ nsHTMLStyleSheet::SetActiveLinkColor(nscolor aColor)
|
||||
if (mActiveRule) {
|
||||
if (mActiveRule->mColor == aColor)
|
||||
return NS_OK;
|
||||
mActiveRule->mSheet = nsnull;
|
||||
NS_RELEASE(mActiveRule);
|
||||
}
|
||||
|
||||
mActiveRule = new HTMLColorRule(this);
|
||||
mActiveRule = new HTMLColorRule();
|
||||
if (!mActiveRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mActiveRule);
|
||||
@ -890,11 +770,10 @@ nsHTMLStyleSheet::SetVisitedLinkColor(nscolor aColor)
|
||||
if (mVisitedRule) {
|
||||
if (mVisitedRule->mColor == aColor)
|
||||
return NS_OK;
|
||||
mVisitedRule->mSheet = nsnull;
|
||||
NS_RELEASE(mVisitedRule);
|
||||
}
|
||||
|
||||
mVisitedRule = new HTMLColorRule(this);
|
||||
mVisitedRule = new HTMLColorRule();
|
||||
if (!mVisitedRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mVisitedRule);
|
||||
|
@ -107,43 +107,32 @@ private:
|
||||
friend class HTMLColorRule;
|
||||
class HTMLColorRule : public nsIStyleRule {
|
||||
public:
|
||||
HTMLColorRule(nsHTMLStyleSheet* aSheet);
|
||||
virtual ~HTMLColorRule();
|
||||
HTMLColorRule() {}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const;
|
||||
|
||||
// The new mapping function.
|
||||
// nsIStyleRule interface
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
#endif
|
||||
|
||||
nscolor mColor;
|
||||
nsHTMLStyleSheet* mSheet;
|
||||
};
|
||||
|
||||
class GenericTableRule;
|
||||
friend class GenericTableRule;
|
||||
class GenericTableRule: public nsIStyleRule {
|
||||
public:
|
||||
GenericTableRule(nsHTMLStyleSheet* aSheet);
|
||||
virtual ~GenericTableRule();
|
||||
GenericTableRule() {}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const;
|
||||
|
||||
// The new mapping function.
|
||||
// nsIStyleRule interface
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
#endif
|
||||
|
||||
nsHTMLStyleSheet* mSheet; // not ref-counted, cleared by content
|
||||
};
|
||||
|
||||
// this rule handles <th> inheritance
|
||||
@ -151,8 +140,7 @@ private:
|
||||
friend class TableTHRule;
|
||||
class TableTHRule: public GenericTableRule {
|
||||
public:
|
||||
TableTHRule(nsHTMLStyleSheet* aSheet);
|
||||
virtual ~TableTHRule();
|
||||
TableTHRule() {}
|
||||
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
};
|
||||
@ -163,8 +151,7 @@ private:
|
||||
friend class TableTbodyRule;
|
||||
class TableTbodyRule: public GenericTableRule {
|
||||
public:
|
||||
TableTbodyRule(nsHTMLStyleSheet* aSheet);
|
||||
virtual ~TableTbodyRule();
|
||||
TableTbodyRule() {}
|
||||
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
};
|
||||
@ -174,8 +161,7 @@ private:
|
||||
friend class TableRowRule;
|
||||
class TableRowRule: public GenericTableRule {
|
||||
public:
|
||||
TableRowRule(nsHTMLStyleSheet* aSheet);
|
||||
virtual ~TableRowRule();
|
||||
TableRowRule() {}
|
||||
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
};
|
||||
@ -185,8 +171,7 @@ private:
|
||||
friend class TableColgroupRule;
|
||||
class TableColgroupRule: public GenericTableRule {
|
||||
public:
|
||||
TableColgroupRule(nsHTMLStyleSheet* aSheet);
|
||||
virtual ~TableColgroupRule();
|
||||
TableColgroupRule() {}
|
||||
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
};
|
||||
@ -196,8 +181,7 @@ private:
|
||||
friend class TableColRule;
|
||||
class TableColRule: public GenericTableRule {
|
||||
public:
|
||||
TableColRule(nsHTMLStyleSheet* aSheet);
|
||||
virtual ~TableColRule();
|
||||
TableColRule() {}
|
||||
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
};
|
||||
|
@ -66,6 +66,7 @@ public:
|
||||
|
||||
NS_IMETHOD GetType(PRInt32& aType) const = 0;
|
||||
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const = 0;
|
||||
NS_IMETHOD SetStyleSheet(nsICSSStyleSheet* aSheet) = 0;
|
||||
NS_IMETHOD SetParentRule(nsICSSGroupRule* aRule) = 0;
|
||||
|
||||
|
@ -818,15 +818,12 @@ class CSSStyleRuleImpl;
|
||||
|
||||
class CSSImportantRule : public nsIStyleRule {
|
||||
public:
|
||||
CSSImportantRule(nsICSSStyleSheet* aSheet, nsCSSDeclaration* aDeclaration);
|
||||
CSSImportantRule(nsCSSDeclaration* aDeclaration);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const;
|
||||
|
||||
// The new mapping function.
|
||||
// nsIStyleRule interface
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
#endif
|
||||
@ -835,14 +832,12 @@ protected:
|
||||
virtual ~CSSImportantRule(void);
|
||||
|
||||
nsCSSDeclaration* mDeclaration;
|
||||
nsICSSStyleSheet* mSheet;
|
||||
|
||||
friend class CSSStyleRuleImpl;
|
||||
friend class CSSStyleRuleImpl;
|
||||
};
|
||||
|
||||
CSSImportantRule::CSSImportantRule(nsICSSStyleSheet* aSheet, nsCSSDeclaration* aDeclaration)
|
||||
: mDeclaration(aDeclaration),
|
||||
mSheet(aSheet)
|
||||
CSSImportantRule::CSSImportantRule(nsCSSDeclaration* aDeclaration)
|
||||
: mDeclaration(aDeclaration)
|
||||
{
|
||||
}
|
||||
|
||||
@ -853,14 +848,6 @@ CSSImportantRule::~CSSImportantRule(void)
|
||||
|
||||
NS_IMPL_ISUPPORTS1(CSSImportantRule, nsIStyleRule)
|
||||
|
||||
NS_IMETHODIMP
|
||||
CSSImportantRule::GetStyleSheet(nsIStyleSheet*& aSheet) const
|
||||
{
|
||||
NS_IF_ADDREF(mSheet);
|
||||
aSheet = mSheet;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CSSImportantRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
{
|
||||
@ -1331,7 +1318,6 @@ CSSStyleRuleImpl::~CSSStyleRuleImpl(void)
|
||||
mDeclaration = nsnull;
|
||||
}
|
||||
if (nsnull != mImportantRule) {
|
||||
mImportantRule->mSheet = nsnull;
|
||||
NS_RELEASE(mImportantRule);
|
||||
mImportantRule = nsnull;
|
||||
}
|
||||
@ -1375,7 +1361,7 @@ nsCSSDeclaration* CSSStyleRuleImpl::GetDeclaration(void) const
|
||||
already_AddRefed<nsIStyleRule> CSSStyleRuleImpl::GetImportantRule(void)
|
||||
{
|
||||
if (!mImportantRule && mDeclaration->HasImportantData()) {
|
||||
mImportantRule = new CSSImportantRule(mSheet, mDeclaration);
|
||||
mImportantRule = new CSSImportantRule(mDeclaration);
|
||||
NS_IF_ADDREF(mImportantRule);
|
||||
}
|
||||
NS_IF_ADDREF(mImportantRule);
|
||||
@ -1391,11 +1377,7 @@ CSSStyleRuleImpl::GetStyleSheet(nsIStyleSheet*& aSheet) const
|
||||
NS_IMETHODIMP
|
||||
CSSStyleRuleImpl::SetStyleSheet(nsICSSStyleSheet* aSheet)
|
||||
{
|
||||
nsCSSRule::SetStyleSheet(aSheet);
|
||||
if (nsnull != mImportantRule) { // we're responsible for this guy too
|
||||
mImportantRule->mSheet = aSheet;
|
||||
}
|
||||
return NS_OK;
|
||||
return nsCSSRule::SetStyleSheet(aSheet);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -64,13 +64,11 @@
|
||||
|
||||
class CSSDisablePropsRule : public nsIStyleRule {
|
||||
public:
|
||||
CSSDisablePropsRule(nsIHTMLCSSStyleSheet* aSheet);
|
||||
CSSDisablePropsRule();
|
||||
virtual ~CSSDisablePropsRule();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const;
|
||||
|
||||
// Call this something else so that this class still has pure virtual
|
||||
// functions.
|
||||
void CommonMapRuleInfoInto(nsRuleData* aRuleData);
|
||||
@ -78,27 +76,22 @@ public:
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
#endif
|
||||
|
||||
nsIHTMLCSSStyleSheet* mSheet;
|
||||
};
|
||||
|
||||
CSSDisablePropsRule::CSSDisablePropsRule(nsIHTMLCSSStyleSheet* aSheet)
|
||||
: mSheet(aSheet)
|
||||
CSSDisablePropsRule::CSSDisablePropsRule()
|
||||
{
|
||||
}
|
||||
|
||||
class CSSFirstLineRule : public CSSDisablePropsRule {
|
||||
public:
|
||||
CSSFirstLineRule(nsIHTMLCSSStyleSheet* aSheet)
|
||||
: CSSDisablePropsRule(aSheet) {}
|
||||
CSSFirstLineRule() {}
|
||||
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
};
|
||||
|
||||
class CSSFirstLetterRule : public CSSDisablePropsRule {
|
||||
public:
|
||||
CSSFirstLetterRule(nsIHTMLCSSStyleSheet* aSheet)
|
||||
: CSSDisablePropsRule(aSheet) {}
|
||||
CSSFirstLetterRule() {}
|
||||
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
};
|
||||
@ -109,14 +102,6 @@ CSSDisablePropsRule::~CSSDisablePropsRule()
|
||||
|
||||
NS_IMPL_ISUPPORTS1(CSSDisablePropsRule, nsIStyleRule)
|
||||
|
||||
NS_IMETHODIMP
|
||||
CSSDisablePropsRule::GetStyleSheet(nsIStyleSheet*& aSheet) const
|
||||
{
|
||||
NS_IF_ADDREF(mSheet);
|
||||
aSheet = mSheet;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHODIMP
|
||||
CSSDisablePropsRule::List(FILE* out, PRInt32 aIndent) const
|
||||
@ -412,14 +397,9 @@ HTMLCSSStyleSheetImpl::HTMLCSSStyleSheetImpl()
|
||||
HTMLCSSStyleSheetImpl::~HTMLCSSStyleSheetImpl()
|
||||
{
|
||||
NS_RELEASE(mURL);
|
||||
if (nsnull != mFirstLineRule) {
|
||||
mFirstLineRule->mSheet = nsnull;
|
||||
NS_RELEASE(mFirstLineRule);
|
||||
}
|
||||
if (nsnull != mFirstLetterRule) {
|
||||
mFirstLetterRule->mSheet = nsnull;
|
||||
NS_RELEASE(mFirstLetterRule);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mFirstLineRule);
|
||||
NS_IF_RELEASE(mFirstLetterRule);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS3(HTMLCSSStyleSheetImpl,
|
||||
@ -455,7 +435,7 @@ HTMLCSSStyleSheetImpl::RulesMatching(PseudoRuleProcessorData* aData)
|
||||
nsIAtom* pseudoTag = aData->mPseudoTag;
|
||||
if (pseudoTag == nsCSSPseudoElements::firstLine) {
|
||||
if (!mFirstLineRule) {
|
||||
mFirstLineRule = new CSSFirstLineRule(this);
|
||||
mFirstLineRule = new CSSFirstLineRule();
|
||||
if (!mFirstLineRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mFirstLineRule);
|
||||
@ -464,7 +444,7 @@ HTMLCSSStyleSheetImpl::RulesMatching(PseudoRuleProcessorData* aData)
|
||||
}
|
||||
else if (pseudoTag == nsCSSPseudoElements::firstLetter) {
|
||||
if (!mFirstLetterRule) {
|
||||
mFirstLetterRule = new CSSFirstLetterRule(this);
|
||||
mFirstLetterRule = new CSSFirstLetterRule();
|
||||
if (!mFirstLetterRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mFirstLetterRule);
|
||||
@ -516,14 +496,9 @@ HTMLCSSStyleSheetImpl::Reset(nsIURI* aURL)
|
||||
NS_IF_RELEASE(mURL);
|
||||
mURL = aURL;
|
||||
NS_ADDREF(mURL);
|
||||
if (nsnull != mFirstLineRule) {
|
||||
mFirstLineRule->mSheet = nsnull;
|
||||
NS_RELEASE(mFirstLineRule);
|
||||
}
|
||||
if (nsnull != mFirstLetterRule) {
|
||||
mFirstLetterRule->mSheet = nsnull;
|
||||
NS_RELEASE(mFirstLetterRule);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mFirstLineRule);
|
||||
NS_IF_RELEASE(mFirstLetterRule);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -65,25 +65,8 @@
|
||||
#include "nsRuleWalker.h"
|
||||
#include "nsRuleData.h"
|
||||
|
||||
nsHTMLStyleSheet::HTMLColorRule::HTMLColorRule(nsHTMLStyleSheet* aSheet)
|
||||
: mSheet(aSheet)
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::HTMLColorRule::~HTMLColorRule()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsHTMLStyleSheet::HTMLColorRule, nsIStyleRule)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyleSheet::HTMLColorRule::GetStyleSheet(nsIStyleSheet*& aSheet) const
|
||||
{
|
||||
NS_IF_ADDREF(mSheet);
|
||||
aSheet = mSheet;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyleSheet::HTMLColorRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
{
|
||||
@ -102,24 +85,8 @@ nsHTMLStyleSheet::HTMLColorRule::List(FILE* out, PRInt32 aIndent) const
|
||||
}
|
||||
#endif
|
||||
|
||||
nsHTMLStyleSheet::GenericTableRule::GenericTableRule(nsHTMLStyleSheet* aSheet)
|
||||
{
|
||||
mSheet = aSheet;
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::GenericTableRule::~GenericTableRule()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsHTMLStyleSheet::GenericTableRule, nsIStyleRule)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyleSheet::GenericTableRule::GetStyleSheet(nsIStyleSheet*& aSheet) const
|
||||
{
|
||||
aSheet = mSheet;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyleSheet::GenericTableRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
{
|
||||
@ -135,15 +102,6 @@ nsHTMLStyleSheet::GenericTableRule::List(FILE* out, PRInt32 aIndent) const
|
||||
}
|
||||
#endif
|
||||
|
||||
nsHTMLStyleSheet::TableTHRule::TableTHRule(nsHTMLStyleSheet* aSheet)
|
||||
: GenericTableRule(aSheet)
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::TableTHRule::~TableTHRule()
|
||||
{
|
||||
}
|
||||
|
||||
static void PostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData)
|
||||
{
|
||||
nsStyleText* text = (nsStyleText*)aStyleStruct;
|
||||
@ -253,15 +211,6 @@ ProcessTableRulesAttribute(nsStyleStruct* aStyleStruct,
|
||||
}
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::TableTbodyRule::TableTbodyRule(nsHTMLStyleSheet* aSheet)
|
||||
: GenericTableRule(aSheet)
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::TableTbodyRule::~TableTbodyRule()
|
||||
{
|
||||
}
|
||||
|
||||
static void TbodyPostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData)
|
||||
{
|
||||
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_TOP, PR_TRUE, NS_STYLE_TABLE_RULES_ALL,
|
||||
@ -281,15 +230,6 @@ nsHTMLStyleSheet::TableTbodyRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
}
|
||||
// -----------------------------------------------------------
|
||||
|
||||
nsHTMLStyleSheet::TableRowRule::TableRowRule(nsHTMLStyleSheet* aSheet)
|
||||
: GenericTableRule(aSheet)
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::TableRowRule::~TableRowRule()
|
||||
{
|
||||
}
|
||||
|
||||
static void RowPostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData)
|
||||
{
|
||||
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_TOP, PR_FALSE, NS_STYLE_TABLE_RULES_ALL,
|
||||
@ -308,15 +248,6 @@ nsHTMLStyleSheet::TableRowRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::TableColgroupRule::TableColgroupRule(nsHTMLStyleSheet* aSheet)
|
||||
: GenericTableRule(aSheet)
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::TableColgroupRule::~TableColgroupRule()
|
||||
{
|
||||
}
|
||||
|
||||
static void ColgroupPostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData)
|
||||
{
|
||||
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_LEFT, PR_TRUE, NS_STYLE_TABLE_RULES_ALL,
|
||||
@ -335,15 +266,6 @@ nsHTMLStyleSheet::TableColgroupRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::TableColRule::TableColRule(nsHTMLStyleSheet* aSheet)
|
||||
: GenericTableRule(aSheet)
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLStyleSheet::TableColRule::~TableColRule()
|
||||
{
|
||||
}
|
||||
|
||||
static void ColPostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData)
|
||||
{
|
||||
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_LEFT, PR_FALSE, NS_STYLE_TABLE_RULES_ALL,
|
||||
@ -425,27 +347,27 @@ nsHTMLStyleSheet::nsHTMLStyleSheet(void)
|
||||
nsresult
|
||||
nsHTMLStyleSheet::Init()
|
||||
{
|
||||
mTableTbodyRule = new TableTbodyRule(this);
|
||||
mTableTbodyRule = new TableTbodyRule();
|
||||
if (!mTableTbodyRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mTableTbodyRule);
|
||||
|
||||
mTableRowRule = new TableRowRule(this);
|
||||
mTableRowRule = new TableRowRule();
|
||||
if (!mTableRowRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mTableRowRule);
|
||||
|
||||
mTableColgroupRule = new TableColgroupRule(this);
|
||||
mTableColgroupRule = new TableColgroupRule();
|
||||
if (!mTableColgroupRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mTableColgroupRule);
|
||||
|
||||
mTableColRule = new TableColRule(this);
|
||||
mTableColRule = new TableColRule();
|
||||
if (!mTableColRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mTableColRule);
|
||||
|
||||
mTableTHRule = new TableTHRule(this);
|
||||
mTableTHRule = new TableTHRule();
|
||||
if (!mTableTHRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mTableTHRule);
|
||||
@ -456,42 +378,17 @@ nsHTMLStyleSheet::Init()
|
||||
nsHTMLStyleSheet::~nsHTMLStyleSheet()
|
||||
{
|
||||
NS_IF_RELEASE(mURL);
|
||||
if (nsnull != mLinkRule) {
|
||||
mLinkRule->mSheet = nsnull;
|
||||
NS_RELEASE(mLinkRule);
|
||||
}
|
||||
if (nsnull != mVisitedRule) {
|
||||
mVisitedRule->mSheet = nsnull;
|
||||
NS_RELEASE(mVisitedRule);
|
||||
}
|
||||
if (nsnull != mActiveRule) {
|
||||
mActiveRule->mSheet = nsnull;
|
||||
NS_RELEASE(mActiveRule);
|
||||
}
|
||||
if (nsnull != mDocumentColorRule) {
|
||||
mDocumentColorRule->mSheet = nsnull;
|
||||
NS_RELEASE(mDocumentColorRule);
|
||||
}
|
||||
if (nsnull != mTableTbodyRule) {
|
||||
mTableTbodyRule->mSheet = nsnull;
|
||||
NS_RELEASE(mTableTbodyRule);
|
||||
}
|
||||
if (nsnull != mTableRowRule) {
|
||||
mTableRowRule->mSheet = nsnull;
|
||||
NS_RELEASE(mTableRowRule);
|
||||
}
|
||||
if (nsnull != mTableColgroupRule) {
|
||||
mTableColgroupRule->mSheet = nsnull;
|
||||
NS_RELEASE(mTableColgroupRule);
|
||||
}
|
||||
if (nsnull != mTableColRule) {
|
||||
mTableColRule->mSheet = nsnull;
|
||||
NS_RELEASE(mTableColRule);
|
||||
}
|
||||
if (nsnull != mTableTHRule) {
|
||||
mTableTHRule->mSheet = nsnull;
|
||||
NS_RELEASE(mTableTHRule);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mLinkRule);
|
||||
NS_IF_RELEASE(mVisitedRule);
|
||||
NS_IF_RELEASE(mActiveRule);
|
||||
NS_IF_RELEASE(mDocumentColorRule);
|
||||
NS_IF_RELEASE(mTableTbodyRule);
|
||||
NS_IF_RELEASE(mTableRowRule);
|
||||
NS_IF_RELEASE(mTableColgroupRule);
|
||||
NS_IF_RELEASE(mTableColRule);
|
||||
NS_IF_RELEASE(mTableTHRule);
|
||||
|
||||
if (mMappedAttrTable.ops)
|
||||
PL_DHashTableFinish(&mMappedAttrTable);
|
||||
}
|
||||
@ -572,11 +469,8 @@ nsHTMLStyleSheet::RulesMatching(ElementRuleProcessorData* aData)
|
||||
&bodyColor);
|
||||
if (NS_SUCCEEDED(rv) &&
|
||||
(!mDocumentColorRule || bodyColor != mDocumentColorRule->mColor)) {
|
||||
if (mDocumentColorRule) {
|
||||
mDocumentColorRule->mSheet = nsnull;
|
||||
NS_RELEASE(mDocumentColorRule);
|
||||
}
|
||||
mDocumentColorRule = new HTMLColorRule(this);
|
||||
NS_IF_RELEASE(mDocumentColorRule);
|
||||
mDocumentColorRule = new HTMLColorRule();
|
||||
if (mDocumentColorRule) {
|
||||
NS_ADDREF(mDocumentColorRule);
|
||||
mDocumentColorRule->mColor = bodyColor;
|
||||
@ -784,22 +678,10 @@ nsHTMLStyleSheet::Reset(nsIURI* aURL)
|
||||
mURL = aURL;
|
||||
NS_ADDREF(mURL);
|
||||
|
||||
if (mLinkRule) {
|
||||
mLinkRule->mSheet = nsnull;
|
||||
NS_RELEASE(mLinkRule);
|
||||
}
|
||||
if (mVisitedRule) {
|
||||
mVisitedRule->mSheet = nsnull;
|
||||
NS_RELEASE(mVisitedRule);
|
||||
}
|
||||
if (mActiveRule) {
|
||||
mActiveRule->mSheet = nsnull;
|
||||
NS_RELEASE(mActiveRule);
|
||||
}
|
||||
if (mDocumentColorRule) {
|
||||
mDocumentColorRule->mSheet = nsnull;
|
||||
NS_RELEASE(mDocumentColorRule);
|
||||
}
|
||||
NS_IF_RELEASE(mLinkRule);
|
||||
NS_IF_RELEASE(mVisitedRule);
|
||||
NS_IF_RELEASE(mActiveRule);
|
||||
NS_IF_RELEASE(mDocumentColorRule);
|
||||
|
||||
if (mMappedAttrTable.ops) {
|
||||
PL_DHashTableFinish(&mMappedAttrTable);
|
||||
@ -851,11 +733,10 @@ nsHTMLStyleSheet::SetLinkColor(nscolor aColor)
|
||||
if (mLinkRule) {
|
||||
if (mLinkRule->mColor == aColor)
|
||||
return NS_OK;
|
||||
mLinkRule->mSheet = nsnull;
|
||||
NS_RELEASE(mLinkRule);
|
||||
}
|
||||
|
||||
mLinkRule = new HTMLColorRule(this);
|
||||
mLinkRule = new HTMLColorRule();
|
||||
if (!mLinkRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mLinkRule);
|
||||
@ -871,11 +752,10 @@ nsHTMLStyleSheet::SetActiveLinkColor(nscolor aColor)
|
||||
if (mActiveRule) {
|
||||
if (mActiveRule->mColor == aColor)
|
||||
return NS_OK;
|
||||
mActiveRule->mSheet = nsnull;
|
||||
NS_RELEASE(mActiveRule);
|
||||
}
|
||||
|
||||
mActiveRule = new HTMLColorRule(this);
|
||||
mActiveRule = new HTMLColorRule();
|
||||
if (!mActiveRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mActiveRule);
|
||||
@ -890,11 +770,10 @@ nsHTMLStyleSheet::SetVisitedLinkColor(nscolor aColor)
|
||||
if (mVisitedRule) {
|
||||
if (mVisitedRule->mColor == aColor)
|
||||
return NS_OK;
|
||||
mVisitedRule->mSheet = nsnull;
|
||||
NS_RELEASE(mVisitedRule);
|
||||
}
|
||||
|
||||
mVisitedRule = new HTMLColorRule(this);
|
||||
mVisitedRule = new HTMLColorRule();
|
||||
if (!mVisitedRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mVisitedRule);
|
||||
|
@ -107,43 +107,32 @@ private:
|
||||
friend class HTMLColorRule;
|
||||
class HTMLColorRule : public nsIStyleRule {
|
||||
public:
|
||||
HTMLColorRule(nsHTMLStyleSheet* aSheet);
|
||||
virtual ~HTMLColorRule();
|
||||
HTMLColorRule() {}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const;
|
||||
|
||||
// The new mapping function.
|
||||
// nsIStyleRule interface
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
#endif
|
||||
|
||||
nscolor mColor;
|
||||
nsHTMLStyleSheet* mSheet;
|
||||
};
|
||||
|
||||
class GenericTableRule;
|
||||
friend class GenericTableRule;
|
||||
class GenericTableRule: public nsIStyleRule {
|
||||
public:
|
||||
GenericTableRule(nsHTMLStyleSheet* aSheet);
|
||||
virtual ~GenericTableRule();
|
||||
GenericTableRule() {}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const;
|
||||
|
||||
// The new mapping function.
|
||||
// nsIStyleRule interface
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
#endif
|
||||
|
||||
nsHTMLStyleSheet* mSheet; // not ref-counted, cleared by content
|
||||
};
|
||||
|
||||
// this rule handles <th> inheritance
|
||||
@ -151,8 +140,7 @@ private:
|
||||
friend class TableTHRule;
|
||||
class TableTHRule: public GenericTableRule {
|
||||
public:
|
||||
TableTHRule(nsHTMLStyleSheet* aSheet);
|
||||
virtual ~TableTHRule();
|
||||
TableTHRule() {}
|
||||
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
};
|
||||
@ -163,8 +151,7 @@ private:
|
||||
friend class TableTbodyRule;
|
||||
class TableTbodyRule: public GenericTableRule {
|
||||
public:
|
||||
TableTbodyRule(nsHTMLStyleSheet* aSheet);
|
||||
virtual ~TableTbodyRule();
|
||||
TableTbodyRule() {}
|
||||
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
};
|
||||
@ -174,8 +161,7 @@ private:
|
||||
friend class TableRowRule;
|
||||
class TableRowRule: public GenericTableRule {
|
||||
public:
|
||||
TableRowRule(nsHTMLStyleSheet* aSheet);
|
||||
virtual ~TableRowRule();
|
||||
TableRowRule() {}
|
||||
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
};
|
||||
@ -185,8 +171,7 @@ private:
|
||||
friend class TableColgroupRule;
|
||||
class TableColgroupRule: public GenericTableRule {
|
||||
public:
|
||||
TableColgroupRule(nsHTMLStyleSheet* aSheet);
|
||||
virtual ~TableColgroupRule();
|
||||
TableColgroupRule() {}
|
||||
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
};
|
||||
@ -196,8 +181,7 @@ private:
|
||||
friend class TableColRule;
|
||||
class TableColRule: public GenericTableRule {
|
||||
public:
|
||||
TableColRule(nsHTMLStyleSheet* aSheet);
|
||||
virtual ~TableColRule();
|
||||
TableColRule() {}
|
||||
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
};
|
||||
|
@ -66,6 +66,7 @@ public:
|
||||
|
||||
NS_IMETHOD GetType(PRInt32& aType) const = 0;
|
||||
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const = 0;
|
||||
NS_IMETHOD SetStyleSheet(nsICSSStyleSheet* aSheet) = 0;
|
||||
NS_IMETHOD SetParentRule(nsICSSGroupRule* aRule) = 0;
|
||||
|
||||
|
@ -85,8 +85,6 @@ class nsIStyleRule : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTYLE_RULE_IID)
|
||||
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const = 0;
|
||||
|
||||
/**
|
||||
* |nsIStyleRule::MapRuleInfoInto| is a request to copy all stylistic
|
||||
* data represented by the rule that:
|
||||
|
Loading…
Reference in New Issue
Block a user