mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:38:10 +00:00
LibWeb: Return DOMException instead of crashing when setting attributes
This commit is contained in:
parent
6891676fce
commit
5d3b7a5ecc
24 changed files with 57 additions and 51 deletions
|
@ -71,18 +71,20 @@ void HTMLCanvasElement::reset_context_to_default_state()
|
|||
});
|
||||
}
|
||||
|
||||
void HTMLCanvasElement::set_width(unsigned value)
|
||||
WebIDL::ExceptionOr<void> HTMLCanvasElement::set_width(unsigned value)
|
||||
{
|
||||
MUST(set_attribute(HTML::AttributeNames::width, DeprecatedString::number(value)));
|
||||
TRY(set_attribute(HTML::AttributeNames::width, DeprecatedString::number(value)));
|
||||
m_bitmap = nullptr;
|
||||
reset_context_to_default_state();
|
||||
return {};
|
||||
}
|
||||
|
||||
void HTMLCanvasElement::set_height(unsigned value)
|
||||
WebIDL::ExceptionOr<void> HTMLCanvasElement::set_height(unsigned value)
|
||||
{
|
||||
MUST(set_attribute(HTML::AttributeNames::height, DeprecatedString::number(value)));
|
||||
TRY(set_attribute(HTML::AttributeNames::height, DeprecatedString::number(value)));
|
||||
m_bitmap = nullptr;
|
||||
reset_context_to_default_state();
|
||||
return {};
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> HTMLCanvasElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue