From de7999bf435e5de4dafa817aa361b9ac823eb92a Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Thu, 6 Mar 2003 19:19:55 +0000 Subject: [PATCH] Fix dynamic style changes resulting from change to href attribute on HTML links. b=194972 r+sr=bzbarsky git-svn-id: svn://10.0.0.236/trunk@139036 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/html/style/src/nsCSSStyleSheet.cpp | 13 +++++++++++++ mozilla/layout/style/nsCSSStyleSheet.cpp | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/mozilla/content/html/style/src/nsCSSStyleSheet.cpp b/mozilla/content/html/style/src/nsCSSStyleSheet.cpp index c932a59bf22..454eaa1f548 100644 --- a/mozilla/content/html/style/src/nsCSSStyleSheet.cpp +++ b/mozilla/content/html/style/src/nsCSSStyleSheet.cpp @@ -4052,6 +4052,19 @@ CSSRuleProcessor::HasAttributeDependentStyle(AttributeRuleProcessorData* aData, NS_PRECONDITION(aData->mContent->IsContentOfType(nsIContent::eELEMENT), "content must be element"); + // Since we always have :-moz-any-link (and almost always have :link + // and :visited rules from prefs), rather than hacking AddRule below + // to add |href| to the hash, we'll just handle it here. + if (aData->mAttribute == nsHTMLAtoms::href && + aData->mIsHTMLContent && + (aData->mContentTag == nsHTMLAtoms::a || + aData->mContentTag == nsHTMLAtoms::area || + aData->mContentTag == nsHTMLAtoms::link)) { + *aResult = PR_TRUE; + return NS_OK; + } + // XXX What about XLinks? + RuleCascadeData* cascade = GetRuleCascade(aData->mPresContext, aMedium); // We do the same thing for attributes that we do for state selectors diff --git a/mozilla/layout/style/nsCSSStyleSheet.cpp b/mozilla/layout/style/nsCSSStyleSheet.cpp index c932a59bf22..454eaa1f548 100644 --- a/mozilla/layout/style/nsCSSStyleSheet.cpp +++ b/mozilla/layout/style/nsCSSStyleSheet.cpp @@ -4052,6 +4052,19 @@ CSSRuleProcessor::HasAttributeDependentStyle(AttributeRuleProcessorData* aData, NS_PRECONDITION(aData->mContent->IsContentOfType(nsIContent::eELEMENT), "content must be element"); + // Since we always have :-moz-any-link (and almost always have :link + // and :visited rules from prefs), rather than hacking AddRule below + // to add |href| to the hash, we'll just handle it here. + if (aData->mAttribute == nsHTMLAtoms::href && + aData->mIsHTMLContent && + (aData->mContentTag == nsHTMLAtoms::a || + aData->mContentTag == nsHTMLAtoms::area || + aData->mContentTag == nsHTMLAtoms::link)) { + *aResult = PR_TRUE; + return NS_OK; + } + // XXX What about XLinks? + RuleCascadeData* cascade = GetRuleCascade(aData->mPresContext, aMedium); // We do the same thing for attributes that we do for state selectors