mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-28 21:26:22 +00:00
LibWeb: Allow ImageProvider subclasses to visit additional GC edges
More prep work for CSS content:image.
This commit is contained in:
parent
0e94c4e270
commit
77abe2a84d
Notes:
github-actions[bot]
2025-07-28 20:48:07 +00:00
Author: https://github.com/awesomekling
Commit: 77abe2a84d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5621
7 changed files with 12 additions and 3 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <LibGC/Cell.h>
|
||||
#include <LibGfx/Size.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/PixelUnits.h>
|
||||
|
@ -25,9 +26,13 @@ public:
|
|||
virtual RefPtr<Gfx::ImmutableBitmap> current_image_bitmap(Gfx::IntSize) const = 0;
|
||||
virtual void set_visible_in_viewport(bool) = 0;
|
||||
|
||||
virtual GC::Ptr<DOM::Element const> 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<DOM::Element const> to_html_element() const = 0;
|
||||
static void did_update_alt_text(ImageBox&);
|
||||
};
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue