LibWeb: Clamp CSS numeric token values to float range

This matches the behavior of other browsers. We did the equivalent
change for <integer> in b86377b

We continue to store these as doubles for the extra precision.
This commit is contained in:
Callum Law
2026-04-15 23:18:24 +12:00
committed by Sam Atkins
parent dbe0cb4b1d
commit d6dbabdf0e
Notes: github-actions[bot] 2026-04-22 13:26:16 +00:00
3 changed files with 32 additions and 3 deletions

View File

@@ -0,0 +1,12 @@
Percentage(value=3.4028234663852886e+38, number_type=Number, source="1e39%", start=0:0, end=0:5)
Whitespace(source="\n", start=0:5, end=1:0)
Percentage(value=-3.4028234663852886e+38, number_type=Number, source="-1e39%", start=1:0, end=1:6)
Whitespace(source="\n", start=1:6, end=2:0)
Dimension(value=3.4028234663852886e+38, number_type=Number, unit="px", source="1e39px", start=2:0, end=2:6)
Whitespace(source="\n", start=2:6, end=3:0)
Dimension(value=-3.4028234663852886e+38, number_type=Number, unit="px", source="-1e39px", start=3:0, end=3:7)
Whitespace(source="\n", start=3:7, end=4:0)
Number(value=3.4028234663852886e+38, number_type=Number, source="1e39", start=4:0, end=4:4)
Whitespace(source="\n", start=4:4, end=5:0)
Number(value=-3.4028234663852886e+38, number_type=Number, source="-1e39", start=5:0, end=5:5)
__EOF__(source="", start=5:5, end=5:5)

View File

@@ -0,0 +1,6 @@
1e39%
-1e39%
1e39px
-1e39px
1e39
-1e39