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

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

Issue 2553923003: Never position a float after it has been placed. (Closed)
Patch Set: Check for floatingObject->isPlaced() instead. Created 4 years 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/LayoutBlockFlow.cpp ('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 75cb21f4da3fb17f7bf03bf87dcbe8cd16b8b63e..b6c82dd1f598bd511b99f3c9c8a4a245758a5ed7 100644
--- a/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
+++ b/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
@@ -492,8 +492,14 @@ inline void BreakingContext::handleFloat() {
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());
+ // whether it's going to fit on the line. That means that we need to
+ // position and lay it out. Note that we have to avoid positioning floats
+ // that have been placed prematurely: Sometimes, floats are inserted too
+ // early by skipTrailingWhitespace(), and later on they all get placed by
+ // the first float here in handleFloat(). Their position may then be wrong,
+ // but it's too late to do anything about that now. See crbug.com/671577
+ if (!floatingObject->isPlaced())
+ 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).
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698