1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:17:44 +00:00

LibWeb: Limit the maximum size of <canvas> bitmap buffers

We will no longer create bitmap buffers for canvases that exceed a
total area of (16384 * 16384) pixels. This matches what some other
browser do.

Thanks to @itamar8910 for finding this! :^)
This commit is contained in:
Andreas Kling 2020-04-15 12:12:19 +02:00
parent 228ace854c
commit 3f698db85d
5 changed files with 49 additions and 18 deletions

View file

@ -41,14 +41,15 @@ public:
HTMLCanvasElement(Document&, const FlyString& tag_name);
virtual ~HTMLCanvasElement() override;
int preferred_width() const;
int preferred_height() const;
const Gfx::Bitmap* bitmap() const { return m_bitmap; }
Gfx::Bitmap& ensure_bitmap();
Gfx::Bitmap* bitmap() { return m_bitmap; }
bool create_bitmap();
CanvasRenderingContext2D* get_context(String type);
int requested_width() const;
int requested_height() const;
private:
virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) const override;
@ -62,5 +63,4 @@ inline bool is<HTMLCanvasElement>(const Node& node)
return is<Element>(node) && to<Element>(node).tag_name().equals_ignoring_case("canvas");
}
}