Commit graph

5852 commits

Author SHA1 Message Date
Callum Law
1a5933cb04 LibWeb: Fail less when multiple mask images are defined
We don't yet support multiple images but we at least continue to use the
first rather than having none
2025-12-01 10:16:41 +00:00
Callum Law
5371862d11 LibWeb: Use correct play state for handling animations on display change
Previously we were doing a couple things wrong:
 - Using the cascaded rather than computed value (so we didn't support
   CSS-wide keywords)
 - Only supporting the case where we had one animation-play-state
2025-12-01 10:16:41 +00:00
Callum Law
1af0364cfc LibWeb: Store last_css_animation_play_state on anim instead of effect
Since it is the animation rather than the effect which has a play state
it makes more sense to store it here
2025-12-01 10:16:41 +00:00
Tete17
6a95506bb1 LibWeb: Update Dom spec now that TrustedTypes integration is merged 2025-12-01 09:54:04 +01:00
Tete17
42284f8006 LibWeb: Modify DomParser parseFromString to accept TrustedHTML
We made the internal changes to accept this new type, but we forgot to
expose it.
2025-12-01 09:54:04 +01:00
Tete17
901afee50b LibWeb: Implement slot validation for HTMLScriptElement
This should be the last section missing in the TrustedType spec.
2025-12-01 09:54:04 +01:00
Tete17
1d1182cad8 LibWeb: Update get_trusted_type_data_for_attribute according to the spec
It now takes into consideration the namespace of the element to decide
if it needs a TrustedType or not.

We also win a few WPT subtests :)
2025-12-01 09:54:04 +01:00
Tete17
d601badd6c LibWeb: Fix east constness 2025-12-01 09:54:04 +01:00
Tete17
7ec9779624 LibWeb: Update links to algorithms
The spec doesn't consider them abstract operations anymore
2025-12-01 09:54:04 +01:00
Lorenz A
7260159b8f LibWeb: Add loading event to style element 2025-11-30 19:22:02 +01:00
InvalidUsernameException
ce2c4a3417 LibGfx+LibWeb: Fix compile errors in clang-cl from recent header cleanup
The recent commits 28ba610f32 and
70c4ed261f adjusted some include
directives to avoid excessive recompilation when changing some header
files. This has broken compilation with clang-cl on Windows without
getting noticed before the PRs were merged.
2025-11-30 08:45:29 -05:00
Sam Atkins
6ca69d9e26 LibWeb/Layout: Spec-comment Table "algorithm for processing rows"
Some of this is rearranged for clarity, but it's mostly the exact same
code. Steps 3, 10, 11, and 15 are new, but don't have any effect until
we implement downward-growing cells.
2025-11-30 11:48:14 +01:00
Sam Atkins
2af63149ec LibWeb/HTML: Resolve/reject apiMethodTracker before dispatching events
Corresponds to:
93634aed57

The current live spec has been rearranged since this went in, so that
these steps are no longer located here. But that's a much larger change
that I don't want to implement right now. See here:
e09d10202d

While I was at it, I also made use of extract_error_information() to
populate the ErrorEvent.
2025-11-30 11:47:10 +01:00
Sam Atkins
c1e4024eca LibWeb/HTML: Split out "abort a NavigateEvent" method
I missed where this change happened in the spec. The second half of
abort_the_ongoing_navigation() becomes a separate method, which is
slightly rearranged. I've placed this in Navigation instead of
NavigateEvent because of how many steps poke at the Navigation's
internals.

The text here includes the amendments I made in
https://github.com/whatwg/html/pull/11967 to correct a variable name.

A bonus is that we now actually populate the ErrorEvent instead of
leaving it blank.
2025-11-30 11:47:10 +01:00
Sam Atkins
218e646e72 LibWeb/HTML: Extract ErrorInformation struct into its own files
This is used from a few different places in the spec.
2025-11-30 11:47:10 +01:00
Timothy Flynn
2453f0bc04 LibHTTP+LibWeb: Use LibHTTP's cache implementation in LibWeb
There are a couple of remaining RFC 9111 methods in LibWeb's Fetch, but
these are currently directly tied to the way we store GC-allocated HTTP
response objects. So de-coupling that is left as a future exercise.
2025-11-29 08:35:02 -05:00
InvalidUsernameException
88c4814de6 LibGfx+LibWeb: Extract bitmap-to-buffer conversion into LibGfx
This factors the conversion logic to be independent from WebGL code,
allowing us to write unit tests for it that can run in CI (since WebGL
can't run in CI).
2025-11-28 18:32:48 +01:00
InvalidUsernameException
7c315ef67f Everywhere: Unify naming of RGBA-like colors
The `Bitmap` type was referring to to its internal pixel format by a
name that represents the order of the color components as they are layed
out in memory. Contrary, the `Color` type was using a naming that where
the name represents the order of the components from most to least
significant byte when viewed as a unsigned 32bit integer. This is
confusing as you have to keep remembering which mental model to use
depending on which code you work with.

To unify the two, the naming of RGBA-like colors in the `Color` type has
been adjusted to match the one from the Bitmap type. This seems to be
generally in line with how web APIs think about these types:
* `ImageData.pixelFormat` can be `rgba-8unorm` backed by a
  `Uint8ClamedArray`, but there is no pixel format backed by a 32bit
  unsigned type.
* WebGL can use format `RGBA` with type `UNSIGNED_BYTE`, but there is no
  such format with type `UNSIGNED_INT`.

Additionally, it appears that other browsers and browser-adjacent
libraries also think similarly about these types:
* Firefox:
  https://github.com/mozilla-firefox/firefox/blob/main/gfx/2d/Types.h
* WebKit:
  https://github.com/WebKit/WebKit/blob/main/Source/WebCore/platform/graphics/PixelFormat.h
* Skia:
  https://chromium.googlesource.com/skia/+/refs/heads/main/include/core/SkColorType.h

This has the not so nice side effect that APIs that interact with these
types through 32bit unsigned integers now have the component order
inverted due to little-endian byte order. E.g. specifying a color as hex
constant needs to be done as `0xAABBGGRR` if it is to be treated as
RGBA8888.

We could alleviate this by providing endian-independent APIs to callers.
But I suspect long-term we might want to think differently about bitmap
data anyway, e.g. to better support HDR in the future. However, such
changes would be more involved than just unifying the naming as done
here. So I considered that out of scope for now.
2025-11-28 18:32:48 +01:00
InvalidUsernameException
28ba610f32 Everywhere: Avoid large rebuilds when editing (Immutable)Bitmap headers
This reduces the number of recompiled files as follow:
- Bitmap.h: 1309 -> 101
- ImmutableBitmap.h: 1218 -> 75
2025-11-28 18:32:48 +01:00
Callum Law
63538c8a75 LibWeb: Prefer transitioned property values over important
CSS transitions have a higher precedence in the cascade than important
properties
2025-11-28 16:15:49 +00:00
Callum Law
9afb523be3 LibWeb: Remove unnecessary parse_list_of_time_values function
We can achieve the same thing by using
`parse_simple_comma_separated_value_list`
2025-11-28 16:15:49 +00:00
Callum Law
b0ab94c00c LibWeb: Allow multiple values for transition-behavior 2025-11-28 16:15:49 +00:00
Callum Law
9de4e3a0eb LibWeb: Avoid resetting important flag when recomputing inherited style
We were missing the important flag here so would always reset it to
false
2025-11-28 16:15:49 +00:00
Callum Law
9d2ecc069f LibWeb: Invalidate less in recompute_inherited_style
We only need to consider the change in the value that is actually used,
not the animated and non-animated values individually
2025-11-28 16:15:49 +00:00
Callum Law
9d49fcc87b LibWeb: Dont overwrite animated values in recompute_inherited_style
Previously we assumed that if the non-animated value was inherited then
the animated value must be also which is not true.
2025-11-28 16:15:49 +00:00
Callum Law
a984ff4f58 LibWeb: Replace use of Optional<NonnullRefPtr> with RefPtr 2025-11-28 16:15:49 +00:00
Callum Law
70c4ed261f LibWeb: Reduce the number of headers CSS Parser.h is included in
Reduces the rebuild required when editing this file
2025-11-28 16:15:49 +00:00
Callum Law
8a197b7ee5 LibWeb: Produce correct resolved value for animation-duration 2025-11-28 13:24:11 +00:00
Callum Law
c8d91c127e LibWeb: Parse view() for the animation-timeline CSS property 2025-11-28 13:24:11 +00:00
Callum Law
7d70714eac LibWeb: Parse scroll() for the animation-timeline CSS property 2025-11-28 13:24:11 +00:00
Callum Law
5bbcd0a48f LibWeb: Parse the animation-timeline CSS property 2025-11-28 13:24:11 +00:00
Callum Law
d79aba68d2 LibWeb: Allow reset-only longhands in coordinating value list shorthands
Required for `animation-timeline` and the various `animation-trigger-*`
properties within the `animation` coordinating value list
2025-11-28 13:24:11 +00:00
Callum Law
6bb7224f4e LibWeb: Parse the view-timeline shorthand CSS property
The remaining failing tests in view-timeline-shorthand.html are due to
either:
 a) incorrect tests, see web-platform-tests/wpt#56181 or;
 b) a wider issue where we collapse coordinating value list longhand
properties to a single value when we shouldn't.
2025-11-28 13:24:11 +00:00
Callum Law
e093c76eea LibWeb: Parse the view-timeline-inset CSS property 2025-11-28 13:24:11 +00:00
Callum Law
21ff35691a LibWeb: Parse the view-timeline-axis CSS property 2025-11-28 13:24:11 +00:00
Callum Law
d9d3e66197 LibWeb: Parse the view-timeline-name CSS property 2025-11-28 13:24:11 +00:00
Callum Law
13ce2d1857 LibWeb: Parse the scroll-timeline shorthand CSS property
The remaining failing tests in scroll-timeline-shorthand.html are due to
either:
 a) incorrect tests, see web-platform-tests/wpt#56181 or;
 b) a wider issue where we collapse coordinating value list longhand
properties to a single value when we shouldn't.
2025-11-28 13:24:11 +00:00
Callum Law
992b0a4dc6 LibWeb: Parse the scroll-timeline-axis CSS property 2025-11-28 13:24:11 +00:00
Callum Law
e95f326f3d LibWeb: Parse the scroll-timeline-name CSS property 2025-11-28 13:24:11 +00:00
Callum Law
826e947920 LibWeb: Propagate 'auto' value of animation-duration
Avoids a crash when `animation-duration` was `auto`
2025-11-28 13:24:11 +00:00
Tete17
c790de24dd LibWeb: Implement encapsulateBits method for SubtleCrypto
None of the current algorithms supports the method but the future
post quantum algorithms will do so.
2025-11-27 21:50:06 +01:00
Tete17
b36a702ad1 LibWeb: Implement encapsulateKey method for SubtleCrypto
None of the current algorithms supports the method but the future
post quantum algorithms will do so.
2025-11-27 21:50:06 +01:00
Tete17
42f55c7c97 LibWeb: Implement Encapsulate(Key|Bits) dictionaries
These are needed structure for the encapsulate(Key|Bits) operations.
2025-11-27 21:50:06 +01:00
Tete17
1d6a64b26c LibWeb: Update the Key Usage enum to adapt for PostQuantum Algorithms 2025-11-27 21:50:06 +01:00
Daniel Price
b0c48b961e LibWeb: Check that import map elements are ordered maps (json objects) 2025-11-27 14:15:33 -06:00
Undefine
c01f0e537e LibWeb: Clear m_current_program when the program gets deleted 2025-11-27 19:19:54 +01:00
Undefine
b0fcb35134 LibWeb: Implement WebGL getParameter(GL_VERTEX_ARRAY_BINDING) 2025-11-27 19:19:54 +01:00
Undefine
f373ab7011 LibWeb: Bind WebGL uniform locations to their respective program
The spec mandates that each uniform location object only gets used with
the program it was created with.
2025-11-27 19:19:54 +01:00
Undefine
7d6212ae71 LibWeb: Ensure WebGL buffers don't mix between index and other data
The spec mandates that a buffer during its lifetime can only get bound
to either an index buffer or any other type.
2025-11-27 19:19:54 +01:00
Sam Atkins
85478c9215 LibWeb/HTML: Rename popover "invoker"
Lots of renames, no behaviour differences. (Apart from the rename of the
IDL type, which does of course affect JS.)

Corresponds to:
16cb7808da
2025-11-27 16:44:51 +00:00