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:
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.
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.
Pull request: https://github.com/WebKit/WebKit/pull/7976
Actually, our behavior seems to match Blink at least.