Commit graph

6 commits

Author SHA1 Message Date
Andreas Kling
1b610ac2b6 LibWeb: Use Checked<T> when creating <canvas> bitmap buffers 2020-04-15 16:58:46 +02:00
Andreas Kling
3f698db85d 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! :^)
2020-04-15 12:29:21 +02:00
Andreas Kling
05311782d7 LibWeb: Remove debug spam about getting a 2D canvas context 2020-03-25 09:54:46 +01:00
Andreas Kling
7309642ca8 LibWeb: Use FlyString for Element tag names
This makes selector matching a lot more efficient, and also reduces the
number of strings on the heap.
2020-03-22 19:12:10 +01:00
Elisée Maurer
12e8efd74e
LibWeb: Fix HTMLCanvasElement::preferred_height() default value (#1490)
The correct height is 150px rather than 300px.
2020-03-20 15:19:38 +01:00
Andreas Kling
a37c29e353 LibWeb: Add <canvas> element and start fleshing out CRC2D
This patch adds HTMLCanvasElement along with a LayoutCanvas object.
The DOM and layout parts are very similar to <img> elements.

The <canvas> element holds a Gfx::Bitmap which is sized according to
the "width" and "height" attributes on the element.

Calling .getContext("2d") on a <canvas> element gives you a context
object that draws into the underlying Gfx::Bitmap of the <canvas>.
The context weakly points to the <canvas> which allows it to outlive
the canvas element if needed.

This is really quite cool. :^)
2020-03-19 19:07:56 +01:00