LibWeb: Limit HTMLProgressElement.max to positive values

Previously, 0 was returned if `HTMLProgressElement.max` was set to a
negative value.
This commit is contained in:
Tim Ledbetter 2024-08-19 07:11:01 +01:00 committed by Andreas Kling
parent a94bf9bd09
commit 353e3e75dc
Notes: github-actions[bot] 2024-08-19 07:03:11 +00:00
3 changed files with 5 additions and 1 deletions

View file

@ -64,7 +64,8 @@ double HTMLProgressElement::max() const
{
if (auto max_string = get_attribute(HTML::AttributeNames::max); max_string.has_value()) {
if (auto max = parse_floating_point_number(*max_string); max.has_value())
return AK::max(*max, 0);
if (*max > 0)
return *max;
}
return 1;
}