Chromium Code Reviews| Index: Source/core/layout/LayoutBlockFlowLine.cpp |
| diff --git a/Source/core/layout/LayoutBlockFlowLine.cpp b/Source/core/layout/LayoutBlockFlowLine.cpp |
| index aaab3896c92b106cd938bbde5e9640730b34fbd8..f2d06dbe79a8b2c7c8e706232eabe74b5c562cbc 100644 |
| --- a/Source/core/layout/LayoutBlockFlowLine.cpp |
| +++ b/Source/core/layout/LayoutBlockFlowLine.cpp |
| @@ -1535,9 +1535,6 @@ void LayoutBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& pa |
| if (!layoutState.hasInlineChild() && o->isInline()) |
| layoutState.setHasInlineChild(true); |
| - if (o->isBR() && o->style()->clear() != CNONE) |
| - layoutState.setContainsBRWithClear(true); |
| - |
| if (o->isReplaced() || o->isFloating() || o->isOutOfFlowPositioned()) { |
| LayoutBox* box = toLayoutBox(o); |
| @@ -1655,11 +1652,8 @@ RootInlineBox* LayoutBlockFlow::determineStartPosition(LineLayoutState& layoutSt |
| } |
| // If the linebox breaks cleanly and with clearance then dirty from at least this point onwards so that we can clear the correct floats without difficulty. |
| - if (!firstLineBoxWithBreakAndClearance && curr->endsWithBreak()) { |
| - InlineBox* lastBox = style()->isLeftToRightDirection() ? curr->lastLeafChild() : curr->firstLeafChild(); |
| - if (lastBox && lastBox->layoutObject().isBR() && lastBox->layoutObject().style()->clear() != CNONE) |
| - firstLineBoxWithBreakAndClearance = curr; |
| - } |
| + if (!firstLineBoxWithBreakAndClearance && lineBoxHasBRWithClearance(curr)) |
| + firstLineBoxWithBreakAndClearance = curr; |
| // If a new float has been inserted before this line or before its last known float, just do a full layout. |
| bool encounteredNewFloat = false; |
| @@ -1751,6 +1745,16 @@ RootInlineBox* LayoutBlockFlow::determineStartPosition(LineLayoutState& layoutSt |
| return curr; |
| } |
| + |
| +bool LayoutBlockFlow::lineBoxHasBRWithClearance(RootInlineBox* curr) |
| +{ |
| + // If the linebox breaks cleanly and with clearance then dirty from at least this point onwards so that we can clear the correct floats without difficulty. |
| + if (!curr->endsWithBreak()) |
| + return false; |
| + InlineBox* lastBox = style()->isLeftToRightDirection() ? curr->lastLeafChild() : curr->firstLeafChild(); |
|
leviw_travelin_and_unemployed
2015/06/22 18:22:42
I understand you're moving this code around. If we
rhogan
2015/06/22 20:27:15
Had to look it up: lineBreakObj() is the object *a
|
| + return lastBox && lastBox->layoutObject().isBR() && lastBox->layoutObject().style()->clear() != CNONE; |
| +} |
| + |
| void LayoutBlockFlow::determineEndPosition(LineLayoutState& layoutState, RootInlineBox* startLine, InlineIterator& cleanLineStart, BidiStatus& cleanLineBidiStatus) |
| { |
| ASSERT(!layoutState.endLine()); |
| @@ -1763,6 +1767,8 @@ void LayoutBlockFlow::determineEndPosition(LineLayoutState& layoutState, RootInl |
| checkFloatsInCleanLine(curr, layoutState.floats(), floatIndex, encounteredNewFloat, dirtiedByFloat); |
| if (encounteredNewFloat) |
| return; |
| + if (lineBoxHasBRWithClearance(curr)) |
| + return; |
| } |
| if (curr->isDirty()) |
| last = nullptr; |
| @@ -1837,11 +1843,6 @@ bool LayoutBlockFlow::matchedEndLine(LineLayoutState& layoutState, const InlineB |
| if (resolver.status() != endLineStatus) |
| return false; |
| - // A trailing BR can be collapsed as it usually doesn't contribute to the height, |
| - // but if it has a clear style we need to force it to layout in the context of floats |
| - // to honor that style. |
| - if (layoutState.containsBRWithClear() && containsFloats()) |
| - return false; |
| return checkPaginationAndFloatsAtEndLine(layoutState); |
| } |