Closed Bug 1559493 Opened 9 months ago Closed 8 months ago

text-underline-offset has wrong baseline for vertical text when set to 0

Categories

(Core :: Layout, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
firefox69 --- fixed

People

(Reporter: cmarlow, Assigned: cmarlow)

Details

Attachments

(2 files)

When text-underline-offset has been set, and the text-underline-position has not been set, at 0 it should default to the alphabetic baseline of the text. It does this in horizontal mode, but in vertical mode it defaults to the center of the text.

Here's a sample file I've been using to look at the effect of this locally. Based on what I see here, I think we probably want to tweak things a bit further. Observations...

  • With current trunk code (i.e. without this patch), the auto position of the underline looks fine, and the text-underline-offset:0px position looks perfect in horizontal mode (it exactly touches the alphabetic baseline). In sideways-* writing modes, the result looks exactly like the horizontal result, just rotated by 90°, which is what I'd expect. In vertical-* modes, the text-underline-offset:0px position is centered, which is bad, and is what we primarily want to fix here.

  • With this patch applied, the text-underline-offset:0px in vertical-* modes is much better. (It's hard to say what the exact "correct" position would be, but the result here looks reasonable to me.) However, in sideways-* modes, the position has been shifted slightly, such that it's now fractionally away from the alphabetic baseline -- there's a 1px gap or thereabouts. This seems regrettable; those cases looked perfect previously. Can we make sure the fix here only affects vertical-* modes, and leaves the sideways-* modes unchanged?

  • The other thing this example highlights (although it's not a new issue in this patch) is that text-underline-offset doesn't have any effect in vertical mode when lang=ja is in effect, when the underline appears by default to the right of the text. This is probably because we handle this internally by effectively swapping under- and over-line decorations at some point, but I think we need to fix this: text-underline-offset should work similarly for all languages and writing modes.

I've added some code so the underline behaves as before in sideways mode, and I opened up Bug 1562704 for the japanese text and have submitted a potential patch for it on Phabricator

Attachment #9074558 - Attachment description: Bug 1559493: Fixed vertical offset for text-underline-offset r?jfkthame → Bug 1559493: Fixed origin from which text-underline-offset is set in vertical writing modes r?jfkthame
Pushed by dholbert@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2f6965b4d5e2
Fixed origin from which text-underline-offset is set in vertical writing modes r=jfkthame
Status: NEW → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69
You need to log in before you can comment on or make changes to this bug.