Loading layout/generic/nsBlockFrame.cpp +32 −6 Original line number Diff line number Diff line Loading @@ -991,6 +991,14 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext, if (state.mFloatContinuations.NotEmpty()) mFloats.AppendFrames(nsnull, state.mFloatContinuations); // If we end in a BR with clear and affected floats continue, // we need to continue, too. if (NS_UNCONSTRAINEDSIZE != aReflowState.availableHeight && NS_FRAME_IS_COMPLETE(state.mReflowStatus) && state.mFloatManager->ClearContinues(FindTrailingClear())) { NS_FRAME_SET_INCOMPLETE(state.mReflowStatus); } if (!NS_FRAME_IS_FULLY_COMPLETE(state.mReflowStatus)) { if (GetOverflowLines()) { state.mReflowStatus |= NS_FRAME_REFLOW_NEXTINFLOW; Loading Loading @@ -1690,7 +1698,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) nsresult rv = NS_OK; PRBool keepGoing = PR_TRUE; PRBool repositionViews = PR_FALSE; // should we really need this? PRBool foundAnyClears = PR_FALSE; PRBool foundAnyClears = aState.mFloatBreakType != NS_STYLE_CLEAR_NONE; PRBool willReflowAgain = PR_FALSE; #ifdef DEBUG Loading Loading @@ -1725,10 +1733,11 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) // recompute the carried out margin before the line if we want to // reflow it or if its previous margin is dirty PRBool needToRecoverState = PR_FALSE; PRBool reflowedFloat = PR_FALSE; // Float continuations were reflowed in ReflowFloatContinuations PRBool reflowedFloat = mFloats.NotEmpty() && mFloats.FirstChild()->GetPrevInFlow(); PRBool lastLineMovedUp = PR_FALSE; // We save up information about BR-clearance here PRUint8 inlineFloatBreakType = NS_STYLE_CLEAR_NONE; PRUint8 inlineFloatBreakType = aState.mFloatBreakType; line_iterator line = begin_lines(), line_end = end_lines(); Loading Loading @@ -2854,9 +2863,6 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, nsBlockReflowContext brc(aState.mPresContext, aState.mReflowState); PRUint8 breakType = display->mBreakType; // If a float split and its prev-in-flow was followed by a <BR>, then combine // the <BR>'s break type with the block's break type (the block will be the very // next frame after the split float). if (NS_STYLE_CLEAR_NONE != aState.mFloatBreakType) { breakType = nsLayoutUtils::CombineBreakType(breakType, aState.mFloatBreakType); Loading Loading @@ -5657,6 +5663,20 @@ nsBlockFrame::ReflowFloat(nsBlockReflowState& aState, return NS_OK; } PRUint8 nsBlockFrame::FindTrailingClear() { // find the break type of the last line for (nsIFrame* b = this; b; b = b->GetPrevInFlow()) { nsBlockFrame* block = static_cast<nsBlockFrame*>(b); line_iterator endLine = block->end_lines(); if (endLine != block->begin_lines()) { --endLine; return endLine->GetBreakTypeAfter(); } } } nsresult nsBlockFrame::ReflowFloatContinuations(nsBlockReflowState& aState, nsRect& aBounds, Loading Loading @@ -5703,6 +5723,12 @@ nsBlockFrame::ReflowFloatContinuations(nsBlockReflowState& aState, ConsiderChildOverflow(aBounds, f); } // If there are continued floats, then we may need to continue BR clearance if (0 != aState.ClearFloats(0, NS_STYLE_CLEAR_LEFT_AND_RIGHT)) { aState.mFloatBreakType = static_cast<nsBlockFrame*>(GetPrevInFlow()) ->FindTrailingClear(); } return rv; } Loading layout/generic/nsBlockFrame.h +4 −0 Original line number Diff line number Diff line Loading @@ -465,6 +465,10 @@ protected: nsRect& aBounds, nsReflowStatus& aStatus); /** Find any trailing BR clear from the last line of the block (or its PIFs) */ PRUint8 FindTrailingClear(); /** * Remove a float from our float list and also the float cache * for the line its placeholder is on. Loading layout/generic/nsFloatManager.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -505,6 +505,27 @@ nsFloatManager::ClearFloats(nscoord aY, PRUint8 aBreakType) const return bottom; } PRBool nsFloatManager::ClearContinues(PRUint8 aBreakType) const { if (!HasAnyFloats() || aBreakType == NS_STYLE_CLEAR_NONE) return PR_FALSE; for (PRUint32 i = mFloats.Length(); i > 0; i--) { nsIFrame* f = mFloats[i-1].mFrame; if (f->GetNextInFlow()) { if (aBreakType == NS_STYLE_CLEAR_LEFT_AND_RIGHT) return PR_TRUE; PRUint8 floatSide = f->GetStyleDisplay()->mFloats; if ((aBreakType == NS_STYLE_CLEAR_LEFT && floatSide == NS_STYLE_FLOAT_LEFT) || (aBreakType == NS_STYLE_CLEAR_RIGHT && floatSide == NS_STYLE_FLOAT_RIGHT)) return PR_TRUE; } } return PR_FALSE; } ///////////////////////////////////////////////////////////////////////////// // FloatInfo Loading layout/generic/nsFloatManager.h +6 −0 Original line number Diff line number Diff line Loading @@ -250,6 +250,12 @@ public: */ nscoord ClearFloats(nscoord aY, PRUint8 aBreakType) const; /** * Checks if clear would pass into the floats' BFC's next-in-flow, * i.e. whether floats affecting this clear have continuations. */ PRBool ClearContinues(PRUint8 aBreakType) const; void AssertStateMatches(SavedState *aState) const { NS_ASSERTION(aState->mX == mX && aState->mY == mY && Loading Loading
layout/generic/nsBlockFrame.cpp +32 −6 Original line number Diff line number Diff line Loading @@ -991,6 +991,14 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext, if (state.mFloatContinuations.NotEmpty()) mFloats.AppendFrames(nsnull, state.mFloatContinuations); // If we end in a BR with clear and affected floats continue, // we need to continue, too. if (NS_UNCONSTRAINEDSIZE != aReflowState.availableHeight && NS_FRAME_IS_COMPLETE(state.mReflowStatus) && state.mFloatManager->ClearContinues(FindTrailingClear())) { NS_FRAME_SET_INCOMPLETE(state.mReflowStatus); } if (!NS_FRAME_IS_FULLY_COMPLETE(state.mReflowStatus)) { if (GetOverflowLines()) { state.mReflowStatus |= NS_FRAME_REFLOW_NEXTINFLOW; Loading Loading @@ -1690,7 +1698,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) nsresult rv = NS_OK; PRBool keepGoing = PR_TRUE; PRBool repositionViews = PR_FALSE; // should we really need this? PRBool foundAnyClears = PR_FALSE; PRBool foundAnyClears = aState.mFloatBreakType != NS_STYLE_CLEAR_NONE; PRBool willReflowAgain = PR_FALSE; #ifdef DEBUG Loading Loading @@ -1725,10 +1733,11 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) // recompute the carried out margin before the line if we want to // reflow it or if its previous margin is dirty PRBool needToRecoverState = PR_FALSE; PRBool reflowedFloat = PR_FALSE; // Float continuations were reflowed in ReflowFloatContinuations PRBool reflowedFloat = mFloats.NotEmpty() && mFloats.FirstChild()->GetPrevInFlow(); PRBool lastLineMovedUp = PR_FALSE; // We save up information about BR-clearance here PRUint8 inlineFloatBreakType = NS_STYLE_CLEAR_NONE; PRUint8 inlineFloatBreakType = aState.mFloatBreakType; line_iterator line = begin_lines(), line_end = end_lines(); Loading Loading @@ -2854,9 +2863,6 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, nsBlockReflowContext brc(aState.mPresContext, aState.mReflowState); PRUint8 breakType = display->mBreakType; // If a float split and its prev-in-flow was followed by a <BR>, then combine // the <BR>'s break type with the block's break type (the block will be the very // next frame after the split float). if (NS_STYLE_CLEAR_NONE != aState.mFloatBreakType) { breakType = nsLayoutUtils::CombineBreakType(breakType, aState.mFloatBreakType); Loading Loading @@ -5657,6 +5663,20 @@ nsBlockFrame::ReflowFloat(nsBlockReflowState& aState, return NS_OK; } PRUint8 nsBlockFrame::FindTrailingClear() { // find the break type of the last line for (nsIFrame* b = this; b; b = b->GetPrevInFlow()) { nsBlockFrame* block = static_cast<nsBlockFrame*>(b); line_iterator endLine = block->end_lines(); if (endLine != block->begin_lines()) { --endLine; return endLine->GetBreakTypeAfter(); } } } nsresult nsBlockFrame::ReflowFloatContinuations(nsBlockReflowState& aState, nsRect& aBounds, Loading Loading @@ -5703,6 +5723,12 @@ nsBlockFrame::ReflowFloatContinuations(nsBlockReflowState& aState, ConsiderChildOverflow(aBounds, f); } // If there are continued floats, then we may need to continue BR clearance if (0 != aState.ClearFloats(0, NS_STYLE_CLEAR_LEFT_AND_RIGHT)) { aState.mFloatBreakType = static_cast<nsBlockFrame*>(GetPrevInFlow()) ->FindTrailingClear(); } return rv; } Loading
layout/generic/nsBlockFrame.h +4 −0 Original line number Diff line number Diff line Loading @@ -465,6 +465,10 @@ protected: nsRect& aBounds, nsReflowStatus& aStatus); /** Find any trailing BR clear from the last line of the block (or its PIFs) */ PRUint8 FindTrailingClear(); /** * Remove a float from our float list and also the float cache * for the line its placeholder is on. Loading
layout/generic/nsFloatManager.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -505,6 +505,27 @@ nsFloatManager::ClearFloats(nscoord aY, PRUint8 aBreakType) const return bottom; } PRBool nsFloatManager::ClearContinues(PRUint8 aBreakType) const { if (!HasAnyFloats() || aBreakType == NS_STYLE_CLEAR_NONE) return PR_FALSE; for (PRUint32 i = mFloats.Length(); i > 0; i--) { nsIFrame* f = mFloats[i-1].mFrame; if (f->GetNextInFlow()) { if (aBreakType == NS_STYLE_CLEAR_LEFT_AND_RIGHT) return PR_TRUE; PRUint8 floatSide = f->GetStyleDisplay()->mFloats; if ((aBreakType == NS_STYLE_CLEAR_LEFT && floatSide == NS_STYLE_FLOAT_LEFT) || (aBreakType == NS_STYLE_CLEAR_RIGHT && floatSide == NS_STYLE_FLOAT_RIGHT)) return PR_TRUE; } } return PR_FALSE; } ///////////////////////////////////////////////////////////////////////////// // FloatInfo Loading
layout/generic/nsFloatManager.h +6 −0 Original line number Diff line number Diff line Loading @@ -250,6 +250,12 @@ public: */ nscoord ClearFloats(nscoord aY, PRUint8 aBreakType) const; /** * Checks if clear would pass into the floats' BFC's next-in-flow, * i.e. whether floats affecting this clear have continuations. */ PRBool ClearContinues(PRUint8 aBreakType) const; void AssertStateMatches(SavedState *aState) const { NS_ASSERTION(aState->mX == mX && aState->mY == mY && Loading