Commit graph

70831 commits

Author SHA1 Message Date
Luke Wilde
da5fca15ee LibWeb: Only expose performance.{timing,navigation} on Window
They are only valid in a Window context, and the spec only exposes them
in Window contexts.

Fixes workers crashing on:
- https://web.whatsapp.com/
- https://pro.kraken.com/app/trade/btc-usd
2025-07-25 11:46:58 +02:00
Luke Wilde
bd51bc6874 LibIDL: Pass partial interface extended attributes onto its members 2025-07-25 11:46:58 +02:00
Tim Ledbetter
89fb783b42 LibWeb: Throw pre insertion validity errors from the correct global 2025-07-25 09:08:14 +02:00
Ali Mohammad Pur
c7ad6cd508 LibRegex: Use code unit length in more places that apply
Some checks are pending
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
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
Finishes what 7f6b70fafb started.
Having one part use length and another code unit length lead to crashes,
the added test ensures we don't mess that up again.
2025-07-24 23:09:01 +02:00
Andrew Kaster
97c8fdd042 Documentation: Add instructions on how to build the Flatpak 2025-07-24 14:25:03 -06:00
Aliaksandr Kalenik
66e1d599f8 LibWeb: Use scroll state from snapshot while applying clip rectangles
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
Fixes race condition introduced in eed47acb when rendering thread
accesses ScrollFrame that could be mutated in the middle of
rasterization by the main thread, resulting in broken rendering.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/5553
2025-07-24 13:03:23 -04:00
Timothy Flynn
8b6e3cb735 LibWeb+LibUnicode+WebContent: Port DOM:CharacterData to UTF-16
This replaces the underlying storage of CharacterData with Utf16String
and deals with the fallout.
2025-07-24 19:00:20 +02:00
Timothy Flynn
cb85eac3d8 LibIDL+IDLGenerators: Begin supporting UTF-16 strings in IDL
This adds a new IDL type, Utf16DOMString. This is the same as DOMString,
except it is UTF-16. This type is temporary - we will want DOMString to
be UTF-16 by default once we've ported enough of LibWeb.

To make this support easier, some string IDL generator handling is moved
directly into `generate_to_string` from the call sites.
2025-07-24 19:00:20 +02:00
Timothy Flynn
6c73dff120 AK: Implement a UTF-16 method to check if a string is ASCII whitespace 2025-07-24 19:00:20 +02:00
Timothy Flynn
f53389bab1 AK: Add a couple of Utf16String factories
* Utf16String::from_utf8_with_replacement_character
* Utf16String::from_code_point
2025-07-24 19:00:20 +02:00
Andreas Kling
b4435bd50c LibWeb: Don't clip descendants outside stacking context root rect
Skia allows you to pass a bounding rect to its saveLayer() function as
an optimization when you know that you won't paint outside those bounds.
Unfortunately, we were passing a too-small rectangle that didn't take
into account transformed descendants, etc.

For now, simply pass null instead of a bounding rect. This way, Skia
figures it out internally. It may allocate larger temporary bitmaps than
needed this way, but at least we get more correct results. I've left
re-enabling the optimization as a FIXME in the code.

This fixes unwanted clipping in various parts of the Discord UI.
2025-07-24 11:15:01 -04:00
Jelle Raaijmakers
b1c3ce807b AK: Rename Utf16View::trim_whitespace() to ::trim_ascii_whitespace()
This reflects the naming of String::trim_ascii_whitespace() and better
indicates what exactly we're trimming.
2025-07-24 07:18:25 -04:00
Jelle Raaijmakers
e029e785d2 LibWeb: Convert Editing API internals to UTF-16
Both sides of the Editing internals now have to deal with some awkward
converting between UTF-8 and UTF-16, but the upside is that it
immediately exposed an issue with the `insertText` command: instead of
dealing with code units, it was iterating over code points causing the
selection to be updated only once instead of twice. This resulted in the
final selection potentially ending up in between a surrogate pair.

Fixes #5547 (pasting/typing surrogate pairs).
2025-07-24 07:18:25 -04:00
Jelle Raaijmakers
9a03ee1c24 AK: Fix mention of renamed member in Utf16View 2025-07-24 07:18:25 -04:00
Jelle Raaijmakers
15178d5230 AK: Add ::ends_with() to Utf16View and Utf16StringBase
I noticed that we can significantly simplify ::starts_with(), and based
the new ::ends_with() on that.
2025-07-24 07:18:25 -04:00
Jelle Raaijmakers
7f8468b0e6 AK: Compare pointers in TypedTransfer<T>::compare()
We can return `true` quickly if the two pointers are identical.
2025-07-24 07:18:25 -04:00
Jelle Raaijmakers
54dd45d3f6 AK: Add Span::ends_with()
Originally I added this to use it in Utf16View::ends_with(), but the
final implementation ended up a lot simpler. I chose to keep this anyway
since it mirrors Span::starts_with().
2025-07-24 07:18:25 -04:00
Jelle Raaijmakers
a9862d60bf LibGfx: Add Color::from_utf16_string() 2025-07-24 07:18:25 -04:00
Jelle Raaijmakers
fd066d2b58 LibWeb: Update two stray "take the action for command" invocations
This is the more idiomatic (although functionally equivalent) way of
taking the action for any command.
2025-07-24 07:18:25 -04:00
aplefull
e2f8f5a350 LibRegex: Fix capture groups in quantified alternations
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
Run test262 and test-wasm / run_and_update_results (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
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 prevents empty matches from overwriting non-empty captures in
quantified alternations. Fixes patterns like (a|a?)+ where the optional
branch would incorrectly overwrite meaningful captures with empty
strings.
2025-07-24 10:40:16 +02:00
Timothy Flynn
173bb67004 LibJS+LibUnicode: Port Intl.RelativeTimeFormat to UTF-16 strings 2025-07-24 10:39:52 +02:00
Timothy Flynn
abcb2d42bc LibUnicode: Port Intl.PluralRules to UTF-16 strings 2025-07-24 10:39:52 +02:00
Timothy Flynn
6fe0e13474 LibJS+LibUnicode: Port Intl.DurationFormat to UTF-16 strings 2025-07-24 10:39:52 +02:00
Timothy Flynn
e637e148d4 LibJS+LibUnicode: Port Intl.NumberFormat to UTF-16 strings 2025-07-24 10:39:52 +02:00
Timothy Flynn
db2148b44a LibJS+LibUnicode: Port Intl.ListFormat to UTF-16 strings 2025-07-24 10:39:52 +02:00
Timothy Flynn
7d80aabbdb LibJS+LibUnicode: Port Intl.DisplayNames to UTF-16 strings 2025-07-24 10:39:52 +02:00
Timothy Flynn
ee01f857d1 LibJS+LibUnicode: Port Intl.DateTimeFormat to UTF-16 strings 2025-07-24 10:39:52 +02:00
Timothy Flynn
b2f053e783 LibJS+LibUnicode: Port Intl.Collator to UTF-16 strings 2025-07-24 10:39:52 +02:00
Andrew Kaster
09c031fa96 CI: Add nightly flatpak workflow
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
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
CI / Linux, x86_64, Sanitizer, 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
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 will build both aarch64 and x86_64 flatpaks nightly. The test jobs
I did with the default GitHub runners took ~1h30m for aarch64 and
~2h30m for x86_64, but this will hopefully improve over time as the
cache is built up. And be better time-wise on the blacksmith runners.

Disk space is a large concern with these flatpak builds. A naive script
on my local machine showed that we needed a max of 10.3 GiB of free
space for the x86_64 build, with clang as the compiler. For some reason,
building with default gcc 14 uses more disk space than that, bumping
up against the default 14 GiB free space limit guaranteed by GitHub for
their default runners.
2025-07-23 16:27:49 -06:00
Andrew Kaster
358a24b461 CI: Give Windows CI workflow a unique name
This should ™️ make it easier to identify the workflow in the
GitHub Actions UI pane on the website.
2025-07-23 16:27:49 -06:00
Aliaksandr Kalenik
c8b574e9b4 LibWeb: Remove animations from timeline in Element::removed_from()
`AnimationTimeline` visits pointers of all registered animations, so if
element is removed from DOM tree but its animations remain registered in
timeline, then `Animation` and owner `Element` will be kept alive until
`AnimationTimeline` is destroyed.
2025-07-23 17:50:01 -04:00
Andrew Kaster
85baf71d48 Meta: Use clang to build ladybird module in flatpak 2025-07-23 15:12:00 -06:00
Jan Koudijs
0c89b2e690 Meta: Add offline build for ANGLE flatpak module
At the same time, build with gcc instead of bundled clang.

Co-Authored-By: Andrew Kaster <andrew@ladybird.org>
2025-07-23 15:12:00 -06:00
Andrew Kaster
7d458103a8 Meta: Move skia and angle flatpak build scripts to their own directories 2025-07-23 15:12:00 -06:00
Andrew Kaster
35f65b8dab Meta: Bump version of gn flatpak source module to rev 2255 2025-07-23 15:12:00 -06:00
Andrew Kaster
738c81877c Meta: Move build of gn module in flatpak build before angle 2025-07-23 15:12:00 -06:00
Andrew Kaster
08221c2534 Meta: Skip build directories when building Ladybird module in flatpak
flatpak-builder doesn't respect .gitignore when creating its local build
directory, so we need to explicitly skip potentially large ignored
directories to avoid bloating the flatpak build directory during builds.
2025-07-23 15:12:00 -06:00
Timothy Flynn
b3d52a8238 LibJS: Compute offsetBehaviour in ToTemporalZonedDateTime after parsing
This is an editorial change in the Temporal proposal. See:
4b83ba3
2025-07-23 22:05:15 +02:00
Timothy Flynn
e95f225362 LibJS: Correctly disallow certain calendar-based Temporal strings
This is an editorial change in the Temporal proposal. See:
d83241f
2025-07-23 22:05:15 +02:00
Timothy Flynn
3f75cf270a LibJS: Move ambiguous Temporal time string handling to a separate parser
This is an editorial change in the Temporal proposal. See:
fa3d0b9
2025-07-23 22:05:15 +02:00
Timothy Flynn
7ca3598221 LibJS: Add new spec comments to ISO 8601 early-error handlers
This is an editorial change in the Temporal proposal. See:
f8489fb
2025-07-23 22:05:15 +02:00
Timothy Flynn
3b3ff6f057 LibJS: Split up the GetTemporalUnitValuedOption AO
This is an editorial change in the Temporal proposal. See:
fcdb47e
ef04774
2070032
adf50d4
40eaeb7
aab7bee
a10d38d
06ce375
2025-07-23 22:05:15 +02:00
Timothy Flynn
1aee1a050e LibJS: Use consistent naming for this value in Temporal prototypes
This is an editorial change in the Temporal proposal. See:
ed49b0b
2025-07-23 22:05:15 +02:00
Timothy Flynn
0c5c6a9944 LibJS: Use consistent wording around NewTarget in Temporal constructors
This is an editorial change in the Temporal proposal. See:
e454171
2025-07-23 22:05:15 +02:00
Luke Wilde
a2f3a5a6ce LibWeb: Send a beforeinput event for pasting
This allows us to paste text into Discord.
2025-07-23 22:04:45 +02:00
Andreas Kling
8d02f28cc2 LibWeb: Don't treat non-replaced sizes as 0 for min-content contrib
This behavior is part of the cyclic percentage contribution logic from
CSS-SIZING-3 which explicitly only applies to non-replaced boxes.

This fixes an issue on Discord where buttons in the settings UI were
cropped to a narrower width than intended.

Fixes #3572
2025-07-23 19:52:59 +02:00
aplefull
34f0ac15fd LibWeb: Resolve calculated time values in animations and transitions
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 lets us play animations and transitions when time values are
stored in the form of calculated values, such as `calc(1s + 500ms)`.
2025-07-23 15:21:23 +01:00
Luke Wilde
a2770bbcb7 LibWeb/WebSocket: Include the User-Agent header on connection
This makes the WebSockets on https://pro.kraken.com/app/trade/btc-usd
happier, but the page doesn't quite work yet.
2025-07-23 13:51:44 +01:00
Sam Atkins
943cc0e32a LibWeb/CSS: Implement "legacy value aliases" in generated code
This uses a `foo>bar` notation in the `valid-identifiers` field of
Properties.json, to say "replace `foo` with `bar`".

The motivation here is to avoid calling `parse_css_value_for_property()`
inside the per-property switch in `parse_css_value()`. Eventually we'll
need to be able to call that switch from
`parse_css_value_for_properties()` so that shorthands can make use of
any bespoke parsing code to parse their longhands.
2025-07-23 12:50:42 +01:00
Tim Ledbetter
062862f315 LibWeb/CSS: Add -webkit-filter as a legacy alias
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-07-23 09:32:39 +02:00