Title: [235561] trunk
Revision
235561
Author
[email protected]
Date
2018-08-31 11:07:46 -0700 (Fri, 31 Aug 2018)

Log Message

[LFC] Add margin box verification back now that Display::Box has non-computed horizontal margin.
https://bugs.webkit.org/show_bug.cgi?id=189193

Reviewed by Antti Koivisto.

Source/WebCore:

Use the non-computed margin values to verify correctness.
This patch also fixes a margin collapsing issue when the inflow box has a float sibling. The float
sibling does not prevent collapsing with the parent's top/bottom margin.

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

* layout/Verification.cpp:
(WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
(WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const):
* 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-with-no-border-expected.txt: Added.
* fast/block/block-only/floating-and-next-previous-inflow-with-margin-with-no-border.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (235560 => 235561)


--- trunk/LayoutTests/ChangeLog	2018-08-31 17:59:01 UTC (rev 235560)
+++ trunk/LayoutTests/ChangeLog	2018-08-31 18:07:46 UTC (rev 235561)
@@ -1,3 +1,13 @@
+2018-08-31  Zalan Bujtas  <[email protected]>
+
+        [LFC] Add margin box verification back now that Display::Box has non-computed horizontal margin.
+        https://bugs.webkit.org/show_bug.cgi?id=189193
+
+        Reviewed by Antti Koivisto.
+
+        * fast/block/block-only/floating-and-next-previous-inflow-with-margin-with-no-border-expected.txt: Added.
+        * fast/block/block-only/floating-and-next-previous-inflow-with-margin-with-no-border.html: Added.
+
 2018-08-31  Per Arne Vollan  <[email protected]>
 
         [Win] Some tests are failing on ews200 after upgrading iTunes.

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


--- trunk/LayoutTests/fast/block/block-only/floating-and-next-previous-inflow-with-margin-with-no-border-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/block/block-only/floating-and-next-previous-inflow-with-margin-with-no-border-expected.txt	2018-08-31 18:07:46 UTC (rev 235561)
@@ -0,0 +1,10 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x128
+  RenderBlock {HTML} at (0,0) size 800x128
+    RenderBody {BODY} at (8,20) size 784x100
+      RenderBlock {DIV} at (0,0) size 100x100
+        RenderBlock (floating) {DIV} at (0,0) size 10x10
+        RenderBlock {DIV} at (0,0) size 10x10
+        RenderBlock {DIV} at (0,10) size 10x10
+        RenderBlock (floating) {DIV} at (0,40) size 10x10

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


--- trunk/LayoutTests/fast/block/block-only/floating-and-next-previous-inflow-with-margin-with-no-border.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/block-only/floating-and-next-previous-inflow-with-margin-with-no-border.html	2018-08-31 18:07:46 UTC (rev 235561)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+div {
+	outline: 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 (235560 => 235561)


--- trunk/Source/WebCore/ChangeLog	2018-08-31 17:59:01 UTC (rev 235560)
+++ trunk/Source/WebCore/ChangeLog	2018-08-31 18:07:46 UTC (rev 235561)
@@ -1,3 +1,23 @@
+2018-08-31  Zalan Bujtas  <[email protected]>
+
+        [LFC] Add margin box verification back now that Display::Box has non-computed horizontal margin.
+        https://bugs.webkit.org/show_bug.cgi?id=189193
+
+        Reviewed by Antti Koivisto.
+
+        Use the non-computed margin values to verify correctness.
+        This patch also fixes a margin collapsing issue when the inflow box has a float sibling. The float
+        sibling does not prevent collapsing with the parent's top/bottom margin.
+
+        Test: fast/block/block-only/floating-and-next-previous-inflow-with-margin-with-no-border.html
+
+        * layout/Verification.cpp:
+        (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
+        (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const):
+        * layout/blockformatting/BlockMarginCollapse.cpp:
+        (WebCore::Layout::isMarginTopCollapsedWithParent):
+        (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):
+
 2018-08-31  Antti Koivisto  <[email protected]>
 
         Replace OptionSet |= and -= operators with add() and remove() functions

Modified: trunk/Source/WebCore/layout/Verification.cpp (235560 => 235561)


--- trunk/Source/WebCore/layout/Verification.cpp	2018-08-31 17:59:01 UTC (rev 235560)
+++ trunk/Source/WebCore/layout/Verification.cpp	2018-08-31 18:07:46 UTC (rev 235561)
@@ -121,6 +121,18 @@
         stream.nextLine();
     };
 
+    auto renderBoxLikeMarginBox = [](auto& displayBox) {
+        // Produce a RenderBox matching margin box.
+        auto borderBox = displayBox.borderBox();
+
+        return Display::Box::Rect {
+            borderBox.top() - displayBox.nonCollapsedMarginTop(),
+            borderBox.left() - displayBox.nonComputedMarginLeft(),
+            displayBox.nonComputedMarginLeft() + borderBox.width() + displayBox.nonComputedMarginRight(),
+            displayBox.nonCollapsedMarginTop() + borderBox.height() + displayBox.nonCollapsedMarginBottom()
+        };
+    };
+
     auto* displayBox = context.displayBoxForLayoutBox(layoutBox);
     ASSERT(displayBox);
 
@@ -134,6 +146,11 @@
         return true;
     }
 
+    if (renderer.marginBoxRect() != renderBoxLikeMarginBox(*displayBox)) {
+        outputRect("marginBox", renderer.marginBoxRect(), renderBoxLikeMarginBox(*displayBox));
+        return true;
+    }
+
     if (renderer.borderBoxRect() != displayBox->borderBox()) {
         outputRect("borderBox", renderer.borderBoxRect(), displayBox->borderBox());
         return true;
@@ -149,7 +166,6 @@
         return true;
     }
 
-    // TODO: The RenderBox::marginBox() does not follow the spec and ignores certain constraints. Skip them for now.
     return false;
 }
 

Modified: trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp (235560 => 235561)


--- trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp	2018-08-31 17:59:01 UTC (rev 235560)
+++ trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp	2018-08-31 18:07:46 UTC (rev 235561)
@@ -97,8 +97,8 @@
     // We never margin collapse the initial containing block.
     ASSERT(layoutBox.parent());
     auto& parent = *layoutBox.parent();
-    // Only the first inlflow child collapses with parent (floating sibling also prevents collapsing). 
-    if (layoutBox.previousInFlowOrFloatingSibling())
+    // Only the first inlflow child collapses with parent.
+    if (layoutBox.previousInFlowSibling())
         return false;
 
     if (parent.establishesBlockFormattingContext())
@@ -274,8 +274,8 @@
     // We never margin collapse the initial containing block.
     ASSERT(layoutBox.parent());
     auto& parent = *layoutBox.parent();
-    // Only the last inlflow child collapses with parent (floating sibling also prevents collapsing). 
-    if (layoutBox.nextInFlowOrFloatingSibling())
+    // Only the last inlflow child collapses with parent.
+    if (layoutBox.nextInFlowSibling())
         return false;
 
     if (parent.establishesBlockFormattingContext())

Modified: trunk/Tools/ChangeLog (235560 => 235561)


--- trunk/Tools/ChangeLog	2018-08-31 17:59:01 UTC (rev 235560)
+++ trunk/Tools/ChangeLog	2018-08-31 18:07:46 UTC (rev 235561)
@@ -1,3 +1,12 @@
+2018-08-31  Zalan Bujtas  <[email protected]>
+
+        [LFC] Add margin box verification back now that Display::Box has non-computed horizontal margin.
+        https://bugs.webkit.org/show_bug.cgi?id=189193
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
 2018-08-31  Antti Koivisto  <[email protected]>
 
         Replace OptionSet |= and -= operators with add() and remove() functions

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


--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-08-31 17:59:01 UTC (rev 235560)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-08-31 18:07:46 UTC (rev 235561)
@@ -47,6 +47,7 @@
 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
+fast/block/block-only/floating-and-next-previous-inflow-with-margin-with-no-border.html
 fast/block/block-only/floating-left-and-right-with-clearance.html
 fast/block/block-only/float-and-siblings-with-margins.html
 fast/block/block-only/margin-collapse-with-clearance.html
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to