LibWeb: Schedule a relayout after <image> and <object> elements load

Otherwise we'll be stuck with the intrinsic dimensions of the
replacement content.
This commit is contained in:
Andreas Kling 2022-03-16 23:12:18 +01:00
parent be5f0b5ac4
commit a403086940
Notes: sideshowbarker 2024-07-17 17:16:17 +09:00
2 changed files with 4 additions and 0 deletions

View file

@ -23,6 +23,7 @@ HTMLImageElement::HTMLImageElement(DOM::Document& document, DOM::QualifiedName q
{
m_image_loader.on_load = [this] {
set_needs_style_update(true);
this->document().set_needs_layout();
queue_an_element_task(HTML::Task::Source::DOMManipulation, [this] {
dispatch_event(DOM::Event::create(EventNames::load));
});
@ -31,6 +32,7 @@ HTMLImageElement::HTMLImageElement(DOM::Document& document, DOM::QualifiedName q
m_image_loader.on_fail = [this] {
dbgln("HTMLImageElement: Resource did fail: {}", src());
set_needs_style_update(true);
this->document().set_needs_layout();
queue_an_element_task(HTML::Task::Source::DOMManipulation, [this] {
dispatch_event(DOM::Event::create(EventNames::error));
});