Commit graph

70961 commits

Author SHA1 Message Date
Callum Law
70cb8d23fb Tests: Import/create tests related to absolutization of StyleValues
Done in a separate commit to show progress
2025-08-06 17:44:12 +01:00
Callum Law
c8bd58c0ba LibWeb: Add method to absolutize CalculatedOr 2025-08-06 17:44:12 +01:00
Callum Law
0df9c225aa LibWeb: Add method to absolutize PercentageOr 2025-08-06 17:44:12 +01:00
Callum Law
ba4a57b34d LibWeb: Absolutize StyleValueList in StyleComputer::absolutize_values 2025-08-06 17:44:12 +01:00
Callum Law
a2ceed27e2 LibWeb: Absolutize CalculatedSVs in StyleComputer::absolutize_values 2025-08-06 17:44:12 +01:00
Callum Law
9db3c66a85 LibWeb: Use correct font size when absolutizing animated properties 2025-08-06 17:44:12 +01:00
Callum Law
011ab5f714 LibWeb: Use correct SerializationMode when serializing CalculatedOr 2025-08-06 17:44:12 +01:00
Callum Law
a5cbcaf698 LibWeb: Use correct SerializationMode when serializing PercentageOr 2025-08-06 17:44:12 +01:00
Andreas Kling
74722cc499 LibWeb: Use the soon-to-be hovered element for tooltip notifications
Instead of the currently hovered element.
2025-08-06 17:26:18 +01:00
Callum Law
a44e28fd56 LibWeb: Avoid premature creation of CSSPixels in calc simplification
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Previously we were converting lengths to CSSPixels values when we didn't
need to, this had a couple of effects in that:
 - We rounded to CSSPixel resolution prematurely (sometimes giving
   incorrect results)
 - We converted NaN to 0 when we shouldn't have.

We now avoid prematurely converting lengths to CSSPixels values in two
places:
 - `CalculationResult::from_value`
 - `CalculatedStyleValue::resolve_length_deprecated` (the new method
   already avoided rounding).

Gains us 16 WPT tests.
2025-08-06 14:57:34 +01:00
Callum Law
3fa7bc1919 LibWeb: Simplify calc products including unresolved percentages 2025-08-06 14:53:22 +01:00
Callum Law
c3b1013018 LibWeb: Skip inverted non-canonical values when simplifying product node
This matches the logic with the non-inverted children.

Gains us 2 WPT tests.
2025-08-06 14:53:22 +01:00
Jelle Raaijmakers
cd1cf75f7b LibWeb: Unbreak SVGFilterElement compilation
This was caused by an undetected merge conflict.
2025-08-06 15:47:44 +02:00
Tim Ledbetter
1dd3608960 LibWeb/SVG: Apply SVGFeBlendElement blend mode
Previously, the blend mode was always assumed to be `normal`.
2025-08-06 15:21:03 +02:00
Tim Ledbetter
22225af994 LibGfx: Reorder CompositingAndBlendingOperator values
This change aligns blending operator values with the constants in
`SVGFEBlendElement`.
2025-08-06 15:21:03 +02:00
Jelle Raaijmakers
3d613a2ac4 LibWeb: Simplify SVGFilterElement::gfx_filter()
No functional changes.
2025-08-06 14:00:31 +01:00
Jelle Raaijmakers
400a36aac1 LibWeb: Warn about unknown SVG filters
This might give some debug noise, but it's better than remaining silent.
2025-08-06 14:00:31 +01:00
Sam Atkins
9b6c26e347 Tests: Include test URL in fuzzy mismatch reports
The test logs tend to get a bit mixed together, so this makes it
possible to identify which values correspond to which test when multiple
are failing at once.
2025-08-06 13:51:36 +02:00
Sam Atkins
75046857ce Tests: Report image differences on tests with no fuzzy config defined
This can be helpful for identifying what the fuzzy config should be for
new tests.
2025-08-06 13:51:36 +02:00
Sam Atkins
90b49b9015 Tests: Report what the fuzzy configuration parsing error was 2025-08-06 13:51:36 +02:00
Sam Atkins
9889710033 Tests: Allow whitespace around fuzzy-matching configurations
Several WPT tests have a space after the semicolon, for example
https://wpt.live/css/css-images/gradient/gradient-single-stop-001.html :

```
<meta name="fuzzy" content="maxDifference=0-1; totalPixels=0-6000">
```
2025-08-06 13:51:36 +02:00
Andreas Kling
28c1dd551b LibWeb: Don't let aspect-ratio influence size definiteness
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
As it turns out, we still have to let the formatting contexts do a bit
of layout work in order to correctly apply the aspect-ratio. Hence we
can't just implicitly transfer definiteness from one size to the other.

This is a revert of 1cfd8b3ac0.
2025-08-05 21:33:41 +02:00
Andreas Kling
41e8211405 LibWeb: Honor "should treat as auto" cases in aspect-ratio decisions 2025-08-05 21:33:41 +02:00
Aliaksandr Kalenik
1201447dfe WebContent: Delete unused PageClient::layout_root()
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
2025-08-05 17:24:34 +02:00
Aliaksandr Kalenik
7a34bc2700 LibWeb: Re-evaluate media queries only when things they depend on change
Before this change we were re-evaluating media queries on every frame
which adds up in 1-4% in profiles on Discord.
2025-08-05 17:24:34 +02:00
Timothy Flynn
3920194bca LibJS: Move regulating and balancing logic into ISODateSurpasses
This is an editorial change in the Temporal proposal. See:
eddb77f
2025-08-05 11:18:08 -04:00
Timothy Flynn
a95d3e2a5e LibJS: Split ISO and non-ISO Temporal calendar operations
This is an editorial change in the Temporal proposal. See:
47042f2
2025-08-05 11:18:08 -04:00
Timothy Flynn
6d1f90c739 AK: Remove now-unused UTF-16 length from UTF-8 string helper 2025-08-05 15:13:36 +02:00
Timothy Flynn
04d32deb52 LibWeb: Port SVGFormattingContext to UTF-16 2025-08-05 15:13:36 +02:00
Timothy Flynn
d893d3234d LibGfx: Support UTF-16 SVG text placement 2025-08-05 15:13:36 +02:00
Timothy Flynn
2dc0a3b3ce AK: Add trim methods to Utf16String that skip allocation when not needed
If the string does not begin with any of the provided code units, we do
not need to create a new string.
2025-08-05 15:13:36 +02:00
Timothy Flynn
0efa98a57a LibJS+LibWeb+WebContent: Port JS::PropertyKey to UTF-16
This has quite a lot of fall out. But the majority of it is just type or
UDL substitution, where the changes just fall through to other function
calls.

By changing property key storage to UTF-16, the main affected areas are:
* NativeFunction names must now be UTF-16
* Bytecode identifiers must now be UTF-16
* Module/binding names must now be UTF-16
2025-08-05 07:07:15 -04:00
Timothy Flynn
cd276235d7 AK: Add a couple of validation-skipping UTF-16 string factories
String and FlyString are known to be valid UTF-8, so we can skip
validation when constructing a UTF-16 string from them.
2025-08-05 07:07:15 -04:00
Timothy Flynn
782f8c381c AK: Implement the spaceship operator for UTF-16 strings 2025-08-05 07:07:15 -04:00
Timothy Flynn
5af99f4dd0 AK: Allow Utf16StringBase to hold null data
This is required by JS::PropertyKey. This will also be needed when we
implement an Optional<Utf16String> specialization.
2025-08-05 07:07:15 -04:00
Timothy Flynn
0bf565b97f AK: Allow comparing UTF-16 strings to UTF-8 strings
Before now, you could compare a Utf16View to a StringView, but it would
only be valid if the StringView were ASCII. When porting code to UTF-16,
it will be handy to have a code point-aware implementation for non-ASCII
StringViews.
2025-08-05 07:07:15 -04:00
Timothy Flynn
319e7aa03b AK: Do not replace lonely surragates with U+FFFD while iterating
Utf8View doesn't do this either. The wobbly format is expected by JS.
2025-08-05 07:07:15 -04:00
Callum Law
a70a397501 LibWeb: Support percentages in word-spacing
Fixes crash in the created test as well as https://wpt.live/css/css-text
/word-spacing/reference/word-spacing-percent-001-ref.html. The WPT test
hasn't been imported as it passing is currently a false-positive due to
the fact that we don't yet respect `word-spacing` in most cases.
2025-08-05 11:43:55 +01:00
Jelle Raaijmakers
62cf33b98e LibGfx: Remove WebP animation writer and utility
This went unused.
2025-08-05 11:30:20 +02:00
Andreas Kling
b60d465029 LibWeb: Defer updating hovered node until end of mouse event handling
Updating the hovered node may fire events, and so we can't assume the
layout and paintable nodes we've found via hit testing will be valid
after doing it.
2025-08-05 11:29:45 +02:00
Andreas Kling
7e06906157 LibWeb: Use GC::Ptr more instead of raw pointers in EventHandler
Gives us nicer stack traces in debug builds.
2025-08-05 11:29:45 +02:00
Sam Atkins
e0c851b736 Tests/LibWeb: Generate screenshot test boilerplate in add_libweb_test.py
Creating the image is left as an exercise to the user, but this saves
some copypasta when adding a new test.
2025-08-05 09:59:47 +01:00
Idan Horowitz
110136b862 LibCrypto: Convert SignedBigInteger::import_data to accept Bytes
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This brings it up to par with UnsignedBigInteger.
2025-08-05 09:08:56 +02:00
Idan Horowitz
b0fdbe3756 LibCrypto: Convert UnsignedBigInteger::import_data to accept Bytes
All the callers are already using Bytes and manually converting to the
old style pointer + length when calling this API.
2025-08-05 09:08:56 +02:00
Idan Horowitz
2a3b072d0e LibCrypto: Convert SignedBigInteger::export_data to return a span
This brings it up to par with UnsignedBigInteger.
2025-08-05 09:08:56 +02:00
Idan Horowitz
660a499223 LibCrypto: Convert UnsignedBigInteger::export_data to return a span
This helps make callers only use the slice of the output buffer that
was written to.

As part of updating the callers of the API several bugs were fixed and
useless code paths were removed:
- The exported data is not host-endianess dependent (always big endian)
- The exported data does not contain leading zeros
- The output buffer is only written up to the result's size
2025-08-05 09:08:56 +02:00
Callum Law
15cee5cc15 LibWeb: Correctly round non-integer z-indexes
Previously we would just cast to an int.

Gains us 3 WPT tests.
2025-08-05 06:37:40 +01:00
Tim Ledbetter
9a5b740da1 LibWeb: Remove unnecessary debug logging from SVGSVGElement 2025-08-05 01:46:36 +02:00
Idan Horowitz
e2fe46065a LibWeb: Remove extraneous trailing '/' from service worker script scope
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
The spec language specifies 'Set maxScopeString to "/", followed by the
strings in XXXX’s path (including empty strings), separated from each
other by "/"': That is, adjacent components are separated by a '/', but
the last component does not get a trailing '/'.

This resulted in the generated scope string ending with '//' in some
cases, incorrectly tripping the 'Service-Worker-Allowed' security check
2025-08-05 00:37:53 +02:00
Sam Atkins
56852fb5c2 LibWeb/CSS: Set style sheet for children of ContentStyleValue
Without this, any relative url()s in the `content` property don't know
what style sheet they are in, which makes them load relative to the
document instead.
2025-08-05 00:35:03 +02:00