mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 10:37:17 +02:00
LibWeb: Avoid premature creation of CSSPixels in calc simplification
Previously we were converting lengths to CSSPixels values when we didn't need to, this had a couple of effects in that: - We rounded to CSSPixel resolution prematurely (sometimes giving incorrect results) - We converted NaN to 0 when we shouldn't have. We now avoid prematurely converting lengths to CSSPixels values in two places: - `CalculationResult::from_value` - `CalculatedStyleValue::resolve_length_deprecated` (the new method already avoided rounding). Gains us 16 WPT tests.
This commit is contained in:
Notes:
github-actions[bot]
2025-08-06 14:01:09 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/a44e28fd563 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5714 Reviewed-by: https://github.com/AtkinsSJ ✅
@@ -0,0 +1,51 @@
|
||||
Harness status: OK
|
||||
|
||||
Found 45 tests
|
||||
|
||||
33 Pass
|
||||
12 Fail
|
||||
Pass Property width value 'calc(NaN * 1px)'
|
||||
Pass Property width value 'calc(NaN * 1%)'
|
||||
Pass Property width value 'calc(infinity * 1px)'
|
||||
Pass Property width value 'calc(infinity * 1%)'
|
||||
Pass Property width value 'calc(infinity * 1cm)'
|
||||
Pass Property width value 'calc(NaN * 1rem)'
|
||||
Pass Property width value 'calc(10.135262721212548pc - 199pt / NaN)'
|
||||
Pass Property width value 'max(15px, NaN * 1px)'
|
||||
Pass Property width value 'max(NaN * 1px, 15px)'
|
||||
Pass Property width value 'max(-15px, NaN * 1px)'
|
||||
Pass Property width value 'max(NaN * 1px, -15px)'
|
||||
Pass Property width value 'min(15px, NaN * 1px)'
|
||||
Pass Property width value 'min(NaN * 1px, 15px)'
|
||||
Pass Property width value 'min(-15px, NaN * 1px)'
|
||||
Pass Property width value 'min(NaN * 1px, -15px)'
|
||||
Pass Property width value 'calc(infinity * 1px - infinity * 1%)'
|
||||
Pass Property width value 'calc(infinity * 1px + infinity * 1%)'
|
||||
Pass Property width value 'calc(min(NaN * 1px, infinity * 1px) + max(infinity * 1px, -infinity * 1px))'
|
||||
Pass Property width value 'calc(infinity * 1px - max(infinity * 1%, 0%))'
|
||||
Pass Property width value 'calc(max(infinity * 1px, 10px))'
|
||||
Pass Property margin-left value 'calc(-infinity * 1px)'
|
||||
Pass Property margin-left value 'calc(min(1px, -infinity * 1%))'
|
||||
Pass Property margin-left value 'calc(-infinity * 1%)'
|
||||
Pass Property margin-left value 'calc(max(10000px, 0px) + min(-infinity * 1px, infinity * 1px))'
|
||||
Pass Property margin-left value 'calc(-infinity * 1px - infinity * 1px)'
|
||||
Pass Property margin-left value 'calc(min(-infinity * 1px, 10px))'
|
||||
Pass Property animation-duration value 'calc(NaN * 1s)'
|
||||
Pass Property animation-duration value 'calc(infinity * 1s)'
|
||||
Pass Property animation-duration value 'calc(1 / 0 * 1s)'
|
||||
Pass Property animation-duration value 'calc(max(infinity * 1s, 10s)'
|
||||
Pass Property transition-delay value 'calc(-infinity* 1s)'
|
||||
Pass Property transition-delay value 'calc(max(10000s, 0s) + min(-infinity * 1s, infinity * 1s))'
|
||||
Pass Property transition-delay value 'calc(min(-infinity * 1s, 10s))'
|
||||
Fail Property rotate(calc(infinity * 1deg)) value expected same with rotate(0deg) in +/-0.0001
|
||||
Fail Property rotate(calc(-infinity * 1deg)) value expected same with rotate(0deg) in +/-0.0001
|
||||
Fail Property rotate(calc(NaN * 1deg)) value expected same with rotate(0deg) in +/-0.0001
|
||||
Fail Property rotate(calc(infinity * 1turn)) value expected same with rotate(0deg) in +/-0.0001
|
||||
Fail Property rotate(calc(-infinity * 1turn)) value expected same with rotate(0deg) in +/-0.0001
|
||||
Fail Property rotate(calc(NaN * 1turn)) value expected same with rotate(0deg) in +/-0.0001
|
||||
Fail Property rotate(calc(infinity * 1rad)) value expected same with rotate(0deg) in +/-0.0001
|
||||
Fail Property rotate(calc(-infinity * 1rad)) value expected same with rotate(0deg) in +/-0.0001
|
||||
Fail Property rotate(calc(NaN * 1rad)) value expected same with rotate(0deg) in +/-0.0001
|
||||
Fail Property rotate(calc(infinity * 1grad)) value expected same with rotate(0deg) in +/-0.0001
|
||||
Fail Property rotate(calc(-infinity * 1grad)) value expected same with rotate(0deg) in +/-0.0001
|
||||
Fail Property rotate(calc(NaN * 1grad)) value expected same with rotate(0deg) in +/-0.0001
|
||||
Reference in New Issue
Block a user