mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 10:48:41 +00:00
LibWeb: Limit progress element attribute values to the correct ranges
The max attribute is now clamped to ensure it is limited to positive numbers and the value attribute is clamped to ensure it is non-negative.
This commit is contained in:
committed by
Andreas Kling
parent
ecbc686bc8
commit
3a7a84f39b
@@ -49,7 +49,7 @@ double HTMLProgressElement::value() const
|
||||
WebIDL::ExceptionOr<void> HTMLProgressElement::set_value(double value)
|
||||
{
|
||||
if (value < 0)
|
||||
return {};
|
||||
value = 0;
|
||||
|
||||
TRY(set_attribute(HTML::AttributeNames::value, MUST(String::number(value))));
|
||||
update_progress_value_element();
|
||||
@@ -69,7 +69,7 @@ double HTMLProgressElement::max() const
|
||||
WebIDL::ExceptionOr<void> HTMLProgressElement::set_max(double value)
|
||||
{
|
||||
if (value <= 0)
|
||||
return {};
|
||||
value = 1;
|
||||
|
||||
TRY(set_attribute(HTML::AttributeNames::max, MUST(String::number(value))));
|
||||
update_progress_value_element();
|
||||
|
||||
Reference in New Issue
Block a user