Commit graph

73157 commits

Author SHA1 Message Date
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
Callum Law
bad9efac22 LibWeb: Support CSS random() function step argument 2025-12-01 11:00:33 +00:00
Callum Law
2a5e389f63 LibWeb: Implement basic CSS random() function
At the moment this is limited to only fixed value sharing and does not
support step values
2025-12-01 11:00:33 +00:00
Callum Law
8944130fde LibWeb: Serialize CSS::Number to spec
We were previously serializing with 5 instead of 6 digits of precision
2025-12-01 11:00:33 +00:00
Callum Law
76108b1979 LibWeb: Update math function argument parsing to use TokenStream
This brings us in line with the rest of the parsing methods
2025-12-01 11:00:33 +00:00
Callum Law
1f7fe97ac3 LibJS/AK: Move XorShift128PlusRNG to AK
This will be useful for CSS random functions so it should be in a
reusable place.

This does require us to use `AK::get_random` instead of
`Crypto::get_secure_random`, but this is fine since the latter is in the
process of being removed (see #6564).
2025-12-01 11:00:33 +00:00
Callum Law
6d9f10ba36 LibWeb: Support nullable arguments to CSS math functions
All existing arguments have defaults but this isn't always the case
(e.g. the step argument for `random()`)
2025-12-01 11:00:33 +00:00
Callum Law
65512f5403 LibWeb: Import CSS random function tests 2025-12-01 11:00:33 +00:00
Callum Law
cd0976395a LibWeb: Remove unused class in CSS parser 2025-12-01 11:00:33 +00:00
Callum Law
2477a8eb0d LibWeb: Use property_initial_value rather than hardcoded default value 2025-12-01 10:16:41 +00:00
Callum Law
d6371fe896 LibWeb: Simplify parse_coordinating_value_list_shorthand 2025-12-01 10:16:41 +00:00
Callum Law
51f694c6af LibWeb: Simplify compute_style_value_list 2025-12-01 10:16:41 +00:00
Callum Law
3ab0bdf4fd LibWeb: Simplify handling of unicode-range descriptor
We know that this is always a `StyleValueList`
2025-12-01 10:16:41 +00:00
Callum Law
47bed173b4 LibWeb: Simplify ComputedProperties::will_change()
We know that `will-change` parses as either `Keyword::Auto` or
`StyleValueList`
2025-12-01 10:16:41 +00:00
Callum Law
b52beb5105 LibWeb: Simplify assemble_coordinated_value_list
We know that all coordinated value list longhands are parsed as
`StyleValueList`s
2025-12-01 10:16:41 +00:00
Callum Law
e8ba1b4fdf LibWeb: Simplify serialization of coordinating value list shorthands
We know that longhand values are always `StyleValueList`s

Introduces a new fail in the `view-timeline-shorthand.html` WPT test
but this is because the test is incorrect and we now correctly don't
contract when `view-timeline-inset` has dissimilar cardinality. See
web-platform-tests/wpt#56181
2025-12-01 10:16:41 +00:00
Callum Law
11a9b5a67b LibWeb: Simplify handling of font-family
We know `parse_comma_separated_value_list` always returns a
`StyleValueList`
2025-12-01 10:16:41 +00:00
Callum Law
0595d52be2 LibWeb: Simplify handling of {text,box}-shadow
We know that shadow values are always parsed as a `KeywordStyleValue`
with `Keyword::None` or a `StyleValueList`
2025-12-01 10:16:41 +00:00
Callum Law
4c4fa5c9cd LibWeb: Simplify expansion of background-position shorthand
We know that this is always a `StyleValueList`
2025-12-01 10:16:41 +00:00
Callum Law
40596d5b99 LibWeb: Simplify getting resolved value for animation-duration
We now know that `animation_duration_computed_value` is always a
StyleValueList
2025-12-01 10:16:41 +00:00
Callum Law
e937f5db57 LibWeb: Always parse comma separated value lists as StyleValueList
Previously we would either parse these as `StyleValueList<T>` or `T`
depending on whether or not there was more than one value, this meant we
always had to handle both cases anywhere we used these values.
2025-12-01 10:16:41 +00:00
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
Rocco Corsi
11dc254d27 LibJS: Add missing internal object string printing for debugging
When testing with JS_BYTECODE_DEBUG macro defined or using the All_Debug
profile, internal objects were not known in Value class to the function
Value::to_string_without_side_effects leading to a VERIFICATION FAILED
when running the test-js or test-web programs.

Internal objects are known in the Value class as cells, and do not have
a dedicated tag to identify them. Internal objects are detected using
is_cell function call, but only after all other types have been
checked as other types of non-internal objects can also be cells.

Both the String and Utf16String version of the function were updated.
2025-11-30 19:22:46 +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
Luke Wilde
0eceee0a05 LibJS: Replace Array.fromAsync with a native JavaScript implementation
This allows us to use the bytecode implementation of await, which
correctly suspends execution contexts and handles completion
injections.

This gains us 4 test262 tests around mutating Array.fromAsync's
iterable whilst it's suspended as well.

This is also one step towards removing spin_until, which the
non-bytecode implementation of await uses.

```
Duration:
     -5.98s

Summary:
    Diff Tests:
        +4     -4 

Diff Tests:
    [...]/Array/fromAsync/asyncitems-array-add-to-singleton.js  -> 
    [...]/Array/fromAsync/asyncitems-array-add.js               -> 
    [...]/Array/fromAsync/asyncitems-array-mutate.js            -> 
    [...]/Array/fromAsync/asyncitems-array-remove.js            -> 
```
2025-11-30 11:54:54 +01:00
Luke Wilde
a63b0cfaba LibJS: Introduce NativeJavaScriptBackedFunction
This hosts the ability to compile and run JavaScript to implement
native functions. This is particularly useful for any native function
that is not a normal function, for example async functions such as
Array.fromAsync, which require yielding.

These functions are not allowed to observe anything from outside their
environment. Any global identifiers will instead be assumed to be a
reference to an abstract operation or a constant. The generator will
inject the appropriate bytecode if the name of the global identifier
matches a known name. Anything else will cause a code generation error.
2025-11-30 11:54:54 +01:00
Luke Wilde
899c6ebffc LibJS: Make stored realm in NativeFunction non-null
We now always have a realm for NativeFunction, which allows removing an
old hack in internal_call and internal_construct.
2025-11-30 11:54:54 +01:00