Commit graph

1395 commits

Author SHA1 Message Date
Tim Ledbetter
e564d25ffb LibWeb: Add ChannelSplitterNode interface 2025-01-02 11:39:23 +00:00
devgianlu
819178a49e LibWeb: Use correct default key size for HMAC
When the default key size was requested it was expressed in bytes
(instead of bits) and from the digest size instead of the block size.
2025-01-02 11:33:43 +01:00
devgianlu
f5d3d6a7d4 LibWeb: Set algorithm length for HMAC key generation
This assignment was missing from the spec, but has been fixed since
https://github.com/w3c/webcrypto/pull/394.

Also add relevant WPT tests.
2025-01-02 11:33:43 +01:00
Shannon Booth
2066ed2318 LibWeb: Correctly initialize Storage objects on the Document
Instead of storing all storage objects in static memory, we now
follow the the spec by lazily creating a unique Storage object
on each document object.

Each Storage object now holds a 'proxy' to the underlying backing
storage. For now, this proxy is simply a reference to the backing
object. In the future, it will need to be some type of interface
object that stores on a SQLite database or similar.

Session storage is now correctly stored / tracked as part of the
TraversableNavigable object.

Local storage is still stored in a static map, but eventually this
should be factored into something that is stored at the user agent
level.
2025-01-02 11:31:15 +01:00
Shannon Booth
f3ecd23a21 LibWeb/HTML: Enforce quota limit for local and session storage
Fixes a timeout/crash for the two commited WPT tests.
2025-01-02 11:31:15 +01:00
Shannon Booth
44bb2b7e32 LibWeb/HTML: Use paintable box for 'associated CSS layout box' check
This is consistent with other functions such as
HTMLElement::offset_width and fixes a crash for the included test.
Returning an offset of zero is not correct for this case, but this is
still an improvement to not crash.
2025-01-02 11:28:37 +01:00
sideshowbarker
1be55fe793 LibWeb: Support the ariaActiveDescendantElement IDL attribute
Some checks are pending
CI / path-changes (push) Waiting to run
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Blocked by required conditions
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Blocked by required conditions
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Blocked by required conditions
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Blocked by required conditions
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, 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-01-01 11:00:53 +00:00
Gingeh
436417aabe LibWeb: Parse background positions as shorthands 2024-12-30 11:07:53 +01:00
Lucas CHOLLET
abc0418710 LibWeb/DOM: Convert elapsedTime to seconds when firing AnimationEvents
This makes all three subtests from this test to pass:
 - css/css-animations/animationevent-types.html
2024-12-30 11:05:37 +01:00
Lucas CHOLLET
d268df747f Tests/LibWeb: Import a test from wpt/css-animation 2024-12-30 11:04:55 +01:00
Tim Ledbetter
db24440403 LibWeb: Allow keyboard input to alter email inputs
Previously, the`HTMLInputElement.selectinStart` and
`HTMLInputElement.selectionEnd` IDL setters, and the
`setRangeText()` IDL method were used when updating an input's value
on keyboard input. These methods can't be used for this purpose,
since selection doesn't apply to email type inputs. Therefore, this
change introduces internal-use only methods that don't check whether
selection applies to the given input.
2024-12-30 11:04:16 +01:00
Shannon Booth
b165ffc868 LibWeb/CSS: Add overflow hidden to UA stylesheet for marquee element 2024-12-28 11:18:25 +00:00
Khaled Lakehal
b0e061b943 LibWeb/HTML: Fix URL fragment comparison triggering unwanted events
This update ensures consistent handling of URL fragments, treating null
fragments as empty strings in `Location::set_hash` method.

This fixes all tests in
https://wpt.live/html/browsers/browsing-the-web/history-traversal/hash-empty-string.html
2024-12-28 10:50:34 +00:00
Lucas CHOLLET
9585aeafda LibWeb/DOM: Don't assume that Animations have an associated effect
Fixes a crash on:
 - css/css-transitions/CSSTransition-effect.tentative.html
2024-12-28 10:37:44 +01:00
Gingeh
42a8effae5 LibWeb: Notify canvas context when width or height attribute is changed 2024-12-28 10:37:15 +01:00
tanner.drake
fe25f77bcf LibWeb/Geometry: Implement "other than none" keyword check 2024-12-28 07:51:11 +01:00
sideshowbarker
2983a17ea6 LibWeb: Compute roles for SVG graphics-symbol elements and foreignObject
This change adds computation of ARIA roles for a number of SVG elements
for which, if the element meets the SVG spec criteria for inclusion in
the accessibility tree, the computed ARIA role should be
“graphics-symbol”, and should otherwise be “generic”.

This change also adds similar role computation for the SVG foreignObject
element (the role for which, if the element meets the SVG spec criteria
for inclusion in the accessibility tree, should be “group”, and should
otherwise be “generic”).
2024-12-27 17:16:15 -08:00
sideshowbarker
8961d5d2ce LibWeb: Add support for ARIA Graphics roles
This change adds support for the graphics-document, graphics-object, and
graphics-symbol ARIA roles from the WAI-ARIA Graphics Module spec at
https://w3c.github.io/graphics-aria/#role_definitions
2024-12-27 17:16:15 -08:00
sideshowbarker
062e33438e LibWeb: Space-separate parts of multi-label accessible names
Some checks are pending
CI / path-changes (push) Waiting to run
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Blocked by required conditions
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Blocked by required conditions
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Blocked by required conditions
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Blocked by required conditions
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, 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 change ensures that when an accessible name is computed from
multiple labels, the parts computed from each label are separated by
spaces. Otherwise, without this change, the parts are run together in
the accessible name, with no space in between.
2024-12-26 20:44:14 +00:00
Lucas CHOLLET
55b4a983a7 LibWeb/CSS: Add the TransitionEvent type 2024-12-25 17:14:08 +01:00
Glenn Skrzypczak
08589741f5 LibWeb: Correctly implement event listeners default passive attribute
Some checks failed
CI / path-changes (push) Waiting to run
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Blocked by required conditions
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Blocked by required conditions
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Blocked by required conditions
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Blocked by required conditions
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, 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
Build Dev Container Image / build (push) Has been cancelled
This commit implements the default value of the passive attribute of
event listeners according to the spec.
2024-12-25 14:57:22 +00:00
Pavel Shliak
4c7cd05078 LibWeb: Update FormData constructor to reflect the spec 2024-12-25 14:52:57 +00:00
sideshowbarker
72a86f2df3 LibWeb: Fix selector matching for non-HTML mixed-case element names
This change fixes selector matching for non-HTML elements that have
mixed-case names — such as the SVG foreignObject element.

Otherwise, without this change, attempting to use a selector to match
such an element — e.g., document.querySelector("foreignObject") — fails.
2024-12-25 13:54:06 +00:00
sideshowbarker
f2ac591614 LibWeb: Compute default ARIA roles for SVG elements
This change adds support for computing default ARIA roles for (selected)
SVG elements, per the requirements in the SVG Accessibility API Mappings
spec at https://w3c.github.io/svg-aam/#mapping_role_table.

This only computes roles for the elements which are covered in the WPT
test at https://wpt.fyi/results/svg-aam/role/roles.html — that is, the
“a”, “g”, and “image” elements.
2024-12-25 10:58:48 +00:00
Shannon Booth
f3e92f2ae5 LibWeb/HTML: Implement the StorageEvent interface 2024-12-25 11:57:14 +01:00
Lucas CHOLLET
c5f9710492 LibWeb/CSS: Create a MediaQueryListEvent when calling MQLE::create()
Otherwise, if not implemented, `MediaQueryListEvent::create()` would
result in a call to `DOM::Event::create()`. This issue exists here:
673537b26b/Libraries/LibWeb/DOM/Document.cpp (L2865)
2024-12-25 11:56:37 +01:00
Andrew Kaster
b11bdd4022 LibWeb: Import WPT tests for WebAssembly.Global
Some checks are pending
CI / path-changes (push) Waiting to run
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Blocked by required conditions
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Blocked by required conditions
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Blocked by required conditions
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Blocked by required conditions
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, 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
There's one failing due to the constructor object not having the name
"Global" vs "WebAssembly.Global". This also doesn't include the
tentative test for the type property.
2024-12-24 15:20:28 +01:00
Shannon Booth
910ff8b694 LibWeb/HTML: Consider <a> all-named elements instead of <link>
Some checks are pending
CI / path-changes (push) Waiting to run
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Blocked by required conditions
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Blocked by required conditions
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Blocked by required conditions
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Blocked by required conditions
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, 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
Leaving only the unimplemented legacy [[Call]] override funkiness
of HTMLAllCollection left not passing in the WPT tests.
2024-12-23 21:19:08 +01:00
sideshowbarker
966c68ae0e LibWeb: Align accname alt-vs-title behavior w/ HTML-AAM spec & WPT tests
Some checks are pending
CI / path-changes (push) Waiting to run
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Blocked by required conditions
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Blocked by required conditions
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Blocked by required conditions
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Blocked by required conditions
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, 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
The https://wpt.fyi/results/accname/name/comp_tooltip.tentative.html
test was recently added by moving an existing subtest out from the test
at https://wpt.fyi/results/accname/name/comp_tooltip.html, and changing
the test expectations to match the HTML-AAM spec requirements at
https://w3c.github.io/html-aam/#img-element-accessible-name-computation.
See https://github.com/web-platform-tests/wpt/pull/49552.

So this code change updates Ladybird to match the updated WPT test
expectations — and to match the existing HTML-AAM spec requirements.
2024-12-23 14:01:37 +01:00
Jelle Raaijmakers
2052792663 LibWeb: Use correct boundaries in Selection::collapse_to_start/end()
We were using the anchor_node() as the boundary point node when
collapsing a selection, but the spec tells us to use the start and end
boundary point nodes.
2024-12-21 19:15:58 +01:00
Feng Yu
b3edbd7bf2 LibWeb: Implement the ClipboardItem API
Spec: https://w3c.github.io/clipboard-apis/#clipboard-item-interface
2024-12-20 15:29:18 +00:00
Gingeh
bdd6729d78 LibWeb: Use paintables when calculating mouse event offset 2024-12-20 15:50:41 +01:00
sideshowbarker
3365cae4a9 Tests: Import more WPT ARIA tests (more regression coverage); no code 2024-12-20 06:23:21 -08:00
Tyler Dence
0378645c25 LibWeb: PlatformObject::DefineOwnProperty fix 'has own property' check
PlatformObjects with named properties does not qualify as 'has own
property' just by virtue of a named property existing.

This fixes at least one WPT test, which is imported.
2024-12-20 15:10:24 +01:00
sideshowbarker
695ce3763e LibWeb: Replace ARIA “synonym” roles with their preferred synonyms
This change does replacement of ARIA roles that have newer synonyms.

There are a number of newer ARIA roles that are synonyms for older
roles. https://wpt.fyi/results/wai-aria/role/synonym-roles.html has a
number of subtests which expect that when retrieving the value of an
explicitly- specified role attribute, if the value is one of the older
role values, implementations must replace that with its newer synonym.
2024-12-20 05:45:59 -08:00
sideshowbarker
e9dedeee34 Tests: Import ARIAMixin string attributes CEReactions tests (no code) 2024-12-20 05:17:05 -08:00
Totto16
540c840755 LibWeb: Add test for getComputedStyle with a PseudoElement argument
Some checks are pending
CI / path-changes (push) Waiting to run
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Blocked by required conditions
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Blocked by required conditions
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Blocked by required conditions
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Blocked by required conditions
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, 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 test checks the case, where an unknown pseudo element is used as
second argument to getComputedStyle
2024-12-19 19:35:57 +00:00
Sam Atkins
f62ccb010d Tests: Let WPT tests set their own timeout
The official WPT runner supports a `<meta name=timeout content=long>`
tag to let tests opt-in to a longer timeout. Modify our harness to pass
that custom timeout to our runner, so that we don't incorrectly time
out if our default time is shorter than the requested one.
2024-12-19 17:27:33 +00:00
Andreas Kling
9164c9784d LibGfx: Treat PNG files with invalid frame data as transparent
If we have a valid PNG header with geometry info etc, we should still
display it as *something*, even if the image data itself is missing or
corrupted.

This matches the behavior of other browsers, and is something that
Cloudflare Turnstile checks for.

To achieve this, we split the PNG decoder's initialization into two
steps: "everything except reading frame data" and "reading frame data".
If the latter step fails, we yield a transparent bitmap with the
geometry from the PNG's IHDR chunk.
2024-12-19 16:49:28 +01:00
Tim Ledbetter
e74d8a6003 LibWeb: Report exceptions that occur during resize observer callback 2024-12-19 15:25:08 +00:00
Tim Ledbetter
62ecff0b40 LibWeb: Report exceptions that occur during microtask callback 2024-12-19 15:25:08 +00:00
Tim Ledbetter
7a41ab960c LibWeb: Report exceptions when invoking intersection observer callback 2024-12-19 15:25:08 +00:00
Tim Ledbetter
7cacf5ca55 LibWeb: Report exceptions when invoking custom element reactions 2024-12-19 15:25:08 +00:00
Tim Ledbetter
d8511e39c9 LibWeb: Report exceptions that occur during mutation observer microtask 2024-12-19 15:25:08 +00:00
Tim Ledbetter
4a6e457d4b LibWeb: Update run_timer_initialization_steps to the latest spec
This fixes a number of WPT tests, which expect an error to be reported
if an exception is thrown in the timer callback.
2024-12-19 15:25:08 +00:00
Lucas CHOLLET
61755b29c9 Tests: Import a bunch of css-color tests from WPT 2024-12-19 09:54:14 +00:00
devgianlu
637f934f69 LibWeb: Correctly normalize HashAlgorithmIdentifier
Make sure that `HashAlgorithmIdentifier` is passed through
`normalize_an_algorithm` to verify that the hash is valid and supported.

This is required by the spec, but we are not following it very strictly
in `normalize_an_algorithm` because it is pretty convoluted.

Fixes ~60 tests.
2024-12-18 12:45:06 -08:00
Lucien Fiorini
d9ab68dd62 Tests: Import WPT test for canvas filter values 2024-12-18 18:54:20 +01:00
sideshowbarker
ce65457746 LibWeb: Fix internal logic for recognizing non-abstract ARIA roles 2024-12-18 15:24:51 +00:00
devgianlu
f3a9bb0a91 LibWeb: Correct WebCryptoAPI derive length behaviour
Fixes multiple slightly wrong behaviours of the `deriveBits` method
across various algorithms. Some of them might be due to a spec update.

Add tests related to fixes.
2024-12-18 13:18:40 +01:00