From 0390e3d311d4d5c0b500e07dbb49461e415e235c Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 8 Jun 2010 15:58:26 -0400 Subject: [PATCH] Add assertions that would catch bug 558943 earlier. r=dbaron --- layout/base/nsFrameManager.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/layout/base/nsFrameManager.cpp b/layout/base/nsFrameManager.cpp index f2722fc6ae2..40806aeeaa1 100644 --- a/layout/base/nsFrameManager.cpp +++ b/layout/base/nsFrameManager.cpp @@ -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