Add assertions that would catch bug 558943 earlier. r=dbaron

This commit is contained in:
Boris Zbarsky 2010-06-08 15:58:26 -04:00
parent 6e35d9ce4f
commit 43a16212af

View File

@ -614,6 +614,7 @@ VerifyContextParent(nsPresContext* aPresContext, nsIFrame* aFrame,
fputs("\n", stdout);
}
}
}
else {
if (actualParentContext) {
@ -624,6 +625,23 @@ VerifyContextParent(nsPresContext* aPresContext, nsIFrame* aFrame,
fputs("Should be null\n\n", stdout);
}
}
nsStyleContext* childStyleIfVisited = aContext->GetStyleIfVisited();
// Since we have different rules for :link and :visited in our ua/user sheets,
// we know that either childStyleIfVisited has a different rulenode than
// aContext (in which case it has :visited rules applied and its parent must
// be aContext->GetParent()), or it has the same rulenode and then its parent
// must be aContext->GetParent()->GetStyleIfVisited().
if (childStyleIfVisited &&
!((childStyleIfVisited->GetRuleNode() != aContext->GetRuleNode() &&
childStyleIfVisited->GetParent() == aContext->GetParent()) ||
(childStyleIfVisited->GetRuleNode() == aContext->GetRuleNode() &&
childStyleIfVisited->GetParent() ==
aContext->GetParent()->GetStyleIfVisited()))) {
NS_ERROR("Visited style has wrong parent");
DumpContext(aFrame, aContext);
fputs("\n", stdout);
}
}
static void