Title: [282085] trunk
Revision
282085
Author
svil...@igalia.com
Date
2021-09-07 08:00:21 -0700 (Tue, 07 Sep 2021)

Log Message

Interoperability issue in margin collapsing with overflow:hidden elements
https://bugs.webkit.org/show_bug.cgi?id=224185

Reviewed by Alan Bujtas.

Source/WebCore:

Margins should not self collapse for those elements that create new formatting contexts
like when using overflow:hidden.

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

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::isSelfCollapsingBlock const): Boxes that create new formatting context should
not self collapse.

LayoutTests:

* TestExpectations: Unskipped 3 flexbox tests that are working fine now.
* fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-expected.html: Added.
* fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (282084 => 282085)


--- trunk/LayoutTests/ChangeLog	2021-09-07 14:32:47 UTC (rev 282084)
+++ trunk/LayoutTests/ChangeLog	2021-09-07 15:00:21 UTC (rev 282085)
@@ -1,3 +1,14 @@
+2021-08-26  Sergio Villar Senin  <svil...@igalia.com>
+
+        Interoperability issue in margin collapsing with overflow:hidden elements
+        https://bugs.webkit.org/show_bug.cgi?id=224185
+
+        Reviewed by Alan Bujtas.
+
+        * TestExpectations: Unskipped 3 flexbox tests that are working fine now.
+        * fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-expected.html: Added.
+        * fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden.html: Added.
+
 2021-09-01  Sergio Villar Senin  <svil...@igalia.com>
 
         [css-flexbox] Add support for left & right css-align-3 positional alignment properties

Modified: trunk/LayoutTests/TestExpectations (282084 => 282085)


--- trunk/LayoutTests/TestExpectations	2021-09-07 14:32:47 UTC (rev 282084)
+++ trunk/LayoutTests/TestExpectations	2021-09-07 15:00:21 UTC (rev 282085)
@@ -4160,11 +4160,6 @@
 webkit.org/b/221474 imported/w3c/web-platform-tests/css/css-flexbox/svg-root-as-flex-item-002.html [ ImageOnlyFailure ]
 webkit.org/b/221474 imported/w3c/web-platform-tests/css/css-flexbox/svg-root-as-flex-item-003.html [ ImageOnlyFailure ]
 
-# Writing modes in flexbox.
-webkit.org/b/221475 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-writing-mode-013.html [ ImageOnlyFailure ]
-webkit.org/b/221475 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-writing-mode-014.html [ ImageOnlyFailure ]
-webkit.org/b/221475 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-writing-mode-015.html [ ImageOnlyFailure ]
-
 webkit.org/b/221468 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-align-self-horiz-002.xhtml [ ImageOnlyFailure ]
 webkit.org/b/221468 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-align-self-vert-002.xhtml [ ImageOnlyFailure ]
 webkit.org/b/221468 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-align-self-vert-rtl-005.xhtml [ ImageOnlyFailure ]

Added: trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-expected.html (0 => 282085)


--- trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-expected.html	2021-09-07 15:00:21 UTC (rev 282085)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<style>
+.margin-top { margin-top: 10px; }
+.margin-bottom { margin-bottom: 20px; }
+
+.grayblock {
+  background: lightgrey;
+  height: 20px;
+  width: 150px;
+}
+
+</style>
+
+<div class="grayblock margin-top margin-bottom"></div>
+
+<div class="grayblock margin-top"></div>
+<div class="grayblock" style="background: lightblue;"></div>
+
+<div class="grayblock margin-top"></div>
+<div class="grayblock" style="background: lightblue; height: 30px;"></div>
+<div class="grayblock"></div>
\ No newline at end of file
Property changes on: trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden-expected.html
___________________________________________________________________

Added: svn:eol-style

+LF \ No newline at end of property

Added: svn:mime-type

+text/html \ No newline at end of property

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


--- trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden.html	2021-09-07 15:00:21 UTC (rev 282085)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<style>
+.container {
+  width: 150px;
+  background: lightblue;
+}
+
+.container > div {
+  display: block;
+  background: lightgrey;
+  margin: 10px 0 20px 0;
+  height: 20px;
+}
+
+nocollapse {
+  display: block;
+  overflow: hidden;
+}
+</style>
+
+<div class="container">
+  <div></div>
+  <nocollapse style="overflow: visible"></nocollapse>
+</div>
+
+<div class="container">
+  <div></div>
+  <nocollapse></nocollapse>
+</div>
+
+<div class="container">
+  <div></div>
+  <nocollapse></nocollapse>
+  <div></div>
+</div>
Property changes on: trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden.html
___________________________________________________________________

Added: svn:eol-style

+LF \ No newline at end of property

Added: svn:mime-type

+text/html \ No newline at end of property

Modified: trunk/Source/WebCore/ChangeLog (282084 => 282085)


--- trunk/Source/WebCore/ChangeLog	2021-09-07 14:32:47 UTC (rev 282084)
+++ trunk/Source/WebCore/ChangeLog	2021-09-07 15:00:21 UTC (rev 282085)
@@ -1,3 +1,19 @@
+2021-08-26  Sergio Villar Senin  <svil...@igalia.com>
+
+        Interoperability issue in margin collapsing with overflow:hidden elements
+        https://bugs.webkit.org/show_bug.cgi?id=224185
+
+        Reviewed by Alan Bujtas.
+
+        Margins should not self collapse for those elements that create new formatting contexts
+        like when using overflow:hidden.
+
+        Test: fast/block/margin-collapse/self-collapsing-block-with-overflow-hidden.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::isSelfCollapsingBlock const): Boxes that create new formatting context should
+        not self collapse.
+
 2021-09-07  Brent Fulgham  <bfulg...@apple.com>
 
         [wpt-improvement] Improve CSP support for window reuse

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (282084 => 282085)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2021-09-07 14:32:47 UTC (rev 282084)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2021-09-07 15:00:21 UTC (rev 282085)
@@ -509,8 +509,9 @@
     // If the height is 0 or auto, then whether or not we are a self-collapsing block depends
     // on whether we have content that is all self-collapsing or not.
     if (hasAutoHeight || ((logicalHeightLength.isFixed() || logicalHeightLength.isPercentOrCalculated()) && logicalHeightLength.isZero()))
-        return !childrenPreventSelfCollapsing();
+        return !createsNewFormattingContext() && !childrenPreventSelfCollapsing();
 
+
     return false;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to