Commit e3cea74
[text-overflow] [line-clamp] Fix
The https://crrev.com/c/6773707 CL just recently added support for
passing a string to `text-overflow`, which is used as a replacement
for the ellipsis added when the line is truncated.
In that CL, `LineTruncator` was updated to use the string that was
passed to `text-overflow` if there was one. However, `LineTruncator`
is also used for the `(-webkit-)line-clamp` ellipses (when the
`CSSLineClampLineBreakingEllipsis` runtime feature is disabled), and
those should not use the string passed to `text-overflow`.
Furthermore, since the `line-clamp` ellipsis can end up placed in
descendant inline formatting contexts which don't have the relevant
`line-clamp` shorthands, and since `text-overflow` can also be used
inside a `line-clamp` container, it can't be known which of those
properties caused the line truncation just from the computed styles.
This CL fixes this by updating
`InlineLayoutAlgorithm::GetLineClampState` so the `kLineClampEllipsis`
and `kTextOverflowEllipsis` return values indicate which property
caused the ellipsis, rather than the method in which the ellipsis is
placed. This is then passed to `LineTruncator` constructor.
Bug: 40336192, 41492459
Change-Id: Ifad94fd848492fc46b5548a1df7833f5df69c46a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6845961
Commit-Queue: Andreu Botella <abotella@igalia.com>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1501770}text-overflow: <string> inside line-clamp
1 parent b56a33b commit e3cea74
4 files changed
Lines changed: 72 additions & 1 deletion
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
0 commit comments