73242 Commits

Author SHA1 Message Date
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
Timothy Flynn
edac716e91 LibCore: Support HTTP disk caching on Windows
This implements Core::System::transfer_file_through_pipe for Windows
(which is actually a socket, not a pipe). This let's us enable the
HTTP disk cache.
2025-12-01 08:55:33 -05:00
Timothy Flynn
079a2ba36a LibCore+RequestServer: Implement Core::System::send on Windows 2025-12-01 08:55:33 -05:00
Timothy Flynn
85fd4d5ea1 LibCore: Accept ReadonlyBytes/Bytes in System::send/recv
Instead of passing in a pointer+size, let's use safer AK types.
2025-12-01 08:55:33 -05:00
Tim Ledbetter
e9519b132f Base: Use the correct memory unit suffixes in about::processes
Previously the GB suffix was displayed as BB.
2025-12-01 07:30:23 -05:00
Lorenz A
b579608d41 Meta: Remove unused function check_program_version_at_least
The function `check_program_version_at_least` was only used in
`ladybird.sh`, which was removed in PR #4904.
2025-12-01 13:02:53 +01:00
Timothy Flynn
90525f7e97 LibCore: Define SocketAddress out-of-line to remove SocketAddressWindows
SocketAddressWindows.h contains a bunch of copy-pasted Windows
definitions. This started causing ad-nauseam redefinition errors when
implementing the HTTP disk cache for Windows.

Instead, let's forward-declare the types we can in SocketAddress.h and
only define the couple of constants that we need. We can then assert at
compile-time that we defined them correctly.
2025-12-01 06:34:32 -05:00
Timothy Flynn
5c88c3718b LibCore: Do not include SocketAddressWindows.h in System.h
SocketAddressWindows.h contains (re)definitions of a bunch of system-
level types. This leads to a bunch of conflicts when trying to include
proper Windows headers in SystemWindows.cpp. This patch removes this
inclusion and just forward-declares the couple of types we need.
2025-12-01 06:34:32 -05:00
Timothy Flynn
2d22ef0db5 LibCore: Move AddressInfoVector to its own file
By defining this class entirely in the System.h header, we are relying
on ::freeaddrinfo being available. This has led to us polluting the
System.h header with system-level definitions on Windows by way of
SocketAddressWindows.h.
2025-12-01 06:34:32 -05:00
Sam Atkins
cdc81e8921 LibWeb/CSS: Add -moz-appearance property alias 2025-12-01 11:10:13 +00:00
Sam Atkins
d5d1b5351e LibWeb: Hide stepper buttons on appearance: textfield number inputs
The spec says:

> For the purpose of this specification, they all have the same effect
  as auto. However, the host language may also take these values into
  account when defining the native appearance of the element.

https://drafts.csswg.org/css-ui/#typedef-appearance-compat-special

Firefox at least hides the stepper buttons when this is set.
2025-12-01 11:10:13 +00:00
Sam Atkins
c3d23a2487 LibWeb/HTML: Clone integrity policy when cloning policy container
Corresponds to:
3c6cb6c0c5
2025-12-01 11:07:16 +00:00
Sam Atkins
b3d9ffdfce LibWeb/HTML: Update ImageRequest::prepare_for_presentation spec steps
Corresponds to:
ad281924e2

We don't implement this at all yet, it's still just FIXMEs.
2025-12-01 11:07:16 +00:00
Sam Atkins
573d5362f4 LibWeb/HTML: Add FIXMEs to honor WebDriver BiDi emulated language
Corresponds to:
547f8044b0

We currently don't follow the spec for these language getters, and the
BiDi changes are still ongoing, so it seems better to leave a FIXME for
them rather than try to make any changes right now.
2025-12-01 11:07:16 +00:00
Sam Atkins
c8990697d1 LibWeb: Add FIXME for moving "stop parsing" step for error documents
Corresponds to:
48cd393d1e

Actually doing so was causing crashes and other issues, so I'll leave it
as a FIXME for later.
2025-12-01 11:07:16 +00:00
Sam Atkins
2feff2b519 LibWeb/HTML: Capitalize autocorrection and autocapitalization states
Only comment changes.

Corresponds to:
ea29ce1963
2025-12-01 11:07:16 +00:00
Sam Atkins
c0b8f47a76 LibWeb/HTML: Move connectedness check for script post_connection()
Corresponds to:
905384d140

Also import the test added along with that change.
2025-12-01 11:07:16 +00:00
Sam Atkins
5179c57ca0 LibWeb/DOM: Use Document::make_unsalvageable()
Noticed because of this spec change:
e2974bd884

I then went and updated the other places it should be used.
2025-12-01 11:07:16 +00:00
Sam Atkins
04f1dbce2e LibWeb/HTML: Update BroadcastChannel::is_eligible_for_messaging() spec
Corresponds to part of:
e9ccb97eb1

The majority of that spec change is in algorithms that we don't yet
implement. So this is just a small text change and an update to use
as_if() instead of static_cast().
2025-12-01 11:07:16 +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
Sam Atkins
d2b261d28e LibWeb/DOM: Update references to ancestor revealing algorithms
No behaviour changes, because we don't yet implement the actual
algorithm.

Corresponds to:
55baf054d2
2025-12-01 11:07:16 +00:00
Sam Atkins
15583040df LibWeb/DOM: Add FIXMEs for new spec steps in respond_to_base_url_changes
Corresponds to part of
49f5cd381e

(Apparently I missed this when previously looking at that spec PR.)
2025-12-01 11:07:16 +00:00
Sam Atkins
f81bb1bd8c LibWeb/CSS: Absolutize GradientStyleValues
This lets us not care about non-absolute Length units when resolving
gradient data, as they'll already have been converted to px.

We can also use Angle::from_style_value() safely on absolutized angles,
which reduces some boilerplate code.
2025-12-01 11:01:06 +00:00
Sam Atkins
fbe0567f90 LibWeb/CSS: Store RadialGradientStyleValue sizes as StyleValues
No significant consequences of this, but it'll make it easier to
absolutize these values.
2025-12-01 11:01:06 +00:00
Sam Atkins
d327f677c5 LibWeb/CSS: Store linear-gradient() angle as a StyleValue
This means we now support calc() there too.
2025-12-01 11:01:06 +00:00
Sam Atkins
73fbaaba77 LibWeb: Store GradientStyleValue color-stop positions as StyleValues
A few things fall out of this:
- We no longer need to templatize our color-stop list types.
- A bit more code is required to resolve gradient data.

This results in a slightly different rendering for a couple of the test
gradients, with a larger difference between macOS and Linux. I've
expanded the fuzziness factor to cover for it.
2025-12-01 11:01:06 +00:00
Sam Atkins
71397c876c Tests: Import gradient interpolation test
Importing separately to make progress easier to see.
2025-12-01 11:01:06 +00:00
Callum Law
12e8f503aa LibWeb: Support non-fixed <random-value-sharing>
This works by generating random values using XorShift128PlusRNG at
compute time and then caching them on the document using the relevant
random-caching-key
2025-12-01 11:00:33 +00:00
Callum Law
86e6aa0291 LibWeb: Keep track of random function index within property value
Caching keys for 'auto' <random-value-sharing> rely on this value to
distinguish between two random functions in a single property
2025-12-01 11:00:33 +00:00