Title: [223396] releases/WebKitGTK/webkit-2.18
Revision
223396
Author
carlo...@webkit.org
Date
2017-10-16 05:59:32 -0700 (Mon, 16 Oct 2017)

Log Message

Merge r222321 - In regular block layout, the width of a child's margin box should always be equal to that of its containing block
Merge from Blink https://bugs.chromium.org/p/chromium/issues/detail?id=708751
https://bugs.webkit.org/show_bug.cgi?id=176620

Patch by Zhifei FANG <facetothef...@gmail.com> on 2017-09-21
Reviewed by Zalan Bujtas.

Source/WebCore:

Test: fast/block/over-constrained-auto-margin.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeLogicalWidthInRegion const):

LayoutTests:

* fast/block/over-constrained-auto-margin-expected.txt: Added.
* fast/block/over-constrained-auto-margin.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.18/LayoutTests/ChangeLog (223395 => 223396)


--- releases/WebKitGTK/webkit-2.18/LayoutTests/ChangeLog	2017-10-16 12:56:26 UTC (rev 223395)
+++ releases/WebKitGTK/webkit-2.18/LayoutTests/ChangeLog	2017-10-16 12:59:32 UTC (rev 223396)
@@ -1,3 +1,14 @@
+2017-09-21  Zhifei FANG  <facetothef...@gmail.com>
+
+        In regular block layout, the width of a child's margin box should always be equal to that of its containing block
+        Merge from Blink https://bugs.chromium.org/p/chromium/issues/detail?id=708751
+        https://bugs.webkit.org/show_bug.cgi?id=176620
+
+        Reviewed by Zalan Bujtas.
+
+        * fast/block/over-constrained-auto-margin-expected.txt: Added.
+        * fast/block/over-constrained-auto-margin.html: Added.
+
 2017-09-20  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         REGRESSION(r191731): SVGPatternElement can only reference another SVGPatternElement in the same SVG document

Added: releases/WebKitGTK/webkit-2.18/LayoutTests/fast/block/over-constrained-auto-margin-expected.txt (0 => 223396)


--- releases/WebKitGTK/webkit-2.18/LayoutTests/fast/block/over-constrained-auto-margin-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.18/LayoutTests/fast/block/over-constrained-auto-margin-expected.txt	2017-10-16 12:59:32 UTC (rev 223396)
@@ -0,0 +1,3 @@
+PASS getComputedStyle(target1).marginRight is '-116px'
+PASS getComputedStyle(target2).marginLeft is '-116px'
+

Added: releases/WebKitGTK/webkit-2.18/LayoutTests/fast/block/over-constrained-auto-margin.html (0 => 223396)


--- releases/WebKitGTK/webkit-2.18/LayoutTests/fast/block/over-constrained-auto-margin.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.18/LayoutTests/fast/block/over-constrained-auto-margin.html	2017-10-16 12:59:32 UTC (rev 223396)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src=""
+    </head>
+    <body>
+        <div id="wrapper">
+            <div style="width: 400px; border: 3px solid black;">
+                <div id="target1" style="
+                    margin-left: 10px; width: 500px; border: 3px solid gray; 
+                    margin-right: auto;">
+                </div>
+            </div>
+            <div style="width: 400px; border: 3px solid black; direction: rtl;">
+                <div id="target2" style="
+                    margin-right: 10px; width: 500px; border: 3px solid gray; 
+                    margin-left: auto; ">
+                </div>
+            </div>
+        </div>
+        <script>
+            shouldBe("getComputedStyle(target1).marginRight", "'-116px'");
+            shouldBe("getComputedStyle(target2).marginLeft", "'-116px'");
+        </script>
+        <div id="console"></div>
+    </body>
+</html>
\ No newline at end of file

Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog (223395 => 223396)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog	2017-10-16 12:56:26 UTC (rev 223395)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog	2017-10-16 12:59:32 UTC (rev 223396)
@@ -1,3 +1,16 @@
+2017-09-21  Zhifei FANG  <facetothef...@gmail.com>
+
+        In regular block layout, the width of a child's margin box should always be equal to that of its containing block
+        Merge from Blink https://bugs.chromium.org/p/chromium/issues/detail?id=708751
+        https://bugs.webkit.org/show_bug.cgi?id=176620
+
+        Reviewed by Zalan Bujtas.
+
+        Test: fast/block/over-constrained-auto-margin.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeLogicalWidthInRegion const):
+
 2017-09-20  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         REGRESSION(r191731): SVGPatternElement can only reference another SVGPatternElement in the same SVG document

Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/rendering/RenderBox.cpp (223395 => 223396)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/rendering/RenderBox.cpp	2017-10-16 12:56:26 UTC (rev 223395)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/rendering/RenderBox.cpp	2017-10-16 12:59:32 UTC (rev 223396)
@@ -2445,12 +2445,12 @@
 #endif
         && !cb.isRenderGrid()
         ) {
-        LayoutUnit newMargin = containerLogicalWidth - computedValues.m_extent - cb.marginStartForChild(*this);
+        LayoutUnit newMarginTotal = containerLogicalWidth - computedValues.m_extent;
         bool hasInvertedDirection = cb.style().isLeftToRightDirection() != style().isLeftToRightDirection();
         if (hasInvertedDirection)
-            computedValues.m_margins.m_start = newMargin;
+            computedValues.m_margins.m_start = newMarginTotal - computedValues.m_margins.m_end;
         else
-            computedValues.m_margins.m_end = newMargin;
+            computedValues.m_margins.m_end = newMarginTotal - computedValues.m_margins.m_start;
     }
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to