Commit graph

70447 commits

Author SHA1 Message Date
Ben Eidson
15aa7dce29 LibWeb/WebAudio: Implement AudioNode::connect()
Sets up the basic infrastructure for the audio node graph and
implements the AudioNode `connect()` method with its related overides.
AudioNodes store vectors of AudioNodeConnections and
AudioParamConnections to represent links between nodes.
2025-06-17 16:54:19 -06:00
Totto16
cee874caaf LibWeb: Factor out CanvasSettings mixin into separate file
This refactors this mixin, that was introduced in #4506 to be the same
as all other mixins, so that it can be used for #3788
2025-06-17 16:54:04 -06:00
stasoid
47da627653 Tests: Enable LibTest, LibTextCodec and LibUnicode tests on Windows 2025-06-17 16:19:22 -06:00
Daniel Bertalan
edeef940b6 LibJS: Fix pointer authentication failure in TypedArray
`TypedArray` objects need to know their own constructor objects to allow
copying. This was implemented by storing a function pointer to the
`Intrinsic` object's method which returns the constructor object.

The problem is that function pointers aren't polymorphic, we can't
legally just cast e.g. a `Derived* (*ptr)(void)` to `Base*
(*ptr)(void)` (this is why the code needed a `bit_cast` to even
compile). But this wasn't actually a problem in practice because their
ABIs were the same. But with pointer authentication (Apple's `arm64e`
ABI) this signature mismatch becomes a hard failure and crashes the
process.

