Skip to content

Commit

Permalink
[line-clamp] Add test for -webkit-line-clamp as a block-in-inline
Browse files Browse the repository at this point in the history
This also fixes a bug in the existing `webkit-line-clamp-047` test.

Bug: 40336192
Change-Id: I1b0d665bccfc8d79e52091b3155e9795db0c2240
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5850277
Reviewed-by: Ian Kilpatrick <[email protected]>
Commit-Queue: Andreu Botella <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1353690}
  • Loading branch information
andreubotella authored and chromium-wpt-export-bot committed Sep 11, 2024
1 parent 1fe7db9 commit dbca9cf
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
display: flow-root;
background-color: yellow;
padding: 0.5em;
font-size: 16px / 32px serif;
font: 16px / 32px serif;
white-space: pre;
}
.float {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!doctype html>
<meta charset="utf-8">
<title>CSS Test Reference</title>
<style>
.no-bottom-margin {
margin-bottom: 0;
}
.clamp {
display: flow-root;
font: 16px / 32px serif;
white-space: pre;
background-color: yellow;
}
</style>

<p class="no-bottom-margin"><span>The following yellow box should clamp after 4 lines.</span></p>

<div class="clamp">Line 1
Line 2
Line 3
Line 4…</div>
2 changes: 1 addition & 1 deletion css/css-overflow/line-clamp/webkit-line-clamp-047.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/* no overflow: hidden */
background-color: yellow;
padding: 0.5em;
font-size: 16px / 32px serif;
font: 16px / 32px serif;
white-space: pre;
}
.float {
Expand Down
30 changes: 30 additions & 0 deletions css/css-overflow/line-clamp/webkit-line-clamp-049.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Overflow: -webkit-line-clamp block in inline</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="reference/webkit-line-clamp-049-ref.html">
<meta name="assert" content="If -webkit-line-clamp is a block inside an inline, it works correctly.">

<style>
p span clamp {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 4;
overflow: hidden; /* can be removed once implementations update their old -webkit-line-clamp implementations */
font: 16px / 32px serif;
white-space: pre;
background-color: yellow;
}
</style>

<p><span>The following yellow box should clamp after 4 lines.

<!-- Using a <clamp> element rather than e.g. <div class="clamp"> so the parser doesn't close the <p>.-->
<clamp>Line 1
Line 2
Line 3
Line 4
Line 5</clamp>

</span></p>

0 comments on commit dbca9cf

Please sign in to comment.