Title: [234786] trunk
Revision
234786
Author
[email protected]
Date
2018-08-12 08:46:44 -0700 (Sun, 12 Aug 2018)

Log Message

[LFC] Float prev/next sibling should prevent top/bottom margin collapsing with parent.
https://bugs.webkit.org/show_bug.cgi?id=188487

Reviewed by Antti Koivisto.

Source/WebCore:

Test: fast/block/block-only/floating-and-next-previous-inflow-with-margin.html

* layout/blockformatting/BlockMarginCollapse.cpp:
(WebCore::Layout::isMarginTopCollapsedWithParent):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

LayoutTests:

* fast/block/block-only/floating-and-next-previous-inflow-with-margin-expected.txt: Added.
* fast/block/block-only/floating-and-next-previous-inflow-with-margin.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (234785 => 234786)


--- trunk/LayoutTests/ChangeLog	2018-08-12 04:13:52 UTC (rev 234785)
+++ trunk/LayoutTests/ChangeLog	2018-08-12 15:46:44 UTC (rev 234786)
@@ -1,3 +1,13 @@
+2018-08-12  Zalan Bujtas  <[email protected]>
+
+        [LFC] Float prev/next sibling should prevent top/bottom margin collapsing with parent.
+        https://bugs.webkit.org/show_bug.cgi?id=188487
+
+        Reviewed by Antti Koivisto.
+
+        * fast/block/block-only/floating-and-next-previous-inflow-with-margin-expected.txt: Added.
+        * fast/block/block-only/floating-and-next-previous-inflow-with-margin.html: Added.
+
 2018-08-10  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: console.log fires getters for deep properties

Added: trunk/LayoutTests/fast/block/block-only/floating-and-next-previous-inflow-with-margin-expected.txt (0 => 234786)


--- trunk/LayoutTests/fast/block/block-only/floating-and-next-previous-inflow-with-margin-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/block/block-only/floating-and-next-previous-inflow-with-margin-expected.txt	2018-08-12 15:46:44 UTC (rev 234786)
@@ -0,0 +1,10 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x118
+  RenderBlock {HTML} at (0,0) size 800x118
+    RenderBody {BODY} at (8,8) size 784x102
+      RenderBlock {DIV} at (0,0) size 102x102 [border: (1px solid #000000)]
+        RenderBlock (floating) {DIV} at (1,1) size 12x12 [border: (1px solid #000000)]
+        RenderBlock {DIV} at (1,21) size 12x12 [border: (1px solid #000000)]
+        RenderBlock {DIV} at (1,33) size 12x12 [border: (1px solid #000000)]
+        RenderBlock (floating) {DIV} at (1,65) size 12x12 [border: (1px solid #000000)]

Added: trunk/LayoutTests/fast/block/block-only/floating-and-next-previous-inflow-with-margin.html (0 => 234786)


--- trunk/LayoutTests/fast/block/block-only/floating-and-next-previous-inflow-with-margin.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/block-only/floating-and-next-previous-inflow-with-margin.html	2018-08-12 15:46:44 UTC (rev 234786)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+div {
+	border: 1px solid black;
+	width: 10px;
+	height: 10px;
+}
+</style>
+</head>
+<body>
+<div style="width: 100px; height: 100px;">
+    <div style="float: left;"></div>
+    <div style="margin-top: 20px;"></div>
+    <div style="margin-bottom: 20px;"></div>
+    <div style="float: left;"></div>
+</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (234785 => 234786)


--- trunk/Source/WebCore/ChangeLog	2018-08-12 04:13:52 UTC (rev 234785)
+++ trunk/Source/WebCore/ChangeLog	2018-08-12 15:46:44 UTC (rev 234786)
@@ -1,3 +1,16 @@
+2018-08-12  Zalan Bujtas  <[email protected]>
+
+        [LFC] Float prev/next sibling should prevent top/bottom margin collapsing with parent.
+        https://bugs.webkit.org/show_bug.cgi?id=188487
+
+        Reviewed by Antti Koivisto.
+
+        Test: fast/block/block-only/floating-and-next-previous-inflow-with-margin.html
+
+        * layout/blockformatting/BlockMarginCollapse.cpp:
+        (WebCore::Layout::isMarginTopCollapsedWithParent):
+        (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):
+
 2018-08-10  Antti Koivisto  <[email protected]>
 
         Use OptionSet for various RenderLayer flags

Modified: trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp (234785 => 234786)


--- trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp	2018-08-12 04:13:52 UTC (rev 234785)
+++ trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp	2018-08-12 15:46:44 UTC (rev 234786)
@@ -97,8 +97,8 @@
     // We never margin collapse the initial containing block.
     ASSERT(layoutBox.parent());
     auto& parent = *layoutBox.parent();
-    // Is this box the first inlflow child?
-    if (parent.firstInFlowChild() != &layoutBox)
+    // Only the first inlflow child collapses with parent (floating sibling also prevents collapsing). 
+    if (layoutBox.previousInFlowOrFloatingSibling())
         return false;
 
     if (parent.establishesBlockFormattingContext())
@@ -274,8 +274,8 @@
     // We never margin collapse the initial containing block.
     ASSERT(layoutBox.parent());
     auto& parent = *layoutBox.parent();
-    // Is this the last inlflow child?
-    if (parent.lastInFlowChild() != &layoutBox)
+    // Only the last inlflow child collapses with parent (floating sibling also prevents collapsing). 
+    if (layoutBox.nextInFlowOrFloatingSibling())
         return false;
 
     if (parent.establishesBlockFormattingContext())

Modified: trunk/Tools/ChangeLog (234785 => 234786)


--- trunk/Tools/ChangeLog	2018-08-12 04:13:52 UTC (rev 234785)
+++ trunk/Tools/ChangeLog	2018-08-12 15:46:44 UTC (rev 234786)
@@ -1,3 +1,12 @@
+2018-08-12  Zalan Bujtas  <[email protected]>
+
+        [LFC] Float prev/next sibling should prevent top/bottom margin collapsing with parent.
+        https://bugs.webkit.org/show_bug.cgi?id=188487
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
 2018-08-11  Aakash Jain  <[email protected]>
 
         [ews-build] Separate queues for Builders and Testers - iOS

Modified: trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt (234785 => 234786)


--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-08-12 04:13:52 UTC (rev 234785)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-08-12 15:46:44 UTC (rev 234786)
@@ -46,3 +46,4 @@
 fast/block/block-only/floating-multiple-lefts-in-body.html
 fast/block/block-only/floating-multiple-lefts-multiple-lines.html
 fast/block/block-only/floating-multiple-lefts.html
+fast/block/block-only/floating-and-next-previous-inflow-with-margin.html
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to