Skip to content

Truly independent web browser

Tests/LibWeb: Add tests for the content widths of row subgrids

Andreas Kling85485d5e8b4f
diff --git a/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-nested-subgrid-uses-grandparent-line-names.txt b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-nested-subgrid-uses-grandparent-line-names.txt
new file mode 100644
index 00000000000..e2c76aba44d
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-nested-subgrid-uses-grandparent-line-names.txt
@@ -0,0 +1,38 @@
+Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline overflow: [0,0 938.25x600]
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 80 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [0,0] [0+0+0 800 0+0+0] [0+0+0 80 0+0+0] children: not-inline
+ Box <div> at [0,0] flex-container(row) [0+0+0 800 0+0+0] [0+0+0 80 0+0+0] [FFC] children: not-inline
+ Box <div.outer> at [95,0] flex-item [0+0+0 610 0+0+0] [0+0+0 80 0+0+0] [GFC] children: not-inline
+ Box <div.tile> at [95,0] [0+0+0 300 0+0+0] [0+0+0 80 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.image> at [95,0] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: not-inline
+ Box <div.group> at [95,20] [0+0+0 508.875 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.first> at [95,20] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [95,20 213.9375x20] baseline: 16
+ "AAAAAAAAAAAA"
+ TextNode <#text> (not painted)
+ BlockContainer <div.second> at [95,40] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [95,40 140.25x20] baseline: 16
+ "BBBBBBBBBBBB"
+ TextNode <#text> (not painted)
+ BlockContainer <div.third> at [95,60] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [95,60 154.6875x20] baseline: 16
+ "CCCCCCCCCCCC"
+ TextNode <#text> (not painted)
+ Box <div.tile> at [405,0] [0+0+0 300 0+0+0] [0+0+0 80 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.image> at [405,0] [0+0+0 533.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: not-inline
+ Box <div.group> at [405,20] [0+0+0 533.25 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.first> at [405,20] [0+0+0 533.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [405,20 167.0625x20] baseline: 16
+ "DDDDDDDDDDDD"
+ TextNode <#text> (not painted)
+ BlockContainer <div.second> at [405,40] [0+0+0 533.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [405,40 177.9375x20] baseline: 16
+ "EEEEEEEEEEEE"
+ TextNode <#text> (not painted)
+ BlockContainer <div.third> at [405,60] [0+0+0 533.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [405,60 188.25x20] baseline: 16
+ "FFFFFFFFFFFF"
+ TextNode <#text> (not painted)
+
+SC for Viewport<#document> [0,0 800x600] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x80] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-own-subgrid-line-names.txt b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-own-subgrid-line-names.txt
new file mode 100644
index 00000000000..8f496d544e7
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-own-subgrid-line-names.txt
@@ -0,0 +1,20 @@
+Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 60 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [0,0] [0+0+0 800 0+0+0] [0+0+0 60 0+0+0] children: not-inline
+ Box <div.parent> at [0,0] [0+0+0 508.875 0+0+291.125] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ Box <div.subgrid> at [0,0] [0+0+0 508.875 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.a> at [0,0] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [0,0 213.9375x20] baseline: 16
+ "AAAAAAAAAAAA"
+ TextNode <#text> (not painted)
+ BlockContainer <div.b> at [0,20] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [0,20 140.25x20] baseline: 16
+ "BBBBBBBBBBBB"
+ TextNode <#text> (not painted)
+ BlockContainer <div.c> at [0,40] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [0,40 154.6875x20] baseline: 16
+ "CCCCCCCCCCCC"
+ TextNode <#text> (not painted)
+
+SC for Viewport<#document> [0,0 800x600] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x60] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-parent-grid-area-names.txt b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-parent-grid-area-names.txt
new file mode 100644
index 00000000000..7b450aafecb
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-parent-grid-area-names.txt
@@ -0,0 +1,20 @@
+Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 60 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [0,0] [0+0+0 800 0+0+0] [0+0+0 60 0+0+0] children: not-inline
+ Box <div.parent> at [0,0] [0+0+0 508.875 0+0+291.125] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ Box <div.subgrid> at [0,0] [0+0+0 508.875 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.top> at [0,0] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [0,0 213.9375x20] baseline: 16
+ "AAAAAAAAAAAA"
+ TextNode <#text> (not painted)
+ BlockContainer <div.middle> at [0,20] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [0,20 140.25x20] baseline: 16
+ "BBBBBBBBBBBB"
+ TextNode <#text> (not painted)
+ BlockContainer <div.bottom> at [0,40] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [0,40 154.6875x20] baseline: 16
+ "CCCCCCCCCCCC"
+ TextNode <#text> (not painted)
+
+SC for Viewport<#document> [0,0 800x600] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x60] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-parent-line-names.txt b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-parent-line-names.txt
new file mode 100644
index 00000000000..206f2c24894
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-parent-line-names.txt
@@ -0,0 +1,35 @@
+Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 120 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [0,0] [0+0+0 800 0+0+0] [0+0+0 120 0+0+0] children: not-inline
+ Box <div.parent> at [0,0] [0+0+0 300 0+0+500] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ Box <div.subgrid> at [0,0] [0+0+0 508.875 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.first> at [0,0] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [0,0 213.9375x20] baseline: 16
+ "AAAAAAAAAAAA"
+ TextNode <#text> (not painted)
+ BlockContainer <div.second> at [0,20] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [0,20 140.25x20] baseline: 16
+ "BBBBBBBBBBBB"
+ TextNode <#text> (not painted)
+ BlockContainer <div.third> at [0,40] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [0,40 154.6875x20] baseline: 16
+ "CCCCCCCCCCCC"
+ TextNode <#text> (not painted)
+ Box <div> at [0,60] flex-container(row) [0+0+0 800 0+0+0] [0+0+0 60 0+0+0] [FFC] children: not-inline
+ Box <div.parent> at [0,60] flex-item [0+0+0 508.875 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ Box <div.subgrid> at [0,60] [0+0+0 508.875 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.first> at [0,60] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [0,60 213.9375x20] baseline: 16
+ "AAAAAAAAAAAA"
+ TextNode <#text> (not painted)
+ BlockContainer <div.second> at [0,80] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [0,80 140.25x20] baseline: 16
+ "BBBBBBBBBBBB"
+ TextNode <#text> (not painted)
+ BlockContainer <div.third> at [0,100] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [0,100 154.6875x20] baseline: 16
+ "CCCCCCCCCCCC"
+ TextNode <#text> (not painted)
+
+SC for Viewport<#document> [0,0 800x600] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x120] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-with-content-sized-subgrid.txt b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-with-content-sized-subgrid.txt
new file mode 100644
index 00000000000..ff2d22fab75
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-with-content-sized-subgrid.txt
@@ -0,0 +1,62 @@
+Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 240 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [0,0] [0+0+0 800 0+0+0] [0+0+0 240 0+0+0] children: not-inline
+ Box <div.parent> at [0,0] [0+0+0 600 0+0+200] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ Box <div.subgrid> at [0,0] [0+0+0 169.625 0+0+430.375] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.first> at [0,0] [0+0+0 169.625 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 9, rect: [0,0 152.625x20] baseline: 16
+ "AAAA AAAA"
+ TextNode <#text> (not painted)
+ BlockContainer <div.second> at [0,20] [0+0+0 169.625 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 9, rect: [0,20 103.5x20] baseline: 16
+ "BBBB BBBB"
+ TextNode <#text> (not painted)
+ BlockContainer <div.third> at [0,40] [0+0+0 169.625 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 9, rect: [0,40 113.125x20] baseline: 16
+ "CCCC CCCC"
+ TextNode <#text> (not painted)
+ Box <div.parent> at [0,60] [0+0+0 600 0+0+200] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ Box <div.subgrid> at [0,60] [0+0+0 369.25 0+0+230.75] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.first> at [0,60] [0+0+0 369.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 9, rect: [0,60 152.625x20] baseline: 16
+ "AAAA AAAA"
+ TextNode <#text> (not painted)
+ BlockContainer <div.second> at [0,80] [0+0+0 369.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 9, rect: [0,80 103.5x20] baseline: 16
+ "BBBB BBBB"
+ TextNode <#text> (not painted)
+ BlockContainer <div.third> at [0,100] [0+0+0 369.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 9, rect: [0,100 113.125x20] baseline: 16
+ "CCCC CCCC"
+ TextNode <#text> (not painted)
+ Box <div.parent> at [0,120] [0+0+0 600 0+0+200] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ Box <div.subgrid> at [0,120] [0+0+0 369.25 0+0+230.75] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.first> at [0,120] [0+0+0 369.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 9, rect: [0,120 152.625x20] baseline: 16
+ "AAAA AAAA"
+ TextNode <#text> (not painted)
+ BlockContainer <div.second> at [0,140] [0+0+0 369.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 9, rect: [0,140 103.5x20] baseline: 16
+ "BBBB BBBB"
+ TextNode <#text> (not painted)
+ BlockContainer <div.third> at [0,160] [0+0+0 369.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 9, rect: [0,160 113.125x20] baseline: 16
+ "CCCC CCCC"
+ TextNode <#text> (not painted)
+ Box <div.parent> at [0,180] [0+0+0 600 0+0+200] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ Box <div.subgrid> at [0,180] [0+0+0 369.25 0+0+230.75] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.first> at [0,180] [0+0+0 369.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 9, rect: [0,180 152.625x20] baseline: 16
+ "AAAA AAAA"
+ TextNode <#text> (not painted)
+ BlockContainer <div.second> at [0,200] [0+0+0 369.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 9, rect: [0,200 103.5x20] baseline: 16
+ "BBBB BBBB"
+ TextNode <#text> (not painted)
+ BlockContainer <div.third> at [0,220] [0+0+0 369.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 9, rect: [0,220 113.125x20] baseline: 16
+ "CCCC CCCC"
+ TextNode <#text> (not painted)
+
+SC for Viewport<#document> [0,0 800x600] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x240] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-with-named-spans.txt b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-with-named-spans.txt
new file mode 100644
index 00000000000..23bedc0c8f7
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-with-named-spans.txt
@@ -0,0 +1,16 @@
+Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 40 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [0,0] [0+0+0 800 0+0+0] [0+0+0 40 0+0+0] children: not-inline
+ Box <div.parent> at [0,0] [0+0+0 354.1875 0+0+445.8125] [0+0+0 40 0+0+0] [GFC] children: not-inline
+ Box <div.subgrid> at [0,0] [0+0+0 354.1875 0+0+0] [0+0+0 40 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.top> at [0,0] [0+0+0 354.1875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [0,0 213.9375x20] baseline: 16
+ "AAAAAAAAAAAA"
+ TextNode <#text> (not painted)
+ BlockContainer <div.bottom> at [0,20] [0+0+0 354.1875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 12, rect: [0,20 140.25x20] baseline: 16
+ "BBBBBBBBBBBB"
+ TextNode <#text> (not painted)
+
+SC for Viewport<#document> [0,0 800x600] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x40] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/input/grid/subgrid-rows-intrinsic-width-nested-subgrid-uses-grandparent-line-names.html b/Tests/LibWeb/Layout/input/grid/subgrid-rows-intrinsic-width-nested-subgrid-uses-grandparent-line-names.html
new file mode 100644
index 00000000000..88a956989f8
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/grid/subgrid-rows-intrinsic-width-nested-subgrid-uses-grandparent-line-names.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<style>
+ body {
+ margin: 0;
+ font: 20px SerifPro;
+ }
+
+ .outer {
+ display: grid;
+ grid-auto-flow: column;
+ column-gap: 10px;
+ grid-template-rows: [image] auto [group-start first] auto [second] auto [third] auto [group-end];
+ }
+
+ .tile {
+ display: grid;
+ grid-row: 1 / -1;
+ grid-template-rows: subgrid;
+ width: 300px;
+ }
+
+ .image {
+ grid-row: image;
+ height: 20px;
+ background: gray;
+ }
+
+ .group {
+ display: grid;
+ grid-row: group;
+ grid-template-rows: subgrid;
+ }
+
+ .first {
+ grid-row: first;
+ }
+
+ .second {
+ grid-row: second;
+ }
+
+ .third {
+ grid-row: third;
+ }
+</style>
+<div style="display: flex; justify-content: center">
+ <div class="outer">
+ <div class="tile"><div class="image"></div><div class="group"><div class="first">AAAAAAAAAAAA</div><div class="second">BBBBBBBBBBBB</div><div class="third">CCCCCCCCCCCC</div></div></div>
+ <div class="tile"><div class="image"></div><div class="group"><div class="first">DDDDDDDDDDDD</div><div class="second">EEEEEEEEEEEE</div><div class="third">FFFFFFFFFFFF</div></div></div>
+ </div>
+</div>
diff --git a/Tests/LibWeb/Layout/input/grid/subgrid-rows-intrinsic-width-uses-own-subgrid-line-names.html b/Tests/LibWeb/Layout/input/grid/subgrid-rows-intrinsic-width-uses-own-subgrid-line-names.html
new file mode 100644
index 00000000000..55968c55bdf
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/grid/subgrid-rows-intrinsic-width-uses-own-subgrid-line-names.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<style>
+ body {
+ margin: 0;
+ font: 20px SerifPro;
+ }
+
+ .parent {
+ display: grid;
+ grid-template-rows: repeat(3, auto);
+ width: max-content;
+ }
+
+ .subgrid {
+ display: grid;
+ grid-row: 1 / -1;
+ grid-template-rows: subgrid [a] [b] [c];
+ }
+
+ .a {
+ grid-row: a;
+ }
+
+ .b {
+ grid-row: b;
+ }
+
+ .c {
+ grid-row: c;
+ }
+</style>
+<div class="parent"><div class="subgrid"><div class="a">AAAAAAAAAAAA</div><div class="b">BBBBBBBBBBBB</div><div class="c">CCCCCCCCCCCC</div></div></div>
diff --git a/Tests/LibWeb/Layout/input/grid/subgrid-rows-intrinsic-width-uses-parent-grid-area-names.html b/Tests/LibWeb/Layout/input/grid/subgrid-rows-intrinsic-width-uses-parent-grid-area-names.html
new file mode 100644
index 00000000000..b9bfb36da6b
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/grid/subgrid-rows-intrinsic-width-uses-parent-grid-area-names.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<style>
+ body {
+ margin: 0;
+ font: 20px SerifPro;
+ }
+
+ .parent {
+ display: grid;
+ grid-template-areas: "top" "middle" "bottom";
+ width: max-content;
+ }
+
+ .subgrid {
+ display: grid;
+ grid-row: 1 / -1;
+ grid-template-rows: subgrid;
+ }
+
+ .top {
+ grid-row: top;
+ }
+
+ .middle {
+ grid-row: middle;
+ }
+
+ .bottom {
+ grid-row: bottom-start / bottom-end;
+ }
+</style>
+<div class="parent"><div class="subgrid"><div class="top">AAAAAAAAAAAA</div><div class="middle">BBBBBBBBBBBB</div><div class="bottom">CCCCCCCCCCCC</div></div></div>
diff --git a/Tests/LibWeb/Layout/input/grid/subgrid-rows-intrinsic-width-uses-parent-line-names.html b/Tests/LibWeb/Layout/input/grid/subgrid-rows-intrinsic-width-uses-parent-line-names.html
new file mode 100644
index 00000000000..86972df2ad0
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/grid/subgrid-rows-intrinsic-width-uses-parent-line-names.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<style>
+ body {
+ margin: 0;
+ font: 20px SerifPro;
+ }
+
+ .parent {
+ display: grid;
+ grid-template-rows: [first] auto [second] auto [third] auto;
+ width: 300px;
+ }
+
+ .subgrid {
+ display: grid;
+ grid-row: 1 / -1;
+ grid-template-rows: subgrid;
+ }
+
+ .first {
+ grid-row: first;
+ }
+
+ .second {
+ grid-row: second;
+ }
+
+ .third {
+ grid-row: third;
+ }
+</style>
+<div class="parent"><div class="subgrid"><div class="first">AAAAAAAAAAAA</div><div class="second">BBBBBBBBBBBB</div><div class="third">CCCCCCCCCCCC</div></div></div>
+<div style="display: flex"><div class="parent" style="width: auto"><div class="subgrid"><div class="first">AAAAAAAAAAAA</div><div class="second">BBBBBBBBBBBB</div><div class="third">CCCCCCCCCCCC</div></div></div></div>
diff --git a/Tests/LibWeb/Layout/input/grid/subgrid-rows-intrinsic-width-with-content-sized-subgrid.html b/Tests/LibWeb/Layout/input/grid/subgrid-rows-intrinsic-width-with-content-sized-subgrid.html
new file mode 100644
index 00000000000..26e5e5d9469
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/grid/subgrid-rows-intrinsic-width-with-content-sized-subgrid.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<style>
+ body {
+ margin: 0;
+ font: 20px SerifPro;
+ }
+
+ .parent {
+ display: grid;
+ grid-template-rows: [first] auto [second] auto [third] auto;
+ width: 600px;
+ justify-items: start;
+ }
+
+ .subgrid {
+ display: grid;
+ grid-row: 1 / -1;
+ grid-template-rows: subgrid;
+ background: lightgray;
+ }
+
+ .first {
+ grid-row: first;
+ }
+
+ .second {
+ grid-row: second;
+ }
+
+ .third {
+ grid-row: third;
+ }
+</style>
+<div class="parent"><div class="subgrid" style="width: min-content"><div class="first">AAAA AAAA</div><div class="second">BBBB BBBB</div><div class="third">CCCC CCCC</div></div></div>
+<div class="parent"><div class="subgrid" style="width: max-content"><div class="first">AAAA AAAA</div><div class="second">BBBB BBBB</div><div class="third">CCCC CCCC</div></div></div>
+<div class="parent"><div class="subgrid" style="width: fit-content"><div class="first">AAAA AAAA</div><div class="second">BBBB BBBB</div><div class="third">CCCC CCCC</div></div></div>
+<div class="parent"><div class="subgrid"><div class="first">AAAA AAAA</div><div class="second">BBBB BBBB</div><div class="third">CCCC CCCC</div></div></div>
diff --git a/Tests/LibWeb/Layout/input/grid/subgrid-rows-intrinsic-width-with-named-spans.html b/Tests/LibWeb/Layout/input/grid/subgrid-rows-intrinsic-width-with-named-spans.html
new file mode 100644
index 00000000000..53d2f6505a2
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/grid/subgrid-rows-intrinsic-width-with-named-spans.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<style>
+ body {
+ margin: 0;
+ font: 20px SerifPro;
+ }
+
+ .parent {
+ display: grid;
+ grid-template-rows: [first] auto [second] auto [third] auto [last];
+ width: max-content;
+ }
+
+ .subgrid {
+ display: grid;
+ grid-row: 1 / -1;
+ grid-template-rows: subgrid;
+ }
+
+ .top {
+ grid-row: first / third;
+ }
+
+ .bottom {
+ grid-row: third / last;
+ }
+</style>
+<div class="parent"><div class="subgrid"><div class="top">AAAAAAAAAAAA</div><div class="bottom">BBBBBBBBBBBB</div></div></div>