73730 Commits

Author SHA1 Message Date
ayeteadoe
dffb971436 AK: Use NumericLimits instead of hardcoded limits in Duration methods
Running test-web via Windows clang-cl reported the following UBSAN
error:

runtime error: negation of -9223372036854775808 cannot be represented
in type 'long long'; cast to an unsigned type to negate this value to
itself.
2025-12-20 13:34:41 +01:00
Andreas Kling
2bbb5a455f LibWeb: Remove unused HTML::Worker::m_document pointer 2025-12-20 12:46:52 +01:00
Andreas Kling
b3b3a8602a LibWeb: Mark a handful of CSS properties as not affecting layout
I noticed us invalidating layouts in the wild (e.g on reddit) for
properties that can't possibly affect layout.
2025-12-20 08:21:18 +00:00
Andreas Kling
cca7cb7ad4 LibWeb: Add missing initializers in XPathResult
Found by UBSAN when using 16 KiB GC heap blocks on Linux.
2025-12-19 20:21:07 -06:00
Andreas Kling
f58d4dd324 LibWeb: Initialize IDBTransaction::m_state correctly
The spec says this should be initialized as "active", so let's do that.

Found by UBSAN when using 16 KiB GC heap blocks on Linux.
2025-12-19 20:21:07 -06:00
Andreas Kling
6975c31b4d LibWeb: Keep underlying data alive for transferred image bitmaps 2025-12-19 20:21:07 -06:00
Andreas Kling
e9b0ef0afa LibGC: Add allocator statistics to post-GC report 2025-12-19 20:21:07 -06:00
Andreas Kling
5af4bc81e1 LibGC: Use mach_vm_map() for BlockAllocator on macOS
This allows us to get a correctly aligned allocation with a single
syscall, unlike posix_memalign() which makes no such guarantees.
2025-12-19 20:21:07 -06:00
Andreas Kling
82f63334d0 LibGC: Use MADV_FREE_REUSABLE and MADV_FREE_REUSE if available
These are macOS madvise() hints that keep the kernel accounting aware of
how we're using the GC memory. This keeps our memory footprint looking
more accurate.
2025-12-19 20:21:07 -06:00
Andreas Kling
716e5f72f2 LibGC: Always use 16 KiB as HeapBlock size
Before this change, we'd use the system page size as the HeapBlock
size. This caused it to vary on different platforms, going as low
as 4 KiB on most Linux systems.

To make this work, we now use posix_memalign() to ensure we get
size-aligned allocations on every platform.

Also nice: HeapBlock::BLOCK_SIZE is now a constant.
2025-12-19 20:21:07 -06:00
Andreas Kling
cce3ce2df7 LibGC: Remove awkward USE_FALLBACK_BLOCK_DEALLOCATION path
We can make a new fallback path eventually if needed for some platform.
2025-12-19 20:21:07 -06:00
Sam Atkins
cb0c428b3a LibWeb/DOM: Use a single scroll queue for all events
Corresponds to:
36f05864a6
302490c80c
https://github.com/w3c/csswg-drafts/pull/13238
https://github.com/w3c/csswg-drafts/pull/13239

The latter two are my own corrections which haven't been merged yet.
2025-12-19 12:09:19 -06:00
Sam Atkins
e3c76d396f LibWeb/DOM: Prevent refreshing to a javascript URL
Corresponds to:
97e0693fb7

We do now pass the test added for this, but can't import it:
http://wpt.live/html/browsers/browsing-the-web/navigating-across-documents/refresh/javascript.window.html
2025-12-19 12:08:03 -06:00
Sam Atkins
30800d6098 LibWeb/WebIDL: Specify name and length params for CreateBuiltinFunction
Corresponds to:
fb0c9c945f

These are already the default values, so no code changes are needed.
2025-12-19 12:06:39 -06:00
Sam Atkins
c446281844 LibWeb/CSS: Remove Transformation in favor of TransformationStyleValue
The Transformation class wasn't really accomplishing anything. It still
had to store StyleValues, so it was basically the same as
TransformationStyleValue, with extra steps to convert from one to the
other. So... let's just use TransformationStyleValue instead!

Apart from moving code around, the behavior has changed a bit. We now
actually acknowledge unresolvable parameters and return an error when
we try to produce a matrix from them. Previously we just skipped over
them, which was pretty wrong. This gets us an extra pass in the
typed-om test.

We also get some slightly different results with our transform
serialization, because we're not converting to CSSPixels and back.
2025-12-19 14:51:53 +01:00
Sam Atkins
6b5836644a LibWeb/CSS: Use PaintableBox for matrix interpolation when available 2025-12-19 14:51:53 +01:00
Sam Atkins
ab176b5dde LibWeb/CSS: Allow unreifiable transform-lists to reify as CSSStyleValues
Some transform-functions are not reifiable as a CSSTransformComponent,
for example a matrix() with sibling-index() in it. In that case, rather
than crashing, fall back to the basic CSSStyleValue reification.

The crash doesn't happen yet, but would with the following commit's
changes. Currently, Transformation::to_matrix() completely ignores
unsupported argument types, but in the next commit that's replaced with
TransformationStyleValue::to_matrix(), which attempts to handle them
properly.
2025-12-19 14:51:53 +01:00
Rocco Corsi
e7b3c70706 Meta: Remove unused option variables 2025-12-19 14:41:40 +01:00
Jelle Raaijmakers
48c6208846 CI: Switch to Blacksmith runners for our Flatpak builds 2025-12-19 14:25:29 +01:00
Jan Koudijs
c79a3abcd0 Meta: Add Flatpak linting for vcpkg equality
The Flatpak manifest linter matches dependencies against vcpkg.json
and if there is a match checks if versions are equal.

If there is no version specified in vcpkg overrides then the vcpkg
baseline is queried for the version. The baseline is what ensures
dependency compatibility.

If there is no match it checks if there is a listed exclusion.
If there is no version match or no listed exclusion then linting fails.
2025-12-19 13:16:47 +01:00
Jan Koudijs
80133665f7 Meta: Bring Flatpak dependency versions in line with vcpkg versions 2025-12-19 13:16:47 +01:00
Zaggy1024
1e773942b1 LibMedia: Try to use FFmpeg for all formats other than Matroska
By sniffing specifically for MP4 and WebM, we were precluding
PlaybackManager from playing any other formats. Instead, use
MatroskaDemuxer if the media has a `matroska` or `webm` EBML doctype,
and fall back to FFmpeg for all others.

We'll need to limit the containers that FFmpeg is able to open at some
point, but for now, this allows us to play the formats we could before.
2025-12-18 17:28:14 -06:00
Zaggy1024
69ac94fcd3 LibMedia: Use Matroska parse_ebml_header for sniff_webm
Allow the function to stop reading without skipping to the end of the
data header element in order to avoid reading more data over the
network than necessary.
2025-12-18 17:28:14 -06:00
Zaggy1024
57df201ff2 LibMedia: Skip the entire EBML header after reading required elements 2025-12-18 17:28:14 -06:00
Zaggy1024
1cb7dea2fd LibMedia: Default-initialize the Matroska DocTypeVersion to 0 2025-12-18 17:28:14 -06:00
Zaggy1024
7e78ffdb86 LibMedia: Allow Matroska master element parsing to skip to the end
In a lot of cases, we're only parsing a few specific elements, then we
only need to skip unknown elements. To make this more efficient, we can
now use the ElementIterationDecision enum to specify that we should
break and jump to the end of the master element, instead of stopping in
place.
2025-12-18 17:28:14 -06:00
Tete17
322ff629a1 LibWeb: Correct Clamp behaviour if the value lies in the halfway point
The C round differs from the web standard if the value lies exactly at
the middle point. C rounds away from 0 while the web moves to the even
value of the 2 extremes.

This fixes at least 5 tests :)
2025-12-18 23:26:20 +01:00
Tete17
8ddf97053a LibWeb: Import Blob-slice WPT test 2025-12-18 23:26:20 +01:00
Sam Atkins
12ff11d9ea Tests: Skip file input tests that frequently time out on CI 2025-12-18 16:08:12 +00:00
Sam Atkins
b0b0669187 LibWeb/CSS: Add :-webkit-autofill as a legacy alias of :autofill 2025-12-18 14:50:27 +01:00
Sam Atkins
2b2e5a1db3 LibWeb/CSS: Support legacy selector aliases for pseudo-classes
These are replaced with the pseudo-class they are an alias of, during
parsing.
2025-12-18 14:50:27 +01:00
Sam Atkins
36a9b653ae LibWeb/CSS: Add the :autofill pseudo-class
We don't support autofilling of form data yet, so this matches nothing
for now.
2025-12-18 14:50:27 +01:00
Sam Atkins
c906dbeaf7 Tests: Import :autofill pseudo-class test 2025-12-18 14:50:27 +01:00
Sam Atkins
cbca527879 Tests: Correct CSS bug in WPT test harness
Corresponds to:
ef6fcf9d74
2025-12-18 12:50:44 +01:00
Jelle Raaijmakers
2cc2992011 CI: Make the Windows nightly build use Blacksmith runners 2025-12-18 12:19:36 +01:00
Jelle Raaijmakers
c8d797797d CI: Move Windows build to ci.yml using new Blacksmith runners 2025-12-18 12:19:36 +01:00
Sam Atkins
4b918cba50 LibWeb/CSS: Serialize very small numbers as 0
The spec asks us to serialize with no more than 6 decimal digits, so if
the number is smaller than 0.000,000,5 then it can't produce any digits
and we should serialize it as 0, instead of using scientific notation.

We also shouldn't use scientific notation for very large numbers, but we
don't seem to have a flag to disable that in the formatter, so I'm
leaving a FIXME for now.

Improves some test results. 🎉
2025-12-18 11:21:27 +01:00
R-Goc
1665f4e980 AK: Remove SIMDMath.h
This header is unused in ladybird. The associated test code is also
removed.
2025-12-17 15:39:37 -06:00
R-Goc
0c37b093e9 AK: Replace gcc specific builtin removed in clang
On clang 22 main with this PR [1], __builtin_ia32_sqrtps was removed in
favor of the __builtin_elementwise_sqrt. As that builtin is not by GCC
we only use it on clang. Using the underlying _mm_sqrt_ps instrinsic was
also an option however including xmmintrin.h is best avoided as it is a
large header. This change doesn't increase our clang version requirement
as this builtin is available since 18.1.0.

[1] https://github.com/llvm/llvm-project/pull/165682
2025-12-17 15:39:37 -06:00
Andreas Kling
ece0b72e3c LibJS: Don't set [[HomeObject]] for non-method object properties
This fixes an issue where we'd incorrectly retain objects via the
[[HomeObject]] slot. This common pattern was affected:

    Object.defineProperty(o, "foo", {
        get: function() { return 123; }
    });

Above, the object literal would get assigned to the [[HomeObject]]
slot even though "get" is not a "method" per the spec.

This frees about 30,000 objects on my x.com home feed.
2025-12-17 12:50:17 -06:00
Andreas Kling
cbe75f8251 LibJS: Lazily instantiate "prototype" field on ECMAScriptFunctionObject
This field is rarely accessed but we were creating it for every single
script function instantiated.

It's a little awkward but the same optimization can be found in other
engines, so it's nothing crazy.

This avoids creating roughly 80,000 objects on my x.com home feed.
2025-12-17 12:50:17 -06:00
Timothy Flynn
941336505c LibJS: Align async module rejection order with fulfillment order
This is a normative change in the ECMA-262 spec. See:
https://github.com/tc39/ecma262/commit/4752038
2025-12-17 15:33:26 +01:00
Gingeh
dd15dfffd1 LibWeb: Check null in getComputedStyle on inactive view transition 2025-12-17 14:12:47 +00:00
Sam Atkins
0241652611 LibWeb/CSS: Parse number as a type in attr()
Dealing with `unit_name` as a separate variable was becoming unwieldy,
so I've also combined that into the `syntax` variant.

Corresponds to:
0e6b4ef33b
2025-12-17 11:53:08 +00:00
Sam Atkins
e1b5a1c803 LibWeb/CSS: Parse attr(foo %) as a <percentage> token
There were two bugs here: `%` is a `<delim>` not an `<ident>`; and we
created a `<dimension>` token when we should create a `<percentage>`.
2025-12-17 11:53:08 +00:00
Sam Atkins
c9f7e0d88c Tests: Reimport attr-all-types WPT test
This has changed quite a bit since we imported it.
2025-12-17 11:53:08 +00:00
ayeteadoe
ee3aa865af Meta+LibGfx+LibWeb: Update skia to 144 and remove overlay port
Skia deprecated some non-span versions of their API, but they provided
SK_SUPPORT_UNSPANNED_APIS to expose the legacy versions.

SkFontMgr_New_FontConfig now requires a font scanner to be passed in.

There were a few screenshot tests that visibily looked the same but skia
must've changed some rendering infrastructure as the PNGs were not
matching anymore so I rebaselined those and adjusted the fuzzy matching
config to allow them to pass on both macOS and Linux.

The empty-radial-gradient-crash Ref test started to fail as we were
setting the horizontal scale factor to inf in when the height = 0. It
looks like something changed to make doing that not valid anymore.

The overlay port is removed as the issues, mainly skcms symbol import
and export were resolved upstream in skia and utilized in the new port
version.
2025-12-17 12:00:33 +01:00
Psychpsyo
5be1e9076a LibWeb: Fix crash when abspos element is relative to table row
This occured because the abspos containing block is in-between the
containing blocks of two regular ancestors in this case, so it was
being skipped. (The containing block of a table cell is the table
itself, not the table row.)
2025-12-17 11:59:46 +01:00
Aliaksandr Kalenik
73de6d4387 LibWeb: Use weak pointer for cache in HTMLCollection
This avoids keeping elements cached in an HTMLCollection alive longer
than necessary in the following scenario:
1. The HTMLCollection cache is populated by querying it.
2. Elements that were included in the cache are removed from the DOM.
3. The cached elements are kept alive by strong references in the cache
   until it is updated, which might never happen.
2025-12-17 11:41:21 +01:00
Jelle Raaijmakers
6c6fdad47a CI: Support wasm-tools download for Windows and arm64
We don't use wasm-tools there yet, but let's at least not do weird
things like download the aarch64 macOS version on Windows x86_64.
2025-12-16 15:18:21 +01:00