Closed Bug 1700490 Opened 4 years ago Closed 4 years ago

Percentage text-decoration-thickness values are resolved against the used font size instead of computed

Categories

(Core :: Layout: Text and Fonts, defect, P3)

Firefox 86
defect

Tracking

()

RESOLVED FIXED
89 Branch
Tracking Status
firefox89 --- fixed

People

(Reporter: xiaochengh, Assigned: jfkthame)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36

Steps to reproduce:

Go to https://jsfiddle.net/h9dqac15/, or render the following

<style>
u {
font-family: Ahem;
font-size: 20px;
}
</style>

<u style="text-decoration-thickness: 10%; font-size-adjust: 2">
É
</u>

<u style="text-decoration-thickness: 10%">
É
</u>

Actual results:

The two <u> elements have different underline thicknesses. The first one is thicker.

Expected results:

The two <u> elements have the same underline thickness

The spec [1] says percentage values of text-decoration-thickness "Specifies the thickness of text decoration lines as a percentage of 1em". So it shouldn't be affected by font-size-adjust or anything else that affects the used font size.

[1] https://drafts.csswg.org/css-text-decor-4/#valdef-text-decoration-thickness-percentage

The Bugbug bot thinks this bug should belong to the 'Core::Layout: Text and Fonts' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Layout: Text and Fonts
Product: Firefox → Core
Severity: -- → S3
Priority: -- → P3

So the relevant code is here, we use the font's em height rather than the computed font-size.

Status: UNCONFIRMED → NEW
Ever confirmed: true

Agreed, this is a bug; the same also applies to percentage values of text-underline-offset.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED

Thanks for reporting, Xiaocheng! I see the equivalent issue was recently fixed in Chrome Canary. :-)

Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2dade59cbeef Use computed font size (rather than used size) to resolve percentages for text-decoration properties. r=jwatt https://hg.mozilla.org/integration/autoland/rev/480d28465472 Add WPT reftest for resolving text-decoration-thickness percentage value. r=jwatt
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/28263 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: