1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:27:45 +00:00

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. :^)
This commit is contained in:
Andreas Kling 2020-03-19 19:07:56 +01:00
parent 73d28a0551
commit a37c29e353
19 changed files with 649 additions and 1 deletions

View file

@ -1,7 +1,9 @@
LIBWEB_OBJS = \
Bindings/CanvasRenderingContext2DWrapper.o \
Bindings/DocumentWrapper.o \
Bindings/EventListenerWrapper.o \
Bindings/EventTargetWrapper.o \
Bindings/HTMLCanvasElementWrapper.o \
Bindings/NodeWrapper.o \
Bindings/Wrappable.o \
CSS/DefaultStyleSheetSource.o \
@ -14,6 +16,7 @@ LIBWEB_OBJS = \
CSS/StyleRule.o \
CSS/StyleSheet.o \
CSS/StyleValue.o \
DOM/CanvasRenderingContext2D.o \
DOM/CharacterData.o \
DOM/Comment.o \
DOM/Document.o \
@ -26,6 +29,7 @@ LIBWEB_OBJS = \
DOM/HTMLBRElement.o \
DOM/HTMLBlinkElement.o \
DOM/HTMLBodyElement.o \
DOM/HTMLCanvasElement.o \
DOM/HTMLElement.o \
DOM/HTMLFontElement.o \
DOM/HTMLFormElement.o \
@ -52,6 +56,7 @@ LIBWEB_OBJS = \
Layout/LayoutBlock.o \
Layout/LayoutBox.o \
Layout/LayoutBreak.o \
Layout/LayoutCanvas.o \
Layout/LayoutDocument.o \
Layout/LayoutImage.o \
Layout/LayoutInline.o \