Bug 215359

Summary: @font-face font-weight descriptor should reject bolder and lighter
Product: WebKit Reporter: Takeshi Kurosawa <taken.spc>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, macpherson, menard, mmaxfield, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Takeshi Kurosawa 2020-08-10 23:12:58 PDT
Both "bolder" and "lighter" are not allowed for @font-face font-weight descriptor.

https://www.w3.org/TR/css-fonts-3/#descdef-font-weight
> Name: 	font-weight
> Value: 	normal | bold | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 

https://drafts.csswg.org/css-fonts-4/#descdef-font-face-font-weight
> For: 	@font-face
> Value: 	auto | <font-weight-absolute> <font-weight-absolute>?

In WebKit, CSS parser accepts "bolder" and "lighter" and font resolver computes absolute weight from "bolder" and "lighter". This doesn't match other browsers behavior and the specs. Rejecting "bolder" and "lighter" improves interoperability and spec compliance.

WPT.fyi
https://wpt.fyi/results/css/css-fonts/variations/at-font-face-descriptors.html

Firefox's CSS parser rejects "bolder" and "lighter".
https://bugzilla.mozilla.org/show_bug.cgi?id=1454596


Chrome's CSS parser accepts "bolder" and "lighter" and its font resolver doesn't use "bolder" and "lighter" (I think it's confusing).
https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/css/font_face.cc;l=661-678;drc=b80faef62a12ac2966f19b014e845a8137718885
Comment 1 Takeshi Kurosawa 2020-08-10 23:28:02 PDT
Created attachment 406367 [details]
Patch
Comment 2 Takeshi Kurosawa 2020-08-14 08:59:40 PDT
Comment on attachment 406367 [details]
Patch

Thank you for reviewing! Could someone land this please?
Comment 3 EWS 2020-08-14 10:34:45 PDT
Committed r265677: <https://trac.webkit.org/changeset/265677>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 406367 [details].
Comment 4 Radar WebKit Bug Importer 2020-08-14 10:35:18 PDT
<rdar://problem/67081913>