Files
ladybird/Tests/LibWeb/Text/expected/IntersectionObserver/scroll-margin-expands-scrollport.txt
Andreas Kling bf15a35ae2 LibWeb: Fix precision loss in CSSPixelFraction::to_float/to_double
CSSPixelFraction::to_float() and to_double() were converting to
CSSPixels (6-bit fixed-point) before converting to float/double,
which truncated the result to 1/64 precision. For example, 500/2500
(= 0.2) became 12/64 (= 0.1875).

Fix by dividing the numerator and denominator as floats/doubles
directly, which is what every other browser engine does when
converting layout units to floating-point ratios.

This was an oversight in the original CSSPixelFraction implementation
(commit 8cd1f65507). The class was designed for lossless comparison
and multiply-then-divide operations (which stay in CSSPixels land),
and the to_float/to_double methods were convenience additions that
took the easy path through CSSPixels conversion without considering
the precision loss.
2026-03-22 14:09:22 -05:00

3 lines
42 B
Plaintext

no-margin: ratio=0.2
with-margin: ratio=1