Commit graph

288 commits

Author SHA1 Message Date
Pavel Shliak
4cd1ef12d7 LibWeb: Refer a spec issue in Location::internal_get_own_property 2024-12-20 14:46:28 +01:00
Pavel Shliak
361c6f1b64 LibWeb: Update Location initialization according to spec 2024-12-20 14:46:28 +01:00
Tim Ledbetter
62ecff0b40 LibWeb: Report exceptions that occur during microtask callback 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
Sam Atkins
4c5a40579a LibWeb: Match spec changes to "create an element" algorithm
Corresponds to https://github.com/whatwg/html/pull/10857

No code changes, only comments.
2024-12-18 19:22:44 +00:00
Sam Atkins
aa29a3ff6b LibWeb/HTML: Update resource fetch algorithm to match current spec
Changes from https://github.com/whatwg/html/pull/10792

No code changes, only comments.
2024-12-18 19:22:44 +00:00
Sam Atkins
30d23ad090 LibWeb/HTML: Use camelCase for variables in adoption agency comments
This is a spec change but I don't know when it occurred.

Also reformat some of the spec comments for clarity.

No code changes, only comments.
2024-12-18 19:22:44 +00:00
Sam Atkins
5651c6fd9b LibWeb: Match spec changes for "custom element registry" concept
Corresponds to https://github.com/whatwg/html/pull/10845 and
https://github.com/whatwg/html/pull/10865
2024-12-18 19:22:44 +00:00
Lucien Fiorini
a6ef6550f3 LibWeb+LibGfx: Implement Canvas2D filters 2024-12-18 18:54:20 +01:00
Johan Dahlin
083f4f3d08 LibWeb: Layout/Shape font-variant-* css properties 2024-12-17 19:07:13 +01:00
Shannon Booth
6c691ccddc LibWeb/HTML: Add null handling for "get noopener for window open"
See: https://github.com/whatwg/html/pull/10847

Which also fixes a crash when window.open is given a blob URL which is
not present in the Blob URL registry.
2024-12-17 17:06:47 +01:00
Luke Warlow
0a02eb639d LibWeb: Implement popover's close watcher
Auto popovers now correctly establish a close watcher when shown.

This means popovers now correctly close with an escape key press.

Also correctly hide open popovers when removed from the document.
2024-12-17 04:55:55 +01:00
sideshowbarker
1b165d887b LibWeb: Support the ARIA “sectionheader” & “sectionfooter” roles 2024-12-16 06:56:31 -08:00
Shannon Booth
e5436ce593 LibWeb/HTML: Remove uneeded FIXME about use of USVString
An AK::String works fine for a USVString as a USVString is just a more
strict version of DOMString. Maybe we will have a different String type
for it in the future, but for now using an AK::String is fine and we do
not need this FIXME.
2024-12-16 05:03:00 -08:00
Shannon Booth
a5bdc56063 LibWeb/HTML: Make ErrorEvent::create a trusted event
Matching DOM::Event.
2024-12-16 05:03:00 -08:00
Tim Ledbetter
2b1725ea51 LibWeb: Collapse selection when selecting text inside a text control 2024-12-16 11:43:28 +01:00
Pavel Shliak
40bf8dde88 LibWeb: Remove unnecessary Quad.h include 2024-12-15 23:27:42 +01:00
Tim Ledbetter
022141647a LibWeb: Implement PopoverInvokerElement attribute change steps
PopoverInvokerElement's explicitly set attr-element should be set to
null whenever the value of the `popovertarget` content attribute is
changed.
2024-12-14 12:11:28 -08:00
Tim Ledbetter
40cb36607c LibWeb: Include namespace parameter in associated_attribute_changed() 2024-12-14 12:11:28 -08:00
Shannon Booth
18dddaa742 LibWeb/HTML: Use DOM's post-connection steps for iframe elements
See: https://github.com/whatwg/html/commit/c8ec987d1
2024-12-14 12:06:41 -08:00
sideshowbarker
583ca6af89 LibWeb: Implement <input type=checkbox switch> experimentally
In conformance with the requirements of the spec PR at
https://github.com/whatwg/html/pull/9546, this change adds support for
the “switch” attribute for type=checkbox “input” elements — which is
shipping in Safari (since Safari 17.4). This change also implements
support for exposing it to AT users with role=switch.
2024-12-13 11:31:27 +00:00
Andrew Kaster
7ee3727074 LibWeb: Fix compile error for popover element internal lambdas
These were converted to lambdas in
6b921e91d4
But I merged fcf6cc27f2 without checking
that the code had responded to the change.
2024-12-12 15:56:55 -07:00
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
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
6e24f23aa0 LibWeb: Add support for the “mark” ARIA role 2024-12-12 05:13:45 -08: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
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
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
Timothy Flynn
fe891727dc LibWeb: Use correct URL parsing methods throughout LibWeb
There are essentially 3 URL parsing AOs defined by the spec:
1. Parse a URL
2. Encoding parse a URL
3. Encoding parse a URL and serialize the result

Further, these are replicated between the Document and the ESO.

This patch defines these methods in accordance with the spec and updates
existing users to invoke the correct method. In places where the correct
method is ambiguous, we use the encoding parser to preserve existing ad-
hoc behavior.
2024-12-10 10:37:01 -08:00
Jelle Raaijmakers
1c55153d43 LibWeb: Refactor "editable" and "editing host" concepts
The DOM spec defines what it means for an element to be an "editing
host", and the Editing spec does the same for the "editable" concept.
Replace our `Node::is_editable()` implementation with these
spec-compliant algorithms.

An editing host is an element that has the properties to make its
contents effectively editable. Editable elements are descendants of an
editing host. Concepts like the inheritable contenteditable attribute
are propagated through the editable algorithm.
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
Andrew Kaster
66519af43f LibWeb: Remove some uses of [&] lambda captures for queued tasks
Using a default reference capture for these kinds of tasks is dangerous
and prone to error. Some of the variables should for sure be captured
by value so that we can keep a GC object alive rather than trying to
refer to stack objects.
2024-12-10 07:13:00 +01:00
Andrew Kaster
6ed2bf2bb1 LibWeb: Mark local variables captured in GC functions as ignored
These variables are all captured in queued events or other event loop
tasks, but are all guarded by event loop spins later in the function.

The IGNORE_USE_IN_ESCAPING_LAMBDA will soon be required for all locals
that are captured by ref in GC::Function as well as AK::Function.
2024-12-10 07:13:00 +01:00
Andrew Kaster
31d21570bf LibWeb: Don't store local functions in GC Function
If a function isn't going to be escaped from the current context,
there's no need to wrap the lambda in a GC allocation.
2024-12-10 07:13:00 +01:00
Jelle Raaijmakers
1514197e36 LibWeb: Remove dom_ from dom_exception_to_throw_completion
We're not converting `WebIDL::DOMException`, but `WebIDL::Exception`
instead.
2024-12-09 20:02:51 -07:00
Timothy Flynn
953fe75271 LibWeb: Remove exception handling from safely extracting response bodies
The entire purpose of this AO is to avoid handling exceptions, which we
can do now that the underlying AOs do not throw exceptions on OOM.
2024-12-09 20:02:51 -07:00
Andrew Kaster
f0bfb7f697 LibWeb: Don't capture local variables in HTMLImageElement::decode 2024-12-10 00:50:45 +01:00
Pavel Shliak
6f81b80114 Everywhere: Include HashMap only where it's actually used 2024-12-09 12:31:16 +01: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
Felipe Muñoz Mazur
e27c59047a LibWeb: Handle abort signal in CloseWatcher 2024-12-07 12:06:53 +00:00
Glenn Skrzypczak
156f9fff32 LibWeb: Support the X-Frame-Options header
Navigation responses are now checked for adherence to the
`X-Frame-Options` header and an error is shown accordingly.
2024-12-07 08:38:02 +00:00
Glenn Skrzypczak
88884c370c LibWeb: Act as if parsing stopped when generating an error document
The user agent now acts as if it has stopped parsing when creating a
document for inline content to display an error.
2024-12-07 08:38:02 +00:00