MacDue
6daef6303a
LibWeb: Use AntiAliasingPainter for canvas painting
2022-11-30 07:58:44 +01:00
Andrew Kaster
f0c5f77f99
LibWeb: Remove unecessary dependence on Window from HTML classes
...
These classes only needed Window to get at its realm. Pass a realm
directly to construct HTML classes.
2022-10-01 21:05:32 +01:00
Linus Groh
ad04d7ac9b
LibWeb: Move ExceptionOr from DOM/ to WebIDL/
...
This is a concept fully defined in the Web IDL spec and doesn't belong
in the DOM directory/namespace - not even DOMException, despite the name
:^)
2022-09-25 19:13:31 +01:00
Linus Groh
4270ede7c4
LibWeb: Remove WRAPPER_HACK() macro
...
We no longer access Bindings::FooWrapper anywhere for a Foo platform
object, so these can be removed :^)
2022-09-21 21:12:24 +01:00
Andreas Kling
6b7a1d13e9
LibWeb: Make TextMetrics GC-allocated
2022-09-06 00:27:09 +02:00
Andreas Kling
369dd42d67
LibWeb: Make ImageData GC-allocated
2022-09-06 00:27:09 +02:00
Andreas Kling
4452b5ca09
LibWeb: Make 2D and 3D canvas rendering contexts GC-allocated
2022-09-06 00:27:09 +02:00
Andreas Kling
6f433c8656
LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocated
...
This is a monster patch that turns all EventTargets into GC-allocated
PlatformObjects. Their C++ wrapper classes are removed, and the LibJS
garbage collector is now responsible for their lifetimes.
There's a fair amount of hacks and band-aids in this patch, and we'll
have a lot of cleanup to do after this.
2022-09-06 00:27:09 +02:00
Sam Atkins
9f71d65005
LibWeb: Extract CanvasPathDrawingStyles class from CRC2D
2022-08-14 11:30:40 +02:00
Sam Atkins
53b9f36413
LibWeb: Extract CanvasImageData class from CRC2D
2022-08-14 11:30:40 +02:00
Sam Atkins
270c60c5e8
LibWeb: Extract CanvasDrawImage class from CRC2D
2022-08-14 11:30:40 +02:00
Sam Atkins
7cf42ede68
LibWeb: Extract CanvasText class from CRC2D
2022-08-14 11:30:40 +02:00
Sam Atkins
62b561e2e1
LibWeb: Extract CanvasDrawPath class from CRC2D
...
Again, this is an entirely virtual class since the methods involve
direct access to the Painter. Though, maybe I could just expose the
Painter...
2022-08-14 11:30:40 +02:00
Sam Atkins
c0494988ed
LibWeb: Extract CanvasRect class from CRC2D
...
This one requires drawing to the canvas, so it doesn't make so much
sense to move the implementation over.
2022-08-14 11:30:40 +02:00
Sam Atkins
aa3cb8b425
LibWeb: Extract CanvasFillStrokeStyles class from CRC2D
2022-08-14 11:30:40 +02:00
Sam Atkins
afabd613bd
LibWeb: Extract CanvasFillStrokeStyles class from CRC2D
2022-08-14 11:30:40 +02:00
Sam Atkins
aa87b9699e
LibWeb: Extract CanvasTransform class from CRC2D
...
The implementation of this got a little funky, because it has to access
methods from CanvasState.
2022-08-14 11:30:40 +02:00
Sam Atkins
08e6071ebb
LibWeb: Extract CanvasState class from CRC2D
...
As with CanvasPath, this is to better match the spec IDL.
2022-08-14 11:30:40 +02:00
Sam Atkins
6644f3ab44
LibWeb: Teach CRC2D to draw Path2Ds :^)
2022-08-14 11:30:40 +02:00
Sam Atkins
a37ab7b9f8
LibWeb: Extract CanvasPath class from CRC2D
...
This better matches the spec, and makes it possible for things like
Path2D to reuse the same implementation without duplicate code. :^)
2022-08-14 11:30:40 +02:00
Luke Wilde
adf8341c4e
LibWeb: Forward CRC2D's ref count to HTMLCanvasElement
...
This allows HTMLCanvasElement and CRC2D to share their lifetime, as JS
allows them to arbitrarily access them at any time and CRC2D.canvas
expects a non-null return value.
2022-06-27 22:54:41 +01:00
Luke Wilde
89c4e011e4
LibWeb: Stub CanvasRenderingContext2D.clip
...
This is primarily required by Google Maps Street View, but the map view
works without this.
2022-04-10 19:59:14 +02:00
Luke Wilde
27cc8742ce
LibWeb: Implement CanvasRenderingContext2D.resetTransform
2022-04-10 19:59:14 +02:00
Luke Wilde
329e740c85
LibWeb: Implement CanvasRenderingContext2D.setTransform
2022-04-10 19:59:14 +02:00
Luke Wilde
df7a83ac0e
LibWeb: Implement CanvasRenderingContext2D.transform
2022-04-10 19:59:14 +02:00
Idan Horowitz
086969277e
Everywhere: Run clang-format
2022-04-01 21:24:45 +01:00
Idan Horowitz
bc0fafade9
LibWeb: Add all overloads of CanvasRenderingContext2D::drawImage()
2022-03-05 23:40:08 +01:00
Linus Groh
e890cd5464
LibWeb: Implement CanvasRenderingContext2D.getImageData()
...
The actual copying of the pixel values into the created ImageData object
is a bit ugly, but Gfx::Painter doesn't like the underlying RGBA8888
bitmap.
2022-03-04 23:03:29 +01:00
Linus Groh
3f3326f1dc
LibWeb: Implement CanvasRenderingContext2D.drawImage() closer to spec
...
Also add support for HTMLCanvasElement for the image parameter, leading
to replacing HTMLImageElement with the CanvasImageSource Variant type.
Also stub out the 'check the usability of the image argument' and 'is
not origin-clean' operations, while taking into consideration that these
can throw (and require DOM::ExceptionOr).
2022-03-04 23:03:29 +01:00
Linus Groh
ed03f37ae9
LibWeb: Add CanvasRenderingContext2D's origin-clean flag
2022-03-04 23:03:29 +01:00
Andreas Kling
926d5271b4
LibWeb: Forward CanvasRenderingContext.strokeText() to fillText()
...
This is a hack until we get an actual text stroking implementation.
2022-02-03 22:35:13 +01:00
Andreas Kling
dc3bf32307
LibWeb: Add barebones CanvasGradient object
...
Also add the CanvasRenderingContext2D APIs to go along with it.
Note that it can't be used for anything yet.
2022-02-03 22:35:13 +01:00
Andreas Kling
90a8744823
LibWeb: Add CanvasRenderingContext2D.bezierCurveTo()
2022-02-03 22:35:13 +01:00
sin-ack
9121cc7cae
LibWeb: Implement CanvasRenderingContext2D.measureText
...
This requires an implementation of the "text preparation algorithm" as
specified here:
html.spec.whatwg.org/multipage/canvas.html#text-preparation-algorithm
However, we're missing a lot of things such as the
CanvasTextDrawingStyles interface, so most of the algorithm was not
implemented. Additionally, we also are not able to use a LineBox like
the algorithm suggests, because our layouting infra is not up to the
task yet. The prepare_text function does nothing other than figuring out
the width of the given text and return glyphs with offsets at the
moment.
2022-01-04 22:41:07 +00:00
Linus Groh
1298c27ca9
LibWeb: Implement CanvasRenderingContext2D.isContextLost()
...
Note that we don't implement the "context lost steps" yet, so this will
always return the initial value (false).
2021-12-27 16:43:23 +01:00
Linus Groh
2576af5db1
LibWeb: Implement CanvasRenderingContext2D.reset()
2021-12-27 16:43:23 +01:00
Linus Groh
3e0e965f24
LibWeb: Implement CanvasRenderingContext2D.restore()
2021-12-27 16:43:23 +01:00
Linus Groh
7d435b5ada
LibWeb: Implement CanvasRenderingContext2D.save()
2021-12-27 16:43:23 +01:00
Linus Groh
6d50ff71de
LibWeb: Encapsulate canvas drawing state in a struct
...
This will allow us to easily add copies of the relevant canvas drawing
state to a stack, and likewise replace the current drawing state with
an entry from that stack.
2021-12-27 16:43:23 +01:00
Linus Groh
b32893eb54
LibWeb: Let canvas {fill,stroke}Style default to black, not transparent
...
I don't know if the original author simply missed this or thought the
default color of Gfx::Color is black, but this meant that drawing on a
canvas without explicitly setting a fillStyle or strokeStyle first would
be drawn in transparent color and therefore be invisible.
In the spec this is indicated by a small comment in the IDL definition:
attribute ... strokeStyle; // (default black)
attribute ... fillStyle; // (default black)
I'm starting to question whether Gfx::Color actually *should* have a
default constructor.
2021-12-27 16:43:23 +01:00
Andreas Kling
b91c49364d
AK: Rename adopt() to adopt_ref()
...
This makes it more symmetrical with adopt_own() (which is used to
create a NonnullOwnPtr from the result of a naked new.)
2021-04-23 16:46:57 +02:00
Brian Gianforcaro
1682f0b760
Everything: Move to SPDX license identifiers in all files.
...
SPDX License Identifiers are a more compact / standardized
way of representing file license information.
See: https://spdx.dev/resources/use/#identifiers
This was done with the `ambr` search and replace tool.
ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Idan Horowitz
c5769a7033
LibWeb: Check radius sign in CanvasRenderingContext2D::{arc, ellipse}
...
As required by the specification: 'If either radiusX or radiusY are
negative, then throw an "IndexSizeError" DOMException.'
2021-04-15 20:22:08 +02:00
Idan Horowitz
00114ab01d
LibWeb: Add a naive implemention of CanvasRenderingContext2D::fill_text
...
This doesnt actually account for several unimplemented attributes
(like ltr/rtl, alignment, etc) yet, so this should be expanded in
the future.
2021-04-15 20:22:08 +02:00
AnotherTest
801daf47f0
LibGfx+LibWeb: Wire up CanvasRenderingContext2D.ellipse()
...
Note that this is *extremely* naive, and not very good at being correct.
2021-04-15 17:50:16 +02:00
Idan Horowitz
aab99d5945
LibWeb: Implement the CanvasRenderingContext2D::rect path method
...
This method adds a rectangle to the current 2D path.
2021-04-14 23:01:23 +02:00
Andreas Kling
d434ae71b3
LibWeb: Add CanvasRenderingContext2D.clearRect()
...
Similar to fillRect, except this API fills with transparent black.
2021-03-15 21:20:33 +01:00
Andreas Kling
13d7c09125
Libraries: Move to Userland/Libraries/
2021-01-12 12:17:46 +01:00