diff --git a/Userland/Libraries/LibWeb/SVG/SVGImageElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGImageElement.cpp index d28875ebf0c..a0e2e726784 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGImageElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGImageElement.cpp @@ -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(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 const& old_value, Optional 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(); diff --git a/Userland/Libraries/LibWeb/SVG/SVGImageElement.h b/Userland/Libraries/LibWeb/SVG/SVGImageElement.h index 1ad742e1fe2..e782aa89b73 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGImageElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGImageElement.h @@ -64,7 +64,6 @@ private: JS::GCPtr m_resource_request; Optional m_load_event_delayer; - JS::GCPtr m_document_observer; }; }