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

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, 7 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 924b1d52140ee051dd94115e57b832038eeab219..18b73082d16c09c4e3ae804715f25c042536855b 100644
--- a/Source/core/layout/LayoutBlockFlowLine.cpp
+++ b/Source/core/layout/LayoutBlockFlowLine.cpp
@@ -756,22 +756,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());
@@ -897,10 +881,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();
@@ -1636,6 +1619,7 @@ RootInlineBox* LayoutBlockFlow::determineStartPosition(LineLayoutState& layoutSt
{
RootInlineBox* curr = 0;
RootInlineBox* last = 0;
+ RootInlineBox* lineBoxWithBreakAndClearance = 0;
leviw_travelin_and_unemployed 2015/06/08 20:12:35 Maybe firstLineBoxWithBreakAndClearance?
// FIXME: This entire float-checking block needs to be broken into a new function.
bool dirtiedByFloat = false;
@@ -1660,6 +1644,15 @@ 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 (!lineBoxWithBreakAndClearance && curr->endsWithBreak()) {
+ if (InlineBox* lastLeafChild = curr->lastLeafChild()) {
+ LayoutObject* lastObject = style()->isLeftToRightDirection() ? &lastLeafChild->layoutObject() : &curr->firstLeafChild()->layoutObject();
leviw_travelin_and_unemployed 2015/06/08 20:12:35 You shouldn't always traverse the first and last l
+ if (lastObject->isBR() && lastObject->style()->clear() != CNONE)
leviw_travelin_and_unemployed 2015/06/02 22:10:44 This seems similar to what https://blink.lc/blink/
+ lineBoxWithBreakAndClearance = 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);
@@ -1692,6 +1685,8 @@ RootInlineBox* LayoutBlockFlow::determineStartPosition(LineLayoutState& layoutSt
}
ASSERT(!firstLineBox() && !lastLineBox());
} else {
+ if (lineBoxWithBreakAndClearance)
+ curr = lineBoxWithBreakAndClearance;
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