summaryrefslogtreecommitdiff
path: root/Tests/LibWeb
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2023-04-06 14:37:54 +0200
committerAndreas Kling <kling@serenityos.org>2023-04-06 16:47:40 +0200
commitb97229c9b5927fa7b43777aefae769fc4d2a0834 (patch)
tree557f9a4453b79b73ade5a39b6ff4b8394e387c68 /Tests/LibWeb
parent68459d43e01546ba9b14b36cd784deaff7d4454e (diff)
downloadserenity-b97229c9b5927fa7b43777aefae769fc4d2a0834.zip
LibWeb: Ignore preferred width when calculating intrinsic width of block
When calculating the intrinsic width of a block-level box, we now ignore the preferred width entirely, and not just when the preferred width should be treated as auto. The condition for this was both confused and wrong, as it looked at the available width around the box, but didn't check for a width constraint on the box itself. Just because the available width has an intrinsic sizing constraint doesn't mean that the box is undergoing intrinsic sizing. It could also be the box's containing block!
Diffstat (limited to 'Tests/LibWeb')
-rw-r--r--Tests/LibWeb/Layout/expected/block-and-inline/max-width-on-child-block-with-width-auto-contributes-to-intrinsic-size-of-parent.txt9
-rw-r--r--Tests/LibWeb/Layout/input/block-and-inline/max-width-on-child-block-with-width-auto-contributes-to-intrinsic-size-of-parent.html18
2 files changed, 27 insertions, 0 deletions
diff --git a/Tests/LibWeb/Layout/expected/block-and-inline/max-width-on-child-block-with-width-auto-contributes-to-intrinsic-size-of-parent.txt b/Tests/LibWeb/Layout/expected/block-and-inline/max-width-on-child-block-with-width-auto-contributes-to-intrinsic-size-of-parent.txt
new file mode 100644
index 0000000000..39151e8cab
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/block-and-inline/max-width-on-child-block-with-width-auto-contributes-to-intrinsic-size-of-parent.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
+ Box <body.outer> at (10,10) content-size 764x21.46875 flex-container(row) children: not-inline
+ BlockContainer <div.middle> at (11,11) content-size 202x19.46875 flex-item children: not-inline
+ BlockContainer <div.inner> at (12,12) content-size 200x17.46875 children: inline
+ line 0 width: 45.15625, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+ frag 0 from TextNode start: 0, length: 4, rect: [12,12 45.15625x17.46875]
+ "OPEN"
+ TextNode <#text>
diff --git a/Tests/LibWeb/Layout/input/block-and-inline/max-width-on-child-block-with-width-auto-contributes-to-intrinsic-size-of-parent.html b/Tests/LibWeb/Layout/input/block-and-inline/max-width-on-child-block-with-width-auto-contributes-to-intrinsic-size-of-parent.html
new file mode 100644
index 0000000000..6a2d8ff373
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/block-and-inline/max-width-on-child-block-with-width-auto-contributes-to-intrinsic-size-of-parent.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html><html><style>
+* {
+ border: 1px solid black;
+ font-family: 'SerenitySans';
+}
+
+html { background: white; }
+
+.outer {
+ display: flex;
+ background: pink;
+}
+
+.inner {
+ min-width: 200px;
+ background: orange;
+}
+</style><body class="outer"><div class="middle"><div class="inner">OPEN \ No newline at end of file