diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index e9297abaa84..588b0578fca 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -2244,9 +2244,8 @@ IsSiblingOperator(PRUnichar oper) return oper == PRUnichar('+') || oper == PRUnichar('~'); } -NS_IMETHODIMP -nsCSSRuleProcessor::HasStateDependentStyle(StateRuleProcessorData* aData, - nsReStyleHint* aResult) +nsReStyleHint +nsCSSRuleProcessor::HasStateDependentStyle(StateRuleProcessorData* aData) { NS_PRECONDITION(aData->mContent->IsNodeOfType(nsINode::eELEMENT), "content must be element"); @@ -2261,8 +2260,8 @@ nsCSSRuleProcessor::HasStateDependentStyle(StateRuleProcessorData* aData, // "body > p:hover" will be in |cascade->mStateSelectors|). Note that // |IsStateSelector| below determines which selectors are in // |cascade->mStateSelectors|. + nsReStyleHint hint = nsReStyleHint(0); if (cascade) { - *aResult = nsReStyleHint(0); nsCSSSelector **iter = cascade->mStateSelectors.Elements(), **end = iter + cascade->mStateSelectors.Length(); for(; iter != end; ++iter) { @@ -2271,17 +2270,17 @@ nsCSSRuleProcessor::HasStateDependentStyle(StateRuleProcessorData* aData, nsReStyleHint possibleChange = IsSiblingOperator(selector->mOperator) ? eReStyle_LaterSiblings : eReStyle_Self; - // If *aResult already includes all the bits of possibleChange, + // If hint already includes all the bits of possibleChange, // don't bother calling SelectorMatches, since even if it returns false - // *aResult won't change. - if ((possibleChange & ~(*aResult)) && + // hint won't change. + if ((possibleChange & ~hint) && SelectorMatches(*aData, selector, aData->mStateMask, PR_FALSE) && SelectorMatchesTree(*aData, selector->mNext, PR_FALSE)) { - *aResult = nsReStyleHint(*aResult | possibleChange); + hint = nsReStyleHint(hint | possibleChange); } } } - return NS_OK; + return hint; } struct AttributeEnumData { diff --git a/layout/style/nsCSSRuleProcessor.h b/layout/style/nsCSSRuleProcessor.h index 300f934261e..3998ffcf0c5 100644 --- a/layout/style/nsCSSRuleProcessor.h +++ b/layout/style/nsCSSRuleProcessor.h @@ -101,8 +101,7 @@ public: NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData); #endif - NS_IMETHOD HasStateDependentStyle(StateRuleProcessorData* aData, - nsReStyleHint* aResult); + virtual nsReStyleHint HasStateDependentStyle(StateRuleProcessorData* aData); virtual nsReStyleHint HasAttributeDependentStyle(AttributeRuleProcessorData* aData); diff --git a/layout/style/nsHTMLCSSStyleSheet.cpp b/layout/style/nsHTMLCSSStyleSheet.cpp index a6f1f0aa185..c10546d7b1e 100644 --- a/layout/style/nsHTMLCSSStyleSheet.cpp +++ b/layout/style/nsHTMLCSSStyleSheet.cpp @@ -97,8 +97,7 @@ public: NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData); #endif - NS_IMETHOD HasStateDependentStyle(StateRuleProcessorData* aData, - nsReStyleHint* aResult); + virtual nsReStyleHint HasStateDependentStyle(StateRuleProcessorData* aData); virtual nsReStyleHint HasAttributeDependentStyle(AttributeRuleProcessorData* aData); @@ -201,12 +200,10 @@ HTMLCSSStyleSheetImpl::Init(nsIURI* aURL, nsIDocument* aDocument) } // Test if style is dependent on content state -NS_IMETHODIMP -HTMLCSSStyleSheetImpl::HasStateDependentStyle(StateRuleProcessorData* aData, - nsReStyleHint* aResult) +nsReStyleHint +HTMLCSSStyleSheetImpl::HasStateDependentStyle(StateRuleProcessorData* aData) { - *aResult = nsReStyleHint(0); - return NS_OK; + return nsReStyleHint(0); } // Test if style is dependent on attribute diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp index 1e5389bb17a..0009daf7e23 100644 --- a/layout/style/nsHTMLStyleSheet.cpp +++ b/layout/style/nsHTMLStyleSheet.cpp @@ -501,23 +501,19 @@ nsHTMLStyleSheet::RulesMatching(ElementRuleProcessorData* aData) } // Test if style is dependent on content state -NS_IMETHODIMP -nsHTMLStyleSheet::HasStateDependentStyle(StateRuleProcessorData* aData, - nsReStyleHint* aResult) +nsReStyleHint +nsHTMLStyleSheet::HasStateDependentStyle(StateRuleProcessorData* aData) { - if (aData->mContent && - aData->mIsHTMLContent && + if (aData->mIsHTMLContent && aData->mContentTag == nsGkAtoms::a && aData->IsLink() && ((mActiveRule && (aData->mStateMask & NS_EVENT_STATE_ACTIVE)) || (mLinkRule && (aData->mStateMask & NS_EVENT_STATE_VISITED)) || (mVisitedRule && (aData->mStateMask & NS_EVENT_STATE_VISITED)))) { - *aResult = eReStyle_Self; + return eReStyle_Self; } - else - *aResult = nsReStyleHint(0); - - return NS_OK; + + return nsReStyleHint(0); } nsReStyleHint diff --git a/layout/style/nsHTMLStyleSheet.h b/layout/style/nsHTMLStyleSheet.h index 8f35a136ab0..17a4c52006d 100644 --- a/layout/style/nsHTMLStyleSheet.h +++ b/layout/style/nsHTMLStyleSheet.h @@ -84,8 +84,7 @@ public: #ifdef MOZ_XUL NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData); #endif - NS_IMETHOD HasStateDependentStyle(StateRuleProcessorData* aData, - nsReStyleHint* aResult); + virtual nsReStyleHint HasStateDependentStyle(StateRuleProcessorData* aData); virtual nsReStyleHint HasAttributeDependentStyle(AttributeRuleProcessorData* aData); NS_IMETHOD MediumFeaturesChanged(nsPresContext* aPresContext, diff --git a/layout/style/nsIStyleRuleProcessor.h b/layout/style/nsIStyleRuleProcessor.h index 63e95249b64..9fc8c84e9a4 100644 --- a/layout/style/nsIStyleRuleProcessor.h +++ b/layout/style/nsIStyleRuleProcessor.h @@ -61,10 +61,10 @@ struct AttributeRuleProcessorData; class nsPresContext; // IID for the nsIStyleRuleProcessor interface -// {ec92bc0c-9518-48ea-9289-74e654659be9} +// {566a7bea-fdc5-40a5-bf8a-87b5a231d79e} #define NS_ISTYLE_RULE_PROCESSOR_IID \ -{ 0xec92bc0c, 0x9518, 0x48ea, \ - { 0x92, 0x89, 0x74, 0xe6, 0x54, 0x65, 0x9b, 0xe9 } } +{ 0x566a7bea, 0xfdc5, 0x40a5, \ + { 0xbf, 0x8a, 0x87, 0xb5, 0xa2, 0x31, 0xd7, 0x9e } } /* The style rule processor interface is a mechanism to separate the matching * of style rules from style sheet instances. @@ -117,8 +117,8 @@ public: * * Event states are defined in nsIEventStateManager.h. */ - NS_IMETHOD HasStateDependentStyle(StateRuleProcessorData* aData, - nsReStyleHint* aResult) = 0; + virtual nsReStyleHint + HasStateDependentStyle(StateRuleProcessorData* aData) = 0; /** * This method will be called twice for every attribute change. diff --git a/layout/style/nsStyleSet.cpp b/layout/style/nsStyleSet.cpp index 52dbd41a53d..cfeb8580809 100644 --- a/layout/style/nsStyleSet.cpp +++ b/layout/style/nsStyleSet.cpp @@ -1076,8 +1076,7 @@ static PRBool SheetHasStatefulStyle(nsIStyleRuleProcessor* aProcessor, void *aData) { StatefulData* data = (StatefulData*)aData; - nsReStyleHint hint; - aProcessor->HasStateDependentStyle(data, &hint); + nsReStyleHint hint = aProcessor->HasStateDependentStyle(data); data->mHint = nsReStyleHint(data->mHint | hint); return PR_TRUE; // continue } diff --git a/layout/style/nsTransitionManager.cpp b/layout/style/nsTransitionManager.cpp index 47eddac5a9f..a9849927407 100644 --- a/layout/style/nsTransitionManager.cpp +++ b/layout/style/nsTransitionManager.cpp @@ -828,12 +828,10 @@ nsTransitionManager::RulesMatching(XULTreeRuleProcessorData* aData) } #endif -NS_IMETHODIMP -nsTransitionManager::HasStateDependentStyle(StateRuleProcessorData* aData, - nsReStyleHint* aResult) +nsReStyleHint +nsTransitionManager::HasStateDependentStyle(StateRuleProcessorData* aData) { - *aResult = nsReStyleHint(0); - return NS_OK; + return nsReStyleHint(0); } nsReStyleHint diff --git a/layout/style/nsTransitionManager.h b/layout/style/nsTransitionManager.h index 53e919b3d84..c91bb81efc6 100644 --- a/layout/style/nsTransitionManager.h +++ b/layout/style/nsTransitionManager.h @@ -91,8 +91,7 @@ public: #ifdef MOZ_XUL NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData); #endif - NS_IMETHOD HasStateDependentStyle(StateRuleProcessorData* aData, - nsReStyleHint* aResult); + virtual nsReStyleHint HasStateDependentStyle(StateRuleProcessorData* aData); virtual nsReStyleHint HasAttributeDependentStyle(AttributeRuleProcessorData* aData); NS_IMETHOD MediumFeaturesChanged(nsPresContext* aPresContext,