Skip to content

Commit fe29c83

Browse files
andreubotellamoz-wptsync-bot
authored andcommitted
Bug 1962663 [wpt PR 52120] - [line-clamp] Make text-overflow: ellipsis work inside line-clamp, a=testonly
Automatic update from web-platform-tests [line-clamp] Make `text-overflow: ellipsis` work inside `line-clamp` Since `-webkit-line-clamp` was first implemented in Webkit, using line clamping would prevent `text-overflow: ellipsis` from working inside the line clamp container. This seems to have been a side effect of the initial implementation, and it was kept as it was when the implementation was redone for LayoutNG, even though that is no longer a side effect. Recently, in w3c/csswg-drafts#10823 the CSSWG resolved that `text-overflow: ellipsis` should apply inside a line-clamp container. For the last line until clamp, if `text-overflow: ellipsis` also applies to it, the line clamp ellipsis is applied first -- however, since we currently only support ellipsis, rather than a text string, for both the `text-overflow` and line-clamp ellipses, this would be identical to only applying the line clamp ellipsis. This change also removes the `LineClampData::State::kDontTruncate` state, which was set when there was no possibility of clamping, but `text-overflow: ellipsis` should still not apply because we were still inside the line-clamp container. Since `text-overflow: ellipsis` now should apply in those cases, we remove that state, and use `kDisabled` instead. We also add an `ignore_line_clamp` flag to `BlockLineClampData` to know to ignore the line-clamp properties when performing a relayout without clamping. Additionally, this change updates some WPT tests that were rendered incorrect with this resolution. Bug: 40336192, 407971271 Change-Id: I06e43011a12ba27507b6f661c7b0484d6587cf19 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6470150 Reviewed-by: Ian Kilpatrick Reviewed-by: Koji Ishii Commit-Queue: Andreu Botella Cr-Commit-Position: refs/heads/main@{#1451710} -- wpt-commits: f70ccb743183524cdb23aa4fc3ce0343d1734fd2 wpt-pr: 52120
1 parent 0332c82 commit fe29c83

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

testing/web-platform/tests/css/css-overflow/line-clamp/line-clamp-auto-009.tentative.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
<link rel="author" title="Andreu Botella" href="mailto:[email protected]">
55
<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp">
66
<link rel="match" href="reference/webkit-line-clamp-036-ref.html">
7-
<meta name="assert" content="text-overflow: ellipsis doesn't apply in a line-clamp: auto context">
7+
<meta name="assert" content="text-overflow: ellipsis does apply in a line-clamp: auto context">
88
<style>
99
.clamp {
10-
width: 10ch;
10+
width: 10.1ch;
1111
max-height: 80px;
1212
font: 16px / 32px monospace;
1313
background-color: yellow;

testing/web-platform/tests/css/css-overflow/line-clamp/line-clamp-auto-010.tentative.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
<link rel="author" title="Andreu Botella" href="mailto:[email protected]">
55
<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp">
66
<link rel="match" href="reference/webkit-line-clamp-037-ref.html">
7-
<meta name="assert" content="text-overflow: ellipsis doesn't apply in a line-clamp: auto context, even if it doesn't have a max-height">
7+
<meta name="assert" content="text-overflow: ellipsis does apply in a line-clamp: auto context, even if it doesn't have a max-height">
88
<style>
99
.clamp {
10-
width: 150px;
10+
width: 15.1ch;
1111
font: 16px / 32px monospace;
1212
background-color: yellow;
1313
padding: 4px;

testing/web-platform/tests/css/css-overflow/line-clamp/reference/webkit-line-clamp-036-ref.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
.clamp {
55
display: -webkit-box;
66
-webkit-box-orient: vertical;
7-
width: 10ch;
7+
width: 10.1ch;
88
font: 16px / 32px monospace;
99
background-color: yellow;
1010
padding: 4px;
1111
overflow: hidden;
1212
}
1313
style>
1414
<div class="clamp">
15-
supercalifragilisticexpialidocious
1615
supercali…
16+
1717
div>

testing/web-platform/tests/css/css-overflow/line-clamp/reference/webkit-line-clamp-037-ref.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
.clamp {
55
display: -webkit-box;
66
-webkit-box-orient: vertical;
7-
width: 150px;
7+
width: 15.1ch;
88
font: 16px / 32px monospace;
99
background-color: yellow;
1010
padding: 4px;
1111
overflow: hidden;
1212
}
1313
style>
1414
<div class="clamp">
15-
supercalifragilisticexpialidocious
16-
supercalifragilisticexpialidocious
15+
supercalifragi…
16+
supercalifragi…
1717
div>

testing/web-platform/tests/css/css-overflow/line-clamp/webkit-line-clamp-036.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<meta charset="utf-8">
33
<link rel="help" href="https://drafts.csswg.org/css-overflow-3/#webkit-line-clamp">
44
<link rel="match" href="reference/webkit-line-clamp-036-ref.html">
5-
<meta name="assert" content="text-overflow: ellipsis shouldn't apply within a -webkit-line-clamp context.">
5+
<meta name="assert" content="text-overflow: ellipsis does apply within a -webkit-line-clamp context.">
66
<style>
77
.clamp {
88
display: -webkit-box;
99
-webkit-box-orient: vertical;
1010
-webkit-line-clamp: 2;
11-
width: 10ch;
11+
width: 10.1ch;
1212
font: 16px / 32px monospace;
1313
background-color: yellow;
1414
padding: 4px;

testing/web-platform/tests/css/css-overflow/line-clamp/webkit-line-clamp-037.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<meta charset="utf-8">
33
<link rel="help" href="https://drafts.csswg.org/css-overflow-3/#webkit-line-clamp">
44
<link rel="match" href="reference/webkit-line-clamp-037-ref.html">
5-
<meta name="assert" content="text-overflow: ellipsis shouldn't apply within a -webkit-line-clamp context.">
5+
<meta name="assert" content="text-overflow: ellipsis should apply within a -webkit-line-clamp context.">
66
<style>
77
.clamp {
88
display: -webkit-box;
99
-webkit-box-orient: vertical;
1010
-webkit-line-clamp: 2;
11-
width: 150px;
11+
width: 15.1ch;
1212
font: 16px / 32px monospace;
1313
background-color: yellow;
1414
padding: 4px;

0 commit comments

Comments
 (0)