Commit graph

73220 commits

Author SHA1 Message Date
Sam Atkins
d717dd64b3 LibWeb: Make Animation's owning element an AbstractElement
From the spec:
> The owning element of a transition refers to the element or
  pseudo-element to which the transition-property property was applied
  that generated the animation.

https://drafts.csswg.org/css-transitions-2/#owning-element

Previously we only stored the element.
2025-12-03 13:29:51 +01:00
Sam Atkins
b61c857c64 LibWeb/CSS: Use AbstractElement animation helpers 2025-12-03 13:29:51 +01:00
Sam Atkins
dacc64cb8b LibWeb/DOM: Add animation helpers to AbstractElement 2025-12-03 13:29:51 +01:00
Sam Atkins
ba86b81c1a LibWeb/Animations: Make KeyframeEffect work with AbstractElements 2025-12-03 13:29:51 +01:00
Andreas Kling
05e449d32a LibCore: Simplify how we calculate processed event count 2025-12-03 13:26:27 +01:00
Andreas Kling
25764fbc54 LibCore: Remove debug logging about pending promise count
This wasn't really achieving anything other than occasionally confusing
people into thinking our JS promise system was broken.
2025-12-03 13:26:27 +01:00
Andreas Kling
cebc4d00dd LibCore: Remove ability to post heap-allocated Core::Event objects
We no longer need this API since all clients have been converted to
simply posting the Core::Event::Type (or a callback function).
2025-12-03 13:26:27 +01:00
Andreas Kling
2a1c5dc108 LibCore: Don't require heap-allocated event to hold deferred invocation
Instead of creating a DeferredInvocationEvent every time we
deferred_invoke, we now let the QueuedEvent store the invokee Function
object directly.
2025-12-03 13:26:27 +01:00
Andreas Kling
69515f8c85 LibCore: Allow posting stateless events without heap-allocated Event
This patch adds an API for posting a Core::Event::Type to the thread
event queue without requiring a full Core::Event object.

We use this API to avoid heap allocations for every timer and notifier
activation event.
2025-12-03 13:26:27 +01:00
Andreas Kling
23fb9781d1 LibCore: Avoid excessive ref-count churn in event dispatch
We were strongly reffing the event receiver twice before actually
invoking the event handlers.
2025-12-03 13:26:27 +01:00
Andreas Kling
fa85f62895 LibCore: Remove unused Core::Event::Type::Quit 2025-12-03 13:26:27 +01:00
Timothy Flynn
96806a3f90 LibWeb: Update cursor and tooltip UI state regardless of event handlers
If a script on the page cancels a mousemove event, we would return early
and neglect to update the cursor. This is seen regularly on "Diablo Web"
where they set the cursor to "none" on the main canvas, and also cancel
mousemove events.
2025-12-03 12:23:56 +01:00
Timothy Flynn
612558144b LibGfx: Add a stringifier for StandardCursor 2025-12-03 12:23:56 +01:00
Timothy Flynn
dcf8463886 LibGfx: Remove unused StandardCursor::__Count 2025-12-03 12:23:56 +01:00
Timothy Flynn
c7b3a4fcf8 LibJS: Implement Iterator.concat
This proposal reached stage 4 and was merged into ECMA-262. See:
aefd096
2025-12-03 12:08:40 +01:00
Timothy Flynn
7ee415a7c2 LibJS: Directly indicate when the IteratorHelper generator is complete
Our existing implementation was checking if the generator step result
was `undefined` to indicate that the generator is complete. This is
not sufficient for an upcoming implementation of Iterator.concat, where
`undefined` is used as an incomplete iteration result.

Instead, let's have the Iterator prototype return an IterationResult to
explicitly indicate its completeness. As a result, the prototype also
looks more like the spec now.
2025-12-03 12:08:40 +01:00
Timothy Flynn
6976ff389e LibJS: Mark IteratorHelper::create as infallible
This is just allocating an IteratorHelper. There is no way for this to
throw an exception.
2025-12-03 12:08:40 +01:00
Timothy Flynn
e011f8d6b1 LibJS: Replace [[UnderlyingIterator]] with [[UnderlyingIterators]]
This is an editorial change in the EMCA-262 spec. See:
c541680
2025-12-03 12:08:40 +01:00
Timothy Flynn
557805d6ef LibJS: Compute byteIndexInBuffer sooner in Atomic's DoWait
This is a normative change in the ECMA-262 spec. See:
4d2116b

Note this does not yet affect us as we do not implement the remainder of
this AO.
2025-12-03 12:08:40 +01:00
Timothy Flynn
b060d5dcdf LibJS: Fix typo in ResolveExport assertion
This is an editorial change in the ECMA-262 spec. See:
29c5b17
2025-12-03 12:08:40 +01:00
Zaggy1024
b572ae95a9 LibCore+LibWeb: Remove the dummy EventReceiver from deferred_invoke()
The DeferredInvocationContext only existed to satisfy the requirement
in ThreadEventQueue that each event has an EventReceiver. However,
deferred_invoke() was not even using the EventReceiver to call its
callback. Therefore, we don't need to allocate one for every deferred
invocation.

This also prevents WeakPtr::strong_ref() from racing and leaking the
context object when invoking a function across threads.
2025-12-02 21:21:03 -06:00
Zaggy1024
970100e789 LibMedia: Pass SeekData by reference to avoid an inexplicable leak
For some reason, it seems that passing NonnullRefPtr<SeekData> const&
was causing us to triple ref() in the capture group for the audio seek
handlers, followed by only a single unref(). Changing this to plain old
SeekData& inexplicably fixes the leak.
2025-12-02 17:19:44 -06:00
Callum Law
e935dfbf5b LibWeb: Simplify compute_style_value_list 2025-12-02 12:47:10 +00:00
Callum Law
38efc39e17 LibWeb: Simplify assemble_coordinated_value_list
We know that all coordinated value list longhands are parsed as
`StyleValueList`s
2025-12-02 12:47:10 +00:00
Callum Law
74e6c5074f LibWeb: Store list-valued properties as lists in StylePropertyMap::set()
This matches the behavior of parsed values
2025-12-02 12:47:10 +00:00
Callum Law
953f9775a4 LibWeb: Mark animation-* properties as list-valued 2025-12-02 12:47:10 +00:00
Callum Law
758432c1cd LibWeb: Don't mark mask-type as list-valued
This is distinct from the other `mask-*` properties and is not a
longhand of `mask`, and is thus not a coordinating value list longhand
2025-12-02 12:14:27 +00:00
Callum Law
4034ce995a LibWeb: Account for transition-{delay,duration} always being a list
This fixes the optimization implemented in 46acdbd that was no longer
working after e937f5d
2025-12-02 11:45:46 +00:00
Callum Law
d7d4f90a2c LibWeb: Update style attribute when calling attributeStyleMap.set()
We also now invalidate the element
2025-12-02 11:37:11 +00:00
Timothy Flynn
4e79d86d03 LibWebView: Enable the HTTP disk cache by default
This enables the disk cache and flips the related command line flag to
allow disabling it. We've reached a point where it works well, so this
will let us get more mileage on it.
2025-12-02 12:19:42 +01:00
Timothy Flynn
aae8574d25 LibHTTP: Place HTTP disk cache log points behind a debug flag
These log points are quite verbose. Before we enable the disk cache by
default, let's place them behind a debug flag.
2025-12-02 12:19:42 +01:00
Timothy Flynn
adcf5462af LibWeb+WebContent: Rename the http-cache flag to http-memory-cache
Rather than having http-cache and http-disk-cache, let's rename the
former to http-memory-cache to be extra clear what we are talking about.
2025-12-02 12:19:42 +01:00
Sam Atkins
b376ab4e81 LibWeb/CSS: Serialize Supports::Declaration as original representation
Fixes some WPT tests that expected `supports(foo:bar)` to serialize as
`supports(foo:bar)`, instead of `supports(foo: bar)` with a space
between.

Reading the original_full_text directly also lets us delete
Declaration::to_string(), which was only used here.
2025-12-02 09:49:23 +00:00
Sam Atkins
db910c68a3 LibWeb/CSS: Add option to retain a Declaration's full source text
This will be needed by Supports, which expects declarations to serialize
verbatim.
2025-12-02 09:49:23 +00:00
Sam Atkins
a8d0be4382 LibWeb/CSS: Expose consumed tokens from TokenStream
In some situations we want to examine a sequence of tokens that have
been already consumed from a TokenStream. These methods let us do so:
- current_index() provides the current internal token index
- tokens_since() provides a span from the given index to the current one
2025-12-02 09:49:23 +00:00
Sam Atkins
8d5eac28a4 LibWeb/CSS: Rename Declaration.original_text -> original_value_text
Otherwise this will conflict with a different original text that I'm
about to add.
2025-12-02 09:49:23 +00:00
Sam Atkins
faba11f33c LibWeb/CSS: Pull out Supports::Declaration parsing
Avoid repeating this in two places.
2025-12-02 09:49:23 +00:00
Sam Atkins
4ed1c56267 LibWeb/CSS: Parse all supports features in @import supports()
The previous implementation assumed that the contents of `supports()`
was either a raw declaration, or a block containing some number of them.
This meant we wouldn't parse things like `supports(not (a:b))` or
`supports(selector(*))`.

