[LFC] Adjust margin box verification.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Jan 2019 14:52:55 +0000 (14:52 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Jan 2019 14:52:55 +0000 (14:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193482

Source/WebCore:

Reviewed by Antti Koivisto.

In certain cases, like out-of-flow boxes with margin auto, marginBoxRect() returns 0. It's clearly incorrect,
so let's check the individual margin values instead (and at this point we know that all other boxes match).

Test: fast/block/block-only/non-auto-top-bottom-height-with-auto-margins.html

* layout/Verification.cpp:
(WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):

Tools:

Reviewed by Antti Koivisto.

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

LayoutTests:

Reviewed by Antti Koivisto.

* fast/block/block-only/non-auto-top-bottom-height-with-auto-margins-expected.txt: Added.
* fast/block/block-only/non-auto-top-bottom-height-with-auto-margins.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240035 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/block/block-only/non-auto-top-bottom-height-with-auto-margins-expected.txt [new file with mode: 0644]
LayoutTests/fast/block/block-only/non-auto-top-bottom-height-with-auto-margins.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/layout/Verification.cpp
Tools/ChangeLog
Tools/LayoutReloaded/misc/LFC-passing-tests.txt

index 173660a..5d4fc28 100644 (file)
@@ -1,3 +1,13 @@
+2019-01-16  Zalan Bujtas  <zalan@apple.com>
+
+        [LFC] Adjust margin box verification.
+        https://bugs.webkit.org/show_bug.cgi?id=193482
+
+        Reviewed by Antti Koivisto.
+
+        * fast/block/block-only/non-auto-top-bottom-height-with-auto-margins-expected.txt: Added.
+        * fast/block/block-only/non-auto-top-bottom-height-with-auto-margins.html: Added.
+
 2019-01-15  Ryosuke Niwa  <rniwa@webkit.org>
 
         VisualViewport API should be updated upon opening of keyboard
diff --git a/LayoutTests/fast/block/block-only/non-auto-top-bottom-height-with-auto-margins-expected.txt b/LayoutTests/fast/block/block-only/non-auto-top-bottom-height-with-auto-margins-expected.txt
new file mode 100644 (file)
index 0000000..dbda702
--- /dev/null
@@ -0,0 +1,17 @@
+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,8) size 784x584
+layer at (8,8) size 110x110
+  RenderBlock (relative positioned) {DIV} at (0,0) size 110x110 [border: (5px solid #008000)]
+layer at (13,53) size 50x50
+  RenderBlock (positioned) {DIV} at (5,45) size 50x50 [bgcolor=#0000FF]
+layer at (8,118) size 110x110
+  RenderBlock (relative positioned) {DIV} at (0,110) size 110x110 [border: (5px solid #008000)]
+layer at (13,133) size 50x50
+  RenderBlock (positioned) {DIV} at (5,15) size 50x50 [bgcolor=#0000FF]
+layer at (8,228) size 110x110
+  RenderBlock (relative positioned) {DIV} at (0,220) size 110x110 [border: (5px solid #008000)]
+layer at (13,258) size 50x50
+  RenderBlock (positioned) {DIV} at (5,30) size 50x50 [bgcolor=#0000FF]
diff --git a/LayoutTests/fast/block/block-only/non-auto-top-bottom-height-with-auto-margins.html b/LayoutTests/fast/block/block-only/non-auto-top-bottom-height-with-auto-margins.html
new file mode 100644 (file)
index 0000000..6272e87
--- /dev/null
@@ -0,0 +1,22 @@
+<style>
+.container {
+       border: 5px solid green;
+    height: 100px;
+    width: 100px;
+    position: relative;
+}
+
+div div {
+       background: blue;
+    position: absolute;
+
+    height: 50px;
+    width: 50px;
+
+    top: 10px;
+    bottom: 10px;
+}
+</style>
+<div class=container><div style="margin-top: auto;"></div></div>
+<div class=container><div style="margin-bottom: auto;"></div></div>
+<div class=container><div style="margin-top: auto; margin-bottom: auto;"></div></div>
index 0585567..700421e 100644 (file)
@@ -1,3 +1,18 @@
+2019-01-16  Alan Kinsley  <zalan@apple.com>
+
+        [LFC] Adjust margin box verification.
+        https://bugs.webkit.org/show_bug.cgi?id=193482
+
+        Reviewed by Antti Koivisto.
+
+        In certain cases, like out-of-flow boxes with margin auto, marginBoxRect() returns 0. It's clearly incorrect,
+        so let's check the individual margin values instead (and at this point we know that all other boxes match).
+
+        Test: fast/block/block-only/non-auto-top-bottom-height-with-auto-margins.html
+
+        * layout/Verification.cpp:
+        (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
+
 2019-01-16  Zan Dobersek  <zdobersek@igalia.com>
 
         [FreeType] Cache the zero-width space glyph in GlyphPage::fill()
index 64f7a84..4f26c4f 100644 (file)
@@ -265,11 +265,6 @@ static bool outputMismatchingBlockBoxInformationIfNeeded(TextStream& stream, con
         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;
@@ -285,6 +280,20 @@ static bool outputMismatchingBlockBoxInformationIfNeeded(TextStream& stream, con
         return true;
     }
 
+    if (renderer.marginBoxRect() != renderBoxLikeMarginBox(displayBox)) {
+        // In certain cases, like out-of-flow boxes with margin auto, marginBoxRect() returns 0. It's clearly incorrect,
+        // so let's check the individual margin values instead (and at this point we know that all other boxes match).
+        auto marginsMatch = displayBox.marginBefore() == renderer.marginBefore()
+            && displayBox.marginAfter() == renderer.marginAfter()
+            && displayBox.marginStart() == renderer.marginStart()
+            && displayBox.marginEnd() == renderer.marginEnd();
+
+        if (!marginsMatch) {
+            outputRect("marginBox", renderer.marginBoxRect(), renderBoxLikeMarginBox(displayBox));
+            return true;
+        }
+    }
+
     return false;
 }
 
index 2ad03e1..4c80cfa 100644 (file)
@@ -1,3 +1,12 @@
+2019-01-16  Zalan Bujtas  <zalan@apple.com>
+
+        [LFC] Adjust margin box verification.
+        https://bugs.webkit.org/show_bug.cgi?id=193482
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
 2019-01-15  Sihui Liu  <sihui_liu@apple.com>
 
         Fix API test WebKit.WebsiteDataStoreCustomPathsWithoutPrewarming after 193354
index 42d36df..4de3e44 100644 (file)
@@ -79,6 +79,7 @@ fast/block/block-only/relative-simple.html
 fast/block/block-only/box-sizing-inflow-out-of-flow-simple.html
 fast/block/block-only/out-of-flow-with-containing-block-border-padding.html
 fast/block/block-only/non-auto-top-bottom-left-right-widht-height-out-of-flow.html
+fast/block/block-only/non-auto-top-bottom-height-with-auto-margins.html
 fast/block/basic/002.html
 fast/block/basic/003.html
 fast/block/basic/006.html