Title: [241546] trunk
Revision
241546
Author
za...@apple.com
Date
2019-02-14 08:44:41 -0800 (Thu, 14 Feb 2019)

Log Message

[LFC][BFC][MarginCollapse] Replaced boxes don't collapse through their margins
https://bugs.webkit.org/show_bug.cgi?id=194622

Reviewed by Antti Koivisto.

Source/WebCore:

Ensure that block replaced boxes don't collapse through their vertical margins.

Test: fast/block/block-only/block-replaced-with-vertical-margins.html

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

Tools:

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

LayoutTests:

* fast/block/block-only/block-replaced-with-vertical-margins-expected.html: Added.
* fast/block/block-only/block-replaced-with-vertical-margins.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (241545 => 241546)


--- trunk/LayoutTests/ChangeLog	2019-02-14 16:32:55 UTC (rev 241545)
+++ trunk/LayoutTests/ChangeLog	2019-02-14 16:44:41 UTC (rev 241546)
@@ -1,3 +1,13 @@
+2019-02-14  Zalan Bujtas  <za...@apple.com>
+
+        [LFC][BFC][MarginCollapse] Replaced boxes don't collapse through their margins
+        https://bugs.webkit.org/show_bug.cgi?id=194622
+
+        Reviewed by Antti Koivisto.
+
+        * fast/block/block-only/block-replaced-with-vertical-margins-expected.html: Added.
+        * fast/block/block-only/block-replaced-with-vertical-margins.html: Added.
+
 2019-02-13  Ryosuke Niwa  <rn...@webkit.org>
 
         Crash in DOMTimer::fired

Added: trunk/LayoutTests/fast/block/block-only/block-replaced-with-vertical-margins-expected.html (0 => 241546)


--- trunk/LayoutTests/fast/block/block-only/block-replaced-with-vertical-margins-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/block-only/block-replaced-with-vertical-margins-expected.html	2019-02-14 16:44:41 UTC (rev 241546)
@@ -0,0 +1,16 @@
+<style>
+.first {
+    width: 100px;
+    margin-top: 100px;
+    outline: 5px solid blue;
+}
+
+.second {
+    width: 100px;
+    height: 100px;
+    outline: 5px solid blue;
+    position: relative;
+    top: 20px
+}
+</style>
+<div class=first></div><div class=second></div>
\ No newline at end of file

Added: trunk/LayoutTests/fast/block/block-only/block-replaced-with-vertical-margins.html (0 => 241546)


--- trunk/LayoutTests/fast/block/block-only/block-replaced-with-vertical-margins.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/block-only/block-replaced-with-vertical-margins.html	2019-02-14 16:44:41 UTC (rev 241546)
@@ -0,0 +1,19 @@
+<style>
+img {
+    display: block;
+    height: 0px;
+    min-height: 0px;
+    width: 100px;
+    margin-top: 100px;
+    margin-bottom: 10px;
+    outline: 5px solid blue;
+}
+
+div {
+    width: 100px;
+    height: 100px;
+    margin-top: 20px;
+    outline: 5px solid blue;
+}
+</style>
+<img src=""
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (241545 => 241546)


--- trunk/Source/WebCore/ChangeLog	2019-02-14 16:32:55 UTC (rev 241545)
+++ trunk/Source/WebCore/ChangeLog	2019-02-14 16:44:41 UTC (rev 241546)
@@ -1,5 +1,21 @@
 2019-02-14  Zalan Bujtas  <za...@apple.com>
 
+        [LFC][BFC][MarginCollapse] Replaced boxes don't collapse through their margins
+        https://bugs.webkit.org/show_bug.cgi?id=194622
+
+        Reviewed by Antti Koivisto.
+
+        Ensure that block replaced boxes don't collapse through their vertical margins. 
+
+        Test: fast/block/block-only/block-replaced-with-vertical-margins.html
+
+        * layout/blockformatting/BlockMarginCollapse.cpp:
+        (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough):
+        * page/FrameViewLayoutContext.cpp:
+        (WebCore::layoutUsingFormattingContext):
+
+2019-02-14  Zalan Bujtas  <za...@apple.com>
+
         [LFC] Shrink-to-fit-width should be constrained by min/max width
         https://bugs.webkit.org/show_bug.cgi?id=194653
 

Modified: trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp (241545 => 241546)


--- trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp	2019-02-14 16:32:55 UTC (rev 241545)
+++ trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp	2019-02-14 16:44:41 UTC (rev 241546)
@@ -392,6 +392,10 @@
     if (!layoutBox.style().minHeight().isAuto())
         return false;
 
+    // FIXME: Block replaced boxes clearly don't collapse through their margins, but I couldn't find it in the spec yet (and no, it's not a quirk).
+    if (layoutBox.isReplaced())
+        return false;
+
     if (!is<Container>(layoutBox))
         return true;
 

Modified: trunk/Tools/ChangeLog (241545 => 241546)


--- trunk/Tools/ChangeLog	2019-02-14 16:32:55 UTC (rev 241545)
+++ trunk/Tools/ChangeLog	2019-02-14 16:44:41 UTC (rev 241546)
@@ -1,5 +1,14 @@
 2019-02-14  Zalan Bujtas  <za...@apple.com>
 
+        [LFC][BFC][MarginCollapse] Replaced boxes don't collapse through their margins
+        https://bugs.webkit.org/show_bug.cgi?id=194622
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
+2019-02-14  Zalan Bujtas  <za...@apple.com>
+
         [LFC] Shrink-to-fit-width should be constrained by min/max width
         https://bugs.webkit.org/show_bug.cgi?id=194653
 

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


--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2019-02-14 16:32:55 UTC (rev 241545)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2019-02-14 16:44:41 UTC (rev 241546)
@@ -43,6 +43,7 @@
 fast/block/block-only/absolute-width-stretch.html
 fast/block/block-only/absolute-with-static-block-position-nested.html
 fast/block/block-only/almost-intruding-left-float-simple.html
+fast/block/block-only/block-replaced-with-vertical-margins.html
 fast/block/block-only/body-height-with-auto-html-height-quirk2.html
 fast/block/block-only/body-height-with-auto-html-height-quirk.html
 fast/block/block-only/body-height-with-non-auto-html-height-quirk2.html
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to