Title: [136967] trunk
Revision
136967
Author
[email protected]
Date
2012-12-07 11:30:51 -0800 (Fri, 07 Dec 2012)

Log Message

REGRESSION(r127163): Content is offset to the right at rea.ru
https://bugs.webkit.org/show_bug.cgi?id=103116

Reviewed by David Hyatt.

Source/WebCore:

The top margin edge of a self-collapsing block that clears a float intrudes up into it by the height of the margin,
so to ensure any child floats of the self-collapsing block only go as far as the top content edge
add the margin back in to the block's current height before placing them.

Tests: fast/block/margin-collapse/self-collapsing-block-with-float-child-collapsed-margins.html
       fast/block/margin-collapse/self-collapsing-block-with-float-child.html

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

LayoutTests:

* fast/block/margin-collapse/self-collapsing-block-with-float-child-collapsed-margins-expected.html: Added.
* fast/block/margin-collapse/self-collapsing-block-with-float-child-collapsed-margins.html: Added.
* fast/block/margin-collapse/self-collapsing-block-with-float-child-expected.html: Added.
* fast/block/margin-collapse/self-collapsing-block-with-float-child.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (136966 => 136967)


--- trunk/LayoutTests/ChangeLog	2012-12-07 19:23:52 UTC (rev 136966)
+++ trunk/LayoutTests/ChangeLog	2012-12-07 19:30:51 UTC (rev 136967)
@@ -1,3 +1,15 @@
+2012-12-07  Robert Hogan  <[email protected]>
+
+        REGRESSION(r127163): Content is offset to the right at rea.ru
+        https://bugs.webkit.org/show_bug.cgi?id=103116
+
+        Reviewed by David Hyatt.
+
+        * fast/block/margin-collapse/self-collapsing-block-with-float-child-collapsed-margins-expected.html: Added.
+        * fast/block/margin-collapse/self-collapsing-block-with-float-child-collapsed-margins.html: Added.
+        * fast/block/margin-collapse/self-collapsing-block-with-float-child-expected.html: Added.
+        * fast/block/margin-collapse/self-collapsing-block-with-float-child.html: Added.
+
 2012-12-07  Mike West  <[email protected]>
 
         fast/frames/sandboxed-iframe-scripting.html contains very misleading comments.

Added: trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-child-collapsed-margins-expected.html (0 => 136967)


--- trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-child-collapsed-margins-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-child-collapsed-margins-expected.html	2012-12-07 19:30:51 UTC (rev 136967)
@@ -0,0 +1,8 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<body>
+<p>The blue box should be stacked on top the black box.</p>
+<!-- https://bugs.webkit.org/show_bug.cgi?id=103116 -->
+<div style="height: 20px; width:20px; background: blue;"></div>
+<div style="height: 20px; width:20px; background: black;"></div>
+</body>

Added: trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-child-collapsed-margins.html (0 => 136967)


--- trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-child-collapsed-margins.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-child-collapsed-margins.html	2012-12-07 19:30:51 UTC (rev 136967)
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<body>
+<p>The blue box should be stacked on top the black box.</p>
+<!-- https://bugs.webkit.org/show_bug.cgi?id=103116 -->
+<div style="height: 20px; width:20px; float:left; background: blue;"></div>
+<div style="margin-top:5px; margin-bottom: 20px; clear:both;">
+    <div style="height: 20px; width:20px; float:left; background: black;"></div>
+</div>
+</body>

Added: trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-child-expected.html (0 => 136967)


--- trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-child-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-child-expected.html	2012-12-07 19:30:51 UTC (rev 136967)
@@ -0,0 +1,8 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<body>
+<p>The blue box should be stacked on top the black box.</p>
+<!-- https://bugs.webkit.org/show_bug.cgi?id=103116 -->
+<div style="height: 20px; width:20px; background: blue;"></div>
+<div style="height: 20px; width:20px; background: black;"></div>
+</body>

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


--- trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-child.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-child.html	2012-12-07 19:30:51 UTC (rev 136967)
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<body>
+<p>The blue box should be stacked on top the black box.</p>
+<!-- https://bugs.webkit.org/show_bug.cgi?id=103116 -->
+<div style="height: 20px; width:20px; float:left; background: blue;"></div>
+<div style="margin-top:10px; clear:both;">
+    <div style="height: 20px; width:20px; float:left; background: black;"></div>
+</div>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (136966 => 136967)


--- trunk/Source/WebCore/ChangeLog	2012-12-07 19:23:52 UTC (rev 136966)
+++ trunk/Source/WebCore/ChangeLog	2012-12-07 19:30:51 UTC (rev 136967)
@@ -1,3 +1,20 @@
+2012-12-07  Robert Hogan  <[email protected]>
+
+        REGRESSION(r127163): Content is offset to the right at rea.ru
+        https://bugs.webkit.org/show_bug.cgi?id=103116
+
+        Reviewed by David Hyatt.
+
+        The top margin edge of a self-collapsing block that clears a float intrudes up into it by the height of the margin,
+        so to ensure any child floats of the self-collapsing block only go as far as the top content edge 
+        add the margin back in to the block's current height before placing them.
+
+        Tests: fast/block/margin-collapse/self-collapsing-block-with-float-child-collapsed-margins.html
+               fast/block/margin-collapse/self-collapsing-block-with-float-child.html
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlock::LineBreaker::skipLeadingWhitespace):
+
 2012-12-07  Alexis Menard  <[email protected]>
 
         Improve r136754 by hardening checks of expected values for background-position.

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (136966 => 136967)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2012-12-07 19:23:52 UTC (rev 136966)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2012-12-07 19:30:51 UTC (rev 136967)
@@ -2213,9 +2213,15 @@
                 resolver.runs().addRun(createRun(0, 1, object, resolver));
                 lineInfo.incrementRunsFromLeadingWhitespace();
             }
-        } else if (object->isFloating())
+        } 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 oldLogicalHeight = m_block->logicalHeight();
+            m_block->setLogicalHeight(oldLogicalHeight + marginOffset);
             m_block->positionNewFloatOnLine(m_block->insertFloatingObject(toRenderBox(object)), lastFloatFromPreviousLine, lineInfo, width);
-        else if (object->isText() && object->style()->hasTextCombine() && object->isCombineText() && !toRenderCombineText(object)->isCombined()) {
+            m_block->setLogicalHeight(oldLogicalHeight);
+        } else if (object->isText() && object->style()->hasTextCombine() && object->isCombineText() && !toRenderCombineText(object)->isCombined()) {
             toRenderCombineText(object)->combineText();
             if (toRenderCombineText(object)->isCombined())
                 continue;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to