Commit graph

4211 commits

Author SHA1 Message Date
Luke Warlow
fcf6cc27f2 LibWeb: Implement popover beforetoggle and toggle events 2024-12-12 15:10:33 -07:00
Nathan van der Kamp
a276cf2d5e LibWeb: Add PopOverInvokerElement and use it in HTMLButtonElement
The popoverTargetElement seems to be one of the only cases of a
reflected Element? attribute in the HTML spec, the behaviour of which
is specified in section 2.6.1.

Buttons can't actually toggle popovers yet because showing/hiding
popovers is not implemented yet.
2024-12-12 17:11:27 +00:00
sideshowbarker
32dddc8140 Tests: Import some ARIA and HTML-AAM (regression) tests (no code)
We’re passing all the tests in this patch on trunk — so let’s go ahead
and welcome them into our regression-testing garden.
2024-12-12 13:54:47 +00:00
sideshowbarker
50e7e9f58d LibWeb: Assign “dir”, “dd”, “dt” default ARIA roles per-spec
Also, import http://wpt.live/html-aam/dir-role.tentative.html (which
provides test/regression coverage for the “dir” change).
2024-12-12 05:13:45 -08:00
sideshowbarker
ccbc436e85 LibWeb: Support the “image” synonym for the “img” ARIA role
Additionally: For “img” elements with empty “alt” attributes, change the
default role to the newer, preferred “none” synonym for the older
“presentation” role; import https://wpt.fyi/results/html-aam/roles.html
(which provides test/regression coverage for these changes).
2024-12-12 05:13:45 -08:00
sideshowbarker
96540e9f89 LibWeb: Add support for the “suggestion” ARIA role 2024-12-12 08:53:20 +00:00
Timothy Flynn
68164aa7ec LibWeb: Run the object representation task when the active state changes
Currently, the following JS snippet will hang indefinitely:

    new DOMParser().parseFromString("<object>", "text/html");

Because the document into which the object is inserted is not active. So
the task queued to run the representation steps will never run.

This patch implements the spec steps to rerun the representation steps
when the active state changes, and avoid the hang when the object is
created in an inactive document.
2024-12-11 17:38:31 -07:00
sideshowbarker
e49fe384d1 LibWeb: Align default “th” and “td” roles with HTML-AAM spec and tests
This change aligns the default roles for “th” and “td” elements with the
requirements in the HTML-AAM spec, and with the corresponding WPT tests
at https://wpt.fyi/results/html-aam/table-roles.html, and with the
behavior in other engines.

Otherwise, without this change, the default role values for “th” and
“td” elements in some cases don’t match the behavior in other engines,
and don’t match the expected results for the corresponding WPT tests.
2024-12-11 16:55:07 -07:00
sideshowbarker
2d638485a8 LibWeb: Assign “orphaned” li elements the default ARIA role “none”
This change makes Ladybird conform to the current requirements at
https://w3c.github.io/core-aam/#roleMappingComputedRole in the “Core
Accessibility API Mappings” spec for the case of “orphaned” li elements;
that is, any li element which doesn’t have a role=list ancestor.

The core-aam spec requires that in such cases, the li element must not
be assigned the “listitem” role but instead must be treated as if it had
no role at all.
2024-12-11 16:43:55 -07:00
Feng Yu
824e91ffdb LibWeb: Ensure Headers API can handle non-ascii characters
This patch ensure Headers object's associated header list
is ISO-8859-1 encoded when set using `Infra::isomorphic_encode`,
and correctly decoded using `Infra::isomorphic_decode`.

Follow-up of https://github.com/LadybirdBrowser/ladybird/pull/1893
2024-12-11 16:40:36 -07:00
Lucas CHOLLET
5e62f548db LibWeb/CSS: Serialize CSSColor without relying on RGB
This gives us 140 subtests pass in:
css/css-color/parsing/color-valid-color-function.html
2024-12-11 16:37:22 -07:00
Feng Yu
9c243caac4 LibWeb: Add statusText validation for Response constructor
Implemented validation to ensure `statusText` matches the
`reason-phrase` token production.

This change fixes a WPT subtest which I have imported.
2024-12-11 16:34:10 -07:00
Pavel Shliak
d5cdda0b40 LibWeb: Load external scripts in SVG 2024-12-11 16:29:42 -07:00
Simek
e7ef8da7f3 LibWeb/ARIA: Add missing structure roles 2024-12-11 10:32:40 -08:00
Timothy Flynn
943ec820fc LibWeb: Avoid dereferencing an empty optional URL
Here, "null" means the empty optional. We don't need to also check if
the URL is valid; the url will be null if it was originally invalid.
2024-12-11 09:33:46 -08:00
Shannon Booth
f110edebd1 LibWeb/HTML: Encoding parse a URL when setting a href URL
Fixes many WPT encoding regression tests which regressed in
fe891727dc.
2024-12-11 09:48:17 +01:00
Tim Ledbetter
a536ee6f31 Tests: Add vendor-specific testdriver send_keys() function
This uses the `Internals.sendText()` function.
2024-12-10 17:16:29 -08:00
Tim Ledbetter
1bd10a5443 Tests: Add vendor-specific testdriver click() function
This uses `Internals.click()` which doesn't do as much as the
equivalent WebDriver method, but should be enough to satify most tests
that use it.
2024-12-10 17:16:29 -08:00
Tim Ledbetter
1ff556a2bd Tests: Move Ladybird specific testdriver code to testdriver-vendor.js 2024-12-10 17:16:29 -08:00
Shannon Booth
4b069344e0 LibWeb/HTML: Fix crash in window open steps on empty URL string 2024-12-10 17:16:07 -08:00
Timothy Flynn
d835a00bee LibWeb: Use Fetch to retrieve HTMLObjectElement data URLs
This eliminates the use of ResourceLoader in HTMLObjectElement. The spec
steps around fetching have been slightly updated since we've last looked
at this, so those are updated here.

Regarding the text test change: we cannot rely on the data: URL being
fetched synchronously. It will occur on a deferred task now. This does
match the behavior of other browsers, as they also will not have run the
fallback representation steps as of DOMContentLoaded.
2024-12-10 10:37:01 -08:00
Jelle Raaijmakers
495006ddb5 LibWeb: Implement document.execCommand('insertLinebreak') 2024-12-10 19:34:38 +01:00
Tim Ledbetter
ae53059816 Tests: Don't display imported WPT test output if browser is headless
Previously, imported WPT tests didn't display any output if the
internals object was exposed. This change adds the condition that the
browser must also be running headlessly for test output to not be
displayed.
2024-12-10 10:31:47 -08:00
Tim Ledbetter
a44b18236c LibWeb: Add an Internals.headless attribute
This returns true if the browser is running in headless mode.
2024-12-10 10:31:47 -08:00
Luke Wilde
d2acf32aae LibWeb: Register Wasm memory grow hook in constructor of Memory objects
Previously it would only register the hook for JavaScript constructed
Memory objects. This allows Ruffle to load again.
2024-12-10 15:54:20 +01:00
Feng Yu
f2eaf3381f LibWeb: Throw TypeError for new Headers(null)
The WebIDL for the `Headers` constructor specifies that the `init`
parameter is optional and must be of type `HeadersInit`. While the
parameter can be omitted (or explicitly set to `undefined`),
`null` is not a valid value.

This change fixes at least 2 "Create headers with null should throw"
WPT subtests which I have imported in this patch.
2024-12-10 06:46:31 -08:00
Luke Wilde
023c3aa5b0 LibWeb: Respect subarrays in Crypto#getRandomBytes
It is the responsibility of code that deals with TypedArrays to apply
the byte offset and byte length. Not doing this caused Unity Web to
crash, as they call getRandomValues with views into their full main
memory. Previously, it would fill their entire memory of about 33.5 MB
with random bytes.
2024-12-10 06:44:00 -08:00
Jelle Raaijmakers
fd949ee3dd LibWeb: Only set selection focus if an associated DOM node was found
The relation from a paintable to a DOM node is not always set.
2024-12-10 14:54:19 +01:00
Shannon Booth
ac6fe2e211 LibWeb: Implement multiple import map support 2024-12-10 12:01:45 +00:00
Shannon Booth
0a216f9c14 LibWeb/HTML: Use DOM's post connection steps for <script> elements
This aligns our behaviour with WebKit and Chrome.

See: https://github.com/whatwg/html/commit/ddd2d0dd
2024-12-10 10:38:56 +00:00
Pavel Shliak
6f81b80114 Everywhere: Include HashMap only where it's actually used 2024-12-09 12:31:16 +01:00
Lucien Fiorini
3c2bbd45cf Tests: Mark test as passing in XMLSerializer-serializeToString.txt 2024-12-09 09:13:24 +00:00
Lucien Fiorini
7feb8eb5bf Tests: Import WPT test for firstElementChild namespace in xhtml 2024-12-09 09:13:24 +00:00
sideshowbarker
0a2aa87107 LibWeb: Assign ARIA role “switch” to <input type=checkbox switch> 2024-12-09 09:47:36 +01:00
Konstantin Konstantin
b03138cbff LibWeb: Support creation of shared memory in WebAssembly API
Add support for shared memory creation in WebAssembly memory API.
This API is needed for WPT tests that use shared array buffers.

Import related WPT tests.
2024-12-08 22:10:45 +01:00
rmg-x
0cd4c26ae8 Tests/LibWeb: Fix type for delay_ms property in HTTP echo server
This was mistakenly changed from int -> str in a previous commit:
08b8c88ac3
2024-12-07 15:49:15 +00:00
Felipe Muñoz Mazur
e27c59047a LibWeb: Handle abort signal in CloseWatcher 2024-12-07 12:06:53 +00:00
sideshowbarker
c1b29e7cc4 Tests: Import the WPT accname/basic.html test
This change imports the https://wpt.live/accname/basic.html — which we
had overlooked earlier when importing all the other WPT accname tests.
(Note that this one of the six upstream WPT tests that directly call
test_driver.get_computed_label(element) — and so that we’d otherwise
need to patch our copy of, if we weren’t patching it in testdriver.js).
2024-12-07 08:25:26 +00:00
sideshowbarker
e10db3aaf0 Tests: Move window.internals.getComputedLabel into testdriver.js file
This change takes the change we made in 120bc52f23 to patch the imported
WPT aria-utils.js file to use our window.internals.getComputedLabel(el)
function, and moves that patching into the imported WPT testdriver.js
file — in the same way we did in c5966bbdcb.

That centralizes the patching, and avoids the need to patch multiple
other WPT tests we’re likely to import eventually. There are actually
six different WPT test files upstream which we haven’t imported yet that
call window.test_driver_internal.get_computed_label(el) directly — and
that, without this change, we’d otherwise end up needing to patch.
2024-12-07 08:25:26 +00:00
Pavel Shliak
2159a4f14e Tests: Remove SerenityOS Check
This check can be safely removed, as we no longer support
building Ladybird for SerenityOS ;^)
2024-12-06 14:21:56 -07:00
Lucien Fiorini
6260e18de6 Tests: Add fillstyle gradients screenshot test for canvas 2024-12-06 20:21:57 +01:00
sideshowbarker
68894306e2 LibWeb: Compute default ARIA roles context-sensitively where required
This change implements spec-conformant computation of default ARIA roles
for elements whose expected default role depends on the element’s
context — specifically, either on the element’s ancestry, or on whether
the element has an accessible name, or both. This affects the “aside”,
“footer”, “header”, and “section” elements.

Otherwise, without this change, “aside”, “footer”, “header”, and
“section” elements may unexpectedly end up with the wrong default roles.
2024-12-06 18:31:45 +00:00
sideshowbarker
c5966bbdcb LibWeb: Add window.internals.getComputedRole(element)
This change adds a window.internals.getComputedLabel(element) function,
for use in testing ARIA-related behavior. It also patches the imported
WPT testdriver.js script’s test_driver.get_computed_role(element)
function to call our window.internals.getComputedRole(element) function.
2024-12-06 18:31:45 +00:00
Tim Ledbetter
d946d94e2d LibWeb: Improve relList feature detection support
`DOMTokenList.supports()` is now correct for all possible `rel`
attribute values for `link`, `a`, `area` and `form` elements.
2024-12-06 18:09:53 +00:00
Andrew Kaster
af536e1192 LibWeb: Add stubbed-out WebGL2RenderingContext 2024-12-06 15:35:36 +01:00
Andrew Kaster
7abc79ece7 LibWeb/WebGL: Add stub class for WebGLVertexArrayObject
This is a WebGL 2.0 class
2024-12-06 15:35:36 +01:00
Andrew Kaster
39018d233f LibWeb/WebGL: Add stub class for WebGLTransformFeedback
This is a WebGL 2.0 class
2024-12-06 15:35:36 +01:00
Andrew Kaster
bb3226ee57 LibWeb/WebGL: Add stub class for WebGLSync
This is a WebGL 2.0 class
2024-12-06 15:35:36 +01:00
Andrew Kaster
2b5e54e995 LibWeb/WebGL: Add stub class for WebGLSampler
This is a WebGL 2.0 class
2024-12-06 15:35:36 +01:00
Andrew Kaster
69e4adbd98 LibWeb/WebGL: Add stub class for WebGLQuery
This is a WebGL 2.0 class
2024-12-06 15:35:36 +01:00