Closed Bug 1813513 Opened 1 year ago Closed 1 year ago

Improve serialization of the `font` shorthand

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

RESOLVED FIXED
111 Branch
Tracking Status
firefox111 --- fixed

People

(Reporter: jfkthame, Assigned: jfkthame)

Details

Attachments

(1 file)

Looking at tests for the font shorthand that currently fail in Firefox, I notice there are a whole collection of failures in font-computed.html that happen because when we serialize the shorthand for a computed style, we always include the font-weight value as part of the serialized value even when it is 400, which is redundant.

So, in Firefox we see behavior like:

> document.body.style.font = "12px serif"
< "12px serif"
> window.getComputedStyle(document.body).font
< "400 12px serif" 

IMO, the principle of preferring the shortest serialization means we should omit the 400 here and just return 12px serif. (Note that this is what Chrome does, so although it represents a change from our existing behavior, it seems unlikely to involve major webcompat risk.)

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ca83cfa25c03
Avoid redundantly serializing the initial value of font-weight (400) as part of the font shorthand in computed style. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 111 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: