-
Notifications
You must be signed in to change notification settings - Fork 719
[css-overflow] interaction between text-overflow:ellipsis and line-clamp #10823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It seems like Chromium and Gecko turn off As far as I can tell, the ellipsis behavior of |
Depending on exactly what you mean by this, I don't think this is actually what the spec calls for. My understanding is:
Now, at step 3, the spec does call for taking line-breaking opportunities into account in order to find what chunks of content you can actually remove:
In this approach, it's not "taken into account when line breaking". Line breaking is step 1, and the ellipsis is ignored then. Yes, step 3 uses some concepts related to line breaking (soft wrap opportunities), but I don't think this should have an impact. With this clarification, do you still think it is hard to make |
With I think the interaction with If the line breaks are chosen as with |
Up to you, since you're the one proposing/defining it :) But yes, I would expect that unlike |
Possibly, yes. I wonder if we should handle that as a two-passes thing: first, do greedy line breaking, find the clamp point based on that, then rewrap lines using the pretty or balance approach, then if that increase the height or the number of lines beyond the clamp point, clamp again (but don't re-wrap after that), then insert the ellispsis (and don't rewrap after that). |
See #10827 (comment) |
The CSS Working Group just discussed
The full IRC log of that discussionis to have text-overflow to not be too long, and line-clamp to not be too long |
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
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 KilpatrickReviewed-by: Koji Ishii Commit-Queue: Andreu Botella Cr-Commit-Position: refs/heads/main@{#1451710}
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 KilpatrickReviewed-by: Koji Ishii Commit-Queue: Andreu Botella Cr-Commit-Position: refs/heads/main@{#1451710}
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 KilpatrickReviewed-by: Koji Ishii Commit-Queue: Andreu Botella Cr-Commit-Position: refs/heads/main@{#1451710}
No spec changes are needed, and tests for this resolution have been merged in web-platform-tests/wpt#52120. |
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 KilpatrickReviewed-by: Koji Ishii Commit-Queue: Andreu Botella Cr-Commit-Position: refs/heads/main@{#1451710}
…is` 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 KilpatrickReviewed-by: Koji Ishii Commit-Queue: Andreu Botella Cr-Commit-Position: refs/heads/main@{#1451710} -- wpt-commits: f70ccb743183524cdb23aa4fc3ce0343d1734fd2 wpt-pr: 52120
…is` 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 KilpatrickReviewed-by: Koji Ishii Commit-Queue: Andreu Botella Cr-Commit-Position: refs/heads/main@{#1451710} -- wpt-commits: f70ccb743183524cdb23aa4fc3ce0343d1734fd2 wpt-pr: 52120
…is` 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 KilpatrickReviewed-by: Koji Ishii Commit-Queue: Andreu Botella Cr-Commit-Position: refs/heads/main{#1451710} -- wpt-commits: f70ccb743183524cdb23aa4fc3ce0343d1734fd2 wpt-pr: 52120 UltraBlame original commit: ab51b6e73ebf58b95274f97b4825bede549a8081
…is` 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 KilpatrickReviewed-by: Koji Ishii Commit-Queue: Andreu Botella Cr-Commit-Position: refs/heads/main{#1451710} -- wpt-commits: f70ccb743183524cdb23aa4fc3ce0343d1734fd2 wpt-pr: 52120 UltraBlame original commit: ab51b6e73ebf58b95274f97b4825bede549a8081
…is` 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 KilpatrickReviewed-by: Koji Ishii Commit-Queue: Andreu Botella Cr-Commit-Position: refs/heads/main{#1451710} -- wpt-commits: f70ccb743183524cdb23aa4fc3ce0343d1734fd2 wpt-pr: 52120 UltraBlame original commit: ab51b6e73ebf58b95274f97b4825bede549a8081
…is` 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 KilpatrickReviewed-by: Koji Ishii Commit-Queue: Andreu Botella Cr-Commit-Position: refs/heads/main@{#1451710} -- wpt-commits: f70ccb743183524cdb23aa4fc3ce0343d1734fd2 wpt-pr: 52120
Uh oh!
There was an error while loading. Please reload this page.
http://wpt.live/css/css-overflow/line-clamp/webkit-line-clamp-036.html and http://wpt.live/css/css-overflow/line-clamp/webkit-line-clamp-037.html assume that if
-webkit-line-clamp
is on, thetext-overflow: ellipsis
has no effect.This is not backed up by the spec, which expects both effects to be independent. Assuming the preconditions for both properties are fulfilled:
The spec also defines how the two interact when they'd happen on the same line, which can happen given that the string for line-clamp can be customized to something different, and possibly longer, than "…":
Should we:
rationale: if gives maximum control to authors, and the interaction can be useful
text-overflow: ellipsis
when using-webkit-line-clamp
for compat reasons, but not when usingline-clamp
?rationale: this behavior originated in a compat workaround, but keep authors in control in the unprefixed version which does not have compat bagage
text-overflow: ellipsis
when using either-webkit-line-clamp
orline-clamp
?rationale: this behavior originated in a compat workaround, and keep both prefixed and unprefixed versions consistent
cc: @andreubotella @bfgeek
The text was updated successfully, but these errors were encountered: