From 8ab45f98a86af3ca84fa20832e62e312dbfef3c5 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Tue, 9 Oct 2007 02:45:10 +0000 Subject: [PATCH] Elimninate the last known source of bogus "wrong parent style context" warnings, and make these warnings into assertions. Bug 374297, r+sr+a=dbaron git-svn-id: svn://10.0.0.236/trunk@237443 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsCSSFrameConstructor.cpp | 28 ++++++++++--------- mozilla/layout/base/nsFrameManager.cpp | 8 ++++-- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index eee60f49fca..5b31a8555c7 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -9923,23 +9923,13 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList) viewMgr->SynthesizeMouseMove(PR_FALSE); } } - -#ifdef DEBUG - // reget from content since it may have been regenerated... - if (content) { - nsIFrame* frame = mPresShell->GetPrimaryFrameFor(content); - if (frame) { - mPresShell->FrameManager()->DebugVerifyStyleTree(frame); - } - } else { - NS_WARNING("Unable to test style tree integrity -- no content node"); - } -#endif } EndUpdate(); - // cleanup references + // cleanup references and verify the style tree. Note that the latter needs + // to happen once we've processed the whole list, since until then the tree + // is not in fact in a consistent state. index = count; while (0 <= --index) { const nsStyleChangeData* changeData; @@ -9948,6 +9938,18 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList) propTable->DeleteProperty(changeData->mFrame, nsGkAtoms::changeListProperty); } + +#ifdef DEBUG + // reget frame from content since it may have been regenerated... + if (changeData->mContent) { + nsIFrame* frame = mPresShell->GetPrimaryFrameFor(changeData->mContent); + if (frame) { + mPresShell->FrameManager()->DebugVerifyStyleTree(frame); + } + } else { + NS_WARNING("Unable to test style tree integrity -- no content node"); + } +#endif } aChangeList.Clear(); diff --git a/mozilla/layout/base/nsFrameManager.cpp b/mozilla/layout/base/nsFrameManager.cpp index 915db8a5ad9..8ac65af4492 100644 --- a/mozilla/layout/base/nsFrameManager.cpp +++ b/mozilla/layout/base/nsFrameManager.cpp @@ -777,8 +777,8 @@ VerifySameTree(nsStyleContext* aContext1, nsStyleContext* aContext2) break; top2 = parent; } - if (top1 != top2) - printf("Style contexts are not in the same style context tree.\n"); + NS_ASSERTION(top1 == top2, + "Style contexts are not in the same style context tree"); } static void @@ -812,9 +812,10 @@ VerifyContextParent(nsPresContext* aPresContext, nsIFrame* aFrame, if (aParentContext != actualParentContext) { DumpContext(aFrame, aContext); if (aContext == aParentContext) { - fputs("Using parent's style context\n\n", stdout); + NS_ERROR("Using parent's style context"); } else { + NS_ERROR("Wrong parent style context"); fputs("Wrong parent style context: ", stdout); DumpContext(nsnull, actualParentContext); fputs("should be using: ", stdout); @@ -826,6 +827,7 @@ VerifyContextParent(nsPresContext* aPresContext, nsIFrame* aFrame, } else { if (actualParentContext) { + NS_ERROR("Have parent context and shouldn't"); DumpContext(aFrame, aContext); fputs("Has parent context: ", stdout); DumpContext(nsnull, actualParentContext);