mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-15 14:51:52 +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:
parent
ecbc686bc8
commit
3a7a84f39b
Notes:
sideshowbarker
2024-07-16 21:42:29 +09:00
Author: https://github.com/tcl3
Commit: 3a7a84f39b
Pull-request: https://github.com/SerenityOS/serenity/pull/23624
3 changed files with 10 additions and 2 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue