Commit graph

11699 commits

Author SHA1 Message Date
Jelle Raaijmakers
62ae4e878f LibWeb: Implement support for drawing with CanvasPattern
We already had the API, but drawing to the canvas was not affected by
any created CanvasPattern. This moves CanvasPatternPaintStyle to LibGfx
so we don't have to reach into LibWeb, and implements the plumbing to
let Skia use images as a fill pattern.
2025-10-23 13:20:03 +01:00
Pavel Shliak
5ee1031b89 LibWeb: Implement SVGFEColorMatrixElement and feColorMatrix 2025-10-23 13:36:26 +02:00
mikiubo
5b2a71a712 LibWeb: Implement XMLFragmentParser
Implement XMLFragmentParser based on the specification:
https://html.spec.whatwg.org/multipage/xhtml.html

Fixes one WPT in:
domparsing/insert_adjacent_html-xhtml.xhtml
2025-10-23 11:06:39 +01:00
mikiubo
0b715b20a2 LibWeb: Make HTML fragment parsing return ExceptionOr
Update Element::parse_fragment and Node::unsafely_set_html to
propagate exceptions.

This refactor is needed as a prerequisite for implementing the XML
fragment parser, which requires consistent error handling in fragment
parsing.
2025-10-23 11:06:39 +01:00
Callum Law
8417d74328 LibWeb: Parse transition property as a coordinating list shorthand
We don't need all this specific logic for parsing the `transition`
property - we also now maintain `none` as such until use time which
gains us a couple extra tests
2025-10-23 10:09:11 +01:00
Callum Law
94c788f2e0 LibWeb: Make animation parsing logic reusable
This is useful for parsing of other coordinating list shorthands
2025-10-23 10:09:11 +01:00
Callum Law
bb7d5747e7 LibWeb: Serialize transition as a coordinating list shorthand 2025-10-23 10:09:11 +01:00
Callum Law
2e6988d681 LibWeb: Make logic for serializing coordinating list shorthand reusable
Previously this was just used for `animation` serialization but can be
used for other properties (e.g. transition, background) as well
2025-10-23 10:09:11 +01:00
Callum Law
fc5cdd69a0 LibWeb: Extract transition coordination logic to reusable method
This will be useful for other coordinating list property groups (e.g.
background and animation)
2025-10-23 10:09:11 +01:00
Callum Law
e78cb71eb3 LibWeb: Dont skip invalid properties when coordinating transition list
Unrecognized property names should still be kept in the list to preserve
matching of indices (e.g. that the Nth property should associate with
the Nth duration)
2025-10-23 10:09:11 +01:00
Callum Law
0b45a68423 LibWeb: Avoid early conversion to CSSPixels when simplifying calculation
Converting to CSSPixels caused us to lose precision and the sign of
signed zeroes.

The values we resolve against in Length::ResolutionContext are still
themselves rounded too early but this is in the right direction.
2025-10-23 09:34:12 +01:00
Callum Law
43b06cbbdd LibWeb: Propagate NaN through CSS sign() function 2025-10-23 09:34:12 +01:00
Callum Law
1977a976da LibWeb: Handle inaccuracies resolving transformation matrix type
Doing trigonometric calculations with floating point numbers can
introduce small inaccuracies. This meant that we would sometimes
incorrectly generate a 3d rather than 2d matrix for the resolved value
of `transform`.

Gains us 3 WPT tests.
2025-10-23 09:34:12 +01:00
Callum Law
2d331b9176 LibWeb: Don't swap atan2 arguments in with_simplified_children 2025-10-23 09:34:12 +01:00
Zaggy1024
e0a75d5084 LibCore: Implement polling for events on Windows 2025-10-22 17:32:45 -05:00
Tim Ledbetter
2fd424ccb6 LibWeb: Draw canvas arcs and ellipses correctly when radius is zero
In this case, we should just draw a line from the last point in the
path to the start point. Previously, a division by zero caused nothing
to be drawn.
2025-10-22 16:08:57 +02:00
Undefine
40bc1c0eb5 LibGfx: Enable Vulkan shared images and WebGL on FreeBSD 2025-10-22 13:54:54 +02:00
Undefine
bfa86f7961 LibGfx: Use PkgConfig to find libdrm
On FreeBSD the libdrm headers are not in a standard location so this
makes the include more portable.
2025-10-22 13:54:54 +02:00
Undefine
abe536652f Meta+LibCore: Disable --no-undefined on FreeBSD and remove LibCore hack
It turns out it's much cleaner to just allow undefined symbols like we
already do for sanitizer Clang and remove the weak symbol definition.
2025-10-22 13:54:54 +02:00
Tim Ledbetter
976912f3e9 LibWeb: Normalize negative drawImage() source/destination dimensions 2025-10-22 12:29:04 +02:00
caztanj
e93f44112d LibJS: Do not verify cycle root's status is linked in CyclicModule
This VERIFY is both incorrect and redundant. The VERIFY at step 2
verifies the status when evaluate is called on m_cycle_root.
2025-10-22 11:54:56 +02:00
Feng Yu
61c36e2865 LibJS: Sync additional Import Attributes spec changes
Some steps were not updated with tc39/ecma262#3057. This patch
syncs the remaining changes.
2025-10-22 10:58:19 +02:00
Jelle Raaijmakers
f8c4043460 LibWeb: Repeat shader for repeating linear gradient
We implemented repeating linear gradients by expanding a vector of color
stops until the entire range was covered. This is both a bit wasteful
and caused Skia to draw corrupted gradients to screen whenever the total
amount of color stops and positions exceeded 127.

