Closed Bug 1799093 Opened 2 years ago Closed 2 years ago

XUL treeview cells containing supplementary characters may be cropped in mid-surrogate-pair

Categories

(Core :: XUL, defect)

defect

Tracking

()

RESOLVED FIXED
108 Branch
Tracking Status
firefox108 --- fixed

People

(Reporter: jfkthame, Assigned: jfkthame)

References

Details

Attachments

(1 file)

STR from https://bugzilla.mozilla.org/show_bug.cgi?id=404856#c30:

Visit the testcases attachment 739762 [details] and attachment 8719500 [details]; then choose Show All History to open the Library window and view the entries in the recent history, and resize the Name column (or the overall window) so that truncation occurs.

Result: as the width varies, the titles containing supplementary-plane characters sometimes break mid-surrogate-pair and display a single surrogate code as a hexbox.

This is basically copied from how nsTextBoxFrame handles truncation, and avoids breaking surrogate pairs
(or other grapheme clusters such as base character + diacritic). It's still a "poor man's" version
of truncation that doesn't correctly measure the string in the presence of complex font shaping.

Longer-term, we should unify all this kind of truncation/ellipsizing of labels etc to use an implementation
based on CSS text-overflow, but that doesn't yet support center-cropping so it's not a drop-in replacement.
So I think we should do this as an interim measure to fix the most egregious brokenness, and make treeview
cells at least work similarly to textbox labels.

Tested manually; seems difficult to do automated tests as it'd be sensitive to exact glyph metrics.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Duplicate of this bug: 1799103
Blocks: 1799193
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d31170282eb9
Avoid breaking surrogate pairs etc when truncating titles in nsTreeBodyFrame.cpp. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: