From c7e0414ca4df2a4ecac19e530652a4b18f7aa6c2 Mon Sep 17 00:00:00 2001 From: "roc+%cs.cmu.edu" Date: Wed, 24 Aug 2005 21:20:48 +0000 Subject: [PATCH] Bug 286491. Recreate an entire IB-complex if one of the child frames gets frames recreated. It might be changing from block to inline or back again, in which case the IB division may change. r+sr=bzbarsky,a=asa git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@178861 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsCSSFrameConstructor.cpp | 39 +++++++++++++------ mozilla/layout/base/nsCSSFrameConstructor.h | 2 + 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 93192256898..d390431d043 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -11616,6 +11616,23 @@ nsCSSFrameConstructor::MaybeRecreateFramesForContent(nsIContent* aContent) return result; } +PRBool +nsCSSFrameConstructor::MaybeRecreateContainerForIBSplitterFrame(nsIFrame* aFrame, nsresult* aResult) +{ + if (!aFrame || !IsFrameSpecial(aFrame)) + return PR_FALSE; + +#ifdef DEBUG + if (gNoisyContentUpdates) { + printf("nsCSSFrameConstructor::RecreateFramesForContent: frame="); + nsFrame::ListTag(stdout, aFrame); + printf(" is special\n"); + } +#endif + *aResult = ReframeContainingBlock(aFrame); + return PR_TRUE; +} + nsresult nsCSSFrameConstructor::RecreateFramesForContent(nsIContent* aContent) { @@ -11636,6 +11653,8 @@ nsCSSFrameConstructor::RecreateFramesForContent(nsIContent* aContent) mPresShell->GetPrimaryFrameFor(aContent, &frame); nsPresContext* presContext = mPresShell->GetPresContext(); + nsresult rv = NS_OK; + if (frame) { // If the background of the frame is painted on one of its ancestors, // the frame reconstruct might not invalidate correctly. @@ -11652,20 +11671,16 @@ nsCSSFrameConstructor::RecreateFramesForContent(nsIContent* aContent) if (ancestor != frame) ApplyRenderingChangeToTree(presContext, ancestor, nsnull, nsChangeHint_RepaintFrame); + + // If the frame is an anonymous frame created as part of + // inline-in-block splitting --- or if its parent is + // such an anonymous frame (i.e., this frame was the cause + // of such splitting), then recreate the containing block. + if (MaybeRecreateContainerForIBSplitterFrame(frame, &rv) || + MaybeRecreateContainerForIBSplitterFrame(frame->GetParent(), &rv)) + return rv; } - if (frame && IsFrameSpecial(frame)) { -#ifdef DEBUG - if (gNoisyContentUpdates) { - printf("nsCSSFrameConstructor::RecreateFramesForContent: frame="); - nsFrame::ListTag(stdout, frame); - printf(" is special\n"); - } -#endif - return ReframeContainingBlock(frame); - } - - nsresult rv = NS_OK; nsCOMPtr container = aContent->GetParent(); if (container) { PRInt32 indexInContainer = container->IndexOf(aContent); diff --git a/mozilla/layout/base/nsCSSFrameConstructor.h b/mozilla/layout/base/nsCSSFrameConstructor.h index e33463b5c8d..4d46acab1e1 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.h +++ b/mozilla/layout/base/nsCSSFrameConstructor.h @@ -697,6 +697,8 @@ private: nsresult RecreateFramesForContent(nsIContent* aContent); + PRBool MaybeRecreateContainerForIBSplitterFrame(nsIFrame* aFrame, nsresult* aResult); + nsresult CreateContinuingOuterTableFrame(nsIPresShell* aPresShell, nsPresContext* aPresContext, nsIFrame* aFrame,