Title: [139337] trunk
Revision
139337
Author
[email protected]
Date
2013-01-10 10:39:17 -0800 (Thu, 10 Jan 2013)

Log Message

REGRESSION(r136967): margin-top + overflow:hidden causes incorrect layout for internal floated elements
https://bugs.webkit.org/show_bug.cgi?id=106374

Reviewed by David Hyatt.

Source/WebCore:

r136397 treated any self-collapsing block that had a clearance delta as though it was clearing a float, but
blocks that avoid floats can get a clearance delta too. So just ensure there is clearance on the block when deciding
whether we need to add the margin back in before placing the float.

Test: fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child.html

* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::LineBreaker::skipLeadingWhitespace):

LayoutTests:

* fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child-expected.txt: Added.
* fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (139336 => 139337)


--- trunk/LayoutTests/ChangeLog	2013-01-10 18:39:13 UTC (rev 139336)
+++ trunk/LayoutTests/ChangeLog	2013-01-10 18:39:17 UTC (rev 139337)
@@ -1,3 +1,13 @@
+2013-01-10  Robert Hogan  <[email protected]>
+
+        REGRESSION(r136967): margin-top + overflow:hidden causes incorrect layout for internal floated elements
+        https://bugs.webkit.org/show_bug.cgi?id=106374
+
+        Reviewed by David Hyatt.
+
+        * fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child-expected.txt: Added.
+        * fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child.html: Added.
+
 2013-01-10  Dimitri Glazkov  <[email protected]>
 
         [Chromium] Update expectations for fast/regions/selecting-text-through-different-region-flows.html.

Added: trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child-expected.txt (0 => 139337)


--- trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child-expected.txt	2013-01-10 18:39:17 UTC (rev 139337)
@@ -0,0 +1,3 @@
+https://bugs.webkit.org/show_bug.cgi?id=106374: The top of the two white boxes below should be aligned.
+
+PASSED

Added: trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child.html (0 => 139337)


--- trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child.html	2013-01-10 18:39:17 UTC (rev 139337)
@@ -0,0 +1,34 @@
+<!DOCTYPE html5>
+<html>
+<style>
+.outside {  
+  margin-top: 20px;
+  overflow: hidden;
+  background: #ddd;
+}
+
+.inside {
+  float: left;
+  background: #fff;
+  width: 100px;
+  height: 100px;
+  margin: 10px;
+}
+</style>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+</script>
+<p> https://bugs.webkit.org/show_bug.cgi?id=106374: The top of the two white boxes below should be aligned. </p>
+<div class="outside">
+    <div id="first" class="inside"></div>
+    <div id="second" class="inside"></div>
+</div>
+<div id="console"></div>
+<script>
+    if (document.getElementById("first").offsetTop == document.getElementById("second").offsetTop)
+        document.getElementById("console").innerText = "PASSED";
+    else
+        document.getElementById("console").innerText = "FAILED";
+</script>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (139336 => 139337)


--- trunk/Source/WebCore/ChangeLog	2013-01-10 18:39:13 UTC (rev 139336)
+++ trunk/Source/WebCore/ChangeLog	2013-01-10 18:39:17 UTC (rev 139337)
@@ -1,3 +1,19 @@
+2013-01-10  Robert Hogan  <[email protected]>
+
+        REGRESSION(r136967): margin-top + overflow:hidden causes incorrect layout for internal floated elements
+        https://bugs.webkit.org/show_bug.cgi?id=106374
+
+        Reviewed by David Hyatt.
+
+        r136397 treated any self-collapsing block that had a clearance delta as though it was clearing a float, but
+        blocks that avoid floats can get a clearance delta too. So just ensure there is clearance on the block when deciding
+        whether we need to add the margin back in before placing the float.
+
+        Test: fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child.html
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlock::LineBreaker::skipLeadingWhitespace):
+
 2013-01-10  Alexander Pavlov  <[email protected]>
 
         Web Inspector: Color picker in Styles pane shows wrong initial color

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (139336 => 139337)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-01-10 18:39:13 UTC (rev 139336)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-01-10 18:39:17 UTC (rev 139337)
@@ -2284,7 +2284,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 child float at the top content edge of the self-collapsing block add the margin back in before placement.
-            LayoutUnit marginOffset = (m_block->isSelfCollapsingBlock() && m_block->getClearDelta(m_block, LayoutUnit())) ? m_block->collapsedMarginBeforeForChild(m_block) : LayoutUnit();
+            LayoutUnit marginOffset = (m_block->isSelfCollapsingBlock() && m_block->style()->clear() && m_block->getClearDelta(m_block, LayoutUnit())) ? m_block->collapsedMarginBeforeForChild(m_block) : LayoutUnit();
             LayoutUnit oldLogicalHeight = m_block->logicalHeight();
             m_block->setLogicalHeight(oldLogicalHeight + marginOffset);
             m_block->positionNewFloatOnLine(m_block->insertFloatingObject(toRenderBox(object)), lastFloatFromPreviousLine, lineInfo, width);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to