Skip to content

Truly independent web browser

Tests: Import line-clamp float WPT tests

Aliaksandr Kalenikf00e167d31a6
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-overflow/line-clamp/reference/line-clamp-with-floats-001-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-overflow/line-clamp/reference/line-clamp-with-floats-001-ref.html
new file mode 100644
index 00000000000..bcd70aa9305
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-overflow/line-clamp/reference/line-clamp-with-floats-001-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Reference</title>
+<style>
+.clamp {
+ font: 16px / 32px serif;
+ padding: 0 4px;
+ white-space: pre;
+ background-color: yellow;
+}
+.float {
+ float: left;
+ width: 50px;
+ height: 50px;
+ margin: 4px;
+ background-color: skyblue;
+}
+</style>
+<div class="clamp"><div class="float"></div>Line 1
+Line 2
+Line 3
+Line 4…</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-overflow/line-clamp/reference/line-clamp-with-floats-005-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-overflow/line-clamp/reference/line-clamp-with-floats-005-ref.html
new file mode 100644
index 00000000000..e3ebd7baac6
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-overflow/line-clamp/reference/line-clamp-with-floats-005-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Reference</title>
+<style>
+.parent {
+ padding: 4px;
+ background-color: yellow;
+}
+.clamp {
+ font: 16px / 32px serif;
+ white-space: pre;
+ overflow: clip;
+}
+.float {
+ float: left;
+ width: 50px;
+ height: 50px;
+ margin: 4px;
+ margin-bottom: 0;
+ background-color: skyblue;
+}
+</style>
+<div class="parent">
+<div class="clamp">Line 1
+Line 2
+Line 3
+Line 4…<div class="float"></div></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-overflow/line-clamp/reference/line-clamp-with-floats-007-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-overflow/line-clamp/reference/line-clamp-with-floats-007-ref.html
new file mode 100644
index 00000000000..56a74d93492
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-overflow/line-clamp/reference/line-clamp-with-floats-007-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Reference</title>
+<style>
+.parent {
+ padding: 4px;
+ background-color: yellow;
+}
+.clamp {
+ font: 16px / 32px serif;
+ white-space: pre;
+ overflow: clip;
+}
+.float {
+ float: left;
+ margin: 4px;
+ white-space: pre;
+ background-color: skyblue;
+ line-height: 1em;
+}
+</style>
+<div class="parent">
+<div class="clamp">Line 1
+Line 2
+Line 3<div class="float">Line A
+Line B
+Line C
+Line D
+Line E</div>
+Line 4…</div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-overflow/line-clamp/reference/webkit-line-clamp-005-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-overflow/line-clamp/reference/webkit-line-clamp-005-ref.html
new file mode 100644
index 00000000000..c9a9ae5d7ff
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-overflow/line-clamp/reference/webkit-line-clamp-005-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Reference</title>
+<style>
+.clamp {
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ font: 16px / 32px serif;
+ white-space: pre;
+ padding: 0 4px;
+ background-color: yellow;
+}
+</style>
+<div class="clamp">Line 1
+Line 2
+Line 3
+Line 4…</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-001.html
new file mode 100644
index 00000000000..be579b7bd1a
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-001.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Overflow: float at the start of a line-clamp</title>
+<link rel="author" title="Andreu Botella" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-overflow/line-clamp/reference/line-clamp-with-floats-001-ref.html">
+<meta name="assert" content="Floats in an inline formatting context inside a line-clamp container are not hidden if they come before the clamp point.">
+<style>
+.clamp {
+ line-clamp: 4;
+ font: 16px / 32px serif;
+ padding: 0 4px;
+ white-space: pre;
+ background-color: yellow;
+}
+.float {
+ float: left;
+ width: 50px;
+ height: 50px;
+ margin: 4px;
+ background-color: skyblue;
+}
+</style>
+<div class="clamp"><div class="float"></div>Line 1
+Line 2
+Line 3
+Line 4
+Line 5</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-002.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-002.html
new file mode 100644
index 00000000000..26a4fe2bb2b
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-002.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Overflow: float at the start of a line-clamp</title>
+<link rel="author" title="Andreu Botella" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-overflow/line-clamp/reference/line-clamp-with-floats-001-ref.html">
+<meta name="assert" content="Floats in a block formatting context inside a line-clamp container are not hidden if they come before the clamp point.">
+<style>
+.clamp {
+ line-clamp: 4;
+ font: 16px / 32px serif;
+ padding: 0 4px;
+ background-color: yellow;
+}
+.float {
+ float: left;
+ width: 50px;
+ height: 50px;
+ margin: 4px;
+ background-color: skyblue;
+}
+.pre {
+ white-space: pre;
+}
+</style>
+<div class="clamp">
+<div class="float"></div>
+<div class="pre">Line 1
+Line 2
+Line 3
+Line 4
+Line 5</div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-003.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-003.html
new file mode 100644
index 00000000000..33cc9568f14
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-003.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Overflow: float in line-clamp after clamp point</title>
+<link rel="author" title="Andreu Botella" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-overflow/line-clamp/reference/webkit-line-clamp-005-ref.html">
+<meta name="assert" content="Floats in an inline formatting context inside a line-clamp container are always hidden if they come after the clamp point.">
+<style>
+.clamp {
+ line-clamp: 4;
+ font: 16px / 32px serif;
+ padding: 0 4px;
+ white-space: pre;
+ background-color: yellow;
+}
+.float {
+ float: left;
+ width: 50px;
+ height: 50px;
+ margin: 4px;
+ background-color: skyblue;
+}
+</style>
+<div class="clamp">Line 1
+Line 2
+Line 3
+Line 4
+<div class="float"></div>Line 5</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-004.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-004.html
new file mode 100644
index 00000000000..0687cb02e1c
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-004.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Overflow: float in line-clamp after clamp point</title>
+<link rel="author" title="Andreu Botella" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-overflow/line-clamp/reference/webkit-line-clamp-005-ref.html">
+<meta name="assert" content="Floats in a block formatting context inside a line-clamp container are always hidden if they come after the clamp point.">
+<style>
+.clamp {
+ line-clamp: 4;
+ font: 16px / 32px serif;
+ padding: 0 4px;
+ background-color: yellow;
+}
+.float {
+ float: left;
+ width: 50px;
+ height: 50px;
+ margin: 4px;
+ background-color: skyblue;
+}
+.pre {
+ white-space: pre;
+}
+</style>
+<div class="clamp">
+<div class="pre">Line 1
+Line 2
+Line 3
+Line 4</div>
+<div class="float"></div>
+<div>Line 5</div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-005.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-005.html
new file mode 100644
index 00000000000..f593931876b
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-005.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Overflow: float in line-clamp before clamp point which extends past it</title>
+<link rel="author" title="Andreu Botella" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-overflow/line-clamp/reference/line-clamp-with-floats-005-ref.html">
+<meta name="assert" content="Floats in an inline formatting context before the clamp point are not hidden, but they are clipped to the line-clamp container's content edge">
+<style>
+.clamp {
+ line-clamp: 4;
+ font: 16px / 32px serif;
+ padding: 4px;
+ white-space: pre;
+ background-color: yellow;
+}
+.float {
+ float: left;
+ width: 50px;
+ height: 50px;
+ margin: 4px;
+ background-color: skyblue;
+}
+</style>
+<div class="clamp">Line 1
+Line 2
+Line 3
+Line 4<div class="float"></div>
+Line 5</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-006.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-006.html
new file mode 100644
index 00000000000..c71537ce31e
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-006.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Overflow: float in line-clamp before clamp point which extends past it</title>
+<link rel="author" title="Andreu Botella" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-overflow/line-clamp/reference/line-clamp-with-floats-005-ref.html">
+<meta name="assert" content="Floats in a block formatting context before the clamp point are not hidden, but they are clipped to the line-clamp container's content edge">
+<style>
+.clamp {
+ line-clamp: 4;
+ font: 16px / 32px serif;
+ padding: 4px;
+ background-color: yellow;
+}
+.float {
+ float: left;
+ width: 50px;
+ height: 75px;
+ margin: 4px;
+ background-color: skyblue;
+}
+.pre {
+ white-space: pre;
+}
+</style>
+<div class="clamp">
+<div class="pre">Line 1
+Line 2
+Line 3</div>
+<div class="float"></div>
+<div class="pre">Line 4
+Line 5</div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-007.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-007.html
new file mode 100644
index 00000000000..a8c9a540e9c
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-007.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Overflow: line-clamp doesn't propagate to floats</title>
+<link rel="author" title="Andreu Botella" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-overflow/line-clamp/reference/line-clamp-with-floats-007-ref.html">
+<meta name="assert" content="Floats create a new BFC, and line-clamp does not propagate into independent BFCs">
+<style>
+.clamp {
+ line-clamp: 4;
+ font: 16px / 32px serif;
+ padding: 4px;
+ white-space: pre;
+ background-color: yellow;
+}
+.float {
+ float: left;
+ margin: 4px;
+ white-space: pre;
+ background-color: skyblue;
+ line-height: 1em;
+}
+</style>
+<div class="clamp">Line 1
+Line 2
+Line 3<div class="float">Line A
+Line B
+Line C
+Line D
+Line E</div>
+Line 4
+Line 5</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-008.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-008.html
new file mode 100644
index 00000000000..e02ca5900ac
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-008.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Overflow: floats inside line-clamp only clip to the container's block-end edge</title>
+<link rel="author" title="Andreu Botella" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp">
+<link rel="match" href="../../../../../expected/wpt-import//css/reference/ref-filled-green-100px-square.xht">
+<meta name="fuzzy" content="maxDifference=0-1; totalPixels=0-4327">
+<meta name="assert" content="Floats inside a line-clamp container clip to the block-end content edge of the container, not to any of the other edges.">
+<style>
+.bg {
+ display: flow-root;
+ background: linear-gradient(red, red) 0px 0px / 100px 100px no-repeat;
+}
+.clamp {
+ line-clamp: 4;
+ font: 16px / 16px serif;
+ margin: 18px;
+ padding: 18px;
+ /* 18 + 18 + 4 * 16 = 100 */
+ color: transparent;
+}
+.float {
+ float: left;
+ width: 100px;
+ height: 300px;
+ position: relative;
+ top: -36px;
+ left: -36px;
+ background:
+ linear-gradient(green, green) 0px 0px / 100px 100px no-repeat,
+ red;
+}
+</style>
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+<div class="bg">
+ <div class="clamp">
+ <div class="float"></div>
+ Line 1 <br>
+ Line 2 <br>
+ Line 3 <br>
+ Line 4 <br>
+ Line 5
+ </div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-013.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-013.html
new file mode 100644
index 00000000000..0474c2856c2
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-013.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<meta charset="utf-8">
+<title>CSS Overflow: line-clamp float clipping repaint test</title>
+<link rel="author" title="Andreu Botella" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-overflow/line-clamp/reference/line-clamp-with-floats-005-ref.html">
+<meta name="assert" content="When a float inside a line-clamp container stops being hidden, it will clip to the content edge of the container.">
+<script src="../../../common/reftest-wait.js"></script>
+
+<style>
+#clamp {
+ line-clamp: 3;
+ font: 16px / 32px serif;
+ padding: 4px;
+ white-space: pre;
+ background-color: yellow;
+}
+.float {
+ float: left;
+ width: 50px;
+ height: 50px;
+ margin: 4px;
+ background-color: skyblue;
+}
+</style>
+
+<div id="clamp">Line 1
+Line 2
+Line 3
+Line 4<div class="float"></div>
+Line 5</div>
+
+<script>
+ window.onload = () => {
+ requestAnimationFrame(() => {
+ requestAnimationFrame(() => {
+ document.getElementById("clamp").style.lineClamp = "4";
+ takeScreenshot();
+ });
+ });
+ };
+</script>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-015.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-015.html
new file mode 100644
index 00000000000..9472fab210a
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-overflow/line-clamp/line-clamp-with-floats-015.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Overflow: a float in a line-clamp container does not make it taller</title>
+<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp">
+<link rel="match" href="../../../../../expected/wpt-import//css/reference/ref-filled-green-100px-square.xht">
+<meta name="assert" content="Floats in a line-clamp container do not introduce any clearance that would make the line-clamp container increase its height.">
+<link rel="stylesheet" href="../../../fonts/ahem.css">
+<style>
+.clamp {
+ line-clamp: 2;
+ font: 50px / 1 Ahem;
+ color: transparent;
+ width: 100px;
+ background-color: green;
+}
+.float {
+ float: left;
+ width: 10px;
+ height: 200px;
+}
+</style>
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+<div style="background-color: red; width: 100px; height: 100px; position: absolute; z-index: -1"></div>
+<div class="clamp"><div class="float"></div>X<br>X<br>X</div>