Skip to content

Truly independent web browser

Tests/LibWeb: Add a test for flex shrinking with a max-size freeze

Andreas Klingbb7b142ef7ca
diff --git a/Tests/LibWeb/Layout/expected/flex/flex-shrink-item-restored-after-sibling-freezes-at-max-size.txt b/Tests/LibWeb/Layout/expected/flex/flex-shrink-item-restored-after-sibling-freezes-at-max-size.txt
new file mode 100644
index 00000000000..34b8565f8e6
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/flex/flex-shrink-item-restored-after-sibling-freezes-at-max-size.txt
@@ -0,0 +1,55 @@
+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 200 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [0,0] [0+0+0 800 0+0+0] [0+0+0 200 0+0+0] children: not-inline
+ Box <div.page> at [0,0] flex-container(row) [0+0+0 800 0+0+0] [0+0+0 200 0+0+0] [FFC] children: not-inline
+ BlockContainer <div.sidebar> at [76,0] flex-item [0+0+0 200 0+0+0] [0+0+0 200 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 4, rect: [76,4 30.484375x16] baseline: 12.796875
+ "side"
+ TextNode <#text> (not painted)
+ Box <div.wrap> at [276,0] flex-container(row) flex-item [0+0+0 448 0+0+0] [0+0+0 200 0+0+0] [FFC] children: not-inline
+ BlockContainer <(anonymous)> (not painted) [BFC] children: inline
+ TextNode <#text> (not painted)
+ Box <div.content> at [300,0] flex-container(column) flex-item [0+0+24 252 24+0+0] [0+0+0 200 0+0+0] [FFC] children: not-inline
+ BlockContainer <p> at [300,0] flex-item [0+0+0 252 0+0+0] [0+0+0 120 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 26, rect: [300,4 227.796875x16] baseline: 12.796875
+ "Lorem ipsum dolor sit amet"
+ frag 1 from TextNode start: 27, length: 31, rect: [300,28 246.859375x16] baseline: 12.796875
+ "consectetur adipiscing elit sed"
+ frag 2 from TextNode start: 59, length: 28, rect: [300,52 235.5625x16] baseline: 12.796875
+ "do eiusmod tempor incididunt"
+ frag 3 from TextNode start: 88, length: 25, rect: [300,76 213.578125x16] baseline: 12.796875
+ "ut labore et dolore magna"
+ frag 4 from TextNode start: 114, length: 6, rect: [300,100 48.3125x16] baseline: 12.796875
+ "aliqua"
+ TextNode <#text> (not painted)
+ BlockContainer <(anonymous)> (not painted) [BFC] children: inline
+ TextNode <#text> (not painted)
+ BlockContainer <div.sidecar> at [600,0] flex-item [24+0+0 31.875 0+0+24] [0+0+0 200 0+0+0] [BFC] children: not-inline overflow: [600,0 75.515625x200]
+ BlockContainer <ul> at [600,0] [0+0+0 31.875 0+0+0] [0+0+0 72 0+0+0] children: not-inline
+ ListItemBox <li> at [600,0] [0+0+0 31.875 0+0+0] [0+0+0 24 0+0+0] children: not-inline
+ ListItemMarkerBox <(anonymous)> at [586,0] [0+0+0 13.84375 0+0+0] [0+0+0 24 0+0+0] [BFC] children: inline
+ frag 0 from GeneratedTextNode start: 0, length: 2, rect: [586,4 13.84375x16] baseline: 12.796875
+ "• "
+ GeneratedTextNode <(anonymous)> (not painted)
+ BlockContainer <p> at [600,0] [0+0+0 31.875 0+0+0] [0+0+0 24 0+0+0] children: inline
+ frag 0 from TextNode start: 0, length: 8, rect: [600,4 66.765625x16] baseline: 12.796875
+ "Security"
+ TextNode <#text> (not painted)
+ ListItemBox <li> at [600,24] [0+0+0 31.875 0+0+0] [0+0+0 48 0+0+0] children: not-inline
+ ListItemMarkerBox <(anonymous)> at [586,24] [0+0+0 13.84375 0+0+0] [0+0+0 24 0+0+0] [BFC] children: inline
+ frag 0 from GeneratedTextNode start: 0, length: 2, rect: [586,28 13.84375x16] baseline: 12.796875
+ "• "
+ GeneratedTextNode <(anonymous)> (not painted)
+ BlockContainer <p> at [600,24] [0+0+0 31.875 0+0+0] [0+0+0 48 0+0+0] children: inline
+ frag 0 from TextNode start: 0, length: 10, rect: [600,28 75.515625x16] baseline: 12.796875
+ "Highlights"
+ frag 1 from TextNode start: 11, length: 4, rect: [600,52 35.5625x16] baseline: 12.796875
+ "here"
+ TextNode <#text> (not painted)
+ BlockContainer <(anonymous)> (not painted) [BFC] children: inline
+ TextNode <#text> (not painted)
+ BlockContainer <(anonymous)> at [0,200] [0+0+0 800 0+0+0] [0+0+0 0 0+0+0] children: inline
+ TextNode <#text> (not painted)
+
+SC for Viewport<#document> [0,0 800x600] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x200] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/input/flex/flex-shrink-item-restored-after-sibling-freezes-at-max-size.html b/Tests/LibWeb/Layout/input/flex/flex-shrink-item-restored-after-sibling-freezes-at-max-size.html
new file mode 100644
index 00000000000..c16ecb0d82d
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/flex/flex-shrink-item-restored-after-sibling-freezes-at-max-size.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<style>
+* { margin: 0; padding: 0; box-sizing: border-box; }
+body { font: 16px/1.5 sans-serif; }
+.page { display: flex; justify-content: center; }
+.sidebar { width: 200px; }
+.wrap { display: flex; flex-grow: 1; max-width: min(calc(300px + 100px + 48px), calc(100vw - 200px)); }
+.content { display: flex; flex-direction: column; flex-grow: 1; max-width: 300px; padding: 0 24px; }
+.sidecar { width: 100px; margin: 0 24px; overflow-y: auto; height: 200px; }
+</style>
+<div class="page"><div class="sidebar">side</div><div class="wrap">
+<div class="content"><p>Lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua</p></div>
+<div class="sidecar"><ul><li><p>Security</p></li><li><p>Highlights here</p></li></ul></div>
+</div></div>