Commit Graph

1575 Commits

Author SHA1 Message Date
Tim Ledbetter
f05bc7c0cd LibWeb: Implement dominant-baseline for SVG text
This property determines the default baseline used to align content
within the given box.
2026-02-26 09:23:23 +01:00
Shannon Booth
9e7aa878bc LibWeb: Properly determine if running in SecureContext for Workers
Fixes the included imported test. Note that this required a minor
edit of the WPT import to work with our test harness setup to
try and create a non secure context setup as both file:// and
localhost are considered secure contexts.
2026-02-26 07:22:50 +01:00
Tim Ledbetter
84043cd82d LibWeb: Track deleted state on IndexedDb Index and ObjectStore
An `InvalidStateError` is now thrown when an attempt is made to
interact with an index or object store that has been deleted.
2026-02-24 17:37:04 +01:00
Sam Atkins
afdc0df70b Tests: Re-enable some tests which rely on font loading
These should no longer be flaky, now that we wait for fonts to load.
2026-02-24 15:44:32 +00:00
Sam Atkins
000f902522 Tests: Import WPT test for document.fonts.ready 2026-02-24 15:44:32 +00:00
Sam Atkins
4ea87db0a8 LibWeb/CSS: Load all fonts through FontFace::load()
The spec requires us to follow the steps in FontFace::load() whenever a
font is loaded. The simplest way to do so, is to make that the only way
we load fonts. :^)

To support this, FontFace::load() uses its connected CSSFontFaceRule's
ParsedFontFace if it's available.

The 1 regression in generic-family-keywords-003.html seems to be a false
positive: we don't support the system-ui font keyword.
2026-02-24 15:44:32 +00:00
Luke Wilde
8017f8a7ed Tests/LibWeb: Import Fullscreen WPT tests 2026-02-23 18:44:26 +00:00
Simon Farre
bc17805b2b LibWeb: Implement requestFullscreen algorithm
The required functionality to exit fullscreen will be in a followup
commit.
2026-02-23 18:44:26 +00:00
Callum Law
49eb9d7a7a LibWeb: Support composition of mixed values
This exposes an existing issue with interpolation where it is not clear
in what situations zero-valued dimensions should be excluded from the
interpolated value of a dimension-percentage mix (e.g. `calc(50% + 0px)`
vs `50%`) - but this is just a serialization issue as both
representations are resolved to the same used value
2026-02-23 09:01:19 +00:00
Zaggy1024
bc60768cb0 LibWeb: Rewrite audio elements without controls to display:none
This is part of the rendering spec, but we had neglected to do this
before. It causes one WPT check to fail, but other browsers get the
same result on that check, so I guess we can call that a win. :^)
2026-02-23 07:27:31 +01:00
devgianlu
3d7b02333f LibWeb: Import some CredentialsContainer WPT tests 2026-02-22 14:55:30 -05:00
Adam Colvin
d2f10c76fd LibWeb: Reject invalid alt text values in CSS content property parsing
The CSS content property's alt text (after `/`) was incorrectly
accepting any content value. Per the CSS Content Module Level 3 spec,
alt text only accepts <string>, <counter>, and <attr()> values. This
change adds type validation in the alt text parsing branch to reject
URLs, quote keywords, images, and other non-alt-text value types.

This fixes 64 subtests in the content-invalid WPT test.
2026-02-22 13:55:22 -05:00
Andreas Kling
90cfa2597d Tests: Import WPT tests for clientLeft and clientTop
Import several WPT tests covering client* properties:
- client-props-input.html (border offsets on input/textarea)
- client-props-root.html (root element client properties)
- client-props-zoom.html (client properties with zoom)
- client-props-inline-list-item.html (inline list-item display)
- client-props-root-display-none-crash.html (crash test)
- table-client-props.html (table element client properties)
2026-02-22 13:24:05 +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
Aliaksandr Kalenik
795222fab3 LibWeb: Validate grid-template-areas rectangles at parse time
Move grid area rectangle computation and validation from layout to the
CSS parser. Named grid areas that don't form filled-in rectangles now
correctly invalidate the declaration per spec.
2026-02-21 21:46:34 +01:00
Callum Law
e6669482e6 LibWeb: Parse font-variant-alternates functions 2026-02-20 22:01:44 +00:00
Luke Wilde
fc13f15193 LibWeb/CSP: Apply strict-dynamic to inline scripts
This implements https://github.com/w3c/webappsec-csp/pull/787 that
fixed the linked spec issue.
2026-02-19 14:58:09 +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
Callum Law
6705bd187c LibWeb: Account for generic font families in FontFaceSet::load()
Fixes a regression in d998a0a which was crashing the imported test
2026-02-19 12:00:52 +01:00
Tim Ledbetter
918937231e LibWeb: Use premultiplied alpha when interpolating legacy sRGB colors
Previously, we were only using premultiplied alpha for non-legacy
colors after converting them to the Oklab color space.
2026-02-19 10:45:32 +00:00
Callum Law
6d73a3e85f LibWeb: Parse @font-feature-values at-rule
We don't yet support the `font-display` descriptor as part of this
2026-02-17 12:25:27 +00:00
Callum Law
784911fb6d LibWeb: Implement CSSFontFeatureValuesRule 2026-02-17 12:25:27 +00:00
Callum Law
fcdc05a4ee LibWeb: Implement CSSFontFeatureValuesMap
This will be used within `CSSFontFeatureValuesRule`
2026-02-17 12:25:27 +00:00
Callum Law
f36d0407ec Tests: Import some @font-feature-values tests 2026-02-17 12:25:27 +00:00
Aliaksandr Kalenik
3c73457b26 LibWeb: Implement CSS Grid dense packing and fix span placement
Implement the `dense` keyword for `grid-auto-flow` so auto-placed items
backfill earlier gaps in the grid. The sparse/dense cursor logic is now
centralized in `place_grid_items()` step 4: dense resets the cursor to
the grid start before each search, while sparse keeps advancing forward.

Also fix a pre-existing bug where `find_unoccupied_place()` and several
placement helpers only checked if a single cell was unoccupied, ignoring
multi-cell spans. Add `OccupationGrid::is_area_occupied()` and use it
throughout to correctly verify the entire rectangular area is available.
2026-02-16 20:00:17 +01:00
Shannon Booth
1a3a775943 LibWeb: Treat numeric PropertyKeys as Strings per spec in PlatformObject
PropertyKey values can only be String or Symbol per spec; numeric keys
are an internal optimization and should be treated as Strings.

This fixes incorrect behavior for numeric property names on legacy
platform objects (e.g. Web Storage).
2026-02-16 18:49:15 +01:00
Shannon Booth
a0d4344d4e Tests/LibWeb: Import some more webstorage WPT tests
Which were helpful in determining property behaviour for the Storage
object.
2026-02-16 18:49:15 +01:00
Callum Law
79dbca29ee LibWeb: Correctly serialize filter url() value
Previously we would have two closing parentheses when serializing a
`url()` within a `FilterValueListStyleValue`
2026-02-16 12:09:23 +00:00
Psychpsyo
6e1f2c10d6 LibWeb: Implement basics of the WebXR testing framework 2026-02-15 10:50:25 +01:00
Psychpsyo
a7267f711b LibWeb: Add overflow-clip-margin-* properties
The corner radius isn't quite right yet, but this gives us
another couple WPT passes for these.
2026-02-14 22:58:21 +01:00
Tim Ledbetter
5060a61081 LibWeb: Align Navigable::reload() with the specification 2026-02-14 20:21:53 +01:00
Tim Ledbetter
dc649a7e46 LibWeb: Use reject_the_finished_promise() in abort_a_navigate_event()
This aligns our implementation with the specification. Doing this
fixes a number of WPT tests because this sets
`m_ongoing_api_method_tracker` to null, avoiding an assertion that
previously caused a crash.
2026-02-14 20:21:53 +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
Niccolo Antonelli Dziri
bd76078f97 LibWeb: Add constructor for Notification and getter methods
The full constructor for NotificationsAPI::Notification is implemented
along with the getter methods.
It is now possible to call the elements of Notification in JS without
getting undefined but the default values (or the ones passed in
options).

The method `current_wall_time` is added in EnvironmentSettingsObject.

This passes a least a few more tests because of the getter methods
that are created.

https://wpt.live/notifications/constructor-basic.https.html

https://wpt.live/notifications/idlharness.https.any.html
2026-02-13 16:47:42 +00:00
Tim Ledbetter
991b3d87e5 LibWeb: Add missing -webkit- legacy property aliases
These are mandated by the compat specification.
2026-02-13 11:13:54 +00:00
Shannon Booth
0b839a9e2d Tests/LibWeb: Sync WPT test for WASM global attribute setter
The regression in 932a204 turned out to be the specified
behaviour changed as part of: whatwg/webidl#1498

And WPT has now been updated accordingly.
2026-02-13 12:12:23 +01:00
Sam Atkins
b21a05d290 LibWeb/CSS: Wait for resources to load to fire <style> load event
Previously, we fired the load event immediately, without waiting for
anything. This was good for not timing out, but bad for anything that
wanted to wait for the load to complete.

CSSStyleSheet now maintains a list of critical subresources, and waits
for all of them to complete before it then tells its owner that it is
ready. "Complete" here means the network request completed with or
without an error. This is done by having those subresources (just
`@import` for now) notify their style sheet when they complete. This
then propagates up as an `@import` tells its style sheet, which then
would tell its parent `@import` if it had one.

There are other subresources we should wait for (specifically fonts and
background images) but this commit just adds `@import` as a first step.
2026-02-12 16:23:12 +01:00
Andreas Kling
ecadf3ce21 LibJS: Inline AsyncIteratorClose with proper Await in for-await-of
The AsyncIteratorClose bytecode op calls async_iterator_close() which
uses synchronous await() internally. This spins the event loop while
execution contexts are on the stack, violating the microtask checkpoint
assertion in LibWeb.

Replace AsyncIteratorClose op emissions in for-await-of close handlers
with inline bytecode that uses the proper Await op, allowing the async
function to yield and resume naturally through the event loop.

For the non-throw path (break/return/continue-to-outer): emit
GetMethod, Call, Await, and ThrowIfNotObject inline.

For the throw path: wrap the close steps in an exception handler so
that any error from GetMethod/Call/Await is discarded and the original
exception is rethrown, per spec step 5.
2026-02-12 11:37:43 +01:00
Callum Law
8a82d116d6 LibWeb: Always parse <counter-style> as such
Previously we parsed it as `<custom-ident>` in `<counter>` and as a
keyword in `list-style-type`.

The practical effect of this is:
 - Spec defined counter style names in `<counter>` are ASCII lowercased
   on parse.
 - Non spec defined counter style names are allowed in `list-style-type.

We are still to parse the `symbols()` function but this gives us a
better base for that.
2026-02-12 10:33:09 +00:00
Callum Law
9de3ddf8f9 Tests: Import some counter style tests 2026-02-12 10:33:09 +00:00
Callum Law
046dfdd192 LibWeb: Parse CSS timeline-scope property 2026-02-11 11:27:16 +01:00
Callum Law
2cbd28b7ec LibWeb: Update CSSAnimation iteration count before normalizing timing
The iteration count is required to compute the intrinsic iteration
duration among other things.
2026-02-11 10:49:34 +01:00
Callum Law
379db7a42c LibWeb: Support animation-timeline scroll() value 2026-02-11 10:49:34 +01:00
Callum Law
61b0b20f11 LibWeb: Respect animation-timeline: none 2026-02-11 10:49:34 +01:00
Callum Law
2f135e0e63 LibWeb: Import some animation-timeline related tests 2026-02-11 10:49:34 +01:00
Luke Wilde
a89b02e5c3 LibWeb/SVG: Implement SVGAnimatedInteger
This is basically the same as SVGAnimatedNumber, but stores an i32
instead.
2026-02-11 09:39:39 +01:00
Jelle Raaijmakers
0a334f50db LibWeb: Stub SpeechSynthesis.cancel()
This was preventing an Emscripten compiled version of ScummVM to load
games.
2026-02-10 11:58:23 +01:00
Tim Ledbetter
4a57fc72cf LibWeb: Omit "row" when serializing grid-auto-flow as "dense" 2026-02-09 17:36:12 +01:00
Tim Ledbetter
f6ad878ea3 LibWeb: Allow interleaving of grid-template line names and track values 2026-02-09 17:36:12 +01:00