From 7c49bd8a89c027dc438cff12cdf10dc5c81f52d0 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Thu, 26 Apr 2007 02:26:25 +0000 Subject: [PATCH] Resolve the right (parentless) style context for a table as a document root, and fix the assertion when adjusting parent style context frames to not trigger in non-scrollable documents. Bug 378693, r+sr=roc git-svn-id: svn://10.0.0.236/trunk@225066 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsCSSFrameConstructor.cpp | 15 +++++++++++---- mozilla/layout/generic/nsFrame.cpp | 6 +++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 71f1ff3ddbc..1eb717e7598 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -6654,11 +6654,18 @@ already_AddRefed nsCSSFrameConstructor::ResolveStyleContext(nsIFrame* aParentFrame, nsIContent* aContent) { - aParentFrame = nsFrame::CorrectStyleParentFrame(aParentFrame, nsnull); + nsStyleContext* parentStyleContext; + if (aContent->GetParent()) { + aParentFrame = nsFrame::CorrectStyleParentFrame(aParentFrame, nsnull); - // Resolve the style context based on the content object and the parent - // style context - nsStyleContext* parentStyleContext = aParentFrame->GetStyleContext(); + // Resolve the style context based on the content object and the parent + // style context + parentStyleContext = aParentFrame->GetStyleContext(); + } else { + // This has got to be a call from ConstructDocElementTableFrame. + // Not sure how best to asserrt that here. + parentStyleContext = nsnull; + } nsStyleSet *styleSet = mPresShell->StyleSet(); diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index 1618d3d2d8d..c64e103a44e 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -5527,7 +5527,11 @@ nsFrame::CorrectStyleParentFrame(nsIFrame* aProspectiveParent, // We can get here if aProspectiveParent is the scrollframe for a viewport // and the kids are the anonymous scrollbars. NS_ASSERTION(aProspectiveParent->GetStyleContext()->GetPseudoType() == - nsCSSAnonBoxes::viewportScroll, + nsCSSAnonBoxes::viewportScroll || + aProspectiveParent->GetStyleContext()->GetPseudoType() == + nsCSSAnonBoxes::canvas || + aProspectiveParent->GetStyleContext()->GetPseudoType() == + nsCSSAnonBoxes::pageSequence, "Should have found a parent before this"); return aProspectiveParent; }