Bug 529750 followup; reenable the assertion. r=dbaron

This commit is contained in:
Boris Zbarsky 2011-05-25 16:54:30 -04:00
Родитель 5191b4929f
Коммит 34715c772e
2 изменённых файлов: 13 добавлений и 7 удалений

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

@ -56,16 +56,16 @@ public:
mCurrent = aNode;
}
protected:
void DoForward(nsIStyleRule* aRule) {
mCurrent = mCurrent->Transition(aRule, mLevel, mImportance);
NS_POSTCONDITION(mCurrent, "Transition messed up");
}
public:
void Forward(nsIStyleRule* aRule) {
// We'd like to assert that this is not a StyleRule, but unfortunately
// ResolveStyleByAddingRules can be passed both style and non-style rules.
// NS_PRECONDITION(!nsRefPtr<mozilla::css::StyleRule>(do_QueryObject(aRule)),
// "Calling the wrong Forward() overload");
NS_PRECONDITION(!nsRefPtr<mozilla::css::StyleRule>(do_QueryObject(aRule)),
"Calling the wrong Forward() overload");
DoForward(aRule);
}
void Forward(mozilla::css::StyleRule* aRule) {
@ -73,6 +73,12 @@ public:
mCheckForImportantRules =
mCheckForImportantRules && !aRule->GetImportantRule();
}
// ForwardOnPossiblyCSSRule should only be used by callers that have
// an explicit list of rules they need to walk, with the list
// already containing any important rules they care about.
void ForwardOnPossiblyCSSRule(nsIStyleRule* aRule) {
DoForward(aRule);
}
void Reset() { mCurrent = mRoot; }

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

@ -943,7 +943,7 @@ nsStyleSet::ResolveStyleForRules(nsStyleContext* aParentContext,
// matter.
ruleWalker.SetLevel(eDocSheet, PR_FALSE, PR_FALSE);
for (PRInt32 i = 0; i < aRules.Count(); i++) {
ruleWalker.Forward(aRules.ObjectAt(i));
ruleWalker.ForwardOnPossiblyCSSRule(aRules.ObjectAt(i));
}
return GetContext(aParentContext, ruleWalker.CurrentNode(), nsnull,
@ -964,7 +964,7 @@ nsStyleSet::ResolveStyleByAddingRules(nsStyleContext* aBaseContext,
// matter.
ruleWalker.SetLevel(eDocSheet, PR_FALSE, PR_FALSE);
for (PRInt32 i = 0; i < aRules.Count(); i++) {
ruleWalker.Forward(aRules.ObjectAt(i));
ruleWalker.ForwardOnPossiblyCSSRule(aRules.ObjectAt(i));
}
nsRuleNode *ruleNode = ruleWalker.CurrentNode();
@ -973,7 +973,7 @@ nsStyleSet::ResolveStyleByAddingRules(nsStyleContext* aBaseContext,
if (aBaseContext->GetStyleIfVisited()) {
ruleWalker.SetCurrentNode(aBaseContext->GetStyleIfVisited()->GetRuleNode());
for (PRInt32 i = 0; i < aRules.Count(); i++) {
ruleWalker.Forward(aRules.ObjectAt(i));
ruleWalker.ForwardOnPossiblyCSSRule(aRules.ObjectAt(i));
}
visitedRuleNode = ruleWalker.CurrentNode();
}