Closed Bug 1607534 Opened 4 years ago Closed 4 years ago

`text-underline-offset` and `text-decoration-thickness` should accept percentage values

Categories

(Core :: CSS Parsing and Computation, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: jfkthame, Assigned: jfkthame)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete, Whiteboard: [layout:backlog:2020q1])

Attachments

(1 file)

The CSS Text Decoration 4 spec (draft) has recently been updated to say that text-underline-offset and text-decoration-thickness can take percentages (of the em size).

This is a useful addition because (as the spec notes) a <percentage> value will inherit as relative values, unlike <length> which inherits as a fixed value (even if specified in font-relative units such as em). So a value like 10% may be more useful than 0.1em in some situations.

(I guess Safari is probably intending to implement this soon, as Myles has been an active participant in the spec discussions, though I don't yet see it in the Safari Tech Preview release notes.)

To be clear, they mean for the percentage values to resolve at layout time, right? So like line-height: <number>? I think it's bad that this behaves differently than line-height: <percentage>.

I commented on https://github.com/w3c/csswg-drafts/issues/2165#issuecomment-571727474 with that argument... I think ideally it should be text-underline-offset: <number> or something of that sort. But we could implement this as-wanted... The definition of the properties should take a <length-percentage> then, rather than a <length> | <percentage>.

Yes, my understanding is that it's expected to behave like line-height: <number> rather than <percentage>. Do you want to object to this?

(Personally, I think it's probably the right behavior. It's unfortunate that it differs from line-height, but that's a legacy flaw that we presumably can't fix for web compatibility reasons. I'm not sure that justifies propagating the poor behavior to new properties, however.)

I have a try build at https://treeherder.mozilla.org/#/jobs?repo=try&revision=3d108d0425aa36bfc43262ca83726b2805539cb2 that implements these as <length-percentage>, but let's see how people respond in the github issue before doing anything here.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/280bd106d48a
Support percentage values for the CSS text-decoration-thickness and text-underline-offset properties. r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/21546 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.

Updated the patch in bug 1607308 to adjust the annotation for the newly-passing test.

Flags: needinfo?(jfkthame)
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/486e43536b7c
Support percentage values for the CSS text-decoration-thickness and text-underline-offset properties. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74
Upstream PR merged by moz-wptsync-bot
Whiteboard: [layout:backlog:2020q1]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: