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

Unified Diff: third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h

Issue 2532573003: Position a float before laying it out. (Closed)
Patch Set: Created 4 years, 1 month 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 | « third_party/WebKit/Source/core/layout/api/LineLayoutBlockFlow.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
diff --git a/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h b/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
index f04a2cc4d56461dba40e0e9399a9b9cb35bbfff9..0fd887de415fcd81babe4bd497cdfc590ad8ee62 100644
--- a/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
+++ b/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
@@ -488,21 +488,27 @@ inline void BreakingContext::handleOutOfFlowPositioned(
inline void BreakingContext::handleFloat() {
LineLayoutBox floatBox(m_current.getLineLayoutItem());
FloatingObject* floatingObject = m_block.insertFloatingObject(floatBox);
- // Check if it fits in the current line; if it does, position it now,
- // otherwise, position it after moving to next line (in newLine() func).
- // FIXME: Bug 110372: Properly position multiple stacked floats with
- // non-rectangular shape outside.
- if (m_floatsFitOnLine &&
- m_width.fitsOnLine(
- m_block.logicalWidthForFloat(*floatingObject).toFloat(),
- ExcludeWhitespace)) {
- m_block.placeNewFloats(m_block.logicalHeight(), &m_width);
- if (m_lineBreak.getLineLayoutItem() == m_current.getLineLayoutItem()) {
- ASSERT(!m_lineBreak.offset());
- m_lineBreak.increment();
+
+ if (m_floatsFitOnLine) {
+ // We need to calculate the logical width of the float before we can tell
+ // whether it's going to fit on the line.
+ m_block.positionAndLayoutFloat(*floatingObject, m_block.logicalHeight());
+
+ // Check if it fits in the current line; if it does, place it now,
+ // otherwise, place it after moving to next line (in newLine() func).
+ // FIXME: Bug 110372: Properly position multiple stacked floats with
+ // non-rectangular shape outside.
+ if (m_width.fitsOnLine(
+ m_block.logicalWidthForFloat(*floatingObject).toFloat(),
+ ExcludeWhitespace)) {
+ m_block.placeNewFloats(m_block.logicalHeight(), &m_width);
+ if (m_lineBreak.getLineLayoutItem() == m_current.getLineLayoutItem()) {
+ DCHECK(!m_lineBreak.offset());
+ m_lineBreak.increment();
+ }
+ } else {
+ m_floatsFitOnLine = false;
}
- } else {
- m_floatsFitOnLine = false;
}
// Update prior line break context characters, using U+FFFD (OBJECT
// REPLACEMENT CHARACTER) for floating element.
« no previous file with comments | « third_party/WebKit/Source/core/layout/api/LineLayoutBlockFlow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698