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
Родитель e10050060b
Коммит 0390e3d311
1 изменённых файлов: 18 добавлений и 0 удалений

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

@ -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