LibWeb: Use i32 max for clamping 'infinite' calculated integers

This required us to change our range values from `float`s to `double`s
since `float` can't exactly represent i32 max
This commit is contained in:
Callum Law
2026-03-25 16:43:51 +13:00
committed by Jelle Raaijmakers
parent 0e8956ee30
commit 0ab06e119e
Notes: github-actions[bot] 2026-03-26 11:31:28 +00:00
5 changed files with 38 additions and 8 deletions

View File

@@ -5145,7 +5145,7 @@ RefPtr<CalculatedStyleValue const> Parser::parse_calculated_value(ComponentValue
switch (descriptor_context.descriptor) {
case DescriptorID::AdditiveSymbols:
case DescriptorID::Pad:
return CalculationContext { .resolve_numbers_as_integers = true, .accepted_type_ranges = { { ValueType::Integer, { 0, NumericLimits<float>::max() } } } };
return CalculationContext { .resolve_numbers_as_integers = true, .accepted_type_ranges = { { ValueType::Integer, { 0, NumericLimits<i32>::max() } } } };
default:
return CalculationContext {};
}
@@ -5176,9 +5176,9 @@ RefPtr<CalculatedStyleValue const> Parser::parse_calculated_value(ComponentValue
case SpecialContext::RatioComponent:
return CalculationContext { .accepted_type_ranges = { { ValueType::Number, { 0, NumericLimits<float>::max() } } } };
case SpecialContext::StepsIntervalsJumpNone:
return CalculationContext { .resolve_numbers_as_integers = true, .accepted_type_ranges = { { ValueType::Integer, { 2, NumericLimits<float>::max() } } } };
return CalculationContext { .resolve_numbers_as_integers = true, .accepted_type_ranges = { { ValueType::Integer, { 2, NumericLimits<i32>::max() } } } };
case SpecialContext::StepsIntervalsNormal:
return CalculationContext { .resolve_numbers_as_integers = true, .accepted_type_ranges = { { ValueType::Integer, { 1, NumericLimits<float>::max() } } } };
return CalculationContext { .resolve_numbers_as_integers = true, .accepted_type_ranges = { { ValueType::Integer, { 1, NumericLimits<i32>::max() } } } };
case SpecialContext::ShadowBlurRadius:
return CalculationContext { .accepted_type_ranges = { { ValueType::Length, { 0, NumericLimits<float>::max() } } } };
case SpecialContext::TranslateZArgument: