Commit Graph

198 Commits

Author SHA1 Message Date
Tim Ledbetter
eb8943cd55 Tests: Remove imported WPT tests that have been deleted upstream 2026-04-04 23:36:58 +02:00
Tim Ledbetter
504a8e6d1d Tests: Resync imported WPT tests 2026-04-04 23:36:58 +02:00
Glenn Skrzypczak
7392d2a2f4 LibWeb: Support JSON modules
This adds support for importing JSON objects from JSON files in
javascript.
2026-04-03 21:21:09 +02:00
Glenn Skrzypczak
f1d3244b22 LibWeb: Support CSS modules
This adds support for importing CSS stylesheets from CSS files in
javascript.
2026-04-03 21:21:09 +02:00
Shannon Booth
a2aff98f07 Tests/LibWeb: Import WPT test for navigation cancel in document.open
This was recently implemented in: 76d9cc4baf
2026-04-01 04:41:11 +02:00
Sam Atkins
bd5424f435 Tests: Import WPT base64() test
This no longer crashes with the StringView fix in the previous commit.
2026-03-31 19:01:10 +02:00
Glenn Skrzypczak
6074424486 LibWeb/HTML: Update the button activation behaviour steps
This commit updates the activation behaviour steps of the button
element in order to properly determine if a command is valid for
a target.
2026-03-25 23:14:10 +01:00
Shannon Booth
fa1c046e68 Tests/LibWeb: Import some MessageEvent Origin API tests 2026-03-23 22:32:43 +01:00
Shannon Booth
45a87b1dbe LibWeb: Update document URL to the entry document URL in document.open()
When document.open() is called from another window, the opened
document's URL should be updated to match the calling document's URL.
2026-03-23 09:00:39 +01:00
Glenn Skrzypczak
c6bd3173ef LibWeb/HTML: Make form submit event trusted
The form submit event was previously not tagged as trusted. This commit
properly tags the event so that we match the behaviour implemented by
other browsers and expected by WPT.
2026-03-23 02:33:56 +01:00
Johan Dahlin
9a34fb59aa LibWeb: Implement HTMLElement.accessKeyLabel
Implement the accessKeyLabel IDL attribute per the HTML spec.

We mimic Chromium's behavior and treat the accesskey attribute value as
a single key rather than splitting on whitespace, since no browser
besides IE/Edge implemented the spec's splitting approach.

See https://github.com/whatwg/html/issues/3769
2026-03-20 15:57:06 -05:00
Jelle Raaijmakers
ec286d96ec Tests/LibWeb: Import WPT canvas text baseline tests 2026-03-10 11:33:35 +01:00
Shannon Booth
8d04c7b738 Tests/LibWeb: Remove bogus file:// URL testcase
This was also removed in upstream WPT as it was testing something
which is implementation defined.
2026-03-01 01:04:10 +01:00
Tim Ledbetter
a4aaed5e83 LibWeb: Propagate error from Notification contructor 2026-02-22 11:37:33 +01:00
Shannon Booth
1be69479a6 LibURL+Elsewhere: Consider file:// origins opaque by default
This aligns our behaviour closer to other browsers, which
_mostly_ consider file scheme URLs as opaque. For test
purposes, allow overriding this behaviour with a commandline
flag.
2026-02-21 23:00:57 +01:00
Luke Wilde
84db5d8c1c Meta+test-web: Support per-test .headers files
If a test requires custom response headers, we now serve it via the
http-test-server, which will read the headers file and add them to the
response.
2026-02-19 14:58:09 +01:00
Jelle Raaijmakers
83913fef84 LibWeb: Queue animation phase events as part of updating animations
Move the dispatch_events_for_animation_if_necessary() calls into step 1
of update_animations_and_send_events(), where the spec note says
updating timelines involves "Queueing animation events for any such
animations." Previously, these calls ran after step 7 (event dispatch),
causing newly queued events to be deferred by an extra rendering update.

This meant that e.g. a CSS transition triggered during an earlier
rendering step would not have its transitionrun event fired until the
next frame, instead of the current one.
2026-02-13 22:44:17 +01:00
Shannon Booth
3e0ea4f62e LibWeb/HTML: Check ongoing navigation before javascript: URL navigation
See: https://github.com/whatwg/html/commit/976d272

This fixes a timeout in the included test. In order for the
test to run properly in our test harness it is modified slightly
(as we are loading the HTML from a file:// URL).
2026-01-26 18:46:54 +01:00
Tim Ledbetter
0035690977 LibWeb: Return body from activeElement() when nothing is focused
This matches the behavior of other browsers.
2026-01-19 13:08:30 +01:00
Tim Ledbetter
e16618bdd1 LibWeb: Apply textBaseline offset in Canvas measureText() 2026-01-15 10:31:23 +01:00
Tim Ledbetter
191e8218dc LibWeb: Use correct font metrics calculations in Canvas measureText() 2026-01-15 10:31:23 +01:00
Shannon Booth
1106496d1c LibWeb/HTML: Ensure data: URL workers are same-origin with themselves
See: https://github.com/whatwg/html/commit/baff3f5
2026-01-13 16:59:54 +01:00
Shannon Booth
9eabaa6833 LibWeb/HTML: Set correct length for cross-origin wrapper functions 2026-01-13 10:11:31 +01:00
Shannon Booth
399c62933a LibWeb/HTML: Set correct name for cross-origin wrapper functions 2026-01-13 10:11:31 +01:00
sideshowbarker
1b41659efd LibXML+LibWeb: Use existing HTML entities table for XML parsing too
For XHTML documents, resolve named character entities (e.g.,  )
using the HTML entity table via a getEntity SAX callback. This avoids
parsing a large embedded DTD on every document and matches the approach
used by Blink and WebKit.

This also removes the now-unused DTD infrastructure:

- Remove resolve_external_resource callback from Parser::Options
- Remove resolve_xml_resource() function and its ~60KB embedded DTD
- Remove all call sites passing the unused callback
2026-01-09 19:13:41 +00:00
Shannon Booth
b557e77cf1 Tests/LibWeb: Import some legacy unforgable related WPT tests 2026-01-08 12:57:17 +01:00
CountBleck
2ca45fba6a LibWeb: Update structured-clone-battery-of-tests to include Error#cause
This just re-imports the file via WPT.sh to match what is currently
present in WPT. This file is used by...
https://wpt.live/html/infrastructure/safe-passing-of-structured-data/messagechannel.any.html
...as well as other WPT tests.
2026-01-08 00:55:52 +01:00
Shannon Booth
82ae2a183c Tests/LibWeb: Import a message event constructor WPT test 2026-01-06 11:49:06 +01:00
Gingeh
789ab3cc57 LibWeb: Declare namespace prefixes in parse_xml_fragment 2026-01-02 11:09:19 +01:00
Shannon Booth
f9a996650b LibWeb/HTML: Implement the Origin interface
See: https://github.com/whatwg/html/commit/68909b2
2025-12-30 12:40:27 +01:00
Shannon Booth
2a8b83a568 LibWeb/WebIDL: Upgrade QuotaExceededError to its own interface
See https://github.com/whatwg/webidl/commit/48eba6d
2025-12-29 17:15:11 +01:00
Sam Atkins
c906dbeaf7 Tests: Import :autofill pseudo-class test 2025-12-18 14:50:27 +01:00
Sam Atkins
f9f4c36f20 LibWeb: Implement the headingoffset and headingreset attributes
:heading() now matches based on a computed heading level, which is based
on the level of the tag (h1, h2, etc) and then modified by these two new
attributes.

I'm caching this heading level on HTMLHeadingElement, based on the dom
tree version. That's more invalidation than is actually needed, but it
saves us calculating it over and over when the document hasn't changed.

The failing test cases are:
- Implicit headingreset for modal dialogs which is apparently unspecced
  and controversial.
- Not walking the flat tree properly. A flat tree ancestor of a
  slot-assigned element is its slot, which is something we don't do
  anywhere that I could find. I've made a note to look into this later.

We also don't implement the `ReflectRange` IDL attribute yet, which
means we're not clamping the read value of `headingOffset`.

Corresponds to:
e774e8e318
2025-12-15 14:08:24 +00:00
bingyuan.ng
6353118809 LibWeb: Update svg type for root element checks when set/get title 2025-12-14 23:22:38 +00:00
Feng Yu
b58fcaeecf LibWeb: Add HTMLSelectedContentElement for customizable select
Introduce the HTMLSelectedContentElement and integrate it into
<select>, <option> and HTMLParser.

See whatwg/html#10548.

There are two bugs with WPT tests which causes the third subtest
in selectedcontent.html and selectedcontent-mutations.html fail.
See whatwg/html#11882, web-platform-tests/wpt#55849.
2025-12-12 12:06:24 +00:00
Feng Yu
89d50befb0 LibWeb: Sync <select> options handling with latest spec changes
- Rename HTMLOptionElement's `owner_select_element()` to
  `nearest_select_element()` to better match spec terminology.
- Update HTMLSelectElement's option list related algorithms.

This change is part of the customizable <select> spec work.
See whatwg/html#10548.
2025-12-12 12:06:24 +00:00
Carlos Sousa
9e3f4c7639 LibWeb: Return custom validity error message
Previously, validation_message() always returned a hardcoded "Invalid
form" string, now it correctly returns the custom validity error
message when the element is suffering from a custom error.
Other validation errors still return the "Invalid form" message.
2025-12-11 22:06:25 +00:00
Callum Law
09b20f172f LibWeb: Set background-image presentational hint as StyleValueList
This fixes a crash introduced in a11666e
2025-12-09 12:08:40 +00:00
Lorenz A
924e4d2baa LibWeb: Add sorting to Table row HTMLCollection
Add an optional sorting function to HTMLCollection. We use
insertion_sort as a stable sorting algorithm so tree order can be
maintained.
2025-12-09 09:26:49 +00:00
Feng Yu
d2029b1814 LibWeb: Relax HTML parser to allow more tags inside <select>
This implements parsing part of customizable <select> spec update.
See whatwg/html PR #10548.

Two failing subtests in `html5lib_innerHTML_tests_innerHTML_1.html`
and `customizable-select/select-parsing.html` are due to the spec
still disallowing `<input>` inside `<select>`, even though Chrome
has already implemented this behavoir (see whatwg/html#11288).
2025-12-04 17:17:01 +00:00
Sam Atkins
e5ea4f9bdf LibWeb/HTML: Add source field to ToggleEventInit
Corresponds to:
95131eec8f

As we now have a field in that dictionary, I removed the separate
`source` parameter from ToggleEvent::create(). Also updated the
relevant test.
2025-12-01 14:58:20 +00:00
Sam Atkins
ed5169af8d LibWeb/HTML: Make command events not composed
Also re-import the affected button-event-dispatch test.

Corresponds to:
787316d519
2025-12-01 11:07:16 +00:00
Glenn Skrzypczak
a0dbae02c8 LibWeb/HTML: Ignore form owner if earlier same-ID element isn't a form
Only set form owner when there is no non-form element with the same ID
as the control's form attribute earlier in tree order.
2025-11-24 09:51:50 +01:00
Tim Ledbetter
fdd3975104 LibWeb: Don't run update_the_image_data() algorithm if already started
This ensures that events are not fired if the image source is updated
while it is being fetched.
2025-11-15 12:39:37 +01:00
Lorenz A
3bc061d028 LibWeb: Allow all elements with tabindex attribute to be focusable 2025-11-12 13:57:05 +01:00
Tim Ledbetter
9da723b5c6 LibWeb: Ensure layout is up to date before resolving canvas colors 2025-10-27 16:56:01 -07:00
Tim Ledbetter
8854bb62c6 LibGfx: Use CSS sRGB serialization for canvas fill styles 2025-10-26 18:55:22 +01:00
Tim Ledbetter
9dceb06992 LibWeb: Don't paint canvas objects with non-visible fill styles 2025-10-26 16:45:38 +01:00
Lorenz A
fb258639d1 LibWeb: CSS selector read-write honor is_allowed_to_be_readonly 2025-10-24 19:15:58 +01:00
Tim Ledbetter
1c00279488 LibWeb: Reset Painter when resetting canvas to its initial state 2025-10-23 18:52:36 +02:00