WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WONTFIX
Bug 249726
Setting `font-weight` property to 3.14 returns 3 as computed value instead of 3.14
https://bugs.webkit.org/show_bug.cgi?id=249726
Summary
Setting `font-weight` property to 3.14 returns 3 as computed value instead of...
Chris Dumez
Reported
2022-12-21 10:03:02 PST
FontSelectionValue is not able to store 3.14. FontSelectionValue::float() returns 3 after storing 3.14. This causes our Web-facing behavior to differ from Chrome and Firefox for the `font-stretch` CSS property and is causing the following WPT test to fail: imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-stretch.html
Attachments
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2022-12-21 10:05:46 PST
The code says: // Since floats have 23 mantissa bits, every value can be represented losslessly. constexpr operator float() const; So I expect the loss of precision is not intentional.
Chris Dumez
Comment 2
2022-12-21 10:12:28 PST
Seems the class uses a int16_t to store the float, after multiplying by fractionalEntropy (which is 4). Then when requesting the float back, it just divides the int16_t by 4. We end up with a precision of 0.25% as a result. So if I store 3.14%, I get 3% back. But if I store 3.25%, I get 3.25% back. This loss in precision doesn't match other browsers and is Web-observable since computed values are exposed to the Web.
Chris Dumez
Comment 3
2022-12-21 14:06:44 PST
Pull request:
https://github.com/WebKit/WebKit/pull/7976
Chris Dumez
Comment 4
2022-12-22 09:23:29 PST
Actually, our behavior seems to match Blink at least.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug