summaryrefslogtreecommitdiff
path: root/Tests/LibWeb/Layout
diff options
context:
space:
mode:
authormartinfalisse <martinmotteditfalisse@gmail.com>2023-04-23 17:03:12 +0200
committerAndreas Kling <kling@serenityos.org>2023-04-24 07:55:40 +0200
commitc987c934d0197c13dffd109aa6776b5c61ecf676 (patch)
treeda8232edd50f2073838e9efd017154298a1cf548 /Tests/LibWeb/Layout
parent9f691b7fe47f46ed3c39f10da9fe8680c3205dc6 (diff)
downloadserenity-c987c934d0197c13dffd109aa6776b5c61ecf676.zip
LibWeb: Fix grid size when intrinsically sized
This fixes a bug that was seen when a combination of the grid having been floated with `float: left` and a `minmax()` column size were used. The issue was that a grid track size should be considered intrinsically sized if both the min and max sizes are intrinsic, not just one of them.
Diffstat (limited to 'Tests/LibWeb/Layout')
-rw-r--r--Tests/LibWeb/Layout/expected/grid/intrinsic-sized-column.txt14
-rw-r--r--Tests/LibWeb/Layout/expected/grid/intrinsic-sized-grid.txt9
-rw-r--r--Tests/LibWeb/Layout/input/grid/intrinsic-sized-column.html24
-rw-r--r--Tests/LibWeb/Layout/input/grid/intrinsic-sized-grid.html18
4 files changed, 65 insertions, 0 deletions
diff --git a/Tests/LibWeb/Layout/expected/grid/intrinsic-sized-column.txt b/Tests/LibWeb/Layout/expected/grid/intrinsic-sized-column.txt
new file mode 100644
index 0000000000..4ce9fb924e
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/grid/intrinsic-sized-column.txt
@@ -0,0 +1,14 @@
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
+ BlockContainer <html> at (0,0) content-size 800x35.46875 children: inline
+ TextNode <#text>
+ BlockContainer <body> at (8,8) content-size 0x19.46875 floating children: not-inline
+ BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline
+ TextNode <#text>
+ Box <div.grid> at (8,8) content-size 0x19.46875 children: not-inline
+ BlockContainer <(anonymous)> children: inline
+ TextNode <#text>
+ BlockContainer <div.whee> at (9,9) content-size 18x17.46875 children: inline
+ line 0 width: 37.953125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+ frag 0 from TextNode start: 0, length: 4, rect: [9,9 37.953125x17.46875]
+ "whee"
+ TextNode <#text>
diff --git a/Tests/LibWeb/Layout/expected/grid/intrinsic-sized-grid.txt b/Tests/LibWeb/Layout/expected/grid/intrinsic-sized-grid.txt
new file mode 100644
index 0000000000..ad400613e9
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/grid/intrinsic-sized-grid.txt
@@ -0,0 +1,9 @@
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
+ BlockContainer <html> at (1,1) content-size 798x39.46875 children: not-inline
+ BlockContainer <body> at (10,10) content-size 2x21.46875 floating children: not-inline
+ Box <div.grid> at (11,11) content-size 0x19.46875 children: not-inline
+ BlockContainer <div.whee> at (12,12) content-size 35.953125x17.46875 children: inline
+ line 0 width: 37.953125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+ frag 0 from TextNode start: 0, length: 4, rect: [12,12 37.953125x17.46875]
+ "whee"
+ TextNode <#text>
diff --git a/Tests/LibWeb/Layout/input/grid/intrinsic-sized-column.html b/Tests/LibWeb/Layout/input/grid/intrinsic-sized-column.html
new file mode 100644
index 0000000000..f40127616e
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/grid/intrinsic-sized-column.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <style>
+ body {
+ float: left;
+ font-family: 'SerenitySans';
+ }
+
+ .grid {
+ display: grid;
+ grid-template-columns: 20px;
+ }
+
+ .whee {
+ background: pink;
+ }
+ </style>
+</head>
+
+<body>
+ <div class="grid">
+ <div class="whee" style="border: 1px solid black;">whee
diff --git a/Tests/LibWeb/Layout/input/grid/intrinsic-sized-grid.html b/Tests/LibWeb/Layout/input/grid/intrinsic-sized-grid.html
new file mode 100644
index 0000000000..1da9823c59
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/grid/intrinsic-sized-grid.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html><html><head><style>
+ * {
+ border: 1px solid black !important;
+ }
+ body {
+ float: left;
+ font-family: 'SerenitySans';
+ }
+ .grid {
+ display: grid;
+ grid-template-areas: "foo whee";
+ grid-template-columns: min-content minmax(0, auto) min-content;
+ }
+ .whee {
+ grid-area: whee;
+ background: pink;
+ }
+</style></head><body><div class="grid"><div class="whee">whee \ No newline at end of file