From 83c6db5ccf75b7a5672da768052f28c4043c9b96 Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Wed, 1 Aug 2001 07:51:27 +0000 Subject: [PATCH] Fix for table color quirk bug. r=dbaron, sr=attinasi --- content/html/style/src/nsHTMLStyleSheet.cpp | 16 ++-------------- content/html/style/src/nsRuleNode.cpp | 2 +- layout/style/nsHTMLStyleSheet.cpp | 16 ++-------------- 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/content/html/style/src/nsHTMLStyleSheet.cpp b/content/html/style/src/nsHTMLStyleSheet.cpp index 3fcab47be965..b70b1dbf26cb 100644 --- a/content/html/style/src/nsHTMLStyleSheet.cpp +++ b/content/html/style/src/nsHTMLStyleSheet.cpp @@ -669,6 +669,8 @@ HTMLStyleSheetImpl::HTMLStyleSheetImpl(void) { NS_INIT_REFCNT(); mTableTHRule = new TableTHRule(this); + mDocumentColorRule = new HTMLDocumentColorRule(this); + NS_ADDREF(mDocumentColorRule); NS_ADDREF(mTableTHRule); } @@ -1117,13 +1119,6 @@ NS_IMETHODIMP HTMLStyleSheetImpl::SetVisitedLinkColor(nscolor aColor) NS_IMETHODIMP HTMLStyleSheetImpl::SetDocumentForegroundColor(nscolor aColor) { - if (nsnull == mDocumentColorRule) { - mDocumentColorRule = new HTMLDocumentColorRule(this); - if (nsnull == mDocumentColorRule) { - return NS_ERROR_OUT_OF_MEMORY; - } - NS_ADDREF(mDocumentColorRule); - } mDocumentColorRule->mColor = aColor; mDocumentColorRule->mForegroundSet = PR_TRUE; return NS_OK; @@ -1131,13 +1126,6 @@ NS_IMETHODIMP HTMLStyleSheetImpl::SetDocumentForegroundColor(nscolor aColor) NS_IMETHODIMP HTMLStyleSheetImpl::SetDocumentBackgroundColor(nscolor aColor) { - if (nsnull == mDocumentColorRule) { - mDocumentColorRule = new HTMLDocumentColorRule(this); - if (nsnull == mDocumentColorRule) { - return NS_ERROR_OUT_OF_MEMORY; - } - NS_ADDREF(mDocumentColorRule); - } mDocumentColorRule->mBackgroundColor = aColor; mDocumentColorRule->mBackgroundSet = PR_TRUE; return NS_OK; diff --git a/content/html/style/src/nsRuleNode.cpp b/content/html/style/src/nsRuleNode.cpp index 9ff44e639539..357a6de11088 100644 --- a/content/html/style/src/nsRuleNode.cpp +++ b/content/html/style/src/nsRuleNode.cpp @@ -892,7 +892,7 @@ nsRuleNode::WalkRuleTree(const nsStyleStructID& aSID, nsIStyleContext* aContext, detail = eRulePartialMixed; // Treat as though some data is specified to avoid // the optimizations and force data computation. - if (detail == eRuleNone && startStruct) { + if (detail == eRuleNone && startStruct && !aRuleData->mPostResolveCallback) { // We specified absolutely no rule information, but a parent rule in the tree // specified all the rule information. We set a bit along the branch from our // node in the tree to the node that specified the data that tells nodes on that diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp index 3fcab47be965..b70b1dbf26cb 100644 --- a/layout/style/nsHTMLStyleSheet.cpp +++ b/layout/style/nsHTMLStyleSheet.cpp @@ -669,6 +669,8 @@ HTMLStyleSheetImpl::HTMLStyleSheetImpl(void) { NS_INIT_REFCNT(); mTableTHRule = new TableTHRule(this); + mDocumentColorRule = new HTMLDocumentColorRule(this); + NS_ADDREF(mDocumentColorRule); NS_ADDREF(mTableTHRule); } @@ -1117,13 +1119,6 @@ NS_IMETHODIMP HTMLStyleSheetImpl::SetVisitedLinkColor(nscolor aColor) NS_IMETHODIMP HTMLStyleSheetImpl::SetDocumentForegroundColor(nscolor aColor) { - if (nsnull == mDocumentColorRule) { - mDocumentColorRule = new HTMLDocumentColorRule(this); - if (nsnull == mDocumentColorRule) { - return NS_ERROR_OUT_OF_MEMORY; - } - NS_ADDREF(mDocumentColorRule); - } mDocumentColorRule->mColor = aColor; mDocumentColorRule->mForegroundSet = PR_TRUE; return NS_OK; @@ -1131,13 +1126,6 @@ NS_IMETHODIMP HTMLStyleSheetImpl::SetDocumentForegroundColor(nscolor aColor) NS_IMETHODIMP HTMLStyleSheetImpl::SetDocumentBackgroundColor(nscolor aColor) { - if (nsnull == mDocumentColorRule) { - mDocumentColorRule = new HTMLDocumentColorRule(this); - if (nsnull == mDocumentColorRule) { - return NS_ERROR_OUT_OF_MEMORY; - } - NS_ADDREF(mDocumentColorRule); - } mDocumentColorRule->mBackgroundColor = aColor; mDocumentColorRule->mBackgroundSet = PR_TRUE; return NS_OK;