diff --git a/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Libraries/LibWeb/HTML/HTMLImageElement.cpp
index 4a4034cf76d..13f42b38eab 100644
--- a/Libraries/LibWeb/HTML/HTMLImageElement.cpp
+++ b/Libraries/LibWeb/HTML/HTMLImageElement.cpp
@@ -86,6 +86,7 @@ void HTMLImageElement::adopted_from(DOM::Document& old_document)
void HTMLImageElement::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
+ image_provider_visit_edges(visitor);
visitor.visit(m_current_request);
visitor.visit(m_pending_request);
visitor.visit(m_document_observer);
diff --git a/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Libraries/LibWeb/HTML/HTMLInputElement.cpp
index 9020ba2f01c..67b04258e10 100644
--- a/Libraries/LibWeb/HTML/HTMLInputElement.cpp
+++ b/Libraries/LibWeb/HTML/HTMLInputElement.cpp
@@ -79,6 +79,7 @@ void HTMLInputElement::initialize(JS::Realm& realm)
void HTMLInputElement::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
+ image_provider_visit_edges(visitor);
visitor.visit(m_inner_text_element);
visitor.visit(m_text_node);
visitor.visit(m_placeholder_element);
diff --git a/Libraries/LibWeb/HTML/HTMLObjectElement.cpp b/Libraries/LibWeb/HTML/HTMLObjectElement.cpp
index 7101af651a2..2c5a6b9e5c7 100644
--- a/Libraries/LibWeb/HTML/HTMLObjectElement.cpp
+++ b/Libraries/LibWeb/HTML/HTMLObjectElement.cpp
@@ -76,6 +76,7 @@ void HTMLObjectElement::initialize(JS::Realm& realm)
void HTMLObjectElement::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
+ image_provider_visit_edges(visitor);
visitor.visit(m_resource_request);
visitor.visit(m_document_observer);
}
diff --git a/Libraries/LibWeb/Layout/ImageBox.cpp b/Libraries/LibWeb/Layout/ImageBox.cpp
index 741070670a1..652f61d4e87 100644
--- a/Libraries/LibWeb/Layout/ImageBox.cpp
+++ b/Libraries/LibWeb/Layout/ImageBox.cpp
@@ -26,7 +26,7 @@ ImageBox::~ImageBox() = default;
void ImageBox::visit_edges(JS::Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
- visitor.visit(m_image_provider.to_html_element());
+ m_image_provider.image_provider_visit_edges(visitor);
}
void ImageBox::prepare_for_replaced_layout()
diff --git a/Libraries/LibWeb/Layout/ImageProvider.h b/Libraries/LibWeb/Layout/ImageProvider.h
index b8b440469be..8beba7db6d9 100644
--- a/Libraries/LibWeb/Layout/ImageProvider.h
+++ b/Libraries/LibWeb/Layout/ImageProvider.h
@@ -6,6 +6,7 @@
#pragma once
+#include
#include
#include
#include
@@ -25,9 +26,13 @@ public:
virtual RefPtr current_image_bitmap(Gfx::IntSize) const = 0;
virtual void set_visible_in_viewport(bool) = 0;
- virtual GC::Ptr to_html_element() const = 0;
+ virtual void image_provider_visit_edges(GC::Cell::Visitor& visitor) const
+ {
+ visitor.visit(to_html_element());
+ }
protected:
+ virtual GC::Ptr to_html_element() const = 0;
static void did_update_alt_text(ImageBox&);
};
diff --git a/Libraries/LibWeb/Painting/ImagePaintable.cpp b/Libraries/LibWeb/Painting/ImagePaintable.cpp
index 31447704278..11e626d6f6e 100644
--- a/Libraries/LibWeb/Painting/ImagePaintable.cpp
+++ b/Libraries/LibWeb/Painting/ImagePaintable.cpp
@@ -45,7 +45,7 @@ ImagePaintable::ImagePaintable(Layout::Box const& layout_box, Layout::ImageProvi
void ImagePaintable::visit_edges(JS::Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
- visitor.visit(m_image_provider.to_html_element());
+ m_image_provider.image_provider_visit_edges(visitor);
}
void ImagePaintable::finalize()
diff --git a/Libraries/LibWeb/SVG/SVGImageElement.cpp b/Libraries/LibWeb/SVG/SVGImageElement.cpp
index b785dc4ccd7..c14beebd52f 100644
--- a/Libraries/LibWeb/SVG/SVGImageElement.cpp
+++ b/Libraries/LibWeb/SVG/SVGImageElement.cpp
@@ -36,6 +36,7 @@ void SVGImageElement::initialize(JS::Realm& realm)
void SVGImageElement::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
+ image_provider_visit_edges(visitor);
SVGURIReferenceMixin::visit_edges(visitor);
visitor.visit(m_x);
visitor.visit(m_y);