mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 01:07:34 +00:00
LibWeb: Use the task queue to fire "load" and "error" events on images
This commit is contained in:
parent
aa3ba629ba
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] {
|
m_image_loader.on_load = [this] {
|
||||||
this->document().update_layout();
|
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] {
|
m_image_loader.on_fail = [this] {
|
||||||
dbgln("HTMLImageElement: Resource did fail: {}", src());
|
dbgln("HTMLImageElement: Resource did fail: {}", src());
|
||||||
this->document().update_layout();
|
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] {
|
m_image_loader.on_animate = [this] {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue