1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

LibWeb: Make HTML::SharedImageRequest GC allocated

This allows to partially solve the problem of cyclic dependency between
HTMLImageElement and SharedImageRequest that prevents all image
elements from being deallocated.
This commit is contained in:
Aliaksandr Kalenik 2023-08-18 14:11:55 +02:00 committed by Andreas Kling
parent bbfedf2e5a
commit 934afcb9d5
9 changed files with 46 additions and 18 deletions

View file

@ -40,7 +40,7 @@ public:
void set_state(State);
AK::URL const& current_url() const;
void set_current_url(AK::URL);
void set_current_url(JS::Realm&, AK::URL);
[[nodiscard]] RefPtr<DecodedImageData const> image_data() const;
void set_image_data(RefPtr<DecodedImageData const>);
@ -59,6 +59,8 @@ public:
SharedImageRequest const* shared_image_request() const { return m_shared_image_request; }
virtual void visit_edges(JS::Cell::Visitor&) override;
private:
explicit ImageRequest(Page&);
@ -84,7 +86,7 @@ private:
// which is either a struct consisting of a width and a height or is null. It must initially be null.
Optional<Gfx::FloatSize> m_preferred_density_corrected_dimensions;
RefPtr<SharedImageRequest> m_shared_image_request;
JS::GCPtr<SharedImageRequest> m_shared_image_request;
};
// https://html.spec.whatwg.org/multipage/images.html#abort-the-image-request