Commit graph

69815 commits

Author SHA1 Message Date
Aliaksandr Kalenik
6169e91994 LibWeb: Delete redundant GridFitContent class from track representation
GridSize already supports the FitContent type, so there is no need to
additionally wrap it in a GridFitContent class.
2025-06-18 15:51:10 +01:00
Tim Ledbetter
e0af205d69 LibWeb/CSS: Implement the empty-cells property
This property sets whether table borders and backgrounds are painted
if a given table cell has no visible content.
2025-06-18 14:55:03 +01:00
Sam Atkins
a0cef5a7da Meta: Only run WPT.sh cleanup routines on Linux
These use the `readarray` command which isn't available in the older
version of Bash available on macOS. However, they're also not needed on
macOS, so let's skip them entirely.

Ref: https://github.com/LadybirdBrowser/ladybird/issues/5118
2025-06-18 13:52:46 +01:00
Luke Wilde
ffae0d8b2d LibGfx/AVIF: Always reduce decoding output to a bit depth of 8
Gfx::Bitmap only supports a bit depth of 8, therefore we refused to
load AVIF images which didn't have this bit depth.

However, we can tell the libavif decoder to reduce the output depth by
setting avifRGBImage.depth to 8. This allows us to support any input
depth.

Makes images load on https://www.ikea.com/ which uses Cloudflare Images
to re-encode their images to 16-bit AVIF.
2025-06-18 14:27:24 +02:00
Shannon Booth
5f5975c81d LibWeb/HTML: Iterate safely in perform_a_microtask_checkpoint()
This list we are iterating over is removed from when there are
no more GC references to an ESO. This may be triggered by a GC
allocation. Since
UniversalGlobalScopeMixin::notify_about_rejected_promises performs
GC allocations (by, for example, allocating a GC function), it
is not safe to simply iterate over this list.

Fix this by taking a strong reference to all registered ESOs by
copying them across to a RootVector before iteration.

Fixes: #4652
2025-06-18 13:08:30 +02:00
Shannon Booth
00002c6443 LibWeb/HTML: Unregister ESO during finalize phase
It is generally safer for GC cells to do cleanup work during the
finalize phase.
2025-06-18 13:08:30 +02:00
Jelle Raaijmakers
3c0b125c1c Tests: Force layout in test to prevent flakiness 2025-06-18 12:52:24 +02:00
stelar7
3815a7c1eb LibWeb: Implement cleanup_indexed_database_transactions
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
2025-06-18 19:05:41 +12:00
Tim Ledbetter
fa1e02e5d7 LibWeb: Allow calc() values in cubic-bezier() easing functions 2025-06-18 08:57:06 +02:00
Tim Ledbetter
c5a3eaaf45 LibWeb: Allow calc() values in steps() easing functions 2025-06-18 08:57:06 +02:00
Veeti Paananen
21b531598d LibWeb/CSS: Fix reference bug when canonicalizing linear easing stops
+2 WPT tests
2025-06-18 08:53:10 +02:00
Gingeh
5e1e0d4e18 LibWeb: Remove some popover AD-HOC comments
Spec PR: https://github.com/whatwg/html/pull/11253
2025-06-18 08:51:22 +02:00
Shannon Booth
fc62a05c98 LibWeb/DOM: Set Document's origin in JS constructor
We were missing this spec step, which meant that the created
document had no origin, causing a crash when accessed for same-origin
checks.
2025-06-18 08:49:01 +02:00
Tomasz Strejczek
e03c558a0a AK: Implement demangle() for MSVC ABI
This implements demangle() using Windows API. Also some rudimentary
test is provided.
2025-06-17 18:39:18 -06:00
Carter Snook
1861f24979 LibJS: Avoid Symbol methods for RegExp on primitives
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
Normative PR: https://github.com/tc39/ecma262/pull/3009 (unmerged as of this commit)

There are a few test262 tests for this, see https://test262.fyi/#built-ins/String/prototype
JSC and Rhino have have already added these changes.
2025-06-17 17:54:36 -06:00
Colin Reeder
d4a5d16d27 LibGfx: Explicitly link against fontconfig 2025-06-17 16:55:50 -06:00
Colin Reeder
b7b5e71767 LibWeb: Explicitly link against GL 2025-06-17 16:55:50 -06:00
Colin Reeder
64f3765cce CMake: Add CMake script for finding libwebp 2025-06-17 16:55:50 -06:00
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