Title: [240146] trunk
Revision
240146
Author
[email protected]
Date
2019-01-18 06:42:46 -0800 (Fri, 18 Jan 2019)

Log Message

[LFC][BFC][MarginCollapsing] Collapsing through should not ignore floats.
https://bugs.webkit.org/show_bug.cgi?id=193564

Reviewed by Antti Koivisto.

Source/WebCore:

Float boxes prevent collapsing through.

Test: fast/block/float/float-in-descendant-formatting-context.html

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

Tools:

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

LayoutTests:

* fast/block/float/float-in-descendant-formatting-context-expected.txt: Added.
* fast/block/float/float-in-descendant-formatting-context.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (240145 => 240146)


--- trunk/LayoutTests/ChangeLog	2019-01-18 14:39:58 UTC (rev 240145)
+++ trunk/LayoutTests/ChangeLog	2019-01-18 14:42:46 UTC (rev 240146)
@@ -1,3 +1,13 @@
+2019-01-18  Zalan Bujtas  <[email protected]>
+
+        [LFC][BFC][MarginCollapsing] Collapsing through should not ignore floats.
+        https://bugs.webkit.org/show_bug.cgi?id=193564
+
+        Reviewed by Antti Koivisto.
+
+        * fast/block/float/float-in-descendant-formatting-context-expected.txt: Added.
+        * fast/block/float/float-in-descendant-formatting-context.html: Added.
+
 2019-01-17  Wenson Hsieh  <[email protected]>
 
         [iOS] Content offset jumps erratically when autoscrolling near scroll view content inset areas

Added: trunk/LayoutTests/fast/block/float/float-in-descendant-formatting-context-expected.txt (0 => 240146)


--- trunk/LayoutTests/fast/block/float/float-in-descendant-formatting-context-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/block/float/float-in-descendant-formatting-context-expected.txt	2019-01-18 14:42:46 UTC (rev 240146)
@@ -0,0 +1,9 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x26
+  RenderBlock {HTML} at (0,0) size 800x26
+    RenderBody {BODY} at (8,8) size 784x10
+layer at (8,8) size 784x10
+  RenderBlock {DIV} at (0,0) size 784x10
+    RenderInline {SPAN} at (0,0) size 0x0
+    RenderBlock (floating) {DIV} at (0,0) size 10x10

Added: trunk/LayoutTests/fast/block/float/float-in-descendant-formatting-context.html (0 => 240146)


--- trunk/LayoutTests/fast/block/float/float-in-descendant-formatting-context.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/float/float-in-descendant-formatting-context.html	2019-01-18 14:42:46 UTC (rev 240146)
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div style="overflow: hidden"><span></span><div style="float: left; width: 10px; height: 10px;"></div></div>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (240145 => 240146)


--- trunk/Source/WebCore/ChangeLog	2019-01-18 14:39:58 UTC (rev 240145)
+++ trunk/Source/WebCore/ChangeLog	2019-01-18 14:42:46 UTC (rev 240146)
@@ -1,5 +1,19 @@
 2019-01-18  Zalan Bujtas  <[email protected]>
 
+        [LFC][BFC][MarginCollapsing] Collapsing through should not ignore floats.
+        https://bugs.webkit.org/show_bug.cgi?id=193564
+
+        Reviewed by Antti Koivisto.
+
+        Float boxes prevent collapsing through.
+
+        Test: fast/block/float/float-in-descendant-formatting-context.html
+
+        * layout/blockformatting/BlockMarginCollapse.cpp:
+        (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough):
+
+2019-01-18  Zalan Bujtas  <[email protected]>
+
         [LFC] Do not skip float boxes that are not part of the current formatting context when computing bottom.
         https://bugs.webkit.org/show_bug.cgi?id=193562
 

Modified: trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp (240145 => 240146)


--- trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp	2019-01-18 14:39:58 UTC (rev 240145)
+++ trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp	2019-01-18 14:42:46 UTC (rev 240146)
@@ -409,7 +409,16 @@
             // we haven't started laying it out yet.
             if (!layoutState.hasFormattingState(layoutBox))
                 return false;
-            return downcast<InlineFormattingState>(layoutState.establishedFormattingState(layoutBox)).inlineRuns().isEmpty();
+            auto& formattingState = downcast<InlineFormattingState>(layoutState.establishedFormattingState(layoutBox));
+            if (!formattingState.inlineRuns().isEmpty())
+                return false;
+            // Any float box in this formatting context prevents collapsing through.
+            auto& floats = formattingState.floatingState().floats();
+            for (auto& floatItem : floats) {
+                if (floatItem.isDescendantOfFormattingRoot(downcast<Container>(layoutBox)))
+                    return false;
+            }
+            return true;
         }
 
         if (establishesBlockFormattingContext(layoutBox))
@@ -416,7 +425,7 @@
             return false;
     }
 
-    for (auto* inflowChild = downcast<Container>(layoutBox).firstInFlowChild(); inflowChild; inflowChild = inflowChild->nextInFlowSibling()) {
+    for (auto* inflowChild = downcast<Container>(layoutBox).firstInFlowOrFloatingChild(); inflowChild; inflowChild = inflowChild->nextInFlowOrFloatingSibling()) {
         if (establishesBlockFormattingContext(*inflowChild))
             return false;
         if (!marginsCollapseThrough(layoutState, *inflowChild))

Modified: trunk/Tools/ChangeLog (240145 => 240146)


--- trunk/Tools/ChangeLog	2019-01-18 14:39:58 UTC (rev 240145)
+++ trunk/Tools/ChangeLog	2019-01-18 14:42:46 UTC (rev 240146)
@@ -1,5 +1,14 @@
 2019-01-18  Zalan Bujtas  <[email protected]>
 
+        [LFC][BFC][MarginCollapsing] Collapsing through should not ignore floats.
+        https://bugs.webkit.org/show_bug.cgi?id=193564
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
+2019-01-18  Zalan Bujtas  <[email protected]>
+
         [LFC] Do not skip float boxes that are not part of the current formatting context when computing bottom.
         https://bugs.webkit.org/show_bug.cgi?id=193562
 

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


--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2019-01-18 14:39:58 UTC (rev 240145)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2019-01-18 14:42:46 UTC (rev 240146)
@@ -120,6 +120,7 @@
 fast/block/float/float-with-anonymous-previous-sibling.html
 fast/block/float/floats-not-cleared-crash.html
 fast/block/float/crash-when-intruding-float-has-anonymous-parent-and-detach.html
+fast/block/float/float-in-descendant-formatting-context.html
 fast/block/margin-collapse/002.html
 fast/block/margin-collapse/003.html
 fast/block/margin-collapse/026.html
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to