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

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

Issue 1132103007: Remove obsolete float-management code from line layout (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 5 years, 5 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/core.gypi ('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 18c10cce7a561db99e71d25bfbf7224085246241..10fccd480b97973d8f1c7dd4506544f620fea671 100644
--- a/Source/core/layout/LayoutBlockFlowLine.cpp
+++ b/Source/core/layout/LayoutBlockFlowLine.cpp
@@ -38,7 +38,6 @@
#include "core/layout/line/LayoutTextInfo.h"
#include "core/layout/line/LineLayoutState.h"
#include "core/layout/line/LineWidth.h"
-#include "core/layout/line/TrailingFloatsRootInlineBox.h"
#include "core/layout/line/WordMeasurement.h"
#include "core/layout/svg/line/SVGRootInlineBox.h"
#include "platform/fonts/Character.h"
@@ -816,7 +815,6 @@ void LayoutBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState,
// Once BidiRunList is separated from BidiResolver this will not be needed.
resolver.runs().deleteRuns();
resolver.markCurrentRunEmpty(); // FIXME: This can probably be replaced by an ASSERT (or just removed).
- layoutState.setCheckForFloatsFromLastLine(true);
resolver.setPosition(InlineIterator(resolver.position().root(), 0, 0), 0);
break;
}
@@ -1012,7 +1010,7 @@ void LayoutBlockFlow::linkToEndLineIfNeeded(LineLayoutState& layoutState)
}
}
- if (m_floatingObjects && (layoutState.checkForFloatsFromLastLine() || positionNewFloats()) && lastRootBox()) {
+ if (positionNewFloats() && lastRootBox()) {
// In case we have a float on the last line, it might not be positioned up to now.
// This has to be done before adding in the bottom border/padding, or the float will
// include the padding incorrectly. -dwh
@@ -1030,22 +1028,6 @@ void LayoutBlockFlow::linkToEndLineIfNeeded(LineLayoutState& layoutState)
if (it == end)
return;
- if (layoutState.checkForFloatsFromLastLine()) {
- LayoutUnit bottomVisualOverflow = lastRootBox()->logicalBottomVisualOverflow();
- LayoutUnit bottomLayoutOverflow = lastRootBox()->logicalBottomLayoutOverflow();
- TrailingFloatsRootInlineBox* trailingFloatsLineBox = new TrailingFloatsRootInlineBox(*this);
- m_lineBoxes.appendLineBox(trailingFloatsLineBox);
- trailingFloatsLineBox->setConstructed();
- GlyphOverflowAndFallbackFontsMap textBoxDataMap;
- VerticalPositionCache verticalPositionCache;
- LayoutUnit blockLogicalHeight = logicalHeight();
- trailingFloatsLineBox->alignBoxesInBlockDirection(blockLogicalHeight, textBoxDataMap, verticalPositionCache);
- trailingFloatsLineBox->setLineTopBottomPositions(blockLogicalHeight, blockLogicalHeight, blockLogicalHeight, blockLogicalHeight);
- LayoutRect logicalLayoutOverflow(0, blockLogicalHeight, 1, bottomLayoutOverflow - blockLogicalHeight);
- LayoutRect logicalVisualOverflow(0, blockLogicalHeight, 1, bottomVisualOverflow - blockLogicalHeight);
- trailingFloatsLineBox->setOverflowFromLogicalRects(logicalLayoutOverflow, logicalVisualOverflow, trailingFloatsLineBox->lineTop(), trailingFloatsLineBox->lineBottom());
- }
-
for (; it != end; ++it)
appendFloatingObjectToLastLine(*it->get());
}
@@ -1546,6 +1528,7 @@ void LayoutBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& pa
// deleted and only dirtied. In that case, we can layout the replaced
// elements at the same time.
Vector<LayoutBox*> replacedChildren;
+ LayoutObject* lastChild = nullptr;
for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) {
LayoutObject* o = walker.current();
@@ -1580,7 +1563,13 @@ void LayoutBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& pa
dirtyLineBoxesForObject(o, layoutState.isFullLayout());
o->clearNeedsLayout();
}
+ if (!o->isText() || !toLayoutText(o)->isAllCollapsibleWhitespace())
+ lastChild = o;
}
+ // If there is a trailing float on the line that will possibly occur after a natural line break
+ // then dirty its adjacent lineboxes to ensure it gets placed.
leviw_travelin_and_unemployed 2015/07/28 18:25:38 If it's the last child and a float, will we ever b
rhogan 2015/07/28 19:10:37 The one it's on and possibly the one before it. Th
+ if (lastChild && lastChild->isFloating())
+ dirtyLinesFromChangedChild(lastChild);
leviw_travelin_and_unemployed 2015/07/28 18:25:38 Where did we dirty these lines before?
rhogan 2015/07/28 19:10:37 We didn't. Instead we added a new line box at the
for (size_t i = 0; i < replacedChildren.size(); i++)
replacedChildren[i]->layoutIfNeeded();
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/layout/line/LineLayoutState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698