Diff
Modified: trunk/LayoutTests/ChangeLog (154398 => 154399)
--- trunk/LayoutTests/ChangeLog 2013-08-21 17:36:19 UTC (rev 154398)
+++ trunk/LayoutTests/ChangeLog 2013-08-21 18:03:06 UTC (rev 154399)
@@ -1,3 +1,13 @@
+2013-08-21 Robert Hogan <[email protected]>
+
+ REGRESSION(r127163): Respect clearance set on ancestors when placing floats
+ https://bugs.webkit.org/show_bug.cgi?id=119979
+
+ Reviewed by David Hyatt.
+
+ * fast/block/margin-collapse/self-collapsing-block-with-float-descendant-expected.html: Added.
+ * fast/block/margin-collapse/self-collapsing-block-with-float-descendant.html: Added.
+
2013-08-21 Brent Fulgham <[email protected]>
[Windows] Unreviewed gardening. One more CSS_IMAGE_SET test can be activated.
Added: trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-descendant-expected.html (0 => 154399)
--- trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-descendant-expected.html (rev 0)
+++ trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-descendant-expected.html 2013-08-21 18:03:06 UTC (rev 154399)
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+ <body>
+ <p> webkit.org/b/119979: The green box should be under the blue box. </p>
+ <div style="height: 20px; width 50px; background-color: blue; float:left;">
+ Text1
+ </div>
+ <div style="margin-top:10px;clear:both;">
+ <div style="height:20px; width: 50px; float: left; background-color: green;">
+ Text2
+ </div>
+ </div>
+
+ </body>
+</html>
+
Added: trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-descendant.html (0 => 154399)
--- trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-descendant.html (rev 0)
+++ trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-descendant.html 2013-08-21 18:03:06 UTC (rev 154399)
@@ -0,0 +1,18 @@
+<!doctype html>
+<html>
+ <body>
+ <p> webkit.org/b/119979: The green box should be under the blue box. </p>
+ <div style="height: 20px; width 50px; background-color: blue; float:left;">
+ Text1
+ </div>
+ <div style="margin-top:10px;clear:both;">
+ <div>
+ <div style="height:20px; width: 50px; float: left; background-color: green;">
+ Text2
+ </div>
+ </div>
+ </div>
+
+ </body>
+</html>
+
Modified: trunk/Source/WebCore/ChangeLog (154398 => 154399)
--- trunk/Source/WebCore/ChangeLog 2013-08-21 17:36:19 UTC (rev 154398)
+++ trunk/Source/WebCore/ChangeLog 2013-08-21 18:03:06 UTC (rev 154399)
@@ -1,3 +1,23 @@
+2013-08-21 Robert Hogan <[email protected]>
+
+ REGRESSION(r127163): Respect clearance set on ancestors when placing floats
+ https://bugs.webkit.org/show_bug.cgi?id=119979
+
+ Reviewed by David Hyatt.
+
+ If a float has a self-collapsing ancestor with clearance then it needs to respect
+ that clearance when placing itself on the line.
+
+ Test: fast/block/margin-collapse/self-collapsing-block-with-float-descendant.html
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::marginOffsetForSelfCollapsingBlock):
+ * rendering/RenderBlock.h:
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlock::LineBreaker::skipLeadingWhitespace):
+ * rendering/RenderBox.h:
+ (WebCore::RenderBox::previousInFlowSiblingBox):
+
2013-08-21 Brent Fulgham <[email protected]>
<https://webkit.org/b/120113> [Windows] Enable CSS_IMAGE_SET
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (154398 => 154399)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2013-08-21 17:36:19 UTC (rev 154398)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2013-08-21 18:03:06 UTC (rev 154399)
@@ -2300,6 +2300,19 @@
return logicalTop;
}
+LayoutUnit RenderBlock::marginOffsetForSelfCollapsingBlock()
+{
+ RenderBlock* current = this;
+ while (current) {
+ if (current->isSelfCollapsingBlock() && current->style()->clear() && current->getClearDelta(current, LayoutUnit()))
+ return current->collapsedMarginBeforeForChild(current);
+ if (current->previousInFlowSiblingBox() || !current->parent() || !current->parent()->isRenderBlock())
+ return LayoutUnit();
+ current = toRenderBlock(current->parent());
+ }
+ return LayoutUnit();
+}
+
void RenderBlock::marginBeforeEstimateForChild(RenderBox* child, LayoutUnit& positiveMarginBefore, LayoutUnit& negativeMarginBefore, bool& discardMarginBefore) const
{
// Give up if in quirks mode and we're a body/table cell and the top margin of the child box is quirky.
Modified: trunk/Source/WebCore/rendering/RenderBlock.h (154398 => 154399)
--- trunk/Source/WebCore/rendering/RenderBlock.h 2013-08-21 17:36:19 UTC (rev 154398)
+++ trunk/Source/WebCore/rendering/RenderBlock.h 2013-08-21 18:03:06 UTC (rev 154399)
@@ -1110,6 +1110,7 @@
void marginBeforeEstimateForChild(RenderBox*, LayoutUnit&, LayoutUnit&, bool&) const;
void handleAfterSideOfBlock(LayoutUnit top, LayoutUnit bottom, MarginInfo&);
void setCollapsedBottomMargin(const MarginInfo&);
+ LayoutUnit marginOffsetForSelfCollapsingBlock();
// End helper functions and structs used by layoutBlockChildren.
// Helper function for layoutInlineChildren()
Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (154398 => 154399)
--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2013-08-21 17:36:19 UTC (rev 154398)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2013-08-21 18:03:06 UTC (rev 154399)
@@ -2596,7 +2596,7 @@
} else if (object->isFloating()) {
// The top margin edge of a self-collapsing block that clears a float intrudes up into it by the height of the margin,
// so in order to place this first child float at the top content edge of the self-collapsing block add the margin back in before placement.
- LayoutUnit marginOffset = (!object->previousSibling() && m_block->isSelfCollapsingBlock() && m_block->style()->clear() && m_block->getClearDelta(m_block, LayoutUnit())) ? m_block->collapsedMarginBeforeForChild(m_block) : LayoutUnit();
+ LayoutUnit marginOffset = !object->previousSibling() ? m_block->marginOffsetForSelfCollapsingBlock() : LayoutUnit();
LayoutUnit oldLogicalHeight = m_block->logicalHeight();
m_block->setLogicalHeight(oldLogicalHeight + marginOffset);
m_block->positionNewFloatOnLine(m_block->insertFloatingObject(toRenderBox(object)), lastFloatFromPreviousLine, lineInfo, width);
Modified: trunk/Source/WebCore/rendering/RenderBox.h (154398 => 154399)
--- trunk/Source/WebCore/rendering/RenderBox.h 2013-08-21 17:36:19 UTC (rev 154398)
+++ trunk/Source/WebCore/rendering/RenderBox.h 2013-08-21 18:03:06 UTC (rev 154399)
@@ -178,6 +178,13 @@
RenderBox* previousSiblingBox() const;
RenderBox* nextSiblingBox() const;
RenderBox* parentBox() const;
+ RenderBox* previousInFlowSiblingBox() const
+ {
+ RenderBox* current = previousSiblingBox();
+ while (current && current->isFloatingOrOutOfFlowPositioned())
+ current = current->previousSiblingBox();
+ return current;
+ }
// Visual and layout overflow are in the coordinate space of the box. This means that they aren't purely physical directions.
// For horizontal-tb and vertical-lr they will match physical directions, but for horizontal-bt and vertical-rl, the top/bottom and left/right