Commit graph

71259 commits

Author SHA1 Message Date
ayeteadoe
3df8e00d91 LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
ayeteadoe
94a3a7d9a1 Tests/LibMedia: Enable in Windows CI 2025-08-23 16:04:36 -06:00
ayeteadoe
0c9b16d09c Tests/LibWebView: Enable in Windows CI 2025-08-23 16:04:36 -06:00
ayeteadoe
a2d3562647 Tests/LibXML: Enable in Windows CI 2025-08-23 16:04:36 -06:00
ayeteadoe
6dbb59da77 LibJS: Export symbols causing linker errors in various consumers
After LibJS had its symbol exports optimized the targets
js, test-js, test262-runner, test-wasm, and LibWeb began to get linker
errors after the work to add Windows support for test-web and ladybird
targets. These extra JS_API annotations fix all those linker errors.
2025-08-23 16:04:36 -06:00
ayeteadoe
9c67c4a270 LibWebView: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
ayeteadoe
ed93551d59 Qt/ladybird: Enable in Windows CI 2025-08-23 16:04:36 -06:00
ayeteadoe
f58298132b LibDevTools: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
ayeteadoe
84690f432e test-web: Allow help command to succeed
These are required for test-web runtime to actually work
2025-08-23 16:04:36 -06:00
ayeteadoe
0b19c04b53 test-web: Enable building in Windows CI
The tests are not registered with CTest yet
2025-08-23 16:04:36 -06:00
ayeteadoe
0847ca4854 WebWorker: Enable in Windows CI 2025-08-23 16:04:36 -06:00
ayeteadoe
0a699132f3 WebContent: Enable in Windows CI 2025-08-23 16:04:36 -06:00
ayeteadoe
e497303e94 LibTextCodec: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
ayeteadoe
58be9e6400 RequestServer: Enable in Windows CI 2025-08-23 16:04:36 -06:00
ayeteadoe
c7f35193d0 LibDevTools: Enable in Windows CI 2025-08-23 16:04:36 -06:00
ayeteadoe
97e8a922ad ImageDecoder: Enable in Windows CI 2025-08-23 16:04:36 -06:00
ayeteadoe
ee3c033de2 LibWebView: Enable in Windows CI 2025-08-23 16:04:36 -06:00
ayeteadoe
09ff99c50e LibImageDecoderClient: Enable in Windows CI 2025-08-23 16:04:36 -06:00
Aliaksandr Kalenik
025011d8e0 LibWeb: Fix algorithm that distributes space beyond limits [GFC]
Fixes bug when we didn't use `tracks_to_grow_beyond_limits` and instead
distributed extra space to all affected tracks. Also implements missing
"when accommodating max-content" part.
2025-08-23 23:16:18 +02:00
Idan Horowitz
d2857164ea Tests: Test that unvisited Templated members are caught by ClangPlugin
Specifically AK::Optional<T> and AK::Variant<...> were of interest in
recent issues.
2025-08-23 21:21:04 +02:00
Idan Horowitz
bcb8b06a74 ClangPlugins: Make sure forward declared fields are visited as well
Instead of ignoring fields using forward-delcared types, always assume
they inherit from GC::Cell. This improves the worst case from a missed
unvisited field, to a slightly wrong error message.

Fixes #5959.
2025-08-23 21:21:04 +02:00
Idan Horowitz
1eed5bdef7 ClangPlugins: Check for unvisited JS::Value members
JS:Value members might hold a JS::Cell inside, so they must be visited
in ::visit_edges implementations as well.

Fixes #5958.
2025-08-23 21:21:04 +02:00
Idan Horowitz
66bd7fa530 LibJS: Add missing visit of Realm::m_builtins 2025-08-23 21:21:04 +02:00
Andreas Kling
3873b1d8cf LibWeb: Create XML document object for SVG-as-image
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
It's not enough to just use the XML parser, we also have to make sure
the DOM document we produce is an actual XML document.

Fixes #5966
2025-08-23 14:01:37 +01:00
Andreas Kling
4350bccf8e LibWeb: Use Accelerate framework on macOS to premultiply bitmap data
This leverages hardware acceleration to speed things up considerably,
shaving ~500ms of load time off of https://cloudflare.com/
2025-08-23 14:09:17 +02:00
Andreas Kling
67432e35f1 LibGfx: Match vImage premultiply/unpremultiply rounding behavior
Our Color::to_premultiplied() and Color::to_unpremultiplied() used
integer truncation.

