[Webkit-unassigned] [Bug 214230] New: font-weight should always serialize as a number
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sat Jul 11 23:16:14 PDT 2020
https://bugs.webkit.org/show_bug.cgi?id=214230
Bug ID: 214230
Summary: font-weight should always serialize as a number
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: CSS
Assignee: webkit-unassigned at lists.webkit.org
Reporter: taken.spc at gmail.com
Created attachment 404087
--> https://bugs.webkit.org/attachment.cgi?id=404087&action=review
Test case
The font-weight should always serialize as a number (400, 700 and so on).
WebKit uses keyword ("normal" or "bold") when possible and number otherwise (300, 600 and son on). This behavior has some drawbacks:
1. It is a bit harder to get differences of computed values in animations
```
const {fontWeight: oldFontWeight} = window.getComputedStyle(element);
// do some stuff
const {fontWeight} = window.getComputedStyle(element));
const diff = parseInt(oldFontWeight, 10) - parseInt(fontWeight, 10);
```
Expected behavior
If oldFontWeight is "300" and fontWeight is "600" then the diff is 300.
If oldFontWeight is "400" and fontWeight is "700" then the diff is 300.
Actual behavior
If oldFontWeight is "300" and fontWeight is "600" then the diff is 300.
If oldFontWeight is "normal" and fontWeight is "bold" then the diff is NaN.
2. Inconsistency with specs
CSS Fonts Module Level 3 defines computed value of font-weight is "numeric"
https://www.w3.org/TR/2018/REC-css-fonts-3-20180920/#propdef-font-weight
CSS Fonts Module Level 4 defines computed value of font-weight is "number"
https://drafts.csswg.org/css-fonts/#propdef-font-weight
3. Inconsistency with other browsers
- IE 11: always use a number
- Chrome: always uses a number
- Firefox always uses a number
WebKit should always use number for font-weight.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200712/56c82111/attachment.htm>
More information about the webkit-unassigned
mailing list