From 0465d009bf00ed5c9418fb8804d07ac81dd2ee18 Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Tue, 25 Mar 2003 15:24:07 +0000 Subject: [PATCH] Fix incremental reflows of
. b=157444 r+sr=roc git-svn-id: svn://10.0.0.236/trunk@140250 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsBlockFrame.cpp | 21 +++++++++++++++---- mozilla/layout/html/base/src/nsBlockFrame.cpp | 21 +++++++++++++++---- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index fdf7b5fc0ed..88d12e10ba9 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -2261,6 +2261,19 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) // before calling PropagateFloaterDamage. if (needToRecoverState && (line->IsDirty() || line->IsPreviousMarginDirty())) { + + // If the previous line had a 'clear' in it, we need to do the + // same thing that we do in |PlaceLine|. + --line; + if (line->IsInline()) { + PRUint8 breakType = line->GetBreakType(); + if (breakType == NS_STYLE_CLEAR_LEFT || + breakType == NS_STYLE_CLEAR_RIGHT || + breakType == NS_STYLE_CLEAR_LEFT_AND_RIGHT) + aState.ClearFloaters(aState.mY, breakType); + } + ++line; + // We need to reconstruct the bottom margin only if we didn't // reflow the previous line and we do need to reflow (or repair // the top position of) the next line. @@ -2274,10 +2287,9 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) // If there's float damage we might end up doing this work twice, // but whatever... if (line->IsBlock()) { - // XXXPerf We could actually make this faster by stealing code - // from the top of nsBlockFrame::ReflowBlockFrame, but it's an - // edge case that will generally happen at most once in a given - // reflow (insertion of a new line before a block) + // We could actually make this faster by stealing code from the + // top of nsBlockFrame::ReflowBlockFrame, but it's an edge case + // that will generally happen at most once per reflow. line->MarkDirty(); } else { deltaY = aState.mY + aState.mPrevBottomMargin.get() - line->mBounds.y; @@ -4431,6 +4443,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, } // Apply break-after clearing if necessary + // This must stay in sync with |ReflowDirtyLines|. PRUint8 breakType = aLine->GetBreakType(); switch (breakType) { case NS_STYLE_CLEAR_LEFT: diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index fdf7b5fc0ed..88d12e10ba9 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -2261,6 +2261,19 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) // before calling PropagateFloaterDamage. if (needToRecoverState && (line->IsDirty() || line->IsPreviousMarginDirty())) { + + // If the previous line had a 'clear' in it, we need to do the + // same thing that we do in |PlaceLine|. + --line; + if (line->IsInline()) { + PRUint8 breakType = line->GetBreakType(); + if (breakType == NS_STYLE_CLEAR_LEFT || + breakType == NS_STYLE_CLEAR_RIGHT || + breakType == NS_STYLE_CLEAR_LEFT_AND_RIGHT) + aState.ClearFloaters(aState.mY, breakType); + } + ++line; + // We need to reconstruct the bottom margin only if we didn't // reflow the previous line and we do need to reflow (or repair // the top position of) the next line. @@ -2274,10 +2287,9 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) // If there's float damage we might end up doing this work twice, // but whatever... if (line->IsBlock()) { - // XXXPerf We could actually make this faster by stealing code - // from the top of nsBlockFrame::ReflowBlockFrame, but it's an - // edge case that will generally happen at most once in a given - // reflow (insertion of a new line before a block) + // We could actually make this faster by stealing code from the + // top of nsBlockFrame::ReflowBlockFrame, but it's an edge case + // that will generally happen at most once per reflow. line->MarkDirty(); } else { deltaY = aState.mY + aState.mPrevBottomMargin.get() - line->mBounds.y; @@ -4431,6 +4443,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, } // Apply break-after clearing if necessary + // This must stay in sync with |ReflowDirtyLines|. PRUint8 breakType = aLine->GetBreakType(); switch (breakType) { case NS_STYLE_CLEAR_LEFT: