Commit graph

1395 commits

Author SHA1 Message Date
sideshowbarker
6bfc35b6a9 LibWeb: Fix aria-label precedence in accessible-name computation
This change makes Ladybird give the value of the aria-label attribute
the correct precedence for accessible-name computation required by the
“Accessible Name and Description Computation” and HTML-AAM specs and by
the corresponding WPT tests.

Otherwise, without this change, Ladybird fails some of the WPT subtests
of the test at https://wpt.fyi/results/accname/name/comp_label.html.
2024-11-29 12:18:28 +00:00
sideshowbarker
314e5d6bb7 LibWeb: Compute accessible names for hidden/hidden-but-referenced nodes
This change implements full support for the “A. Hidden Not Referenced”
step at https://w3c.github.io/accname/#step2A in the “Accessible Name
and Description Computation” spec — including handling all hidden nodes
that must be ignored, as well as handling hidden nodes that, for the
purposes of accessible-name computation, must not be ignored (due to
having aria-labelledby/aria-describedby references from other nodes).

Otherwise, without this change, not all cases of hidden nodes get
ignored as expected, while cases of nodes that are hidden but that have
aria-labelledby/aria-describedby references from other nodes get
unexpectedly ignored.
2024-11-29 12:18:28 +00:00
Pavel Shliak
c00b97a1f0 Tests: Fix 404 at css selector test
Fixes css/selectors/focus-visible-017-2.html
2024-11-29 12:16:50 +00:00
Pavel Shliak
1d2ceaf33f Tests: Fix 404 at css selector test
Fixes css/selectors/focus-visible-009.html
2024-11-29 12:16:50 +00:00
Pavel Shliak
dcca24868c Tests: Fix 404 at css-grid alignment tests
Fixes Tests/LibWeb/Text/expected/wpt-import/css/css-grid/alignment/
2024-11-29 12:16:50 +00:00
Pavel Shliak
ab83540523 Tests: Fix 404 at Element-text-transform-fullwidth.html 2024-11-29 12:16:50 +00:00
Tim Ledbetter
aafc829e6d LibWeb: Don't allow HTMLTextAreaElement rows and cols to be set to 0
In this case we should fall back to the default value.
2024-11-29 09:48:45 +01:00
Tim Ledbetter
ae0c87c747 LibWeb: Limit HTMLInputElement.size to allowed values
Attempting to set `HTMLInputElement.size` to 0 via IDL now throws an
IndexSizeError DOMException. Attempting to set it to a value larger
than 2147483647 results in it being set to the default value.
2024-11-29 09:48:45 +01:00
devgianlu
46e724729c LibWeb: Match algorithm names case-insensitive
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
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
Push notes / build (push) Waiting to run
I dug through the code and the WebCryptoAPI spec to figure out the
reason for `... mixed case parameters` WPT tests and figured out that
our implementation was slightly wrong.

By being closer to the spec we can now pass those tests and also remove
a bunch of duplicated code.

Context: https://github.com/LadybirdBrowser/ladybird/pull/2598#discussion_r1859263798
2024-11-28 00:21:49 +01:00
Milo van der Tier
5deb2b4cad LibWeb: Do not give the HTML namespace to elements when parsing XML
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
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
Push notes / build (push) Waiting to run
While the code that did this referred to the HTML spec, other browsers
appear not to have this behavior when parsing XML, and it breaks a WPT
subtest.

This change does not appear to break any tests, and fixes 1 WPT subtest.
2024-11-27 17:10:32 +01:00
Andreas Kling
a7b791050e LibWeb: Only negotiate NavigableContainerViewport size with objects
Size negotiation should not occur for other viewports, such as iframe,
since that would allow content inside the iframe to affect the size of
the iframe in the containing document.

300 new subtest passes on WPT. :^)
2024-11-27 14:47:05 +01:00
Andreas Kling
630028daa5 Tests: Import SVG-in-iframe sizing tests from WPT 2024-11-27 14:47:05 +01:00
Tim Ledbetter
7fe3bf07e2 LibWeb: Limit HTMLTextAreaElement attributes to allowed values
If `HTMLTextAreaElement.rows` or `HTMLTextAreaElement.cols`
is set to a value larger than 2147483647, then it should be set to its
default value.
2024-11-27 11:00:25 +01:00
Tim Ledbetter
a8719a706b LibWeb: Limit HTMLMarqueeElement attributes to allowed values
If `HTMLMarqueeElemnt.scrollAmount` or `HTMLMarqueeElemnt.scrollDelay`
is set to a value larger than 2147483647, then it should be set to its
default value.
2024-11-27 11:00:25 +01:00
Tim Ledbetter
e5c99b475a IDLGenerators: Set reflected unsigned long value according to spec
Setting an unsigned long attribute with IDL to a value outside the
range 0 to 2147483647, the value should be set to the default value.
2024-11-27 11:00:25 +01:00
devgianlu
601eae47f2 LibWeb: Import WebCryptoAPI ECDH tests from WPT
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
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
Push notes / build (push) Waiting to run
Import and rebaseline tests related to WebCryptoAPI ECDH. The commits
before this one allow for ~700 tests to pass.
2024-11-27 10:59:48 +01:00
Tim Ledbetter
cc0ad0d1ef LibWeb: Use [URL] extended attribute for HTMLInputElement.src
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
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
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (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
2024-11-26 23:20:20 +00:00
Jelle Raaijmakers
24069d55bf LibWeb: Partially implement MediaSource.isTypeSupported() 2024-11-26 23:51:02 +01:00
Gingeh
0adf261c32 LibWeb: Don't end parsing after reaching the insertion point 2024-11-26 23:50:18 +01:00
Tim Ledbetter
67d05b0104 LibWeb: Use [URL] extended attribute for HTMLVideoElement.poster 2024-11-26 19:07:53 +01:00
Andreas Kling
733c6b14ff LibWeb: Teach HTMLObjectElement to negotiate natural size with SVGs
We do this by generalizing the code previously used for SVGSVGBox into
something that can be used for NavigableViewportContainer as well.
2024-11-26 18:32:48 +01:00
Andreas Kling
3ebc7fbd28 LibWeb: Create layout node for HTMLObjectElement navigable containers
This makes SVGs in object elements actually render!
2024-11-26 18:32:48 +01:00
Andreas Kling
eadeec8b8d Tests: Import some svg-in-object-element tests from WPT 2024-11-26 18:32:48 +01:00
stelar7
74828bbd10 LibWeb: Import WPT for idbfactory.open 2024-11-26 14:50:27 +01:00
stelar7
1656d8fe07 LibWeb: Implement most of upgrade_a_database for IndexedDB 2024-11-26 14:50:27 +01:00
stelar7
48fae7b64f LibWeb: Add IDBKeyRange 2024-11-26 14:50:27 +01:00
stelar7
20a92a81c4 LibWeb: Add IDBTransaction 2024-11-26 14:50:27 +01:00
stelar7
16ce2b975a LibWeb: Add IDBObjectStore 2024-11-26 14:50:27 +01:00
stelar7
297c775b34 LibWeb: Add IDBIndex 2024-11-26 14:50:27 +01:00
stelar7
71772d97dc LibWeb: Add IDBCursor 2024-11-26 14:50:27 +01:00
Jelle Raaijmakers
614b93beca Meta: Set constructor prototype in IDLGenerators
Without this, retrieving `__proto__` from any interface will always
yield an instance of `FunctionPrototype`.
2024-11-26 12:44:05 +00:00
Glenn Skrzypczak
74645facae LibWeb/HTML: Implement cite attribute according to spec
Implements the cite attribute of `q`, `blockqoute`, `ins` and `del`
elements according to spec by returning a valid URL.
2024-11-26 11:40:42 +00:00
Khaled Lakehal
2f51e9a98e LibWeb/HTML: Use default input size (20) when value is 0
According to the HTML specification, the `size` attribute of an input
element must be a valid non-negative integer greater than zero. If the
value is invalid or set to `0`, the default size of `20` should be used.

This small change fixes one issue identified in
https://wpt.live/html/rendering/widgets/input-text-size.html
The WPT test suite was also automatically imported.
2024-11-26 10:01:57 +00:00
Glenn Skrzypczak
1e67b85571 LibWeb/Animation: Support progress values outside of [0,1]
If the progress is not in [0,1], the first two or the last two
keyframes are now used for interpolation outside the interval.
2024-11-25 18:10:24 +01:00
Glenn Skrzypczak
0d15cc4672 LibWeb/Animation: Fall back to discrete animation in more cases
Use discrete animation when the number of components or the types
of corresponding components do not match. This commit does not cover
all cases, but adds FIXME comments in the appropriate places.
2024-11-25 18:10:24 +01:00
Andreas Kling
d625e12082 LibWeb: Implement the deriveBits algorithm for X448
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
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
Push notes / build (push) Waiting to run
2024-11-25 17:16:51 +01:00
Andreas Kling
96ddccd961 LibWeb: Implement the importKey algorithm for X448 2024-11-25 17:16:51 +01:00
Andreas Kling
4a734226aa LibWeb: Implement the exportKey algorithm for X448 2024-11-25 17:16:51 +01:00
Andreas Kling
5a8b0a2610 LibWeb: Implement the generateKey algorithm for X448 2024-11-25 17:16:51 +01:00
Andreas Kling
a7652d5073 Tests: Import WPT tests for X448 curves 2024-11-25 17:16:51 +01:00
Milo van der Tier
aa33acf3a2 LibWeb: Update existing style object when setting style attribute
Previously any existing ElementInlineCSSStyleDeclaration would get
overwritten by e.setAttribute("style", ...), while it should be updated
instead.

This fixes 2 WPT subtests.
2024-11-25 17:16:29 +01:00
Jelle Raaijmakers
be3a941f44 LibWeb: Add ChannelMergerNode interface 2024-11-25 17:16:06 +01:00
stelar7
331f26a88b LibWeb: Implement IDBFactory::cmp 2024-11-25 11:53:50 +01:00
sideshowbarker
e2a7f844e6 LibWeb: Handle accessible-name computation for shadow roots and slots
This change adds handling for the “Determine Child Nodes” substep at
https://w3c.github.io/accname/#comp_name_from_content_find_child in the
“Accessible Name and Description Computation” spec. Specifically, it
adds handling for the “If the current node has an attached shadow root”
and “if the current node is a slot with assigned nodes” conditions.

Otherwise, without this change, AT users don’t hear the expected
accessible names in cases where the content for which an accessible name
being computed is in a shadow root or slot element.
2024-11-25 11:52:48 +01:00
Milo van der Tier
6bb8bf189f LibWeb: Store CSS color name in CSSRGB
When serializing an sRGB color value that originated from a named color,
it should return the color name converted to ASCII lowercase. This
requires storing the color name (if it has one).

This change also requires explicitly removing the color names when
computing style, because computed color values do not retain their name.
It also requires removing a caching optimization in create_from_color(),
because adding the name means that the cached value might be wrong.

This fixes some WPT subtests, and also required updating some of our own
tests.
2024-11-25 11:51:50 +01:00
sideshowbarker
db29d248ad LibWeb: Fix accessible-name computation for “encapsulation” cases
This change makes Ladybird correctly handle all “encapsulation” tests in
the https://wpt.fyi/results/accname/name/comp_host_language_label.html
set of tests in WPT.

Those all test the requirement that when computing the accessible name
for a <label>-ed form control, then any content (text content or
attribute values) from the control itself that would otherwise be
included in the accessible-name computation for it ancestor <label> must
instead be skipped and not included.

The HTML-AAM spec seems to try to achieve that result by expressing
specific steps for each particular type of form control. But what all
that reduces/optimizes/simplifies down to is just, “skip over self”.

Otherwise, without this change, Ladybird includes that “self” content
from those “encapsulated” elements when doing accessible-name
computation for the elements — which results in AT users hearing
unexpected extra content in the accessible names for those elements.
2024-11-25 11:21:23 +01:00
Shannon Booth
4913dac745 LibWeb: Get Page from principal realm during resource loading
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
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
Push notes / build (push) Waiting to run
Fixes a crash for module loading for a shadow realm.
2024-11-24 15:29:47 -07:00
Andreas Kling
7b678d3e1f LibWeb: Throw TypeError if WebCrypto algorithm doesn't have "name" field 2024-11-24 23:28:23 +01:00
Andreas Kling
ed7b1caba2 LibWeb: Implement the exportKey algorithm for Ed25519 2024-11-24 23:28:23 +01:00
Andreas Kling
4d25369f29 LibWeb: Implement the importKey algorithm for Ed25519 2024-11-24 23:28:23 +01:00