mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-04-04 19:55:32 +00:00
LibWeb: Make ImageRequest store Page member as NonnullGCPtr
Co-Authored-By: Andreas Kling <kling@serenityos.org>
This commit is contained in:
committed by
Andreas Kling
parent
d277ac72e6
commit
289ea2db9c
@@ -14,6 +14,7 @@
|
||||
#include <LibWeb/HTML/DecodedImageData.h>
|
||||
#include <LibWeb/HTML/ImageRequest.h>
|
||||
#include <LibWeb/HTML/ListOfAvailableImages.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
#include <LibWeb/Platform/ImageCodecPlugin.h>
|
||||
#include <LibWeb/SVG/SVGDecodedImageData.h>
|
||||
|
||||
@@ -21,12 +22,12 @@ namespace Web::HTML {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ImageRequest);
|
||||
|
||||
JS::NonnullGCPtr<ImageRequest> ImageRequest::create(JS::Realm& realm, Page& page)
|
||||
JS::NonnullGCPtr<ImageRequest> ImageRequest::create(JS::Realm& realm, JS::NonnullGCPtr<Page> page)
|
||||
{
|
||||
return realm.heap().allocate<ImageRequest>(realm, page);
|
||||
}
|
||||
|
||||
ImageRequest::ImageRequest(Page& page)
|
||||
ImageRequest::ImageRequest(JS::NonnullGCPtr<Page> page)
|
||||
: m_page(page)
|
||||
{
|
||||
}
|
||||
@@ -39,6 +40,7 @@ void ImageRequest::visit_edges(JS::Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_shared_image_request);
|
||||
visitor.visit(m_page);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/images.html#img-available
|
||||
|
||||
@@ -22,7 +22,7 @@ class ImageRequest final : public JS::Cell {
|
||||
JS_DECLARE_ALLOCATOR(ImageRequest);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static JS::NonnullGCPtr<ImageRequest> create(JS::Realm&, Page&);
|
||||
[[nodiscard]] static JS::NonnullGCPtr<ImageRequest> create(JS::Realm&, JS::NonnullGCPtr<Page>);
|
||||
|
||||
~ImageRequest();
|
||||
|
||||
@@ -63,9 +63,9 @@ public:
|
||||
virtual void visit_edges(JS::Cell::Visitor&) override;
|
||||
|
||||
private:
|
||||
explicit ImageRequest(Page&);
|
||||
explicit ImageRequest(JS::NonnullGCPtr<Page>);
|
||||
|
||||
Page& m_page;
|
||||
JS::NonnullGCPtr<Page> m_page;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/images.html#img-req-state
|
||||
// An image request's state is initially unavailable.
|
||||
|
||||
Reference in New Issue
Block a user