-
Notifications
You must be signed in to change notification settings - Fork 640
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
[css-ui] text-overflow: ellipsis when a word of different direction was truncated #2125
Comments
From the spec: L3:
L4:
and
So old-Blink and Gecko are doing the correct thing here. Also, UAs are supposed to (RFC2119 SHOULD) reveal more content when you scroll. This seems awkward to do with
which doesn't really feel like scrolling, since the right edge doesn't move. Compare with this what you get in Firefox on your example (changed from From an i18n point of view, the placement of the ellipsis to the right CBA is also weird. I think So again, in conclusion, old-Blink and Gecko are doing the correct thing here, and the other browsers should be fixed. Can you file the bug on Blink/layout-NG if there isn't one already? I'll fine the bug on everyone else. We hadn't caught that scenario in the test suite, so I've just made a new test for it. Review appreciated. |
Thank you for your prompt response. Spec text-wise, the "end" was unclear to us whether it's logical (DOM order) or visual (after bidi reorder.) Some of us read it as logical, some as visual, hence the question. Behavior-wise, I remember barely we discussed this before, or was that my wrong memory? Do you have pointers to minutes? When my team discussed:
Having minutes of WG discussion might help our understanding. |
It's been years since @fantasai and I discussed this but yes, Gecko is doing what the spec expects. If there's some way to make the wording more clear, I'd be happy to consider that. |
@kojiishi I agree that multi-line ellipsis would be using the CBA, as it is effectively a matter of fragmentation, and that's what you would get if you were to break the line / fragment. However, here we're talking about single line ellipsisis, which is a graphical thing that can be uncovered by scrolling, and explicitly does not affect layout.
Indeed, that's what we consider, since:
That's certainly true of me as well, although my understanding is that the spec as it is written did have the input of bidi-native people (and got horizontal review from i18n) |
If you truncate visually, the text will be somewhat illegible. In addition, doing visual truncation will make text selection kind of broken (don't forget that other operations besides viewing can happen). Instead of using non-words like
While having it be:
... doesn't make any sense. |
In the example presented by Aphilips above, a more realistic representation of what is displayed should be (assuming that "and OSTRICHES" overflows to the next line): Logical truncation: Visual truncation: Personally, I don't have a strong preference either way. |
@aphillips In the non bidi case, the words are truncated visually: pointer events are expected to hit the elements behind the ellipsis when you click on the ellipsis, selecting the ellipsis and copying to the clipboard gives you the elided text, you are supposed to be able to scroll (if overflow is scroll or auto) to reveal the part that has been hidden... Consider also that CSS-UI-4 introduces a fadeout style, in addition to the existing "...". I don't know how to make that all these things work or make sense if we truncate other than visually. |
@tantek Thanks for the clarification. Put "what it should be" aside, I understood past discussions and the spec intention now. For the text, Blink team uses terms "logical" and "visual", the former is DOM order and the latter is the order after bidi reorder, but I don't think this distinction is well-defined in CSS nor in HTML specs yet. There's no other features that handles grapheme cluster boundaries after bidi reorder AFAIK, so you probably need to define it. Also, when you say "end" side, there are 4 different directions for a character; block, paragraph, inline, and resolved. I guess you want paragraph here (haven't tested block/paragraph but tested no browsers use inline nor resolved.) |
Thanks for the explanations.
I wasn't clear enough, sorry about that. I think there were 2 different points in our thinking:
Point 1 is clear now, thank you for that. What do you think about point 2? I think even with fadeout style, if the following text is assumed to be in the following lines, CBA makes sense. Is the consistency with multi-line option considered as a new data to reconsider the past conclusion? |
@frivoal A case could be made that the non-bidi case (that is, the unidirectional case) isn't necessarily truncating "visually", it just looks that way :-). Consider a purely right-to-left text: it should truncate on the left side rather than the right side. @kojiishi calls out that vertical presentation is also affected here and needs an answer about visual vs. logical truncation. I think that shouldn't be overlooked. If the control is a "viewport" on an infinite baseline of text, that suggests a visual presentation (visual is certainly easier in that case; particularly I'm thinking about scrolling behavior, although cursor movement might be an adventure if the cursor is placed in bidi text---the cursor normally moves logically in text) @matial I actually treated mentally each RTL word as isolated (as we recommend for insertion), as they are inserted into an LTR context, so logical:
And visual:
|
Which part of the word, ABC or DEF, is truncated is relative and depends on base direction (and the reading direction). With Firefox: In RTL mode, Arabic "FEDCBA" will result in "...CBA". The right reading for Arabic readers In LTR mode it is just the opposite behavior Arabic "FEDCBA" will result in "FED ...". So, ellipsis is coherent with scrolling. I expect this is the right thing to do. Give it a try here with this text " |
I you just look at it, a case could be made (although I would still disagree). Once you start looking at user interaction or how to integrate with other parts of css, I think the case for non-visual ellipsis falls apart (or at least gets substantively more complicated).
EDIT: added point 7 TL;DR: this is handling of overflow, not of wrapping. Treating it as wrapping makes everything complicated, treating it as overflow makes everything fall out of existing behavior.
This has been considered, and is why the spec say you put the ellipsis at the end of the line, not at the right of the line.
It isn't overlooked, and is also handled by using the end edge of the line. I absolutely want to do the right thing here for internationalization, but this isn't like this is a new proposal that hasn't been defined precisely yet. The current definition of doing it visually dates to 2011, and the decision was made because of bidi (as explicitely recorded in the commit message, in order to be able to support interaction sensibly in the face of mixed directionality). This has been in css-ui specs for 7 years, and was in css-text for 3 years priori to that. I encourage you to look at how the whole feature is defined in the spec, and how it is extended in level 4 (that text has matured over many years too). The spec went through 2 CRs and associated horizontal reviews with this feature in it, and has now reached PR. It is possible that a superior model exists, but the way it is defined is deliberate, and it forms a consistent system. It is never too late to fix a broken spec, but I think at this stage If you'd like to replace it, we need substantial evidence that the current design is broken or suboptimal, and we'll need to see the full picture of how the alternative would work, not just visually, but also in terms of layout, interaction, etc. |
The wordings used in the spec are:
and
Per https://www.w3.org/TR/css-writing-modes-3/#end, I do not believe this to be ambiguous. |
example with actual RTL text (thanks @ntounsi ) http://jsbin.com/lidijin/1/edit?html,css,output |
Minor, but "end line box edge in the inline progression direction of its block container element" and "the end edge of the line" are not always the same. It looks like impls agree to use the former, disregards the direction of the line box, from this test. For logical v.s. visual, I see both have reasonable justifications, both have supporting people, and both have 2 impls. I guess it's best to see how our discussion goes on #390 Consider support for multiple-line ellipsis and #1574 Consider support for ellipsizing only whole words. |
Thank you @frivoal for the history, that's definitely something we should keep in mind. This is about an edge case that we can probably change without causing web compat problem, but if it's questionable, we can help to gather data. |
Please explain how you position abspos descendants, how you do scrolling, how you target pointer events, how you handle clipboard and selections, whether you plan to do the same for overflow:clip (and if not, why not), how you handle caret position if the element is editable... Maybe there are good answers to these questions, but I have not hear them yet. If there's no answer to these questions, it seems to me that this is an implementation shortcut leading to bugs, not a reasonable alternative solution. |
This is unrelated. Both topics use the “…” character, but apply in very different situations. This is about overflowing a non wrappable line in the inline direction, that is about cutting wrapped content that overflows in the block direction (aka fragmentation).
I don't see why this would require switching to the logical ordering. Yes, this is more than a purely graphical operation, and you need to be aware of character boundaries, word boundaries, etc, but it still makes sense to work after bidi reordering, after transforms, etc. |
The spec writes
I think the “end edge of the line” is very clearly not about the DOM order of characters. As @tantek says, the clipping is visual only. There were in fact very long discussions about this in the CSSWG, and we resolved very clearly to have this behavior. Altogether the As for multi-line ellipsis, the text that is clipped is on later lines, and line-breaking is already logical, so there is no conflict with expectations there: later text on later lines is elided. @tantek Can you add a bidi example after the quoted text, please? |
The I18N WG discussed this in our teleconference of 18 January 2018 and I was actioned with this reply. The WG members present felt that the arguments in favor of visual truncation are persuasive. In particular, we agree with @fantasai's comment just above. |
@FremyCompany Great example! Numbers in RTL languages are still LTR--logical truncation with the ellipsis on the end-edge of the line would create much more confusion about what part of the number is visible/missing than visual truncation, imho. |
Made web-platform-tests/wpt#9294 based on @FremyCompany 's example. @FremyCompany, @fantasai Wanna review it? Should be a quick & easy one. |
Oops. I had already written a test for that, and forgot about it. Maybe there's something to be said for quick reviews... |
…only Automatic update from web-platform-tests In support of w3c/csswg-drafts#2125 <!-- Reviewable:start --> <!-- Reviewable:end --> wpt-commits: da3f289df5d63c0ffac925964d2cd9388afa0fde wpt-pr: 9294 reapplied-commits: 370e267e160568862f1fd9ec246ab5bb840f586e, fe4514c84e7ad28e46bad5da93381deb99b177f3, 7806af854343c043a2645a4034fdc7812f65daad, 9ddfd21554293dec5a4bf2e5375ae4f3c9f2ded0, 75f63c4d1ebc949647184fd60972fc7b9fd4affb, 1f3a5b496acd2288cc8cf0c32af86cb35157ea4e, 88b42bd5847abac58a62c4d6b33c1509bfce5f3d, 15c2e4c690700c6c115f8afe5e44ded10d943538, c8d461ef1437641ae7d4ea1d21e1e60cd62910b0, a6088a5f48ee299386a84d2f771902267d7355b1, 0634cd8f08ebe0905a9188fb1398c7b5f889c5dc, c8ee4a012dae506ae06bb5b2ad50942b04c1aaaa, c2c352456a4cf62dcc12f851138b04397675a445, b93a8879555d2fa7e7d4e00a275513a3a6338b35, b86e1331cb36634fd33677043b61fc0c1d8485bc, 44ddf14fd3346658c3223f13652073fafbfa48fa, a1a5840a6bb53e305ba02bcbeb215659342d0edb, 7465cb110ae5ec2e2ca73182caf5293f0efc8fd5, aad5349b3458bc3414e274b33fa86a1123901ff2, eca0907980d2769c449894a6277c60c1a306792f, 38626987c0cfd6e715cfcc6f4f1a1209191a03c5, e4a67f7ddcde6cd99348e9104bd7ed07074da44a, bb3c9990840a0fae2afc840b5952d7874785b112, 042d7adef0bdb9dc80e825c3997ace7519477c42, 99f1ea44fc7915b8b7b33bce4732fa8765fd3ac2
…only Automatic update from web-platform-tests In support of w3c/csswg-drafts#2125 <!-- Reviewable:start --> <!-- Reviewable:end --> wpt-commits: da3f289df5d63c0ffac925964d2cd9388afa0fde wpt-pr: 9294 reapplied-commits: 370e267e160568862f1fd9ec246ab5bb840f586e, fe4514c84e7ad28e46bad5da93381deb99b177f3, 7806af854343c043a2645a4034fdc7812f65daad, 9ddfd21554293dec5a4bf2e5375ae4f3c9f2ded0, 75f63c4d1ebc949647184fd60972fc7b9fd4affb, 1f3a5b496acd2288cc8cf0c32af86cb35157ea4e, 88b42bd5847abac58a62c4d6b33c1509bfce5f3d, 15c2e4c690700c6c115f8afe5e44ded10d943538, c8d461ef1437641ae7d4ea1d21e1e60cd62910b0, a6088a5f48ee299386a84d2f771902267d7355b1, 0634cd8f08ebe0905a9188fb1398c7b5f889c5dc, c8ee4a012dae506ae06bb5b2ad50942b04c1aaaa, c2c352456a4cf62dcc12f851138b04397675a445, b93a8879555d2fa7e7d4e00a275513a3a6338b35, b86e1331cb36634fd33677043b61fc0c1d8485bc, 44ddf14fd3346658c3223f13652073fafbfa48fa, a1a5840a6bb53e305ba02bcbeb215659342d0edb, 7465cb110ae5ec2e2ca73182caf5293f0efc8fd5, aad5349b3458bc3414e274b33fa86a1123901ff2, eca0907980d2769c449894a6277c60c1a306792f, 38626987c0cfd6e715cfcc6f4f1a1209191a03c5, e4a67f7ddcde6cd99348e9104bd7ed07074da44a, bb3c9990840a0fae2afc840b5952d7874785b112, 042d7adef0bdb9dc80e825c3997ace7519477c42, 99f1ea44fc7915b8b7b33bce4732fa8765fd3ac2 UltraBlame original commit: aafcfd714c7c7cf4c8ed8c0feb9896791688d1a3
…only Automatic update from web-platform-tests In support of w3c/csswg-drafts#2125 <!-- Reviewable:start --> <!-- Reviewable:end --> wpt-commits: da3f289df5d63c0ffac925964d2cd9388afa0fde wpt-pr: 9294 reapplied-commits: 370e267e160568862f1fd9ec246ab5bb840f586e, fe4514c84e7ad28e46bad5da93381deb99b177f3, 7806af854343c043a2645a4034fdc7812f65daad, 9ddfd21554293dec5a4bf2e5375ae4f3c9f2ded0, 75f63c4d1ebc949647184fd60972fc7b9fd4affb, 1f3a5b496acd2288cc8cf0c32af86cb35157ea4e, 88b42bd5847abac58a62c4d6b33c1509bfce5f3d, 15c2e4c690700c6c115f8afe5e44ded10d943538, c8d461ef1437641ae7d4ea1d21e1e60cd62910b0, a6088a5f48ee299386a84d2f771902267d7355b1, 0634cd8f08ebe0905a9188fb1398c7b5f889c5dc, c8ee4a012dae506ae06bb5b2ad50942b04c1aaaa, c2c352456a4cf62dcc12f851138b04397675a445, b93a8879555d2fa7e7d4e00a275513a3a6338b35, b86e1331cb36634fd33677043b61fc0c1d8485bc, 44ddf14fd3346658c3223f13652073fafbfa48fa, a1a5840a6bb53e305ba02bcbeb215659342d0edb, 7465cb110ae5ec2e2ca73182caf5293f0efc8fd5, aad5349b3458bc3414e274b33fa86a1123901ff2, eca0907980d2769c449894a6277c60c1a306792f, 38626987c0cfd6e715cfcc6f4f1a1209191a03c5, e4a67f7ddcde6cd99348e9104bd7ed07074da44a, bb3c9990840a0fae2afc840b5952d7874785b112, 042d7adef0bdb9dc80e825c3997ace7519477c42, 99f1ea44fc7915b8b7b33bce4732fa8765fd3ac2 UltraBlame original commit: aafcfd714c7c7cf4c8ed8c0feb9896791688d1a3
…only Automatic update from web-platform-tests In support of w3c/csswg-drafts#2125 <!-- Reviewable:start --> <!-- Reviewable:end --> wpt-commits: da3f289df5d63c0ffac925964d2cd9388afa0fde wpt-pr: 9294 reapplied-commits: 370e267e160568862f1fd9ec246ab5bb840f586e, fe4514c84e7ad28e46bad5da93381deb99b177f3, 7806af854343c043a2645a4034fdc7812f65daad, 9ddfd21554293dec5a4bf2e5375ae4f3c9f2ded0, 75f63c4d1ebc949647184fd60972fc7b9fd4affb, 1f3a5b496acd2288cc8cf0c32af86cb35157ea4e, 88b42bd5847abac58a62c4d6b33c1509bfce5f3d, 15c2e4c690700c6c115f8afe5e44ded10d943538, c8d461ef1437641ae7d4ea1d21e1e60cd62910b0, a6088a5f48ee299386a84d2f771902267d7355b1, 0634cd8f08ebe0905a9188fb1398c7b5f889c5dc, c8ee4a012dae506ae06bb5b2ad50942b04c1aaaa, c2c352456a4cf62dcc12f851138b04397675a445, b93a8879555d2fa7e7d4e00a275513a3a6338b35, b86e1331cb36634fd33677043b61fc0c1d8485bc, 44ddf14fd3346658c3223f13652073fafbfa48fa, a1a5840a6bb53e305ba02bcbeb215659342d0edb, 7465cb110ae5ec2e2ca73182caf5293f0efc8fd5, aad5349b3458bc3414e274b33fa86a1123901ff2, eca0907980d2769c449894a6277c60c1a306792f, 38626987c0cfd6e715cfcc6f4f1a1209191a03c5, e4a67f7ddcde6cd99348e9104bd7ed07074da44a, bb3c9990840a0fae2afc840b5952d7874785b112, 042d7adef0bdb9dc80e825c3997ace7519477c42, 99f1ea44fc7915b8b7b33bce4732fa8765fd3ac2 UltraBlame original commit: aafcfd714c7c7cf4c8ed8c0feb9896791688d1a3
https://bugs.webkit.org/show_bug.cgi?id=164999 <rdar://problem/29464657> Reviewed by Antti Koivisto. This patch addresses w3c/csswg-drafts#2125 which clarifies truncation behavior when content direction != inline direction. truncateOverflowingDisplayBoxes: mismatching direction requires truncation starting from the beginning of the content. paintForegroundAndDecorations: since TextBoxSelectableRange only has the truncated length, we need to adjust the position for mismatching direction. * LayoutTests/TestExpectations: 27 and 28 have also progressed but we seem to have some rounding bugs getting an extra character truncated (Chrome too). * Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp: (WebCore::Layout::truncateOverflowingDisplayBoxes): * Source/WebCore/rendering/TextBoxPainter.cpp: (WebCore::TextBoxPainter<TextBoxPath>::paintForegroundAndDecorations): (WebCore::TextBoxPainter<TextBoxPath>::computePaintRect): Canonical link: https://commits.webkit.org/263418@main
When the overflowing word is in different direction from the paragraph direction, which part of the word should be truncated?
For example, if a paragraph in the logical order (uppercase means RTL characters):
which is laid out this way:
and if the last 3 characters overflows, should "FED" be visible, or "CBA"?
Test@jsbin
Blink/Gecko shows "FED..." while Edge/WebKit shows "CBA...". Blink w/LayoutNG currently matches to Edge/WebKit.
The text was updated successfully, but these errors were encountered: