Index: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
index b0e66841315b3cea38a413ce8e4550d05a91175b..d09bfd46d03a16484f774bccc03d8788232e20d6 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
@@ -691,7 +691,6 @@ void LayoutBlockFlow::MarkDescendantsWithFloatsForLayoutIfNeeded( |
// mark it for layout. |
LayoutUnit lowest_float = |
std::max(previous_float_logical_bottom, LowestFloatLogicalBottom()); |
- lowest_float = std::max(lowest_float, child.LowestFloatLogicalBottom()); |
if (lowest_float > new_logical_top) |
mark_descendants_with_floats = true; |
} |
@@ -3717,6 +3716,7 @@ LayoutUnit LayoutBlockFlow::PositionAndLayoutFloat( |
} |
} |
+ LayoutUnit old_logical_top = child.LogicalTop(); |
if (child.NeedsLayout()) { |
if (is_paginated) { |
// Before we can lay out the float, we need to estimate a position for |
@@ -3766,6 +3766,17 @@ LayoutUnit LayoutBlockFlow::PositionAndLayoutFloat( |
MarkChildForPaginationRelayoutIfNeeded(child, layout_scope); |
child.LayoutIfNeeded(); |
+ // If negative margin pushes the child completely out of its old position |
+ // mark for layout siblings that may have it in its float lists. |
+ if (child.LogicalBottom() <= old_logical_top) { |
+ LayoutObject* next = child.NextSibling(); |
+ if (next && next->IsLayoutBlockFlow()) { |
+ LayoutBlockFlow* nextBlock = ToLayoutBlockFlow(next); |
+ if (!nextBlock->AvoidsFloats() || nextBlock->ShrinkToAvoidFloats()) |
+ nextBlock->MarkAllDescendantsWithFloatsForLayout(); |
+ } |
+ } |
+ |
if (is_paginated) { |
PaginatedContentWasLaidOut(child.LogicalBottom()); |