зеркало из https://github.com/mozilla/pjs.git
Bug 554061 - Also check XBL stylesheets when determining whether a restyle is necessary when document state changes. r=dbaron
This commit is contained in:
Родитель
0dac3407de
Коммит
73d87378dc
|
@ -1330,6 +1330,39 @@ EnumRuleProcessors(nsISupports *aKey, nsXBLBinding *aBinding, void* aClosure)
|
|||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
struct WalkAllRulesData {
|
||||
nsIStyleRuleProcessor::EnumFunc mFunc;
|
||||
RuleProcessorData* mData;
|
||||
};
|
||||
|
||||
static PLDHashOperator
|
||||
EnumWalkAllRules(nsVoidPtrHashKey *aKey, void* aClosure)
|
||||
{
|
||||
nsIStyleRuleProcessor *ruleProcessor =
|
||||
static_cast<nsIStyleRuleProcessor*>(const_cast<void*>(aKey->GetKey()));
|
||||
WalkAllRulesData *data = static_cast<WalkAllRulesData*>(aClosure);
|
||||
|
||||
(*(data->mFunc))(ruleProcessor, data->mData);
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
void
|
||||
nsBindingManager::WalkAllRules(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||
RuleProcessorData* aData)
|
||||
{
|
||||
if (!mBindingTable.IsInitialized())
|
||||
return;
|
||||
|
||||
RuleProcessorSet set;
|
||||
mBindingTable.EnumerateRead(EnumRuleProcessors, &set);
|
||||
if (!set.IsInitialized())
|
||||
return;
|
||||
|
||||
WalkAllRulesData data = { aFunc, aData };
|
||||
set.EnumerateEntries(EnumWalkAllRules, &data);
|
||||
}
|
||||
|
||||
struct MediumFeaturesChangedData {
|
||||
nsPresContext *mPresContext;
|
||||
PRBool *mRulesChanged;
|
||||
|
|
|
@ -204,6 +204,9 @@ public:
|
|||
nsresult WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||
RuleProcessorData* aData,
|
||||
PRBool* aCutOffInheritance);
|
||||
|
||||
void WalkAllRules(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||
RuleProcessorData* aData);
|
||||
/**
|
||||
* Do any processing that needs to happen as a result of a change in
|
||||
* the characteristics of the medium, and return whether this rule
|
||||
|
|
|
@ -707,8 +707,8 @@ static const PLDHashTableOps AttributeSelectorOps = {
|
|||
struct RuleCascadeData {
|
||||
RuleCascadeData(nsIAtom *aMedium, PRBool aQuirksMode)
|
||||
: mRuleHash(aQuirksMode),
|
||||
mSelectorDocumentStates(0),
|
||||
mStateSelectors(),
|
||||
mSelectorDocumentStates(0),
|
||||
mCacheKey(aMedium),
|
||||
mNext(nsnull),
|
||||
mQuirksMode(aQuirksMode)
|
||||
|
|
|
@ -664,7 +664,8 @@ nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
|
|||
// of the rules and doesn't walk !important-rules.
|
||||
void
|
||||
nsStyleSet::WalkRuleProcessors(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||
RuleProcessorData* aData)
|
||||
RuleProcessorData* aData,
|
||||
PRBool aWalkAllXBLStylesheets)
|
||||
{
|
||||
NS_PRECONDITION(SheetCount(ePresHintSheet) == 0 ||
|
||||
SheetCount(eHTMLPresHintSheet) == 0,
|
||||
|
@ -685,7 +686,11 @@ nsStyleSet::WalkRuleProcessors(nsIStyleRuleProcessor::EnumFunc aFunc,
|
|||
PRBool cutOffInheritance = PR_FALSE;
|
||||
if (mBindingManager) {
|
||||
// We can supply additional document-level sheets that should be walked.
|
||||
mBindingManager->WalkRules(aFunc, aData, &cutOffInheritance);
|
||||
if (aWalkAllXBLStylesheets) {
|
||||
mBindingManager->WalkAllRules(aFunc, aData);
|
||||
} else {
|
||||
mBindingManager->WalkRules(aFunc, aData, &cutOffInheritance);
|
||||
}
|
||||
}
|
||||
if (!skipUserStyles && !cutOffInheritance &&
|
||||
mRuleProcessors[eDocSheet]) // NOTE: different
|
||||
|
@ -1093,7 +1098,7 @@ nsStyleSet::HasDocumentStateDependentStyle(nsPresContext* aPresContext,
|
|||
return PR_FALSE;
|
||||
|
||||
StatefulData data(aPresContext, aContent, aStateMask);
|
||||
WalkRuleProcessors(SheetHasDocumentStateStyle, &data);
|
||||
WalkRuleProcessors(SheetHasDocumentStateStyle, &data, PR_TRUE);
|
||||
return data.mHint != 0;
|
||||
}
|
||||
|
||||
|
@ -1116,7 +1121,7 @@ nsStyleSet::HasStateDependentStyle(nsPresContext* aPresContext,
|
|||
|
||||
if (aContent->IsNodeOfType(nsINode::eELEMENT)) {
|
||||
StatefulData data(aPresContext, aContent, aStateMask);
|
||||
WalkRuleProcessors(SheetHasStatefulStyle, &data);
|
||||
WalkRuleProcessors(SheetHasStatefulStyle, &data, PR_FALSE);
|
||||
result = data.mHint;
|
||||
}
|
||||
|
||||
|
@ -1156,7 +1161,7 @@ nsStyleSet::HasAttributeDependentStyle(nsPresContext* aPresContext,
|
|||
if (aContent->IsNodeOfType(nsINode::eELEMENT)) {
|
||||
AttributeData data(aPresContext, aContent, aAttribute, aModType,
|
||||
aAttrHasChanged);
|
||||
WalkRuleProcessors(SheetHasAttributeStyle, &data);
|
||||
WalkRuleProcessors(SheetHasAttributeStyle, &data, PR_FALSE);
|
||||
result = data.mHint;
|
||||
}
|
||||
|
||||
|
|
|
@ -333,7 +333,8 @@ class nsStyleSet
|
|||
// Enumerate all the rules in a way that doesn't care about the order
|
||||
// of the rules and break out if the enumeration is halted.
|
||||
void WalkRuleProcessors(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||
RuleProcessorData* aData);
|
||||
RuleProcessorData* aData,
|
||||
PRBool aWalkAllXBLStylesheets);
|
||||
|
||||
already_AddRefed<nsStyleContext> GetContext(nsPresContext* aPresContext,
|
||||
nsStyleContext* aParentContext,
|
||||
|
|
Загрузка…
Ссылка в новой задаче