Commit graph

72372 commits

Author SHA1 Message Date
Andreas Kling
4f684bb4c9 LibGfx: Don't create AnonymousBuffer for each bitmap in BitmapSequence
When decoding a BitmapSequence received over IPC, we were creating an
AnonymousBuffer for each bitmap and then making a Gfx::Bitmap wrapper
around it.

This was unnecessarily using up one file descriptor per bitmap, and also
wasting a lot of memory for small bitmaps since we always allocated at
least one VM page.

This patch changes the BitmapSequence decoder to use malloc memory
instead, saving file descriptors and using less memory overall.
2025-10-24 08:52:53 +02:00
Andreas Kling
3593c3b687 LibWeb: Throw out decoded UTF-32 data in HTMLTokenizer after parser runs
This ends up saving quite a bit of memory on many pages, since UTF-32
uses 4 bytes per code points.

As an example, it reduces the footprint on https://gymgrossisten.com/
by 2 MiB.
2025-10-24 08:52:53 +02:00
Andreas Kling
b10f2993b3 LibWeb: Use Optional<ssize_t> for the HTMLTokenizer insertion points
Instead of making a custom struct, we can just use Optional here,
to make the code feel a bit more idiomatic.
2025-10-24 08:52:53 +02:00
Tim Ledbetter
9df6ccf772 LibWeb: Add MathML doctypes that enable XHTML entities 2025-10-23 22:08:40 +02:00
Tim Ledbetter
1c00279488 LibWeb: Reset Painter when resetting canvas to its initial state 2025-10-23 18:52:36 +02:00
Tim Ledbetter
017e8a5b8d LibGfx: Add a method to reset a Painter to its initial state 2025-10-23 18:52:36 +02:00
Andreas Kling
dbf041aa98 LibWeb: Ignore repaint requests inside iframes with visibility: hidden
This reduces idle CPU usage on https://gymgrossisten.com/ from 100%
(split between WebContent and Ladybird) to ~4% on my machine.
2025-10-23 17:42:37 +02:00
Tim Ledbetter
f34361950c Tests: Rebaseline failing IndexedDB tests 2025-10-23 15:55:17 +02:00
Tim Ledbetter
49a46522d0 Meta: Use binary search instead of a Trie for public suffix list lookups 2025-10-23 15:01:13 +02:00
Tim Ledbetter
15518f119c Tests: Add some basic public suffix tests 2025-10-23 15:01:13 +02:00
Luke Wilde
85e8d2ba38 LibWeb/IndexedDB: Prevent copying and moving of RequestList
RequestList cannot be copied or moved, because m_pending_request_queue
contains lambdas that store pointers to the original RequestList and
completion steps that we don't have a reference to.

Fixes a bunch of WPT regressions and imports the ones that work.
2025-10-23 14:42:45 +02:00
Luke Wilde
4ede2cdf18 LibWebView+WebContent: Allow setting the default time zone
This is used by tests to set the default time zone to UTC.

This is because certain tests create JavaScript Date objects, which are
in the current timezone.
2025-10-23 14:42:45 +02:00
stelar7
d0bfb85c22 LibWeb/IDB: Mark request as errored if upgrade transaction is aborted 2025-10-23 14:26:54 +02:00
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
Jelle Raaijmakers
9753b8e62c Tests: Import WPT canvas repeating pattern test 2025-10-23 13:20:03 +01:00
Pavel Shliak
5ee1031b89 LibWeb: Implement SVGFEColorMatrixElement and feColorMatrix 2025-10-23 13:36:26 +02:00
ste
b50b89b4a8 Meta: Do not set -march=native on riscv64 2025-10-23 12:17:21 +02:00
ste
b28a97b399 Meta: Add build support for RISC-V (riscv64)
Co-authored-by: Bas M. <bas@opvolger.net>
2025-10-23 12:17:21 +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
fd2f3b1f03 Tests: Import transition parsing tests 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
d32f99b16f LibWeb: Ensure all passed arguments are used when parsing math functions
This disallows things such as `log(1, foobar)` where we would previously
just skip over `foobar` and parse this as `log(1)`
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
670cbccb4c Tests: Enable ThreadedPromise tests on Windows 2025-10-22 17:32:45 -05:00
Zaggy1024
3c9ddc9b7f Tests: Add a test for EventLoop::pump(PollForEvents) 2025-10-22 17:32:45 -05: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
865699066e Documentation: Add libdrm to FreeBSD packages 2025-10-22 13:54:54 +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
Undefine
bd8c6c1431 Meta: Add the dbus feature to qtbase
D-Bus is needed for Qt to build its accessibility support and since we
build D-Bus regardless it doesn't add any overhead.
2025-10-22 13:54:54 +02:00
Undefine
5fd0586125 Meta: Build dbus on FreeBSD 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
8af6da64a6 Tests: Rework CSS gradients test layout
Put the CSS gradients in a grid instead of a single long column. This
makes it much easier to detect changes / view diffs.
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