Title: [156075] trunk
Revision
156075
Author
bjone...@adobe.com
Date
2013-09-18 18:31:11 -0700 (Wed, 18 Sep 2013)

Log Message

REGRESSION (r155854 - r155967) block with margin-left adjacent to floated block causes text of subsequent blocks to overlap the floated block.
https://bugs.webkit.org/show_bug.cgi?id=121532

Reviewed by Andreas Kling.

Source/WebCore:

When refactoring the code, I ended up adding the margin in instead of
subtracting it in the case of an intruding float. This patch fixes
that so that the margin is properly handled.

Test: fast/block/float/intruding-float-sibling-with-margin.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::addIntrudingFloats):

LayoutTests:

* fast/block/float/intruding-float-sibling-with-margin-expected.html: Added.
* fast/block/float/intruding-float-sibling-with-margin.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (156074 => 156075)


--- trunk/LayoutTests/ChangeLog	2013-09-19 00:55:50 UTC (rev 156074)
+++ trunk/LayoutTests/ChangeLog	2013-09-19 01:31:11 UTC (rev 156075)
@@ -1,3 +1,13 @@
+2013-09-18  Bem Jones-Bey  <bjone...@adobe.com>
+
+        REGRESSION (r155854 - r155967) block with margin-left adjacent to floated block causes text of subsequent blocks to overlap the floated block.
+        https://bugs.webkit.org/show_bug.cgi?id=121532
+
+        Reviewed by Andreas Kling.
+
+        * fast/block/float/intruding-float-sibling-with-margin-expected.html: Added.
+        * fast/block/float/intruding-float-sibling-with-margin.html: Added.
+
 2013-09-18  Ryosuke Niwa  <rn...@webkit.org>
 
         Merge HTMLBodyElement::didNotifySubtreeInsertions into HTMLBodyElement::insertedInto

Added: trunk/LayoutTests/fast/block/float/intruding-float-sibling-with-margin-expected.html (0 => 156075)


--- trunk/LayoutTests/fast/block/float/intruding-float-sibling-with-margin-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/float/intruding-float-sibling-with-margin-expected.html	2013-09-19 01:31:11 UTC (rev 156075)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<style type="text/css">
+    #container {
+        font: 20px/1 Ahem;
+        line-height: 20px;
+        background-color: red;
+        width: 40px;
+        height: 40px;
+        color: green;
+    }
+    #float {
+        float: left;
+        width: 20px;
+        height: 40px;
+        background: green;
+    }
+</style>
+<body>
+    <p>You should see a single green square. You should not see any red.</p>
+    <div id="container">
+        <div id="float"></div>
+        <div id="text-margin">X</div>
+        <div id="text">X</div>
+    </div>
+</body>

Added: trunk/LayoutTests/fast/block/float/intruding-float-sibling-with-margin.html (0 => 156075)


--- trunk/LayoutTests/fast/block/float/intruding-float-sibling-with-margin.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/float/intruding-float-sibling-with-margin.html	2013-09-19 01:31:11 UTC (rev 156075)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<style type="text/css">
+    #container {
+        font: 20px/1 Ahem;
+        line-height: 20px;
+        background-color: red;
+        width: 40px;
+        height: 40px;
+        color: green;
+    }
+    #float {
+        float: left;
+        width: 20px;
+        height: 40px;
+        background: green;
+    }
+    #text-margin {
+        margin-left: 20px;
+    }
+</style>
+<body>
+    <p>You should see a single green square. You should not see any red.</p>
+    <div id="container">
+        <div id="float"></div>
+        <div id="text-margin">X</div>
+        <div id="text">X</div>
+    </div>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (156074 => 156075)


--- trunk/Source/WebCore/ChangeLog	2013-09-19 00:55:50 UTC (rev 156074)
+++ trunk/Source/WebCore/ChangeLog	2013-09-19 01:31:11 UTC (rev 156075)
@@ -1,3 +1,19 @@
+2013-09-18  Bem Jones-Bey  <bjone...@adobe.com>
+
+        REGRESSION (r155854 - r155967) block with margin-left adjacent to floated block causes text of subsequent blocks to overlap the floated block.
+        https://bugs.webkit.org/show_bug.cgi?id=121532
+
+        Reviewed by Andreas Kling.
+
+        When refactoring the code, I ended up adding the margin in instead of
+        subtracting it in the case of an intruding float. This patch fixes
+        that so that the margin is properly handled.
+
+        Test: fast/block/float/intruding-float-sibling-with-margin.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::addIntrudingFloats):
+
 2013-09-18  Ryosuke Niwa  <rn...@webkit.org>
 
         Merge HTMLBodyElement::didNotifySubtreeInsertions into HTMLBodyElement::insertedInto

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (156074 => 156075)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2013-09-19 00:55:50 UTC (rev 156074)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2013-09-19 01:31:11 UTC (rev 156075)
@@ -3887,8 +3887,8 @@
                 // into account.  Only apply this code if prev is the parent, since otherwise the left margin
                 // will get applied twice.
                 LayoutSize offset = isHorizontalWritingMode()
-                    ? LayoutSize(logicalLeftOffset + (prev != parent() ? prev->marginLeft() : LayoutUnit()), logicalTopOffset)
-                    : LayoutSize(logicalTopOffset, logicalLeftOffset + (prev != parent() ? prev->marginTop() : LayoutUnit()));
+                    ? LayoutSize(logicalLeftOffset - (prev != parent() ? prev->marginLeft() : LayoutUnit()), logicalTopOffset)
+                    : LayoutSize(logicalTopOffset, logicalLeftOffset - (prev != parent() ? prev->marginTop() : LayoutUnit()));
 
                 m_floatingObjects->add(r->copyToNewContainer(offset));
             }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to