Bug 529750 part 1. Don't walk non-CSS UA rules when checking for important UA rules. r=dbaron

This commit is contained in:
Boris Zbarsky 2011-05-23 16:45:42 -04:00
Родитель 28880643f0
Коммит f9c2b88340
1 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -700,6 +700,10 @@ nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
// -. transition rules = Transition normal
// [most important]
// Save off the last rule before we start walking our agent sheets;
// this will be either the root or one of the restriction rules.
nsRuleNode* lastRestrictionRN = aRuleWalker->CurrentNode();
aRuleWalker->SetLevel(eAgentSheet, PR_FALSE, PR_TRUE);
if (mRuleProcessors[eAgentSheet])
(*aCollectorFunc)(mRuleProcessors[eAgentSheet], aData);
@ -786,14 +790,18 @@ nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
if (haveImportantUARules) {
aRuleWalker->SetLevel(eAgentSheet, PR_TRUE, PR_FALSE);
AddImportantRules(lastAgentRN, mRuleTree, aRuleWalker); //agent
AddImportantRules(lastAgentRN, lastRestrictionRN, aRuleWalker); //agent
}
#ifdef DEBUG
else {
AssertNoImportantRules(lastAgentRN, mRuleTree);
AssertNoImportantRules(lastAgentRN, lastRestrictionRN);
}
#endif
#ifdef DEBUG
AssertNoCSSRules(lastRestrictionRN, mRuleTree);
#endif
#ifdef DEBUG
nsRuleNode *lastImportantRN = aRuleWalker->CurrentNode();
#endif
@ -1022,6 +1030,7 @@ nsStyleSet::ResolvePseudoElementStyle(Element* aParentElement,
if (treeContext.HaveRelevantLink()) {
treeContext.ResetForVisitedMatching();
ruleWalker.Reset();
WalkRestrictionRule(aType, &ruleWalker);
FileRules(EnumRulesMatching<PseudoElementRuleProcessorData>, &data,
aParentElement, &ruleWalker);
visitedRuleNode = ruleWalker.CurrentNode();
@ -1081,6 +1090,7 @@ nsStyleSet::ProbePseudoElementStyle(Element* aParentElement,
if (aTreeMatchContext.HaveRelevantLink()) {
aTreeMatchContext.ResetForVisitedMatching();
ruleWalker.Reset();
WalkRestrictionRule(aType, &ruleWalker);
FileRules(EnumRulesMatching<PseudoElementRuleProcessorData>, &data,
aParentElement, &ruleWalker);
visitedRuleNode = ruleWalker.CurrentNode();