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 c3510f973e22afc515e8188f6e701bb74f3f47fb..dbe43e55d98ce7f5081325dd7a33a5d3a3ff5f49 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
@@ -2118,12 +2118,10 @@ void LayoutBlockFlow::adjustFloatingBlock(const MarginInfo& marginInfo) { |
// tested for by simply calling canCollapseWithMarginBefore. See |
// http://www.hixie.ch/tests/adhoc/css/box/block/margin-collapse/046.html for |
// an example of this scenario. |
- LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() |
- ? LayoutUnit() |
- : marginInfo.margin(); |
- setLogicalHeight(logicalHeight() + marginOffset); |
- positionNewFloats(); |
- setLogicalHeight(logicalHeight() - marginOffset); |
+ LayoutUnit logicalTop = logicalHeight(); |
+ if (!marginInfo.canCollapseWithMarginBefore()) |
+ logicalTop += marginInfo.margin(); |
+ positionNewFloats(logicalTop); |
} |
void LayoutBlockFlow::handleAfterSideOfBlock(LayoutBox* lastChild, |
@@ -3340,7 +3338,7 @@ void LayoutBlockFlow::childBecameNonInline(LayoutObject*) { |
} |
void LayoutBlockFlow::clearFloats(EClear clear) { |
- positionNewFloats(); |
+ positionNewFloats(logicalHeight()); |
// set y position |
LayoutUnit newY; |
switch (clear) { |
@@ -3592,7 +3590,8 @@ void LayoutBlockFlow::removeFloatingObjectsBelow(FloatingObject* lastFloat, |
} |
} |
-bool LayoutBlockFlow::positionNewFloats(LineWidth* width) { |
+bool LayoutBlockFlow::positionNewFloats(LayoutUnit logicalTop, |
+ LineWidth* width) { |
if (!m_floatingObjects) |
return false; |
@@ -3620,8 +3619,6 @@ bool LayoutBlockFlow::positionNewFloats(LineWidth* width) { |
} |
} |
- LayoutUnit logicalTop = logicalHeight(); |
- |
// The float cannot start above the top position of the last positioned float. |
if (lastPlacedFloatingObject) |
logicalTop = |