Glitch in text-overflow:ellipsis rendering with RTL directionality
Categories
(Core :: Layout: Text and Fonts, defect, P3)
Tracking
()
People
(Reporter: jfkthame, Assigned: jfkthame)
Details
Attachments
(2 files)
Testcase: https://codepen.io/jfkthame/pen/RwJgLmK
The exact rendering of the testcase will vary depending on system fonts, but what I'm seeing on all of macOS, Windows and Linux is that several of the RTL examples (right-hand column) show a large gap between the text and the ellipsis, where there would have been room to render an additional character of the text.
Oddly, doing a Select All to highlight the text makes the "missing" characters appear. So the problem doesn't show up in the paint-with-selection codepath. (Even just selecting one of the visible characters in one of the "bad" paragraphs will cause the "missing" character in that block to appear.)
| Assignee | ||
Comment 1•3 years ago
|
||
The root of the problem here seems to be the GetClusterLength helper used by nsTextFrame::MeasureCharClippedText, which is returning nonsense results in the RTL case. E.g. in the codepen example, all the content should have cluster lengths of 3 code units (two surrogates for the U+1f310 character, plus the trailing variation selector), but GetClusterLength simply returns 1, and we crop and clip in the wrong place when painting.
As far as I can see, this function doesn't actually need to care about RTL; we're iterating forward through the textrun, regardless of directionality. A simplified version gives us the expected results here.
| Assignee | ||
Comment 2•3 years ago
|
||
Updated•3 years ago
|
| Assignee | ||
Comment 3•3 years ago
|
||
Depends on D162095
Comment 5•3 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/902175624543
https://hg.mozilla.org/mozilla-central/rev/e2fb54d49160
Updated•3 years ago
|
Reproducible on Firefox 108.0.1(build ID: 20221215175817, ar-locale) on macOS 12.
Verified as fixed on Firefox 109.0b6(build ID: 20221222190305, ar-locale) and Nightly 110.0a1(build ID: 20221226154927, ar-locale) on macOS 12, Windows 10, Ubuntu 22.
Description
•