Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1389)

Unified Diff: Source/core/layout/LayoutBlockFlowLine.cpp

Issue 1156063002: Floats on an empty line should still get positioned. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/block/float/float-on-empty-line-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutBlockFlowLine.cpp
diff --git a/Source/core/layout/LayoutBlockFlowLine.cpp b/Source/core/layout/LayoutBlockFlowLine.cpp
index b7c194bda31ac346636ec498690024d39c6437e9..aaab3896c92b106cd938bbde5e9640730b34fbd8 100644
--- a/Source/core/layout/LayoutBlockFlowLine.cpp
+++ b/Source/core/layout/LayoutBlockFlowLine.cpp
@@ -746,22 +746,6 @@ void LayoutBlockFlow::layoutRunsAndFloats(LineLayoutState& layoutState)
deleteLineRange(layoutState, startLine);
}
- if (!layoutState.isFullLayout() && lastRootBox() && lastRootBox()->endsWithBreak()) {
- // If the last line before the start line ends with a line break that clear floats,
- // adjust the height accordingly.
- // A line break can be either the first or the last object on a line, depending on its direction.
- if (InlineBox* lastLeafChild = lastRootBox()->lastLeafChild()) {
- LayoutObject* lastObject = &lastLeafChild->layoutObject();
- if (!lastObject->isBR())
- lastObject = &lastRootBox()->firstLeafChild()->layoutObject();
- if (lastObject->isBR()) {
- EClear clear = lastObject->style()->clear();
- if (clear != CNONE)
- clearFloats(clear);
- }
- }
- }
-
layoutRunsAndFloatsInRange(layoutState, resolver, cleanLineStart, cleanLineBidiStatus);
linkToEndLineIfNeeded(layoutState);
markDirtyFloatsForPaintInvalidation(layoutState.floats());
@@ -888,10 +872,9 @@ void LayoutBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState,
for (size_t i = 0; i < lineBreaker.positionedObjects().size(); ++i)
setStaticPositions(this, lineBreaker.positionedObjects()[i]);
- if (!layoutState.lineInfo().isEmpty()) {
+ if (!layoutState.lineInfo().isEmpty())
layoutState.lineInfo().setFirstLine(false);
- clearFloats(lineBreaker.clear());
- }
+ clearFloats(lineBreaker.clear());
if (m_floatingObjects && lastRootBox()) {
const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
@@ -1646,6 +1629,7 @@ RootInlineBox* LayoutBlockFlow::determineStartPosition(LineLayoutState& layoutSt
{
RootInlineBox* curr = nullptr;
RootInlineBox* last = nullptr;
+ RootInlineBox* firstLineBoxWithBreakAndClearance = 0;
// FIXME: This entire float-checking block needs to be broken into a new function.
bool dirtiedByFloat = false;
@@ -1670,6 +1654,13 @@ 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 a new float has been inserted before this line or before its last known float, just do a full layout.
bool encounteredNewFloat = false;
checkFloatsInCleanLine(curr, layoutState.floats(), floatIndex, encounteredNewFloat, dirtiedByFloat);
@@ -1695,6 +1686,8 @@ RootInlineBox* LayoutBlockFlow::determineStartPosition(LineLayoutState& layoutSt
curr = nullptr;
ASSERT(!firstLineBox() && !lastLineBox());
} else {
+ if (firstLineBoxWithBreakAndClearance)
+ curr = firstLineBoxWithBreakAndClearance;
if (curr) {
// We have a dirty line.
if (RootInlineBox* prevRootBox = curr->prevRootBox()) {
« no previous file with comments | « LayoutTests/fast/block/float/float-on-empty-line-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698