Skip to content

Truly independent web browser

Tests/LibWeb: Test line clamping atomic inlines laid out before

Andreas Kling8b9e1c38a4be
diff --git a/Tests/LibWeb/Ref/expected/line-clamp-hides-reused-atomic-inlines-ref.html b/Tests/LibWeb/Ref/expected/line-clamp-hides-reused-atomic-inlines-ref.html
new file mode 100644
index 00000000000..8df6e2f1bea
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/line-clamp-hides-reused-atomic-inlines-ref.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<style>
+ body {
+ margin: 0;
+ }
+
+ div {
+ display: inline-block;
+ width: 40px;
+ height: 20px;
+ background: green;
+ }
+</style>
+<div></div><div></div>
diff --git a/Tests/LibWeb/Ref/input/line-clamp-hides-reused-atomic-inlines.html b/Tests/LibWeb/Ref/input/line-clamp-hides-reused-atomic-inlines.html
new file mode 100644
index 00000000000..e803e54f907
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/line-clamp-hides-reused-atomic-inlines.html
@@ -0,0 +1,39 @@
+<!doctype html>
+<link rel="match" href="../expected/line-clamp-hides-reused-atomic-inlines-ref.html">
+<style>
+ body {
+ margin: 0;
+ }
+
+ #container {
+ width: 100px;
+ line-clamp: 1 no-ellipsis;
+ font-size: 0;
+ }
+
+ .box {
+ display: inline-block;
+ width: 40px;
+ height: 20px;
+ background: green;
+ }
+
+ .pushed {
+ background: red;
+ }
+
+ .pushed > div {
+ width: 10px;
+ height: 10px;
+ background: red;
+ }
+</style>
+<div id="container"><div class="box"></div><div class="box pushed"><div></div></div><div class="box pushed"></div></div>
+<script>
+ // The boxes after the first are laid out before the insertion pushes them past the clamp point.
+ document.body.offsetWidth;
+ const box = document.createElement("div");
+ box.className = "box";
+ container.insertBefore(box, container.firstChild);
+ document.body.offsetWidth;
+</script>