Commit Graph

72565 Commits

Author SHA1 Message Date
Lorenz A
eeef370902 LibWeb: Check that elements are HTML elements in StackOfOpenElements 2025-10-20 12:14:14 +01:00
Tim Ledbetter
08641c9e15 LibWeb: Ensure CanvasPath::arc() nonfinite radius argument is ignored 2025-10-20 12:12:16 +01:00
Tim Ledbetter
303ebc0a67 LibWeb: Ignore non-finite arguments to canvas text drawing methods 2025-10-20 12:12:16 +01:00
Callum Law
26b82986c4 LibWeb: Clean up parse_css_value_for_properties
We no longer rely on parsing easing functions before keywords so this
can be moved down with the other parse_for_type calls.

`parse_for_type` is used for more than just parsing easing functions so
the variable name `maybe_easing_function` was misleading
2025-10-20 11:27:44 +01:00
Callum Law
03be70087d LibWeb: Maintain easing keywords as KeywordStyleValue until use-time
This excludes `step-end` and `step-start` which are expected to be
converted to the equivalent function at parse time.

We are expected to serialize these as the explicit keywords - previously
we would parse as `EasingStyleValue` and serialize equivalent functions
as the keywords. This caused issues as we would incorrectly serialize
even explicit functions as the keyword.

This also allows us to move the magic easing functions to
`EasingFunction` rather than `EasingStyleValue` which is a bit tidier
2025-10-20 11:27:44 +01:00
Callum Law
755a576013 LibWeb: Support relative lengths within easing function calc()s 2025-10-20 11:27:44 +01:00
Callum Law
ad41f053b8 LibWeb: Clamp calculated steps() interval count using normal system
Previously we were doing this ad-hoc later in the process but we now
have the `calc` clamping system which can simplify things.

This reveals some false-positives in that we don't handle relative
lengths within these `calc`s but these are fixed in the next commit
2025-10-20 11:27:44 +01:00
Callum Law
06a57a280d LibWeb: Clamp calculated cubic-bezier() X coords using normal system
Previously we were doing this ad-hoc later in the process but we now
have the `calc` clamping system which can simplify things
2025-10-20 11:27:44 +01:00
Callum Law
ef4f01ea44 LibWeb: Discard Number type when converting to CalculationNode
Before this change we would maintain explicit signs when serializing
e.g. `animation-iteration-count: calc(+1)` would serialize as `calc(+1)`
rather than `calc(1)` as intended
2025-10-20 11:27:44 +01:00
Callum Law
2f83356c0f LibWeb: Support calc within linear() easing function 2025-10-20 11:27:44 +01:00
Callum Law
91925db9ca LibWeb: Don't canonicalize linear easing function points until use time
Canonicalization can require information that is only known after
compute time (i.e. resolved relative lengths within calcs).

This also allows us to get rid of the `had_explicit_input` flag and just
rely on whether Optional has a value
2025-10-20 11:27:44 +01:00
Callum Law
95e26819d9 LibWeb: Separate use time easing functions from EasingStyleValue
In the future there will be different methods of creating these use-time
easing functions (e.g. from `KeywordStyleValue`s)
2025-10-20 11:27:44 +01:00
Callum Law
0e30de82cc LibWeb: Implement <step-position> as an enum
This simplifies parsing and serialization by using the generated
functions
2025-10-20 11:27:44 +01:00
Callum Law
4c97b336c3 Tests: Import timing function tests 2025-10-20 11:27:44 +01:00
Sam Atkins
41b4292447 LibDevTools+LibWebView: Implement initial accessibility tree view
This is enough for Firefox to display the Accessibility tab, containing
our accessibility tree which can be inspected. Most information is
blank for now.

There's quite a bit of duplication between AccessibilityWalkerActor and
WalkerActor - it might be worth trying to make a base class once the
details are figured out. Frustratingly, the two don't work quite the
same: for a lot of messages that would be sent to WalkerActor, the
accessibility equivalent is sent to the AccessibilityNodeActor instead.

Co-authored-by: Tim Flynn <trflynn89@pm.me>
2025-10-20 10:51:19 +01:00
Sam Atkins
c9811af3b5 LibWeb/DOM: Set missing JSON attributes for a11y text nodes
Firefox DevTools expects all nodes to have an ID and type, and for a
text node's name to be its text.
2025-10-20 10:51:19 +01:00
Sam Atkins
d5fe7f7a98 LibDevTools: Pull DOMNode type and related code into new Node.h
Accessibility nodes will share this code, so make it available, and
rename DOMNode to Node.
2025-10-20 10:51:19 +01:00
Luke Wilde
eeb5446c1b LibWeb: Avoid including Navigable.h in headers
This greatly reduces how much is recompiled when changing Navigable.h,
from >1000 to 82.
2025-10-20 10:16:55 +01:00
Undefine
7bccd65b4a LibWasm: Make sure try_table creates a new frame while validating
The spec says that while validating this opcode a new label should
be pushed.

Fixes a crash in instance.wast on WPT.
2025-10-19 17:28:11 +02:00
Undefine
07c86542b6 LibWasm: Properly read and validate limits for I64 memories and tables
Since memory64 got merged into the spec the minimum value for limits
is now actualy 64-bit and the maximum sizes for memories and tables
for I64 address types were increased.

Fixes 5 tests in memory64.wast nad 8 tests in table64.wast on WPT.
2025-10-19 17:28:11 +02:00
Undefine
692195ae88 LibWasm: Cast to long double before checking if trunactions is in range
I found that this fixes some precision issues while comparing to values
on the edge of the limits.

Fixes 6 tests in conversions.wast on WPT.
2025-10-19 17:28:11 +02:00
Luke Wilde
11a1e97e40 LibWeb: Invalidate layout tree after removing element from top layer
Otherwise the layout tree will still contain the top layer element(s).

Fixes Steam Events & Announcements `<dialog>` modal visually not fully
disappearing upon removal.
2025-10-19 16:58:47 +02:00
Tim Ledbetter
34857ba554 LibWeb: Apply dithering when painting gradients 2025-10-19 16:53:00 +02:00
stelar7
98f91a3fcc LibWeb/IDB: Dont run wait callbacks as a database task 2025-10-18 13:50:01 +01:00
ljamar
7fb65283c2 LibWeb: Ignore non-finite args in CanvasRenderingContext2D::clear_rect() 2025-10-17 17:41:58 +01:00
Callum Law
b1801c0bc9 LibWeb: Avoid crash evaluating media query in document lacking window
In some cases a document may lack an associated window - to fix this for
now we just return false but perhaps there are some media queries we
should still attempt to resolve.
2025-10-17 18:24:59 +02:00
Andreas Kling
7ee8645b9c LibJS: Avoid redundant GC::Weak checks in hot inline cache code paths
By copying out pointees to a temporary, we can avoid some redundant
pointer chasing inside GC::Weak when hitting our inline caches.
2025-10-17 17:22:16 +02:00
Andreas Kling
dfa796a4e4 LibJS+LibWeb: Use GC::Weak instead of AK::WeakPtr for GC-allocated types
This makes some common types like JS::Object smaller (by 8 bytes) and
yields a minor speed improvement on many benchmarks.
2025-10-17 17:22:16 +02:00
Andreas Kling
25a5ed94d6 LibGC: Add GC::Weak<T> as an alternative to AK::WeakPtr<T>
This is a weak pointer that integrates with the garbage collector.
It has a number of differences compared to AK::WeakPtr, including:

- The "control block" is allocated from a well-packed WeakBlock owned by
  the GC heap, not just a generic malloc allocation.

- Pointers to dead cells are nulled out by the garbage collector
  immediately before running destructors.

- It works on any GC::Cell derived type, meaning you don't have to
  inherit from AK::Weakable for the ability to be weakly referenced.

- The Weak always points to a control block, even when "null" (it then
  points to a null WeakImpl), which means one less null check when
  chasing pointers.
2025-10-17 17:22:16 +02:00
Andreas Kling
127208f3d6 LibWeb: Move Document unregistration from EventLoop to finalizer
This ensure that it's not visible to event loops by the time we're
running destructors.
2025-10-17 17:22:16 +02:00
Callum Law
1a3635cda5 LibWeb: Parse the shape-margin property 2025-10-17 11:10:05 +01:00
Callum Law
9c7202e3f3 LibWeb: Parse the shape-image-threshold property 2025-10-17 11:10:05 +01:00
Callum Law
0e82ab2966 LibWeb: Define <opacity-value> as a ValueType
Since `<opacity-value>` is used across multiple properties it makes
sense to have it defined as a value.
2025-10-17 11:10:05 +01:00
Callum Law
01c5b6f74f LibWeb: Parse the shape-outside property 2025-10-17 11:10:05 +01:00
Callum Law
fb64be2f78 Tests: Import some css-shapes tests 2025-10-17 11:10:05 +01:00
Andreas Kling
383dd28217 LibWebView: Add CLI option to run with content filters disabled
Let's have a way to run all the JavaScript the web wants to give us.
This was previously available as a Debug menu option, and this makes
it available from process startup.
2025-10-17 11:24:57 +02:00
stelar7
ced862c460 LibWeb/IDB: Apply default cursor direction
IDBGetAllOptions is supposed to have a default value for direction.
When the value passed is not a potentially valid key range, we
need to default the direction argument, and not assume its set

Spec issue: https://github.com/w3c/IndexedDB/pull/478
2025-10-17 09:42:39 +02:00
Callum Law
cdbf4f49e1 LibWeb: Support '<zero>' in '<color-stop-angle>`
`<color-stop-angle> = [ <angle-percentage> | <zero> ]{1,2}` but we were
previously parsing instead as `<angle-percentage>{1,2}`.
2025-10-17 08:37:18 +01:00
Callum Law
cc2c8e8615 LibWeb: Resolve percentages in <angular-color-stop-list> as angles 2025-10-17 08:37:18 +01:00
Tim Ledbetter
62c00712fa LibWeb: Update HTMLScriptElement::prepare_script() spec text 2025-10-16 16:46:48 +02:00
Tim Ledbetter
24a7eac4ab LibWeb: Delay module script execution until current script has ended 2025-10-16 16:46:48 +02:00
Lorenz A
e73e0b3c92 LibWeb: Implement CSS decode bytes algo 2025-10-16 16:44:42 +02:00
aplefull
4b989b8efd LibRegex: Add support for forward references to named capture groups
This commit implements support for forward references to named capture
groups. We now allow patterns like \k<name>(?<name>x) and
self-references like (?<name>\k<name>x).
2025-10-16 16:37:54 +02:00
aplefull
25a47ceb1b LibRegex+LibJS: Include all named capture groups in source order
Previously, named capture groups in RegExp results did not always follow
their source order, and unmatched groups were omitted. According to the
spec, all named capture groups must appear in the result object in the
order they are defined, even if they did not participate in the match.
This commit makes sure we follow this requirement.
2025-10-16 16:37:54 +02:00
aplefull
c4eef822de LibRegex: Fix backreferences to undefined capture groups
Fixes handling of backreferences when the referenced capture group is
undefined or hasn't participated in the match.
CharacterCompareType::NamedReference is added to distinguish numbered
(\1) from named (\k<name>) backreferences. Numbered backreferences use
exact group lookup. Named backreferences search for participating
groups among duplicates.
2025-10-16 16:37:54 +02:00
Timothy Flynn
9b8f6b8108 RequestServer: Issue a network request for failed cached responses
If transferring a cached response body fails for any reason, we will now
issue a network request instead of failing the request outright.

The catch here is that we will have already transferred the response
code and headers to the client, and potentially some of the body. So we
attempt to only request the remaining data over the network using a
range request. This feels a bit sketchy, but this is also how Chromium
behaves.

However, the server may or may not support range requests. If they do,
we can expect an HTTP 206 response with the bytes we need. If not, we
will receive an HTTP 200 (assuming the request succeeded), along with
the entire object's body. In this case, we also behave like Chromium,
and internally drop number of bytes we had already transferred.
2025-10-16 09:06:48 -04:00
Timothy Flynn
fc9233f198 RequestServer: Delete unreadable cache files (for now)
If we are unable to pipe the response body from a cache file to the
client, let's take the extra safe approach of deleting the cache file
for now. We already remove the file if we weren't able to read its
metadata during initialization.
2025-10-16 09:06:48 -04:00
Jelle Raaijmakers
27cb5d8c1e CI: Switch Flatpak builds back temporarily to GitHub runners
Until Blacksmith runners enable redirect_dir, the flatpak builder
container is unable to install updates for packages in its system dirs.
2025-10-16 14:26:19 +02:00
Jelle Raaijmakers
188384710a CI: Remove options with default values from Flatpak build
No functional changes.
2025-10-16 14:26:19 +02:00
Zaggy1024
9cd0f9c445 LibMedia: Support BT.470 System B/G color primaries 2025-10-16 05:12:29 -05:00