1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:47: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

@ -85,14 +85,14 @@ JS::Value HTMLCanvasElementWrapper::get_context(JS::Interpreter& interpreter)
JS::Value HTMLCanvasElementWrapper::width_getter(JS::Interpreter& interpreter)
{
if (auto* impl = impl_from(interpreter))
return JS::Value(impl->preferred_width());
return JS::Value(impl->requested_width());
return {};
}
JS::Value HTMLCanvasElementWrapper::height_getter(JS::Interpreter& interpreter)
{
if (auto* impl = impl_from(interpreter))
return JS::Value(impl->preferred_height());
return JS::Value(impl->requested_height());
return {};
}