зеркало из https://github.com/mozilla/pjs.git
Bug 531933. Give HasStateDependentStyle a better signature. r=dbaron
This commit is contained in:
Родитель
1333943c85
Коммит
62f12d76fb
|
@ -2244,9 +2244,8 @@ IsSiblingOperator(PRUnichar oper)
|
||||||
return oper == PRUnichar('+') || oper == PRUnichar('~');
|
return oper == PRUnichar('+') || oper == PRUnichar('~');
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nsReStyleHint
|
||||||
nsCSSRuleProcessor::HasStateDependentStyle(StateRuleProcessorData* aData,
|
nsCSSRuleProcessor::HasStateDependentStyle(StateRuleProcessorData* aData)
|
||||||
nsReStyleHint* aResult)
|
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aData->mContent->IsNodeOfType(nsINode::eELEMENT),
|
NS_PRECONDITION(aData->mContent->IsNodeOfType(nsINode::eELEMENT),
|
||||||
"content must be element");
|
"content must be element");
|
||||||
|
@ -2261,8 +2260,8 @@ nsCSSRuleProcessor::HasStateDependentStyle(StateRuleProcessorData* aData,
|
||||||
// "body > p:hover" will be in |cascade->mStateSelectors|). Note that
|
// "body > p:hover" will be in |cascade->mStateSelectors|). Note that
|
||||||
// |IsStateSelector| below determines which selectors are in
|
// |IsStateSelector| below determines which selectors are in
|
||||||
// |cascade->mStateSelectors|.
|
// |cascade->mStateSelectors|.
|
||||||
|
nsReStyleHint hint = nsReStyleHint(0);
|
||||||
if (cascade) {
|
if (cascade) {
|
||||||
*aResult = nsReStyleHint(0);
|
|
||||||
nsCSSSelector **iter = cascade->mStateSelectors.Elements(),
|
nsCSSSelector **iter = cascade->mStateSelectors.Elements(),
|
||||||
**end = iter + cascade->mStateSelectors.Length();
|
**end = iter + cascade->mStateSelectors.Length();
|
||||||
for(; iter != end; ++iter) {
|
for(; iter != end; ++iter) {
|
||||||
|
@ -2271,17 +2270,17 @@ nsCSSRuleProcessor::HasStateDependentStyle(StateRuleProcessorData* aData,
|
||||||
nsReStyleHint possibleChange = IsSiblingOperator(selector->mOperator) ?
|
nsReStyleHint possibleChange = IsSiblingOperator(selector->mOperator) ?
|
||||||
eReStyle_LaterSiblings : eReStyle_Self;
|
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
|
// don't bother calling SelectorMatches, since even if it returns false
|
||||||
// *aResult won't change.
|
// hint won't change.
|
||||||
if ((possibleChange & ~(*aResult)) &&
|
if ((possibleChange & ~hint) &&
|
||||||
SelectorMatches(*aData, selector, aData->mStateMask, PR_FALSE) &&
|
SelectorMatches(*aData, selector, aData->mStateMask, PR_FALSE) &&
|
||||||
SelectorMatchesTree(*aData, selector->mNext, PR_FALSE)) {
|
SelectorMatchesTree(*aData, selector->mNext, PR_FALSE)) {
|
||||||
*aResult = nsReStyleHint(*aResult | possibleChange);
|
hint = nsReStyleHint(hint | possibleChange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return hint;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct AttributeEnumData {
|
struct AttributeEnumData {
|
||||||
|
|
|
@ -101,8 +101,7 @@ public:
|
||||||
NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData);
|
NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NS_IMETHOD HasStateDependentStyle(StateRuleProcessorData* aData,
|
virtual nsReStyleHint HasStateDependentStyle(StateRuleProcessorData* aData);
|
||||||
nsReStyleHint* aResult);
|
|
||||||
|
|
||||||
virtual nsReStyleHint
|
virtual nsReStyleHint
|
||||||
HasAttributeDependentStyle(AttributeRuleProcessorData* aData);
|
HasAttributeDependentStyle(AttributeRuleProcessorData* aData);
|
||||||
|
|
|
@ -97,8 +97,7 @@ public:
|
||||||
NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData);
|
NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NS_IMETHOD HasStateDependentStyle(StateRuleProcessorData* aData,
|
virtual nsReStyleHint HasStateDependentStyle(StateRuleProcessorData* aData);
|
||||||
nsReStyleHint* aResult);
|
|
||||||
|
|
||||||
virtual nsReStyleHint
|
virtual nsReStyleHint
|
||||||
HasAttributeDependentStyle(AttributeRuleProcessorData* aData);
|
HasAttributeDependentStyle(AttributeRuleProcessorData* aData);
|
||||||
|
@ -201,12 +200,10 @@ HTMLCSSStyleSheetImpl::Init(nsIURI* aURL, nsIDocument* aDocument)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test if style is dependent on content state
|
// Test if style is dependent on content state
|
||||||
NS_IMETHODIMP
|
nsReStyleHint
|
||||||
HTMLCSSStyleSheetImpl::HasStateDependentStyle(StateRuleProcessorData* aData,
|
HTMLCSSStyleSheetImpl::HasStateDependentStyle(StateRuleProcessorData* aData)
|
||||||
nsReStyleHint* aResult)
|
|
||||||
{
|
{
|
||||||
*aResult = nsReStyleHint(0);
|
return nsReStyleHint(0);
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test if style is dependent on attribute
|
// Test if style is dependent on attribute
|
||||||
|
|
|
@ -501,23 +501,19 @@ nsHTMLStyleSheet::RulesMatching(ElementRuleProcessorData* aData)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test if style is dependent on content state
|
// Test if style is dependent on content state
|
||||||
NS_IMETHODIMP
|
nsReStyleHint
|
||||||
nsHTMLStyleSheet::HasStateDependentStyle(StateRuleProcessorData* aData,
|
nsHTMLStyleSheet::HasStateDependentStyle(StateRuleProcessorData* aData)
|
||||||
nsReStyleHint* aResult)
|
|
||||||
{
|
{
|
||||||
if (aData->mContent &&
|
if (aData->mIsHTMLContent &&
|
||||||
aData->mIsHTMLContent &&
|
|
||||||
aData->mContentTag == nsGkAtoms::a &&
|
aData->mContentTag == nsGkAtoms::a &&
|
||||||
aData->IsLink() &&
|
aData->IsLink() &&
|
||||||
((mActiveRule && (aData->mStateMask & NS_EVENT_STATE_ACTIVE)) ||
|
((mActiveRule && (aData->mStateMask & NS_EVENT_STATE_ACTIVE)) ||
|
||||||
(mLinkRule && (aData->mStateMask & NS_EVENT_STATE_VISITED)) ||
|
(mLinkRule && (aData->mStateMask & NS_EVENT_STATE_VISITED)) ||
|
||||||
(mVisitedRule && (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
|
nsReStyleHint
|
||||||
|
|
|
@ -84,8 +84,7 @@ public:
|
||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData);
|
NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData);
|
||||||
#endif
|
#endif
|
||||||
NS_IMETHOD HasStateDependentStyle(StateRuleProcessorData* aData,
|
virtual nsReStyleHint HasStateDependentStyle(StateRuleProcessorData* aData);
|
||||||
nsReStyleHint* aResult);
|
|
||||||
virtual nsReStyleHint
|
virtual nsReStyleHint
|
||||||
HasAttributeDependentStyle(AttributeRuleProcessorData* aData);
|
HasAttributeDependentStyle(AttributeRuleProcessorData* aData);
|
||||||
NS_IMETHOD MediumFeaturesChanged(nsPresContext* aPresContext,
|
NS_IMETHOD MediumFeaturesChanged(nsPresContext* aPresContext,
|
||||||
|
|
|
@ -61,10 +61,10 @@ struct AttributeRuleProcessorData;
|
||||||
class nsPresContext;
|
class nsPresContext;
|
||||||
|
|
||||||
// IID for the nsIStyleRuleProcessor interface
|
// IID for the nsIStyleRuleProcessor interface
|
||||||
// {ec92bc0c-9518-48ea-9289-74e654659be9}
|
// {566a7bea-fdc5-40a5-bf8a-87b5a231d79e}
|
||||||
#define NS_ISTYLE_RULE_PROCESSOR_IID \
|
#define NS_ISTYLE_RULE_PROCESSOR_IID \
|
||||||
{ 0xec92bc0c, 0x9518, 0x48ea, \
|
{ 0x566a7bea, 0xfdc5, 0x40a5, \
|
||||||
{ 0x92, 0x89, 0x74, 0xe6, 0x54, 0x65, 0x9b, 0xe9 } }
|
{ 0xbf, 0x8a, 0x87, 0xb5, 0xa2, 0x31, 0xd7, 0x9e } }
|
||||||
|
|
||||||
/* The style rule processor interface is a mechanism to separate the matching
|
/* The style rule processor interface is a mechanism to separate the matching
|
||||||
* of style rules from style sheet instances.
|
* of style rules from style sheet instances.
|
||||||
|
@ -117,8 +117,8 @@ public:
|
||||||
*
|
*
|
||||||
* Event states are defined in nsIEventStateManager.h.
|
* Event states are defined in nsIEventStateManager.h.
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD HasStateDependentStyle(StateRuleProcessorData* aData,
|
virtual nsReStyleHint
|
||||||
nsReStyleHint* aResult) = 0;
|
HasStateDependentStyle(StateRuleProcessorData* aData) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will be called twice for every attribute change.
|
* This method will be called twice for every attribute change.
|
||||||
|
|
|
@ -1076,8 +1076,7 @@ static PRBool SheetHasStatefulStyle(nsIStyleRuleProcessor* aProcessor,
|
||||||
void *aData)
|
void *aData)
|
||||||
{
|
{
|
||||||
StatefulData* data = (StatefulData*)aData;
|
StatefulData* data = (StatefulData*)aData;
|
||||||
nsReStyleHint hint;
|
nsReStyleHint hint = aProcessor->HasStateDependentStyle(data);
|
||||||
aProcessor->HasStateDependentStyle(data, &hint);
|
|
||||||
data->mHint = nsReStyleHint(data->mHint | hint);
|
data->mHint = nsReStyleHint(data->mHint | hint);
|
||||||
return PR_TRUE; // continue
|
return PR_TRUE; // continue
|
||||||
}
|
}
|
||||||
|
|
|
@ -828,12 +828,10 @@ nsTransitionManager::RulesMatching(XULTreeRuleProcessorData* aData)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nsReStyleHint
|
||||||
nsTransitionManager::HasStateDependentStyle(StateRuleProcessorData* aData,
|
nsTransitionManager::HasStateDependentStyle(StateRuleProcessorData* aData)
|
||||||
nsReStyleHint* aResult)
|
|
||||||
{
|
{
|
||||||
*aResult = nsReStyleHint(0);
|
return nsReStyleHint(0);
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsReStyleHint
|
nsReStyleHint
|
||||||
|
|
|
@ -91,8 +91,7 @@ public:
|
||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData);
|
NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData);
|
||||||
#endif
|
#endif
|
||||||
NS_IMETHOD HasStateDependentStyle(StateRuleProcessorData* aData,
|
virtual nsReStyleHint HasStateDependentStyle(StateRuleProcessorData* aData);
|
||||||
nsReStyleHint* aResult);
|
|
||||||
virtual nsReStyleHint
|
virtual nsReStyleHint
|
||||||
HasAttributeDependentStyle(AttributeRuleProcessorData* aData);
|
HasAttributeDependentStyle(AttributeRuleProcessorData* aData);
|
||||||
NS_IMETHOD MediumFeaturesChanged(nsPresContext* aPresContext,
|
NS_IMETHOD MediumFeaturesChanged(nsPresContext* aPresContext,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче