Commit graph

70614 commits

Author SHA1 Message Date
Aliaksandr Kalenik
0e8d70d8c3 LibWeb: Rename draw_text_run to draw_glyph_run in DisplayListRecorder
For consistency with corresponding display list item name.
2025-07-27 10:20:18 +02:00
Andrew Kaster
64f1a76636 CMake: Ignore invalid offset of when generating Swift interop header
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-26 23:33:58 +02:00
Andrew Kaster
7d669b8b0c AK: Update Swift test for Utf16String changes 2025-07-26 23:33:58 +02:00
Abhinav
93a0ef949a LibWeb: Update x25519 raw key import tests
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 / Linux, x86_64 (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
2025-07-26 10:43:16 -06:00
Abhinav
ea8538ea49 LibWeb: Don't import raw X25519 key of incorrect length 2025-07-26 10:43:16 -06:00
Aliaksandr Kalenik
8569124b87 LibWeb: Fix scroll state refresh in cached display list for iframes
6507d23 introduced a bug when snapshot for iframe is saved in
`PaintNestedDisplayList` and, since display lists are immutable, it's
not possible to update before the next repaint.

This change fixes the issue by moving `ScrollStateSnapshot` for
nested display lists from `PaintNestedDisplayList` to
`HashMap<NonnullRefPtr<DisplayList>, ScrollStateSnapshot>` that is
placed into pending rendering task, making it possible to update
snapshots for all display lists before the next repaint.

This change doesn't have a test because it's really hard to make a ref
test that will specifically check scenario when scroll offset of an
iframe is advanced after display list is cached. We already have
`Tests/LibWeb/Ref/input/scroll-iframe.html` but unfortunately it did
not catch this bug.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/5486
2025-07-26 11:53:21 -04:00
Luke Wilde
124bdce99c UI/Qt: Set WC's max FPS to the refresh rate of the current screen 2025-07-26 10:09:12 -04:00
Luke Wilde
b0d97c991f UI/AppKit: Set WC's max FPS to the max FPS of the current screen 2025-07-26 10:09:12 -04:00
Luke Wilde
c93c30d596 LibWebView+WebContent: Make it possible to change the painting interval
This allows us to paint at the refresh rate of the screen. The default
is 60, as before, in case it never gets set by anything.
2025-07-26 10:09:12 -04:00
Luke Wilde
31faf31f6a LibCore: Unmark timer interval being dirty after applying new interval
Previously it was never unmarked, so the timer would constantly stop
and start, which made the timer jittery especially at small intervals.
2025-07-26 10:09:12 -04:00
Timothy Flynn
3a072f66e3 LibWeb: Pass Utf16String around directly in Editing APIs
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
Noticed while working adjacent to these APIs that we take a Utf16String
and pass it around as a Utf16View, only to re-allocate the Utf16String
in many commands. Let's just pass the string itself around.
2025-07-26 00:40:06 +02:00
Timothy Flynn
f001dbea30 LibWeb: Add missing includes to Editing/Commands.h
clangd is complaining loudly about these.
2025-07-26 00:40:06 +02:00
Timothy Flynn
2da615ed31 LibWeb: Port document.execCommand and InputEvent to UTF-16 2025-07-26 00:40:06 +02:00
Timothy Flynn
49467d0583 LibIDL+LibWeb: Support UTF-16 USVString 2025-07-26 00:40:06 +02:00
Timothy Flynn
1375e6bf39 AK+LibJS+LibWeb: Use simdutf to create well-formed strings 2025-07-26 00:40:06 +02:00
Timothy Flynn
017a6cc687 LibWeb+WebContent: Port FormAssociatedTextControlElement APIs to UTF-16 2025-07-26 00:40:06 +02:00
Timothy Flynn
cdf270a5e6 WebContent: Invert focus condition in WebDriver's Element Send Keys
The spec states we should inspect the relevant value if the element does
*not* have focus.
2025-07-26 00:40:06 +02:00
Timothy Flynn
c566cc5024 LibWeb: Invoke correct word-jumping method in EditingHostManager
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-25 12:57:03 -04:00
Timothy Flynn
97548f48de LibWeb: Port rendered text to UTF-16
This migrates TextNode::text_for_rendering() to Utf16String and deals
with the fallout. As a consequence, this effectively reverts commit
3df83dade8.

The layout test expecation file updates are because we now express text
lengths and offsets in UTF-16 code units.

The selection-over-multiple-code-units expectation file update actually
represents a correctness fix. Our result now matches Firefox.
2025-07-25 18:16:22 +02:00
Timothy Flynn
a270706411 LibWeb: Port DOM::Range stringification to UTF-16 2025-07-25 18:16:22 +02:00
Timothy Flynn
8d17786b8c LibWeb: Add missing include to LineBoxFragment.h
This missing include is making clangd behave badly on this file.
2025-07-25 18:16:22 +02:00
Timothy Flynn
0e9b694058 LibGfx: Support UTF-16 text shaping
We can achieve this with templating the string view type, and then just
piping the view into the correct `hb_buffer_add_utf*` API.
2025-07-25 18:16:22 +02:00
Timothy Flynn
a740bfd8ff AK+LibUnicode: Implement Unicode-aware UTF-16 case transformations 2025-07-25 18:16:22 +02:00
Timothy Flynn
df77ae1920 AK: Implement creating a UTF-16 string from a repeated code point 2025-07-25 18:16:22 +02:00
Timothy Flynn
a46e9b2adb AK: Compute the correct capacity in StringBuilder::try_append_repeated
This was mistakenly broken in 2803d66d87.
2025-07-25 18:16:22 +02:00
Timothy Flynn
745f288796 AK: Implement a method to acquire a UTF-16 iterator's code unit offset
This is the same as Utf8View::iterator_offset().
2025-07-25 18:16:22 +02:00
mikiubo
acf1fe7b05 LibWeb: Return base Document for non-HTML parses
The HTML specification does not explicitly require
a specific return type for parseFromString(),
but according to Web Platform TestsDOMParser-parseFromString.html,
the expected return value for
XML MIME types is a Document—not an XMLDocument.
2025-07-25 10:08:29 -06:00
Jelle Raaijmakers
acc7c2f7f3 LibWeb: Do not use namespace in interface names
Gives us 20 additional WPT subtest passes in `wasm/jsapi`.
2025-07-25 16:50:45 +02:00
Jelle Raaijmakers
73967ee90c Everywhere: Use HashMap::update() where applicable 2025-07-25 16:22:06 +02:00
Jelle Raaijmakers
0b96690f0c AK: Add HashMap::update()
This updates a HashMap by copying another HashMap's keys and values.
2025-07-25 16:22:06 +02:00
Jelle Raaijmakers
76ee1ce04c LibWeb: Support wasm module instantiation using a global address
Fixes 1 WPT subtest in `wasm/core/simd`.
2025-07-25 15:35:27 +02:00
Jelle Raaijmakers
58c3a391a3 LibWeb+LibWasm: Reject module instantiation with correct error type
The spec tells us to reject the promise with a RuntimeError instead of a
LinkError whenever the module's start function fails during module
instantiation. Fixes 1 WPT subtest in `wasm/core`.
2025-07-25 15:13:28 +02:00
Jelle Raaijmakers
35ca7f82b0 LibWeb: Add BaseAudioContext::createScriptProcessor()
Some checks are pending
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
Push notes / build (push) Waiting to run
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
This is a deprecated node, but it's still widely used on the web.
2025-07-25 11:48:04 +02:00
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