Instead of doing that, use the original color stops for the shader and
repeat it instead of clamping it. We need to do a bit of math to project
positions correctly, but after that the shader repeats itself nicely.

While we're here, calculate the gradient's length and the center point
as floats instead of ints, yielding a slight but noticeable improvement
in gradient rendering (see the diff on the zig zag pattern in
css-gradients.html for an example of this).
2025-10-22 10:45:18 +02:00
Jelle Raaijmakers
e6ddc995a7 LibWeb: Remove unused include from GradientData.h 2025-10-22 10:45:18 +02:00
Jelle Raaijmakers
868c29545a LibWeb: Skip one single positive linear gradient color stop repeat
We prime `color_stop_list_with_expanded_repeat` with the input
`color_stop_list`, so we don't actually need to copy the stops for the
first iteration. This didn't result in graphical glitches, but these
entries were unnecessary irregardless.
2025-10-22 10:45:18 +02:00
Tim Ledbetter
c4e56cc845 LibWeb: Throw error when calling drawImage() with a broken image 2025-10-22 10:44:58 +02:00
Lorenz A
96b34ea744 LibWeb: Add MathML Element presentational hints 2025-10-22 01:46:41 +02:00
Tim Ledbetter
f1571c4217 LibWeb: Ensure drawImage() always uses the first image frame 2025-10-22 01:25:46 +02:00
Callum Law
f49cf75d44 LibWeb: Don't pass unnecessary PropertyComputationDependencies struct
Since we now have access to the `AbstractElement` through the
`ComputationContext` we can just set the flag that this element relies
on tree counting functions directly, no need to pass this struct around.
2025-10-22 00:01:30 +02:00
Callum Law
5b9a36b172 LibWeb: Pass AbstractElement in ComputationContext
Passing the `AbstractElement` rather than the
`TreeCountingFunctionResolutionContext` allows us to only compute the
resolution context when necessary (i.e. when we actually need to resolve
a tree counting function)
2025-10-22 00:01:30 +02:00
Callum Law
a4184fda1f LibWeb: Avoid iterating in children_changed unless necessary
Previously when one child of an element changed we would iterate over
every child to check whether they needed to be invalidated because they
relied on tree counting functions.

We now skip this in most cases by only doing it when at least one child
relies on tree counting functions.
2025-10-22 00:01:30 +02:00
Lorenz A
6afd39b16a LibWeb: Keep the tokens in ListOfActiveFormattingElements 2025-10-21 23:36:07 +02:00
Luke Wilde
b8bbebd3ff LibWeb/WebGL: Upload blank image in texImage2D if pixels is null 2025-10-21 23:29:50 +02:00
Luke Wilde
4ebe43af58 LibWeb/WebGL2: Implement most of the transform feedback APIs 2025-10-21 23:29:50 +02:00
Luke Wilde
39d42b7b73 LibWeb/WebGL2: Implement waitSync 2025-10-21 23:29:50 +02:00
Luke Wilde
3005cc30b4 LibWeb/WebGL2: Check if WebGLSync object belongs to the current context 2025-10-21 23:29:50 +02:00
Luke Wilde
3d2874bc4e LibWeb/WebGL2: Implement invalidateSubFramebuffer 2025-10-21 23:29:50 +02:00
Luke Wilde
b949c8ea47 LibWeb/WebGL2: Implement framebufferTextureLayer 2025-10-21 23:29:50 +02:00
Luke Wilde
5c1bf5c3f6 LibWeb/WebGL2: Implement most of the query APIs 2025-10-21 23:29:50 +02:00
Luke Wilde
2b941731a7 LibWeb/WebGL2: Implement compressedTex(Sub)Image3D 2025-10-21 23:29:50 +02:00
Luke Wilde
8dcbe69eb6 LibWeb/WebGL2: Implement drawRangeElements 2025-10-21 23:29:50 +02:00
Luke Wilde
2c13a2a68c LibWeb/WebGL2: Implement vertexAttribI4(u)i(v) 2025-10-21 23:29:50 +02:00
Luke Wilde
35763ffe53 LibWeb/WebGL2: Implement uniform{1,2,3,4}uiv 2025-10-21 23:29:50 +02:00
Luke Wilde
59bea36a59 LibWeb/WebGL2: Implement remaining uniformMatrix methods 2025-10-21 23:29:50 +02:00
Tim Ledbetter
7db73118e9 LibWeb+LibGfx: Draw shadows for stroke joins and caps 2025-10-21 18:55:08 +02:00
Tim Ledbetter
0f295e8989 LibWeb: Take transforms into account when drawing shadows 2025-10-21 18:55:08 +02:00
Tim Ledbetter
0516c414d4 LibWeb: Don't draw shadows for transparent gradient fills 2025-10-21 18:55:08 +02:00
Tim Ledbetter
13f551612c LibWeb: Don't draw shadows if shadow offset and blur are not set 2025-10-21 18:55:08 +02:00
Tim Ledbetter
eb44cca5bd LibWeb: Ignore non-finite shadow offset values 2025-10-21 18:55:08 +02:00
Tim Ledbetter
b99c0c6a7f LibWeb: Account for paint style and global alpha when drawing shadows 2025-10-21 18:55:08 +02:00