Apple’s Accelerate framework (and many other libraries) use
round-to-nearest, which avoids bias and produces results that differ
by ±1 in many cases.

This commit switches both helpers to round-to-nearest and clamps the
results to [0,255]. For alpha==0 we now return fully transparent black
(0,0,0,0) to align with common conventions, instead of preserving RGB.
2025-08-23 14:09:17 +02:00
CountBleck
7575beafcb LibWeb: Import tests for resizable/growable ArrayBuffer Wasm memories
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
We pass to-fixed-length-buffer.any.html and to-resizable-buffer.any.html
but not to-resizable-buffer-shared.any.html, because LibJS doesn't have
growable SharedArrayBuffers implemented...
2025-08-23 08:26:23 +02:00
CountBleck
d0d5bffb2d LibWeb: Implement resizable ArrayBuffers for Wasm memories
This commit adds the toResizableBuffer() and toFixedLengthBuffer()
methods to WebAssembly.Memory. This includes the necessary hook to
HostResizeArrayBuffer. Some modifications to function signatures in
LibWeb/WebAssembly/Memory.h were also made (changing the return type
from WebIDL::ExceptionOr to JS::ThrowCompletionOr) to allow the use of
some code in the aforementioned hook.

Note: the hook for HostGrowSharedArrayBuffer isn't implemented, since
LibJS doesn't seem to have complete support for growable
SharedArrayBuffers; the relevant methods/getters don't even exist on
the prototype, let alone HostGrowSharedArrayBuffer!

This should help pass the WebAssembly.Memory WPT tests included in
Interop 2025, except those pertaining to growable SharedArrayBuffers.
2025-08-23 08:26:23 +02:00
CountBleck
826eb68ecd LibWeb: Add test ensuring re-exported Wasm memories equal the import
If a memory is imported by a Wasm instance and re-exported, the export's
value should be the exact same WebAssembly.Memory object as the
WebAssembly.Memory object passed for the import.
2025-08-23 08:26:23 +02:00
CountBleck
f2a170bcfb LibWeb: Implement the WebAssembly "Memory object cache" + other changes
This cache is referenced by a few parts of the JS API spec, including
the threads spec (such as in toFixedLengthBuffer), as well as the
"refresh the Memory buffer" algorithm, which was implemented as a method
of Memory before this change.

Now, this algorithm can be implemented in a spec-like fashion (though it
mostly seems to add extra complexity). This change also fixes a bug
where memories that were re-exported from an imported WebAssembly.Memory
were given a distinct WebAssembly.Memory object, since the caching that
existed in Instance.cpp was instance-local, not global to the realm.

We also make Memory::m_buffer non-lazy, since we have to implement
"initialize a memory object" correctly anyway.
2025-08-23 08:26:23 +02:00
CountBleck
a2dc6c4bbb LibJS: Keep the lengths of ArrayBuffers with unowned ByteBuffers fixed
The relevant type of ArrayBuffer DataBlock is now a struct containing
both a ByteBuffer* and a size_t size, and not just a ByteBuffer*, with
the size being that of the ByteBuffer. This type of DataBlock is only
used for WebAssembly.Memory (see commit 4fd43a8f96), meaning this
change won't affect any other code. This change is required to pass one
WPT subtest in wasm/jsapi/memory/grow.any.html, since old fixed-length
SharedArrayBuffers after a WebAssembly.Memory growth should keep their
length, while the new buffer after the growth will have the updated
length.
2025-08-23 08:26:23 +02:00
CountBleck
0bda014c96 LibWeb: Don't create a copy SharedArrayBuffer for shared Wasm memories
For whatever reason, the implementation of "create a fixed length memory
buffer" was borked for shared Wasm memories, in that a new
SharedArrayBuffer was created, with the contents of the Wasm memory
copied into it. This is incorrect, since the SharedArrayBuffer should be
a view into the Wasm memory's span, not a copy of it. This helps pass a
WPT subtest in wasm/jsapi/memory/grow.any.html.
2025-08-23 08:26:23 +02:00
Tim Ledbetter
aadd563592 LibWeb: Replace usages of dynamic_cast with as and as_if
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
2025-08-22 20:26:09 +02:00
Tim Ledbetter
d31aec25e8 AK: Ignore possible const reference when comparing type equality in is 2025-08-22 20:26:09 +02:00
Tim Ledbetter
4e57a2aedf LibWeb: Ensure static cast is used when possible in as_if 2025-08-22 20:26:09 +02:00
Andreas Kling
5e6b8b2785 LibWeb: Add missing visit of IDBRequest::m_source
Clang plugin bug: LadybirdBrowser/ladybird#5959
2025-08-22 19:29:29 +02:00
Andreas Kling
02f3002081 LibWeb: Add missing visit of IDBCursor::m_value
Clang plugin bug: LadybirdBrowser/ladybird#5958
2025-08-22 19:29:29 +02:00
Timothy Flynn
1f88e6819a LibWeb: Ensure hit testing is grapheme aware
Previously, clicking in the middle of a multi-code point grapheme would
place the cursor at a code unit index somewhere in the middle of the
grapheme. This was not only visually misleading, but the user could then
start typing and insert characters in the middle of the cluster. This
also made text select pretty wonky.