`parse_a_supports()` actually does what we want in every case except for
raw declarations (`supports(a: b)`), so let's always call it first, and
then fall back to parsing a single declaration.
2025-12-02 09:49:23 +00:00
Sam Atkins
d9abfdf2ab LibWeb/CSS: Allow non-StyleValueLists in animation properties
Reverts 51f694c6af and
b52beb5105.

The animation-* properties are in an awkward place currently, where
they *should* be lists, and a lot of our code acts as if they are, but
actually we parse them as single values. The above commits caused a few
WPT tests to crash - see link below. I've imported one of them to
prevent future regressions.
https://wpt.fyi/results/css/css-typed-om/the-stylepropertymap/properties?diff&filter=ADC&run_id=6293362870321152&run_id=5123272984494080
2025-12-02 09:48:32 +00:00
Andreas Kling
4d27e9aa5e LibWeb: Make setInterval() reuse the timer to reduce drift
Instead of creating a new single-shot timer every time a setInterval
timer reschedules itself, we now use a repeating Core::Timer internally.

This dramatically reduces timer drift, since the next timeout is now
based on when the timer fired, rather than when the timer callback
completed (which could take arbitrarily long since we run JS).

It's not perfect, but it's a huge improvement and allows us to play
DiabloWeb at full framerate (20 fps).
2025-12-01 19:58:47 +01:00
InvalidUsernameException
fb9286eccb LibWeb: Apply clip frames even when transformation is identity
Clip frames for overflow were applied based on whether the box in
question had a non-identity matrix transformation associated with it.
That however is not correct, since specifying a no-op transform like
`scale(1)` still needs to apply clip overflow rectangles. So instead we
need to check whether the element associated with the box in question
has any CSS transforms.

This appears to have been a regression from
9bbc1cd618 and effectively reverts that
commit, but keeps its effect by unifying on the check for CSS transforms
instead.

This fixes some background boxes being rendered for the invisible items
of the carousels on https://computerbase.de/.
2025-12-01 17:46:44 +01:00
InvalidUsernameException
a08c175da2 LibWeb: Display clip rectangles when dumping display list 2025-12-01 17:46:44 +01:00
Timothy Flynn
005e965380 LibCore+RequestServer: Return size_t from system read/write functions
The system uses ssize_t so it can return -1 in case of an error. But in
our case, we will transform that to an AK::Error, thus we never return
-1. Let's return size_t instead.
2025-12-01 16:29:48 +01: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
Andreas Kling
99bef81d09 LibJS: Fast path for TypedArray.slice()
We now try to do a bulk memcpy() when possible. This is significantly
faster than going byte-at-a-time.
2025-12-01 15:12:52 +01:00
Andreas Kling
94fc8c47c0 LibIPC: Decode Vector<T> in one swoop for trivial arithmetic types
This avoids having the CPU churn through the vector one little integer
at a time.
2025-12-01 15:12:52 +01:00
Andreas Kling
4d7d8aa827 LibJS: Allow fast conversions between Uint8Array and Uint8ClampedArray
These two typed array kinds have the same exact underlying data type and
differ only in how assignment works.

We can allow them to take the fast paths for same-type conversions.
2025-12-01 15:12:52 +01:00
Andreas Kling
096eddfd5a LibIPC: Encode spans of trivial arithmetic types more efficiently
For stuff like Span<u8>, we should obviously grow the message buffer
once, and then copy all the bytes in one go.
2025-12-01 15:12:52 +01:00
Andreas Kling
1c45930767 LibWeb+LibWebView+LibRequests: Reduce dependency on LibIPC includes
Let's try to include the IPC encoder/decoder stuff in fewer headers
to make rebuilds more pleasant when editing these files.
2025-12-01 15:12:52 +01:00
Sam Atkins
62d7011f45 LibWeb/HTML: Update worker construction spec steps
This is largely editorial. One behaviour change is that events are now
sent from a global task on the DOMManipulation task source.

Somewhat awkwardly, the spec refers to `this` before the Worker exists.
As it's for getting the relevant global object / settings object, I've
had to work around that.

Corresponds to:
917c2f6a73
2025-12-01 15:02:27 +01:00