mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibWeb: Relayout document when SVG image is successfully loaded
This commit is contained in:
parent
45e4ab69d6
commit
dcbb073b3e
Notes:
github-actions[bot]
2024-09-03 09:31:12 +00:00
Author: https://github.com/tcl3
Commit: dcbb073b3e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1257
Reviewed-by: https://github.com/AtkinsSJ ✅
2 changed files with 2 additions and 8 deletions
|
@ -28,12 +28,6 @@ void SVGImageElement::initialize(JS::Realm& realm)
|
|||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGImageElement);
|
||||
|
||||
m_document_observer = realm.heap().allocate<DOM::DocumentObserver>(realm, realm, document());
|
||||
m_document_observer->set_document_completely_loaded([this]() mutable {
|
||||
// FIXME: This is a hack to make SVG images appear when the document has finished loading
|
||||
document().invalidate_layout();
|
||||
});
|
||||
}
|
||||
|
||||
void SVGImageElement::visit_edges(Cell::Visitor& visitor)
|
||||
|
@ -45,7 +39,6 @@ void SVGImageElement::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_width);
|
||||
visitor.visit(m_height);
|
||||
visitor.visit(m_resource_request);
|
||||
visitor.visit(m_document_observer);
|
||||
}
|
||||
|
||||
void SVGImageElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
|
@ -166,6 +159,8 @@ void SVGImageElement::fetch_the_document(URL::URL const& url)
|
|||
m_animation_timer->set_interval(image_data->frame_duration(0));
|
||||
m_animation_timer->start();
|
||||
}
|
||||
set_needs_style_update(true);
|
||||
document().set_needs_layout();
|
||||
},
|
||||
[this] {
|
||||
m_load_event_delayer.clear();
|
||||
|
|
|
@ -64,7 +64,6 @@ private:
|
|||
|
||||
JS::GCPtr<HTML::SharedResourceRequest> m_resource_request;
|
||||
Optional<DOM::DocumentLoadEventDelayer> m_load_event_delayer;
|
||||
JS::GCPtr<DOM::DocumentObserver> m_document_observer;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue