浏览代码

Tests/LibWeb: Split grid/positions-and-spans.html into smaller tests

This giant grid test has been a source of problems while iterating on
GFC for a long time. Let's split it into smaller tests to make it
easier to identify issues without needing further reductions on the
test.
Aliaksandr Kalenik 1 年之前
父节点
当前提交
6267037a74

+ 23 - 0
Tests/LibWeb/Layout/expected/grid/placement-1.txt

@@ -0,0 +1,23 @@
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
+  BlockContainer <html> at (1,1) content-size 798x600 [BFC] children: not-inline
+    BlockContainer <body> at (10,10) content-size 780x21.46875 children: not-inline
+      Box <div.grid-container> at (11,11) content-size 778x19.46875 [GFC] children: not-inline
+        BlockContainer <div.a> at (12,12) content-size 516.125x17.46875 [BFC] children: inline
+          line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+            frag 0 from TextNode start: 0, length: 1, rect: [12,12 6.34375x17.46875]
+              "1"
+          TextNode <#text>
+        BlockContainer <div.b> at (530.125,12) content-size 257.0625x17.46875 [BFC] children: inline
+          line 0 width: 8.8125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+            frag 0 from TextNode start: 0, length: 1, rect: [530.125,12 8.8125x17.46875]
+              "2"
+          TextNode <#text>
+
+ViewportPaintable (Viewport<#document>) [0,0 800x600] overflow: [0,0 800x602]
+  PaintableWithLines (BlockContainer<HTML>) [0,0 800x602]
+    PaintableWithLines (BlockContainer<BODY>) [9,9 782x23.46875]
+      PaintableBox (Box<DIV>.grid-container) [10,10 780x21.46875]
+        PaintableWithLines (BlockContainer<DIV>.a) [11,11 518.125x19.46875]
+          TextPaintable (TextNode<#text>)
+        PaintableWithLines (BlockContainer<DIV>.b) [529.125,11 259.0625x19.46875]
+          TextPaintable (TextNode<#text>)

+ 23 - 0
Tests/LibWeb/Layout/expected/grid/placement-2.txt

@@ -0,0 +1,23 @@
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
+  BlockContainer <html> at (1,1) content-size 798x600 [BFC] children: not-inline
+    BlockContainer <body> at (10,10) content-size 780x21.46875 children: not-inline
+      Box <div.grid-container> at (11,11) content-size 778x19.46875 [GFC] children: not-inline
+        BlockContainer <div.grid-item.a> at (12,12) content-size 257.0625x17.46875 [BFC] children: inline
+          line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+            frag 0 from TextNode start: 0, length: 1, rect: [12,12 6.34375x17.46875]
+              "1"
+          TextNode <#text>
+        BlockContainer <div.grid-item.b> at (271.0625,12) content-size 516.125x17.46875 [BFC] children: inline
+          line 0 width: 8.8125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+            frag 0 from TextNode start: 0, length: 1, rect: [271.0625,12 8.8125x17.46875]
+              "2"
+          TextNode <#text>
+
+ViewportPaintable (Viewport<#document>) [0,0 800x600] overflow: [0,0 800x602]
+  PaintableWithLines (BlockContainer<HTML>) [0,0 800x602]
+    PaintableWithLines (BlockContainer<BODY>) [9,9 782x23.46875]
+      PaintableBox (Box<DIV>.grid-container) [10,10 780x21.46875]
+        PaintableWithLines (BlockContainer<DIV>.grid-item.a) [11,11 259.0625x19.46875]
+          TextPaintable (TextNode<#text>)
+        PaintableWithLines (BlockContainer<DIV>.grid-item.b) [270.0625,11 518.125x19.46875]
+          TextPaintable (TextNode<#text>)

+ 23 - 0
Tests/LibWeb/Layout/expected/grid/placement-3.txt

@@ -0,0 +1,23 @@
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
+  BlockContainer <html> at (1,1) content-size 798x600 [BFC] children: not-inline
+    BlockContainer <body> at (10,10) content-size 780x102 children: not-inline
+      Box <div.grid-container> at (11,11) content-size 778x100 [GFC] children: not-inline
+        BlockContainer <div.a> at (12,12) content-size 776x38 [BFC] children: inline
+          line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+            frag 0 from TextNode start: 0, length: 1, rect: [12,12 6.34375x17.46875]
+              "1"
+          TextNode <#text>
+        BlockContainer <div.b> at (12,52) content-size 776x58 [BFC] children: inline
+          line 0 width: 8.8125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+            frag 0 from TextNode start: 0, length: 1, rect: [12,52 8.8125x17.46875]
+              "2"
+          TextNode <#text>
+
+ViewportPaintable (Viewport<#document>) [0,0 800x600] overflow: [0,0 800x602]
+  PaintableWithLines (BlockContainer<HTML>) [0,0 800x602]
+    PaintableWithLines (BlockContainer<BODY>) [9,9 782x104]
+      PaintableBox (Box<DIV>.grid-container) [10,10 780x102]
+        PaintableWithLines (BlockContainer<DIV>.a) [11,11 778x40]
+          TextPaintable (TextNode<#text>)
+        PaintableWithLines (BlockContainer<DIV>.b) [11,51 778x60]
+          TextPaintable (TextNode<#text>)

+ 23 - 0
Tests/LibWeb/Layout/expected/grid/placement-4.txt

@@ -0,0 +1,23 @@
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
+  BlockContainer <html> at (1,1) content-size 798x600 [BFC] children: not-inline
+    BlockContainer <body> at (10,10) content-size 780x40.9375 children: not-inline
+      Box <div.grid-container> at (11,11) content-size 778x38.9375 [GFC] children: not-inline
+        BlockContainer <div.a> at (12,12) content-size 776x17.46875 [BFC] children: inline
+          line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+            frag 0 from TextNode start: 0, length: 1, rect: [12,12 6.34375x17.46875]
+              "1"
+          TextNode <#text>
+        BlockContainer <div> at (12,31.46875) content-size 387x17.46875 [BFC] children: inline
+          line 0 width: 8.8125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+            frag 0 from TextNode start: 0, length: 1, rect: [12,31.46875 8.8125x17.46875]
+              "2"
+          TextNode <#text>
+
+ViewportPaintable (Viewport<#document>) [0,0 800x600] overflow: [0,0 800x602]
+  PaintableWithLines (BlockContainer<HTML>) [0,0 800x602]
+    PaintableWithLines (BlockContainer<BODY>) [9,9 782x42.9375]
+      PaintableBox (Box<DIV>.grid-container) [10,10 780x40.9375]
+        PaintableWithLines (BlockContainer<DIV>.a) [11,11 778x19.46875]
+          TextPaintable (TextNode<#text>)
+        PaintableWithLines (BlockContainer<DIV>) [11,30.46875 389x19.46875]
+          TextPaintable (TextNode<#text>)

+ 0 - 110
Tests/LibWeb/Layout/expected/grid/positions-and-spans.txt

@@ -1,110 +0,0 @@
-Viewport <#document> at (0,0) content-size 800x600 children: not-inline
-  BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
-    BlockContainer <body> at (8,8) content-size 784x169.875 children: not-inline
-      Box <div.grid-container> at (8,8) content-size 784x17.46875 [GFC] children: not-inline
-        BlockContainer <(anonymous)> (not painted) [BFC] children: inline
-          TextNode <#text>
-        BlockContainer <div.grid-item> at (8,8) content-size 522.5x17.46875 [BFC] children: inline
-          line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
-            frag 0 from TextNode start: 0, length: 1, rect: [8,8 6.34375x17.46875]
-              "1"
-          TextNode <#text>
-        BlockContainer <(anonymous)> (not painted) [BFC] children: inline
-          TextNode <#text>
-        BlockContainer <div.grid-item> at (530.5,8) content-size 261.25x17.46875 [BFC] children: inline
-          line 0 width: 8.8125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
-            frag 0 from TextNode start: 0, length: 1, rect: [530.5,8 8.8125x17.46875]
-              "2"
-          TextNode <#text>
-        BlockContainer <(anonymous)> (not painted) [BFC] children: inline
-          TextNode <#text>
-      BlockContainer <(anonymous)> at (8,25.46875) content-size 784x0 children: inline
-        TextNode <#text>
-        TextNode <#text>
-        TextNode <#text>
-      Box <div.grid-container> at (8,25.46875) content-size 784x17.46875 [GFC] children: not-inline
-        BlockContainer <(anonymous)> (not painted) [BFC] children: inline
-          TextNode <#text>
-        BlockContainer <div.grid-item> at (8,25.46875) content-size 261.25x17.46875 [BFC] children: inline
-          line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
-            frag 0 from TextNode start: 0, length: 1, rect: [8,25.46875 6.34375x17.46875]
-              "1"
-          TextNode <#text>
-        BlockContainer <(anonymous)> (not painted) [BFC] children: inline
-          TextNode <#text>
-        BlockContainer <div.grid-item> at (269.25,25.46875) content-size 522.5x17.46875 [BFC] children: inline
-          line 0 width: 8.8125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
-            frag 0 from TextNode start: 0, length: 1, rect: [269.25,25.46875 8.8125x17.46875]
-              "2"
-          TextNode <#text>
-        BlockContainer <(anonymous)> (not painted) [BFC] children: inline
-          TextNode <#text>
-      BlockContainer <(anonymous)> at (8,42.9375) content-size 784x0 children: inline
-        TextNode <#text>
-        TextNode <#text>
-        TextNode <#text>
-      Box <div.grid-container> at (8,42.9375) content-size 784x100 [GFC] children: not-inline
-        BlockContainer <(anonymous)> (not painted) [BFC] children: inline
-          TextNode <#text>
-        BlockContainer <div.grid-item> at (8,42.9375) content-size 784x40 [BFC] children: inline
-          line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
-            frag 0 from TextNode start: 0, length: 1, rect: [8,42.9375 6.34375x17.46875]
-              "1"
-          TextNode <#text>
-        BlockContainer <(anonymous)> (not painted) [BFC] children: inline
-          TextNode <#text>
-        BlockContainer <div.grid-item> at (8,82.9375) content-size 784x60 [BFC] children: inline
-          line 0 width: 8.8125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
-            frag 0 from TextNode start: 0, length: 1, rect: [8,82.9375 8.8125x17.46875]
-              "2"
-          TextNode <#text>
-        BlockContainer <(anonymous)> (not painted) [BFC] children: inline
-          TextNode <#text>
-      BlockContainer <(anonymous)> at (8,142.9375) content-size 784x0 children: inline
-        TextNode <#text>
-        TextNode <#text>
-        TextNode <#text>
-      Box <div.grid-container> at (8,142.9375) content-size 784x34.9375 [GFC] children: not-inline
-        BlockContainer <(anonymous)> (not painted) [BFC] children: inline
-          TextNode <#text>
-        BlockContainer <div.grid-item> at (8,142.9375) content-size 784x17.46875 [BFC] children: inline
-          line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
-            frag 0 from TextNode start: 0, length: 1, rect: [8,142.9375 6.34375x17.46875]
-              "1"
-          TextNode <#text>
-        BlockContainer <(anonymous)> (not painted) [BFC] children: inline
-          TextNode <#text>
-        BlockContainer <div.grid-item> at (8,160.40625) content-size 392x17.46875 [BFC] children: inline
-          line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
-            frag 0 from TextNode start: 0, length: 1, rect: [8,160.40625 6.34375x17.46875]
-              "1"
-          TextNode <#text>
-        BlockContainer <(anonymous)> (not painted) [BFC] children: inline
-          TextNode <#text>
-
-ViewportPaintable (Viewport<#document>) [0,0 800x600]
-  PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
-    PaintableWithLines (BlockContainer<BODY>) [8,8 784x169.875]
-      PaintableBox (Box<DIV>.grid-container) [8,8 784x17.46875]
-        PaintableWithLines (BlockContainer<DIV>.grid-item) [8,8 522.5x17.46875]
-          TextPaintable (TextNode<#text>)
-        PaintableWithLines (BlockContainer<DIV>.grid-item) [530.5,8 261.25x17.46875]
-          TextPaintable (TextNode<#text>)
-      PaintableWithLines (BlockContainer(anonymous)) [8,25.46875 784x0]
-      PaintableBox (Box<DIV>.grid-container) [8,25.46875 784x17.46875]
-        PaintableWithLines (BlockContainer<DIV>.grid-item) [8,25.46875 261.25x17.46875]
-          TextPaintable (TextNode<#text>)
-        PaintableWithLines (BlockContainer<DIV>.grid-item) [269.25,25.46875 522.5x17.46875]
-          TextPaintable (TextNode<#text>)
-      PaintableWithLines (BlockContainer(anonymous)) [8,42.9375 784x0]
-      PaintableBox (Box<DIV>.grid-container) [8,42.9375 784x100]
-        PaintableWithLines (BlockContainer<DIV>.grid-item) [8,42.9375 784x40]
-          TextPaintable (TextNode<#text>)
-        PaintableWithLines (BlockContainer<DIV>.grid-item) [8,82.9375 784x60]
-          TextPaintable (TextNode<#text>)
-      PaintableWithLines (BlockContainer(anonymous)) [8,142.9375 784x0]
-      PaintableBox (Box<DIV>.grid-container) [8,142.9375 784x34.9375]
-        PaintableWithLines (BlockContainer<DIV>.grid-item) [8,142.9375 784x17.46875]
-          TextPaintable (TextNode<#text>)
-        PaintableWithLines (BlockContainer<DIV>.grid-item) [8,160.40625 392x17.46875]
-          TextPaintable (TextNode<#text>)

+ 18 - 0
Tests/LibWeb/Layout/input/grid/placement-1.html

@@ -0,0 +1,18 @@
+<style>
+    * {
+        border: 1px solid black;
+    }
+
+    .grid-container {
+        display: grid;
+        grid-template-columns: repeat(12, minmax(0, 5fr));
+    }
+
+    .a {
+        grid-column-end: span 8;
+    }
+
+    .b {
+        grid-column-end: span 4;
+    }
+</style><div class="grid-container"><div class="a">1</div><div class="b">2</div></div>

+ 20 - 0
Tests/LibWeb/Layout/input/grid/placement-2.html

@@ -0,0 +1,20 @@
+<style>
+    * {
+        border: 1px solid black;
+    }
+
+    .grid-container {
+        display: grid;
+        grid-template-columns: repeat(12, minmax(0, 5fr));
+    }
+
+    .a {
+        grid-column-start: span 4;
+        grid-column-end: span 8;
+    }
+
+    .b {
+        grid-column-start: span 8;
+        grid-column-end: span 4;
+    }
+</style><div class="grid-container"><div class="grid-item a">1</div><div class="grid-item b">2</div></div>

+ 18 - 0
Tests/LibWeb/Layout/input/grid/placement-3.html

@@ -0,0 +1,18 @@
+<style>
+    * {
+        border: 1px solid black;
+    }
+
+    .grid-container {
+        display: grid;
+        grid-template-rows: repeat(5, 20px);
+    }
+
+    .a {
+        grid-row-end: span 2;
+    }
+
+    .b {
+        grid-row-end: span 3;
+    }
+</style><div class="grid-container"><div class="a">1</div><div class="b">2</div></div>

+ 15 - 0
Tests/LibWeb/Layout/input/grid/placement-4.html

@@ -0,0 +1,15 @@
+<style>
+    * {
+        border: 1px solid black;
+        grid-template-columns: 1fr 1fr;
+    }
+
+    .grid-container {
+        display: grid;
+    }
+
+    .a {
+        grid-column: 1 / span 3;
+        grid-row: 1;
+    }
+</style><div class="grid-container"><div class="a">1</div><div>2</div></div>

+ 0 - 63
Tests/LibWeb/Layout/input/grid/positions-and-spans.html

@@ -1,63 +0,0 @@
-<style>
-  .grid-container {
-    display: grid;
-    background-color: lightsalmon;
-  }
-
-  .grid-item {
-    background-color: lightblue;
-  }
-</style>
-
-<!-- Column end and span -->
-<!-- There should be a column spanning 8 units, and then one spanning 4 -->
-<div class="grid-container" style="
-    grid-template-columns: repeat(12,minmax(0,5fr));
-  ">
-  <div class="grid-item" style="
-    grid-column-end: span 8;
-  ">1</div>
-  <div class="grid-item" style="
-    grid-column-end: span 4;
-  ">2</div>
-</div>
-
-<!-- Column start span takes priority over column end span -->
-<!-- There should be a column spanning 4 units, and then one spanning 8 -->
-<div class="grid-container" style="
-    grid-template-columns: repeat(12,minmax(0,5fr));
-  ">
-  <div class="grid-item" style="
-    grid-column-start: span 4;
-    grid-column-end: span 8;
-  ">1</div>
-  <div class="grid-item" style="
-    grid-column-start: span 8;
-    grid-column-end: span 4;
-  ">2</div>
-</div>
-
-<!-- Row end and span -->
-<!-- There should be a row spanning 2 units, and then one spanning 3 -->
-<div class="grid-container" style="
-    grid-template-rows: repeat(5, 20px);
-  ">
-  <div class="grid-item" style="
-    grid-row-end: span 2;
-  ">1</div>
-  <div class="grid-item" style="
-    grid-row-end: span 3;
-  ">2</div>
-</div>
-
-<!-- Grid shouldn't expand to 3 columns as having too much span doesn't change size. -->
-<!-- The bottom row should take up half the width of the grid. -->
-<div class="grid-container" style="
-        grid-template-columns: 1fr 1fr;
-    ">
-  <div class="grid-item" style="
-        grid-column: 1 / span 3;
-        grid-row: 1;
-    ">1</div>
-  <div class="grid-item">1</div>
-</div>