mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 10:48:41 +00:00
LibWeb: Use the task queue to fire "load" and "error" events on images
This commit is contained in:
@@ -22,13 +22,17 @@ HTMLImageElement::HTMLImageElement(DOM::Document& document, QualifiedName qualif
|
||||
{
|
||||
m_image_loader.on_load = [this] {
|
||||
this->document().update_layout();
|
||||
dispatch_event(DOM::Event::create(EventNames::load));
|
||||
queue_an_element_task(HTML::Task::Source::DOMManipulation, [this] {
|
||||
dispatch_event(DOM::Event::create(EventNames::load));
|
||||
});
|
||||
};
|
||||
|
||||
m_image_loader.on_fail = [this] {
|
||||
dbgln("HTMLImageElement: Resource did fail: {}", src());
|
||||
this->document().update_layout();
|
||||
dispatch_event(DOM::Event::create(EventNames::error));
|
||||
queue_an_element_task(HTML::Task::Source::DOMManipulation, [this] {
|
||||
dispatch_event(DOM::Event::create(EventNames::error));
|
||||
});
|
||||
};
|
||||
|
||||
m_image_loader.on_animate = [this] {
|
||||
|
||||
Reference in New Issue
Block a user