mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-03 17:02:56 +00:00
LibWeb: Use the task queue to fire "load" and "error" events on images
This commit is contained in:
parent
aa3ba629ba
commit
33f67e4c0f
Notes:
sideshowbarker
2024-07-18 04:24:22 +09:00
Author: https://github.com/awesomekling
Commit: 33f67e4c0f
1 changed files with 6 additions and 2 deletions
|
@ -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] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue