6616 Commits

Author SHA1 Message Date
Callum Law
acc8b90549 LibWeb: Improve gradient position serialization
Some checks failed
CI / Linux, arm64, Sanitizer, Clang (push) Has been cancelled
CI / macOS, arm64, Sanitizer, Clang (push) Has been cancelled
CI / Linux, x86_64, All_Debug, Clang (push) Has been cancelled
CI / Linux, x86_64, Fuzzers, Clang (push) Has been cancelled
CI / Linux, x86_64, Sanitizer, GNU (push) Has been cancelled
CI / Linux, x86_64, Sanitizer, Clang (push) Has been cancelled
CI / Windows, x86_64, Windows_Sanitizer_CI, ClangCL (push) Has been cancelled
Build Dev Container Image / build (push) Has been cancelled
Package the js repl as a binary artifact / Linux, arm64 (push) Has been cancelled
Package the js repl as a binary artifact / macOS, arm64 (push) Has been cancelled
Package the js repl as a binary artifact / Linux, x86_64 (push) Has been cancelled
Run test262 and test-wasm / run_and_update_results (push) Has been cancelled
Lint Code / lint (push) Has been cancelled
Label PRs with merge conflicts / auto-labeler (push) Has been cancelled
Push notes / build (push) Has been cancelled
Nightly Lagom / Linux, arm64, Distribution, Clang (push) Has been cancelled
Nightly Lagom / macOS, arm64, Distribution, Clang (push) Has been cancelled
Nightly Lagom / Linux, arm64, Sanitizer, Clang (push) Has been cancelled
Nightly Lagom / macOS, arm64, Sanitizer, Swift (push) Has been cancelled
Nightly Lagom / Linux, x86_64, Distribution, GNU (push) Has been cancelled
Nightly Lagom / Linux, x86_64, Sanitizer, Swift (push) Has been cancelled
Nightly Lagom / Windows, x86_64, Windows_Sanitizer_CI, ClangCL (push) Has been cancelled
Nightly Lagom / Flatpak aarch64 (push) Has been cancelled
Nightly Lagom / Flatpak x86_64 (push) Has been cancelled
Nightly Android / CI (macos-14, Android) (push) Has been cancelled
Close stale PRs / stale (push) Has been cancelled
`EdgeStyleValues` which consist of an offset of a `calc()`s which
resolves to 50% should be considered "centered" for
`SerializationMode::ResolvedValue` for the purpose of omitting the
position value from gradient serialization.
2026-01-02 11:43:10 +01:00
Callum Law
6964593377 LibWeb: Add absolutized method to EdgeStyleValue
Fixes #7192.

We absolutize `EdgeStyleValue` to always be relative to the top/left
edge which allows for some simplification.
2026-01-02 11:43:10 +01:00
Callum Law
e6ddb7db9e LibWeb: Store EdgeStyleValue sub-values directly
As well as being required to implement absolutization this also means we
now bypass a limitation with `LengthPercentage` where we would always
use `SerializationMode::Normal` for the constituent lengths which gains
us some WPT passes
2026-01-02 11:43:10 +01:00
Callum Law
9c93fdbd9a Tests: Import some WPT background position parsing tests 2026-01-02 11:43:10 +01:00
Gingeh
789ab3cc57 LibWeb: Declare namespace prefixes in parse_xml_fragment 2026-01-02 11:09:19 +01:00
InvalidUsernameException
375020d8ce LibWeb: Do not attempt to access elements of empty list
This recovers 750+ WPT subtests that were lost when
https://github.com/web-platform-tests/wpt/pull/56913 was merged and
added new testcases, two of which exposed this crash.

I have added my own testcase instead of importing the affected WPT tests
since they are large and complex, which makes it hard to understand
where the problem is coming from based on them alone. Also this is only
a crash test (i.e. not a different kind) because the tested scenario
doesn't actually behave correctly yet for seemingly unrelated reasons.
2026-01-02 10:14:07 +01:00
Lorenz A
953b33d273 Tests/LibWeb: Do not wait so long to cancel previous playEffect 2025-12-31 18:25:22 +01:00
Sam Kravitz
bef8423f0f AK: Rename CaseInsensitiveStringTraits
To CaseInsensitiveASCIIStringTraits. This change indicates that these
traits are about ASCII-only insensitivity.
2025-12-31 10:24:42 +01:00
Shannon Booth
865b2b88b0 LibWeb/HTML: Fix Origin.from(value) for Window objects
I had completely managed to forget about the special case of Window
where a WindowProxy is what is received over IDL. This was caught
by the origin-from-window WPT test, but unfortunately this cannot
be imported as it relies on a web server running and other
surroundsing WPT infrastructure.
2025-12-30 18:50:05 +01:00
Tete17
460244c5a8 LibWeb: Add encap & decap WPT tests
For now only the most basic test pass but it is a beginning.
2025-12-30 14:16:35 +01:00
Shannon Booth
89dbdd3411 LibURL: Add domain concept to URL::Origin to fix same-origin-domain
The same-origin domain check always returned true if only the scheme
matched. This was because of missing steps to check for the origin's
domain, which didn't exist. Add this concept to URL::Origin, even
though we do not use it at this stage in document.domain setter.

Co-Authored-By: Luke Wilde <luke@ladybird.org>
2025-12-30 13:02:10 +01:00
Gingeh
04b4cd9e00 LibWeb: Treat near-zero aspect-ratios as degenerate 2025-12-30 12:45:31 +01:00
Shannon Booth
f9a996650b LibWeb/HTML: Implement the Origin interface
See: https://github.com/whatwg/html/commit/68909b2
2025-12-30 12:40:27 +01:00
Shannon Booth
2c11e03582 LibURL: Return a proper registrable domain if it's missing in the PSL
Instead of '*', which is a nonsensical value. Similar to what we do
for determining the public suffix, if no match could be made via the
PSL algorithm, then take everything after the second dot as
the registrable domain.

This prevents us from considering e.g. b.b.example and
a.example as the same site.
2025-12-30 12:40:27 +01:00
Gingeh
5c0e707f01 LibWeb: Don't crash when rounded background image is too large 2025-12-30 12:26:55 +01:00
Zaggy1024
744abc0c18 Tests: Use some tasks when testing PlaybackStream
This doesn't help to reproduce the potential UAF in the previous
commit, but it doesn't hurt to include this nonetheless.
2025-12-29 19:58:22 -06:00
R-Goc
1f3e20cebf LibMedia: Add a WASAPI playback stream for Windows
Implement PlaybackStream using WASAPI. The design is similar to
PlaybackStreamAudioUnit in that it uses a task queue. A high priority
thread is used to render the stream. All the stream controls save for
the exit being requested which happens on destruction of the stream are
managed by the render thread.

Due to the design of the windows audio mixer the audio we receive must
be resampled to match the sample rate of the mixer. We use a float based
interleaved PCM stream which matches both our existing code and the
audio mixer which internally usues floats.

Having to use a mutex around a queue for the task queue is suboptimal,
in a future PR a MPSC queue could be added to AK and used instead.
2025-12-29 18:02:02 -06:00
Shannon Booth
2a8b83a568 LibWeb/WebIDL: Upgrade QuotaExceededError to its own interface
See https://github.com/whatwg/webidl/commit/48eba6d
2025-12-29 17:15:11 +01:00
Callum Law
e79644bf6b LibWeb: Mark scrollbar-color property as inherited 2025-12-29 16:11:13 +01:00
Tim Ledbetter
70671b4c11 Revert "LibWeb/HTML: Return Promises from Window scroll methods"
This reverts commit a610639119.
2025-12-26 19:33:51 +01:00
Tim Ledbetter
cacadc8806 Revert "LibWeb/HTML: Return Promises from Element scroll methods"
This reverts commit 3a7fcde341.
2025-12-26 19:33:51 +01:00
Andreas Kling
b6bd38c55d AK+LibJS: Make SinglyLinkedList::remove() return a new iterator
This fixes an issue where the iterator could be in a bad state after
removing something from the list.

The behavior is also more idiomatic in general.
2025-12-25 20:21:37 +01:00
Callum Law
781f961c07 LibWeb: Always use timeline time for animation pending task ready time
It is not guaranteed that an animation is ready to run a pending task
when it is scheduled just because it has a timeline, and even if it is,
the current time when scheduling will not necessarily still be correct
when the task is run (e.g. if the timeline changes in the interim).

We had some tests which relied on the previous behavior which have been
updated to await the pending play task

Fixes a crash in the
/web-animations/interfaces/Animatable/animate-no-browsing-context.html
WPT test but it can't be imported since it relies on a python web server
to be running
2025-12-23 14:54:22 +01:00
Callum Law
1bad8e5a78 LibWeb: Update animations regardless of whether timeline time changed
There are times that we want to update an animation regardless of
whether it's timelines time has changed, for example if an animation
associated with a scroll timeline has a pending task we should run that
on the next update regardless of whether the user has scrolled
2025-12-23 14:54:22 +01:00
Callum Law
f235625670 LibWeb: Don't disassociate animations from timeline when target orphaned
An animation with an orphaned owning element should continue to be
ticked by the timeline.

Reverts c8b574e and instead avoids leaking animations by not visiting
`Animation`s from `AnimationTimeline`s.

Fixes a timeout in the imported test
2025-12-23 14:54:22 +01:00
Callum Law
d62e2e39a3 LibWeb: Avoid running microtasks too early when updating animations
There were a bunch of places that we created
`HTML::TemporaryExecutionContext`s when updating animations in order to
resolve various promises, this worked but as part of the destructor it
would perform a microtask checkpoint which would result in us executing
microtasks earlier than intended, this is solved by instead having a
single temporary execution context for the entire animation update
process which we then destruct at the intended time.
2025-12-23 14:54:22 +01:00
Callum Law
d1e8788d43 LibWeb: Account for pending playback rate changes when playing animation
The spec calls for us to use the effective playback rate (i.e. including
any pending updates) when playing an animation.

Fixes a timeout in the newly imported test.
2025-12-23 14:54:22 +01:00
Callum Law
16d1498bb0 Tests: Import some more animation tests 2025-12-23 14:54:22 +01:00
Sam Atkins
3a7fcde341 LibWeb/HTML: Return Promises from Element scroll methods
Corresponds to part of:
c548a9a1d4
2025-12-23 14:24:28 +01:00
Sam Atkins
a610639119 LibWeb/HTML: Return Promises from Window scroll methods
Corresponds to part of:
c548a9a1d4
2025-12-23 14:24:28 +01:00
Sam Atkins
cae526286a Tests: Import CSSOM-View IDL harness test 2025-12-23 14:24:28 +01:00
aplefull
3e391bdb2d LibRegex: Use token-state restoration in character class parsing
Previously, we used restoration based on character position in parser.
This caused the lexer to re-tokenize from the middle of multi-character
tokens like escape sequences, and led to incorrect parse failures for
patterns like `[\[\]]`. We would backtrack to before the first `\[`
token, then re-lex the `[` as a separate token instead of part of the
`\[` escape.

Now we save and restore the actual token object along with the lexer
index, so we keep correct token state when backtracking.
2025-12-23 11:04:16 +01:00
aplefull
ff06a4a9e5 LibRegex: Fix negated class validation for nested string properties
We were incorrectly checking for negated character class when string
properties appeared in nested classes. Now we track negation state in
the parser and correctly reject invalid string properties in negated
classes.
2025-12-23 11:04:16 +01:00
aplefull
1b570fcd61 LibRegex: Correct negated character class escapes behavior
Patterns like /[^\S]/ should match whitespace characters, but previously
would fail to match. The position would advance twice: once during the
character class comparison, and again at the end when temporary_inverse
was reset. This caused matches to be skipped incorrectly.

Now we advance at the end only if position hasn't already changed during
the loop.
2025-12-23 11:04:16 +01:00
aplefull
52a3c19c0a LibRegex: Clamp large quantifier values instead of rejecting them
Fixes parsing of regex quantifiers with extremely large numeric values.
Previously, very large quantifiers would fail to parse, but Chrome and
Firefox both clamp such large values to 2^31-1 instead of rejecting
them. So now we do the same.
2025-12-23 11:04:16 +01:00
Aliaksandr Kalenik
defbd0ec05 LibWeb/SVG: Percent-decode same-document <use> href fragments
`SVGUseElement::referenced_element()` previously passed
`m_href->fragment()` directly to `Document::get_element_by_id()`. URL
fragments are stored in their serialized form, so references to elements
whose IDs contain non-ASCII characters would fail to resolve.
2025-12-23 00:11:42 +01:00
Gingeh
690c48d912 LibWeb: Don't crash from svg mask reference cycles 2025-12-20 23:54:54 -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
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
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
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
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