Fix this by adding a virtual function that returns the intrinsic
constructor (actually, a `NativeFunction`, as typed arrays constructors
don't inherit from the base `TypedArray` constructor) instead of the
function pointer.

With this, test-js passes and Ladybird launches correctly when built
(with a lot of vcpkg hacks) for arm64e.
2025-06-17 15:44:37 -06:00
stasoid
460b257449 LibIPC: Enable in Windows CI 2025-06-17 15:36:47 -06:00
stasoid
8af2a49b5c LibIPC: Make TransportSocketWindows responsible for reading entire
messages. Port of a371f84 to Windows.
2025-06-17 15:36:47 -06:00
stasoid
ccf303eefc LibIPC: Move AutoCloseFileDescriptor to its own header 2025-06-17 15:36:47 -06:00
ayeteadoe
1893f89799 Meta: Update Windows Nightly CI to Windows 2025 Image with Sanitizers
Github Actions just updated windows-2025 to LLVM 20, which is the
minimum version required for us to build and run tests with sanitizers

Now that we've added support, enable the Sanitizer build in CI.
2025-06-17 15:33:26 -06:00
ayeteadoe
d9d6e55102 Tests: Disable test-js on Windows
It doesn't quite work in CI the same way it does with the VS Preview
locally.
2025-06-17 15:33:26 -06:00
ayeteadoe
56d7d50566 Meta: Add Windows sanitizer presets
Windows Clang supports both ASAN and UBSAN
2025-06-17 15:33:26 -06:00
ayeteadoe
35d39e6cbc CMake: Add support for building with sanitizers on Windows 2025-06-17 15:33:26 -06:00
ayeteadoe
3fd05306fc AK: Add abstraction for forcing empty base optimization on Windows
Without this annotation, the MSVC ABI is reluctant to apply EBO even
in cases that are basically guaranteed on the Itanium ABI by modern
compilers. This fixes an UBSAN issue with Variant on Windows.
2025-06-17 15:33:26 -06:00
stasoid
75b0e9a199 LibCore: Fix race condition in PosixSocketHelper::read on Windows
CancelIo introduces a race condition: if data arrives between calls to
WSARecv and CancelIo it will be lost.
See also: https://vstinner.github.io/asyncio-proactor-wsarecv-cancellation-data-loss.html
2025-06-17 20:56:32 +02:00
Shannon Booth
e0d7278820 LibURL+LibWeb: Make URL::Origin default constructor private
Instead, porting over all users to use the newly created
Origin::create_opaque factory function. This also requires porting
over some users of Origin to avoid default construction.
2025-06-17 20:54:03 +02:00
Shannon Booth
5deb8ba2f8 LibWeb: Explicitly set Document's origin
As part of the effort of removing the default constructor of
Origin, since document has the origin set after construction,
port Document's origin over to an Optional<Origin>.

This exposes that we were never setting the origin of the document
during fragment parsing. For now, to maintain previous behaviour,
let's explicitly set it to an opaque origin.
2025-06-17 20:54:03 +02:00
Shannon Booth
de79eb4410 LibWeb: Give NonFetchSchemeNavigationParams a constructor 2025-06-17 20:54:03 +02:00
Shannon Booth
0d905b1846 LibWeb: Give NavigationParams a constructor
This allows for NavigationParams to hold non-default constructable
types.
2025-06-17 20:54:03 +02:00
Shannon Booth
766cbf4937 LibGfx: Remove dependency on LibURL
This was previously a dependency (from ICC, if I recall correctly),
but this no longer appears to be the case.
2025-06-17 20:54:03 +02:00
Shannon Booth
1a34485460 LibWeb/HTML: Serialize time origin in environments
Which is caught from changing across to this form of initializing
the object.
2025-06-17 20:54:03 +02:00
Luke Wilde
f12b6b258f LibJS: Don't use presence of function params to identify function scope
Instead, we can just use the scope type to determine if a scope is a
function scope.

This fixes using `this` for parameter default values in arrow functions
crashing. This happened by `uses_this_from_environment` was not set in
`set_uses_this`, as it didn't think it was in a function scope whilst
parsing parameters.

Fixes closing modal dialogs causing a crash on https://www.ikea.com/

No test262 diff.

Reverts the functional part of 08cfd5f, because it was a workaround for
this issue.
2025-06-17 20:48:45 +02:00
Sam Atkins
26105b8b11 AK: Add a Formatter for Checked
This goes in Format.h instead of Checked.h, to avoid an include cycle.
2025-06-17 20:44:01 +02:00
Aliaksandr Kalenik
b9b6927b85 LibWeb: Fix swapped strings for auto-fill and auto-fit in GridRepeat
...serialization.
2025-06-17 17:43:04 +01:00
Jelle Raaijmakers
e8e6dbcee0 LibWeb: Fix document element's .scrollHeight and .scrollWidth
We were using the viewport's size as the viewport scrolling area, but
those are completely different things.
2025-06-17 17:17:34 +01:00
Jelle Raaijmakers
8f139d065c LibWeb: Simplify ViewportPaintable::assign_scroll_frames()
No functional changes.
2025-06-17 17:17:34 +01:00
Jelle Raaijmakers
e104d896eb LibWeb: Rename Navigable::m_size to ::m_viewport_size
All other viewport-related dimensions are referenced to by 'viewport',
so let's rename the member that stores the viewport size to prevent
further confusion.
2025-06-17 17:17:34 +01:00
Jelle Raaijmakers
46a46a1c61 LibGfx+LibWeb: Append glyphs in LineBoxFragment run more efficiently
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (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
Since we know the number of glyphs we're going to append, ensure the
LineBoxFragment run's capacity once and perform unchecked appends.
2025-06-17 17:03:33 +02:00
Jelle Raaijmakers
5ac067c804 LibGfx: Inline Font::pixel_metrics()
Calls to this method were showing up in profiles.
2025-06-17 17:03:33 +02:00
Jelle Raaijmakers
df20ac0f3c LibGfx: Optimize Gfx::measure_text_width()
Instead of constructing a GlyphRun, just add the X advances of all
glyphs to determine a text's width.
2025-06-17 17:03:33 +02:00
Jelle Raaijmakers
631c857301 LibGfx: Only determine glyphs info once in TextLayout
We were calling into `hb_buffer_get_glyph_infos()` twice and setting up
an unused `Vector<hb_glyph_info_t>`.
2025-06-17 17:03:33 +02:00
Jelle Raaijmakers
c91718148d LibWeb: Undo curious case of line wrapping 2025-06-17 17:03:33 +02:00
Jelle Raaijmakers
e80914a399 LibGfx: Use Vector::extend() to extend fonts in FontCascadeList
This only grows the capacity once, if required.
2025-06-17 17:03:33 +02:00
Jelle Raaijmakers
4a514020e0 LibWeb: Remove unused include from InlineLevelIterator 2025-06-17 17:03:33 +02:00
Sam Atkins
0e168ce631 Tests: Reimport dom/nodes/moveBefore tests
Apart from these moving out of `tentative/`, the
custom-element-move-reactions.html test was updated to be less flaky:
5e87cd92c0
2025-06-17 13:59:01 +02:00
Sam Atkins
7fe854c131 LibWeb/CSS: Link CalculationContext to new spec definition
Corresponds to ad244f3413

There's nothing that we need to do differently I think, but it's nice to
have a clear spec definition to refer to. :^)
2025-06-17 12:38:27 +01:00
Sam Atkins
a263ba78ed LibWeb/CSS: Add FIXME that color-mix() now takes 1+ colors, not 2
Corresponds to 83c7bffe51
2025-06-17 12:38:27 +01:00
Sam Atkins
af9a227ca3 LibWeb/HTML: Implement HTMLElement.scrollParent
Corresponds to d3effb701c

What a "fixed position container" is isn't clear to me, and we don't
seem to use that elsewhere, so I've left the steps using that as FIXMEs
for now.

There's no test coverage for this in WPT yet and I'm not confident
enough in the specific behaviour to write one myself. So, waiting on
https://github.com/web-platform-tests/wpt/issues/53214
2025-06-17 12:38:27 +01:00
Sam Atkins
5d5f16845c LibWeb/HTML: Bring HTMLElement::offset_parent() up to date 2025-06-17 12:38:27 +01:00
Sam Atkins
3fbd3146a1 LibWeb/DOM: Implement "is closed-shadow-hidden" algorithm 2025-06-17 12:38:27 +01:00
Sam Atkins
1435480d76 LibWeb/CSS: Add fixme for sRGB color interpolation
Corresponds to a0a9886063
2025-06-17 12:38:27 +01:00
Jelle Raaijmakers
046d1169de LibWeb: Only calculate enclosing rect for fragments if we use it
This would show up in profiles for pages with lots of fragments. No
functional changes.
2025-06-17 11:55:28 +02:00
Jelle Raaijmakers
7dc8062283 LibWeb: Store visibility for Paintables
For every invocation of `::before_paint()` and `::after_paint()`, we
would reach into the node's computed values to determine its visibility.
Let's just do this once during construction of the paintable instead,
since this was showing up in profiles.
2025-06-17 11:55:28 +02:00
Jelle Raaijmakers
1871843acb LibWeb: Reformat Node/PaintableBox::has_css_transform()
Slightly more visually pleasing. No functional changes.
2025-06-17 11:55:28 +02:00
Jelle Raaijmakers
ade5709939 LibWeb: Lazily obtain the Z-index for children in StackingContext
In `StackingContext::paint_descendants()`, we don't need to obtain the
computed values nor the Z-index of a child unless certain other
conditions are true. Let these conditions short-circuit before actually
reaching into the computed values, which shows up in profiles.
2025-06-17 11:55:28 +02:00
Jelle Raaijmakers
7d1ee3a2fa LibGfx+LibWeb: Perform unchecked appends related to text layout
Use unchecked appends in places where we know for certain the vector has
enough capacity.
2025-06-17 11:55:28 +02:00
Jelle Raaijmakers
2cba208366 LibWeb: Skip unnecessary alt text rendering work if alt is empty
Both text shaping and drawing operations were showing up in profiles,
even though the alt text was an empty string.
2025-06-17 11:55:28 +02:00
Jelle Raaijmakers
6710aa102a LibGfx: Return NonnullRefPtr in Gfx::shape_text()
We always return a glyph run here.
2025-06-17 11:55:28 +02:00
Jelle Raaijmakers
c999dd0c9f LibWeb: Remove unused includes
No functional changes.
2025-06-17 11:55:28 +02:00
Tim Ledbetter
59a2e10a4e LibWeb: Distinguish between empty block at-rules and statement at-rules 2025-06-17 08:58:00 +01:00
Tim Ledbetter
701fcb9e87 LibWeb: Allow anonymous layer block rule with no declarations 2025-06-17 08:58:00 +01:00
Tim Ledbetter
30cdacc05a LibWeb: Add flow relative values for the clear property
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (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
Currently `inline-start` and `inline-end` are always treated as `left`
and `right` respectively.
2025-06-17 09:26:26 +02:00