mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Don't crash when setting offscreen canvas size to 0
Previously, this would crash because `Gfx::Bitmap` can't have a zero size.
This commit is contained in:
parent
f882c446cb
commit
5413716802
Notes:
github-actions[bot]
2025-07-04 15:11:48 +00:00
Author: https://github.com/tcl3
Commit: 5413716802
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5255
Reviewed-by: https://github.com/AtkinsSJ ✅
5 changed files with 78 additions and 18 deletions
|
@ -32,8 +32,7 @@ class OffscreenCanvas : public DOM::EventTarget
|
|||
GC_DECLARE_ALLOCATOR(OffscreenCanvas);
|
||||
|
||||
public:
|
||||
static GC::Ref<OffscreenCanvas> create(JS::Realm&, WebIDL::UnsignedLong width,
|
||||
WebIDL::UnsignedLong height);
|
||||
static GC::Ref<OffscreenCanvas> create(JS::Realm&, WebIDL::UnsignedLong width, WebIDL::UnsignedLong height);
|
||||
|
||||
static WebIDL::ExceptionOr<GC::Ref<OffscreenCanvas>> construct_impl(
|
||||
JS::Realm&,
|
||||
|
@ -50,7 +49,7 @@ public:
|
|||
WebIDL::UnsignedLong width() const;
|
||||
WebIDL::UnsignedLong height() const;
|
||||
|
||||
NonnullRefPtr<Gfx::Bitmap> bitmap() const;
|
||||
RefPtr<Gfx::Bitmap> bitmap() const;
|
||||
|
||||
WebIDL::ExceptionOr<void> set_width(WebIDL::UnsignedLong);
|
||||
WebIDL::ExceptionOr<void> set_height(WebIDL::UnsignedLong);
|
||||
|
@ -69,7 +68,7 @@ public:
|
|||
GC::Ptr<WebIDL::CallbackType> oncontextrestored();
|
||||
|
||||
private:
|
||||
OffscreenCanvas(JS::Realm&, NonnullRefPtr<Gfx::Bitmap> bitmap);
|
||||
OffscreenCanvas(JS::Realm&, RefPtr<Gfx::Bitmap> bitmap);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
@ -85,7 +84,7 @@ private:
|
|||
|
||||
Variant<GC::Ref<HTML::OffscreenCanvasRenderingContext2D>, GC::Ref<WebGL::WebGLRenderingContext>, GC::Ref<WebGL::WebGL2RenderingContext>, Empty> m_context;
|
||||
|
||||
NonnullRefPtr<Gfx::Bitmap> m_bitmap;
|
||||
RefPtr<Gfx::Bitmap> m_bitmap;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue