mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-03 17:58:49 +00:00
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:
parent
be5f0b5ac4
commit
a403086940
Notes:
sideshowbarker
2024-07-17 17:16:17 +09:00
Author: https://github.com/awesomekling
Commit: a403086940
2 changed files with 4 additions and 0 deletions
|
@ -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));
|
||||
});
|
||||
|
|
|
@ -21,6 +21,7 @@ HTMLObjectElement::HTMLObjectElement(DOM::Document& document, DOM::QualifiedName
|
|||
m_image_loader.on_load = [this] {
|
||||
m_should_show_fallback_content = false;
|
||||
set_needs_style_update(true);
|
||||
this->document().set_needs_layout();
|
||||
// FIXME: This should be done by the HTML^Wdocument parser.
|
||||
dispatch_event(DOM::Event::create(HTML::EventNames::load));
|
||||
};
|
||||
|
@ -28,6 +29,7 @@ HTMLObjectElement::HTMLObjectElement(DOM::Document& document, DOM::QualifiedName
|
|||
m_image_loader.on_fail = [this] {
|
||||
m_should_show_fallback_content = true;
|
||||
set_needs_style_update(true);
|
||||
this->document().set_needs_layout();
|
||||
// FIXME: This should be done by the HTML^Wdocument parser.
|
||||
dispatch_event(DOM::Event::create(HTML::EventNames::load));
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue