- Revision
- 239827
- Author
- za...@apple.com
- Date
- 2019-01-10 07:42:18 -0800 (Thu, 10 Jan 2019)
Log Message
[LFC][BFC][MarginCollapsing] Take collapsed through siblings into account when computing vertical position
https://bugs.webkit.org/show_bug.cgi?id=193310
Reviewed by Antti Koivisto.
Source/WebCore:
If the block inflow element has previous siblings with collapsed through vertical margins,
then this box's before margin could _indirectly_ collapse with the parent. Use the previous siblings
to check for margin collapsing.
Test: fast/block/block-only/collapsed-through-siblings.html
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::adjustedVerticalPositionAfterMarginCollapsing const):
* page/FrameViewLayoutContext.cpp:
(WebCore::layoutUsingFormattingContext):
Tools:
* LayoutReloaded/misc/LFC-passing-tests.txt:
LayoutTests:
* fast/block/margin-collapse/collapsed-through-siblings-expected.txt: Added.
* fast/block/margin-collapse/collapsed-through-siblings.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (239826 => 239827)
--- trunk/LayoutTests/ChangeLog 2019-01-10 12:46:18 UTC (rev 239826)
+++ trunk/LayoutTests/ChangeLog 2019-01-10 15:42:18 UTC (rev 239827)
@@ -1,3 +1,13 @@
+2019-01-10 Zalan Bujtas <za...@apple.com>
+
+ [LFC][BFC][MarginCollapsing] Take collapsed through siblings into account when computing vertical position
+ https://bugs.webkit.org/show_bug.cgi?id=193310
+
+ Reviewed by Antti Koivisto.
+
+ * fast/block/margin-collapse/collapsed-through-siblings-expected.txt: Added.
+ * fast/block/margin-collapse/collapsed-through-siblings.html: Added.
+
2019-01-10 Dominik Infuehr <dinfu...@igalia.com>
Enable DFG on ARM/Linux again
Added: trunk/LayoutTests/fast/block/block-only/collapsed-through-siblings-expected.txt (0 => 239827)
--- trunk/LayoutTests/fast/block/block-only/collapsed-through-siblings-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/block/block-only/collapsed-through-siblings-expected.txt 2019-01-10 15:42:18 UTC (rev 239827)
@@ -0,0 +1,12 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,70) size 784x522
+ RenderBlock {DIV} at (0,0) size 400x400
+ RenderBlock {DIV} at (0,0) size 400x0
+ RenderBlock {DIV} at (0,0) size 400x0
+ RenderBlock {DIV} at (0,0) size 400x0
+ RenderBlock {DIV} at (0,0) size 400x0
+ RenderBlock {DIV} at (0,0) size 400x0
+ RenderBlock {DIV} at (0,0) size 100x100
Added: trunk/LayoutTests/fast/block/block-only/collapsed-through-siblings.html (0 => 239827)
--- trunk/LayoutTests/fast/block/block-only/collapsed-through-siblings.html (rev 0)
+++ trunk/LayoutTests/fast/block/block-only/collapsed-through-siblings.html 2019-01-10 15:42:18 UTC (rev 239827)
@@ -0,0 +1,8 @@
+<div style="width: 400px; height: 400px">
+ <div style="margin-top: 10px; margin-bottom: 70px"></div>
+ <div style="margin-top: 20px; margin-bottom: 60px"></div>
+ <div style="margin-top: 30px; margin-bottom: 50px"></div>
+ <div style="margin-top: 40px; margin-bottom: 40px"></div>
+ <div style="margin-top: 50px; margin-bottom: 30px"></div>
+ <div style="width: 100px; height: 100px; margin-top: 20px"></div>
+</div>
Modified: trunk/Source/WebCore/ChangeLog (239826 => 239827)
--- trunk/Source/WebCore/ChangeLog 2019-01-10 12:46:18 UTC (rev 239826)
+++ trunk/Source/WebCore/ChangeLog 2019-01-10 15:42:18 UTC (rev 239827)
@@ -1,3 +1,21 @@
+2019-01-10 Zalan Bujtas <za...@apple.com>
+
+ [LFC][BFC][MarginCollapsing] Take collapsed through siblings into account when computing vertical position
+ https://bugs.webkit.org/show_bug.cgi?id=193310
+
+ Reviewed by Antti Koivisto.
+
+ If the block inflow element has previous siblings with collapsed through vertical margins,
+ then this box's before margin could _indirectly_ collapse with the parent. Use the previous siblings
+ to check for margin collapsing.
+
+ Test: fast/block/block-only/collapsed-through-siblings.html
+
+ * layout/blockformatting/BlockFormattingContext.cpp:
+ (WebCore::Layout::BlockFormattingContext::adjustedVerticalPositionAfterMarginCollapsing const):
+ * page/FrameViewLayoutContext.cpp:
+ (WebCore::layoutUsingFormattingContext):
+
2019-01-10 Alicia Boya GarcĂa <ab...@igalia.com>
[MSE][GStreamer] Use GRefPtr in AppendPipeline::pushNewBuffer()
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (239826 => 239827)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2019-01-10 12:46:18 UTC (rev 239826)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2019-01-10 15:42:18 UTC (rev 239827)
@@ -477,8 +477,13 @@
currentLayoutBox = &previousInFlowSibling;
}
- auto containingBlockContentBoxTop = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxTop();
- if (MarginCollapse::marginBeforeCollapsesWithParentMarginBefore(layoutState, layoutBox) || MarginCollapse::marginBeforeCollapsesWithParentMarginAfter(layoutState, layoutBox))
+ auto& containingBlock = *layoutBox.containingBlock();
+ auto containingBlockContentBoxTop = layoutState.displayBoxForLayoutBox(containingBlock).contentBoxTop();
+ // If we reached the parent through collapsed sibling(s), this box (may) collapses the before margin indirectly with the parent.
+ auto* collapsingCandidate = layoutBox.previousInFlowSibling() ? containingBlock.firstInFlowChild() : &layoutBox;
+ auto marginBeforeCollapsesWithParent = MarginCollapse::marginBeforeCollapsesWithParentMarginBefore(layoutState, *collapsingCandidate)
+ || MarginCollapse::marginBeforeCollapsesWithParentMarginAfter(layoutState, *collapsingCandidate);
+ if (marginBeforeCollapsesWithParent)
return containingBlockContentBoxTop;
return containingBlockContentBoxTop + marginBefore;
Modified: trunk/Tools/ChangeLog (239826 => 239827)
--- trunk/Tools/ChangeLog 2019-01-10 12:46:18 UTC (rev 239826)
+++ trunk/Tools/ChangeLog 2019-01-10 15:42:18 UTC (rev 239827)
@@ -1,3 +1,12 @@
+2019-01-10 Zalan Bujtas <za...@apple.com>
+
+ [LFC][BFC][MarginCollapsing] Take collapsed through siblings into account when computing vertical position
+ https://bugs.webkit.org/show_bug.cgi?id=193310
+
+ Reviewed by Antti Koivisto.
+
+ * LayoutReloaded/misc/LFC-passing-tests.txt:
+
2019-01-10 Dominik Infuehr <dinfu...@igalia.com>
Enable DFG on ARM/Linux again
Modified: trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt (239826 => 239827)
--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt 2019-01-10 12:46:18 UTC (rev 239826)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt 2019-01-10 15:42:18 UTC (rev 239827)
@@ -63,6 +63,7 @@
fast/block/block-only/margin-propagation-simple-content-height.html
fast/block/block-only/margin-sibling-collapse-propagated.html
fast/block/block-only/margin-simple.html
+fast/block/block-only/collapsed-through-siblings.html
fast/block/block-only/min-max-height-percentage.html
fast/block/block-only/negative-margin-simple.html
fast/block/block-only/padding-nested.html