The main issue was that we were treating the glyph index in a glyph run
as a code unit index. We must instead map that glyph index back to a
code unit index with help from LibGfx (via harfbuzz).

The distance computation used here was also a bit off, especially for
the last glyph in a glyph run. We essentially want the cursor to end
up on whichever edge of the clicked glyph it is closest to. The result
of the distance computation limited us to the left edge of the last
glyph. Instead, we can use the same edge tracking we use for form-
associated elements to handle this for us.
2025-08-22 14:06:46 +02:00
Timothy Flynn
c3f4d32162 LibWeb: Extract FormAssociatedElement's grapheme edge code to a helper
The edge detection will be used at least in hit testing.
2025-08-22 14:06:46 +02:00
Timothy Flynn
047f521c4c LibGfx+LibWeb: Add some extra fields to glyph run data
We currently have a mixup in LibWeb between code unit offset and glyph
offset during hit testing. These extra fields will allow us to correct
this discrepency.
2025-08-22 14:06:46 +02:00
Timothy Flynn
b1fe816336 AK: Provide a length_in_code_units API for UTF-8 strings
This is just to afford API symmetry with UTF-16 strings to help in
templated methods.
2025-08-22 14:06:46 +02:00
zac
41eaf0d966 Tests: Add tests for some common image types in TestLibCoreMimeType 2025-08-22 08:03:28 -04:00
zac
b8f95a091c LibCore: Add AVIF to registered types in MimeData 2025-08-22 08:03:28 -04:00
Callum Law
5c2fe12772 LibWeb: Don't consider null -> null as a change for invalidation
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This avoids excessive invalidation within `recompute_inherited_style`
where we inherit a value but not an animated value.
2025-08-22 12:17:55 +02:00
Callum Law
cecd5b3b5b LibWeb: Compute invalidation before value is moved
`set_animated_property` will move `new_animated_value` away so we need
to compute invalidation before we call it
2025-08-22 12:17:55 +02:00
Andreas Kling
3c808de270 LibWeb: Use XML parser for SVG-as-image documents
We were already using the XML parser for SVG files when opening at the
top level. This patch makes things consistent by using the same code
path when parsing SVG-as-image.

We also make some tweaks in SVG presentation attribute handling since
we can no longer rely on the HTML length attribute parsing quirk when
parsing width/height attributes.
2025-08-22 11:35:59 +02:00
Andreas Kling
b7595013c1 LibWeb+LibXML: Preserve element attribute order in XML documents
We now use OrderedHashMap instead of HashMap to ensure that attributes
on XML elements retain their original order.
2025-08-22 11:35:59 +02:00
Sam Atkins
da88db04cf LibWeb/CSS: Implement the "numeric factory" methods (CSS.px() and pals) 2025-08-22 09:48:30 +01:00
Sam Atkins
24017e4ab7 LibWeb/CSS: Reify numbers, dimensions and percentages as CSSUnitValue 2025-08-22 09:48:30 +01:00
Sam Atkins
5384338788 LibWeb/CSS: Implement CSSUnitValue 2025-08-22 09:48:30 +01:00