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

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

Issue 1168733002: Refactor how we handle BRs with clearance (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 | « Source/core/layout/LayoutBlockFlow.h ('k') | Source/core/layout/line/LineLayoutState.h » ('j') | 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 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);
}
« no previous file with comments | « Source/core/layout/LayoutBlockFlow.h ('k') | Source/core/layout/line/LineLayoutState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698