Title: [140447] branches/chromium/1364
Revision
140447
Author
t...@chromium.org
Date
2013-01-22 12:03:44 -0800 (Tue, 22 Jan 2013)

Log Message

Merge r139337 to M25.

  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.

TBR=t...@chromium.org
Review URL: https://codereview.chromium.org/12039022

Modified Paths

Added Paths

Diff

Modified: branches/chromium/1364/LayoutTests/ChangeLog (140446 => 140447)


--- branches/chromium/1364/LayoutTests/ChangeLog	2013-01-22 19:55:01 UTC (rev 140446)
+++ branches/chromium/1364/LayoutTests/ChangeLog	2013-01-22 20:03:44 UTC (rev 140447)
@@ -1,3 +1,13 @@
+2013-01-10  Robert Hogan  <rob...@webkit.org>
+
+        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-09  Tien-Ren Chen  <trc...@chromium.org>
 
         Make caret repainting container-aware

Copied: branches/chromium/1364/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child-expected.txt (from rev 139337, trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child-expected.txt) (0 => 140447)


--- branches/chromium/1364/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child-expected.txt	                        (rev 0)
+++ branches/chromium/1364/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child-expected.txt	2013-01-22 20:03:44 UTC (rev 140447)
@@ -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

Copied: branches/chromium/1364/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child.html (from rev 139337, trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child.html) (0 => 140447)


--- branches/chromium/1364/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child.html	                        (rev 0)
+++ branches/chromium/1364/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-and-float-child.html	2013-01-22 20:03:44 UTC (rev 140447)
@@ -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: branches/chromium/1364/Source/WebCore/ChangeLog (140446 => 140447)


--- branches/chromium/1364/Source/WebCore/ChangeLog	2013-01-22 19:55:01 UTC (rev 140446)
+++ branches/chromium/1364/Source/WebCore/ChangeLog	2013-01-22 20:03:44 UTC (rev 140447)
@@ -1,3 +1,19 @@
+2013-01-10  Robert Hogan  <rob...@webkit.org>
+
+        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-09  Tien-Ren Chen  <trc...@chromium.org>
 
         Make caret repainting container-aware

Modified: branches/chromium/1364/Source/WebCore/rendering/RenderBlockLineLayout.cpp (140446 => 140447)


--- branches/chromium/1364/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-01-22 19:55:01 UTC (rev 140446)
+++ branches/chromium/1364/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-01-22 20:03:44 UTC (rev 140447)
@@ -2283,7 +2283,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
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to