Title: [264214] trunk
Revision
264214
Author
[email protected]
Date
2020-07-10 03:48:32 -0700 (Fri, 10 Jul 2020)

Log Message

[LFC][MarginCollapsing] Margins do not collapse through when the box has clearance.
https://bugs.webkit.org/show_bug.cgi?id=214172

Reviewed by Antti Koivisto.

Source/WebCore:

https://www.w3.org/TR/CSS22/box.html#collapsing-margins
"Two margins are adjoining if and only if: no line boxes, no clearance, no padding and no border separate them"

Only adjoining margins can collapse through.

Test: fast/layoutformattingcontext/empty-block-level-box-with-clearance.html

* layout/blockformatting/BlockMarginCollapse.cpp:
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough const):

LayoutTests:

* fast/layoutformattingcontext/empty-block-level-box-with-clearance-expected.html: Added.
* fast/layoutformattingcontext/empty-block-level-box-with-clearance.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (264213 => 264214)


--- trunk/LayoutTests/ChangeLog	2020-07-10 09:16:18 UTC (rev 264213)
+++ trunk/LayoutTests/ChangeLog	2020-07-10 10:48:32 UTC (rev 264214)
@@ -1,3 +1,13 @@
+2020-07-10  Zalan Bujtas  <[email protected]>
+
+        [LFC][MarginCollapsing] Margins do not collapse through when the box has clearance.
+        https://bugs.webkit.org/show_bug.cgi?id=214172
+
+        Reviewed by Antti Koivisto.
+
+        * fast/layoutformattingcontext/empty-block-level-box-with-clearance-expected.html: Added.
+        * fast/layoutformattingcontext/empty-block-level-box-with-clearance.html: Added.
+
 2020-07-09  Lauro Moura  <[email protected]>
 
         [GTK][WPE] Garden more failures/rebaselines after WPT updates.

Added: trunk/LayoutTests/fast/layoutformattingcontext/empty-block-level-box-with-clearance-expected.html (0 => 264214)


--- trunk/LayoutTests/fast/layoutformattingcontext/empty-block-level-box-with-clearance-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/empty-block-level-box-with-clearance-expected.html	2020-07-10 10:48:32 UTC (rev 264214)
@@ -0,0 +1,10 @@
+<!DOCTYPE html><!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+div {
+    width: 100px;
+    height: 100px;
+}
+
+</style>
+<div style="background-color: green"></div>
+<div style="background-color: blue"></div>

Added: trunk/LayoutTests/fast/layoutformattingcontext/empty-block-level-box-with-clearance.html (0 => 264214)


--- trunk/LayoutTests/fast/layoutformattingcontext/empty-block-level-box-with-clearance.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/empty-block-level-box-with-clearance.html	2020-07-10 10:48:32 UTC (rev 264214)
@@ -0,0 +1,24 @@
+<!DOCTYPE html><!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+.clear_left {
+  clear: left;
+  width: 0px;
+  height: 0px;
+}
+
+.previous_sibling {
+  float: left;
+  width: 100px;
+  height: 100px;
+  background-color: green;
+}
+
+.next_sibling {
+  width: 100px;
+  height: 100px;
+  background-color: blue;
+}
+</style>
+<div class=previous_sibling></div>
+<div class=clear_left></div>
+<div class=next_sibling></div>

Modified: trunk/Source/WebCore/ChangeLog (264213 => 264214)


--- trunk/Source/WebCore/ChangeLog	2020-07-10 09:16:18 UTC (rev 264213)
+++ trunk/Source/WebCore/ChangeLog	2020-07-10 10:48:32 UTC (rev 264214)
@@ -1,3 +1,20 @@
+2020-07-10  Zalan Bujtas  <[email protected]>
+
+        [LFC][MarginCollapsing] Margins do not collapse through when the box has clearance.
+        https://bugs.webkit.org/show_bug.cgi?id=214172
+
+        Reviewed by Antti Koivisto.
+
+        https://www.w3.org/TR/CSS22/box.html#collapsing-margins
+        "Two margins are adjoining if and only if: no line boxes, no clearance, no padding and no border separate them"
+
+        Only adjoining margins can collapse through.
+
+        Test: fast/layoutformattingcontext/empty-block-level-box-with-clearance.html
+
+        * layout/blockformatting/BlockMarginCollapse.cpp:
+        (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough const):
+
 2020-07-10  Jan-Michael Brummer  <[email protected]>
 
         [GTK][WPE] Use mobile user-agent on tablet

Modified: trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp (264213 => 264214)


--- trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp	2020-07-10 09:16:18 UTC (rev 264213)
+++ trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp	2020-07-10 10:48:32 UTC (rev 264214)
@@ -373,6 +373,10 @@
     if (hasPaddingBefore(layoutBox) || hasPaddingAfter(layoutBox))
         return false;
 
+    // Margins are not adjoining when the box has clearance.
+    if (hasClearance(layoutBox))
+        return false;
+
     auto& style = layoutBox.style();
     auto computedHeightValueIsZero = style.height().isFixed() && !style.height().value();
     if (!(style.height().isAuto() || computedHeightValueIsZero))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to