Commit graph

70831 commits

Author SHA1 Message Date
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
Idan Horowitz
aeb7b442d3 LibWeb: Add initial support for bitmap cropping to createImageBitmap 2025-08-04 23:39:11 +02:00
Idan Horowitz
e81c33da42 LibGfx: Skip manual cropping for the degenerate case 2025-08-04 23:39:11 +02:00
Idan Horowitz
3c3da1ce8c LibGfx: Allow specifying outside color in Bitmap::cropped()
This is required for LibWeb bitmap cropping.
2025-08-04 23:39:11 +02:00
Idan Horowitz
bf2dc77dfc LibGfx: Remove unused new bitmap format option from Bitmap::cropped() 2025-08-04 23:39:11 +02:00
ayeteadoe
da2969008b CI: Enable compiler cache for Windows 2025-08-04 22:05:47 +02:00
Sam Atkins
e4b2e7b131 LibWeb: Remove now-unnecessary hack from preferred_color_scheme()
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-04 14:01:00 +02:00
Sam Atkins
b06d2370c1 UI/Qt: Initialize BrowserWindow fields
Initializing m_current_screen may not be necessary, but the initial
value of m_preferred_color_scheme is sent to WebContent, so failing to
give it an initializer would cause bugs.
2025-08-04 14:01:00 +02:00
Callum Law
344d6199da LibWeb: Use correct colors for SVGFEFloodElement::flood_color
Previously we would always render floods as black, we now use the
computed color.

We also now support relative lengths within any `calc`s present.
2025-08-04 11:29:05 +01:00
Callum Law
3b52b1139a LibWeb: Support relative lengths in stop-color calcs 2025-08-04 11:29:05 +01:00
Callum Law
db439d224a LibWeb: Support creating ColorResolutionContext from AbstractElement
No functionality changes.
2025-08-04 11:29:05 +01:00
Callum Law
e0e00220fe LibWeb: Handle Auto resolution within Page::preferred_color_scheme
Handling this here means we don't have to it within individual callers
2025-08-04 11:29:05 +01:00
Callum Law
a19a6deaa4 LibWeb: Take a ColorResolutionContext in color_or_fallback
Taking a ColorResolutionContext directly instead of creating one from a
layout node allows us to call this from places where we don't have a
layout node.
2025-08-04 11:29:05 +01:00
Callum Law
46153910ec LibWeb: Update to_color to take ColorResolutionContext
Using a generic context argument will allow us to resolve colors in
places where we have all the required information but not in the form of
a layout node as was expected previously.
2025-08-04 11:29:05 +01:00
Callum Law
b0508fb39a LibWeb: Move CSS::CalculationResolutionContext to its own file
This struct will be used within CSSStyleValue.h in a future commit and
having it in CalculatedStyleValue.h causes a dependency loop.
2025-08-04 11:29:05 +01:00
norbiros
7dc41b52db LibWeb/CSS: Use proper parsing_params in CSS.registerProperty 2025-08-04 11:08:46 +01:00
norbiros
190745fd58 LibWeb/CSS: Parse initial value using syntax from @property
Now we pass all WPT tests in:
`css/css-properties-values-api/at-property-cssom`.

Note: Failing tests were false positives.
Proper handling of inheriting values and detecting computational
independence will be done in another PR.
2025-08-04 11:08:46 +01:00
Sam Atkins
31536c53a2 UI/AppKit: Add "Dump CSS Errors" menu item 2025-08-04 10:50:09 +01:00
Sam Atkins
d65d46f4f0 UI/Qt: Add "Dump CSS Errors" menu item
Dumps out any CSS errors that have appeared since launch.
2025-08-04 10:50:09 +01:00
Sam Atkins
1adddb158a WebContent+LibWeb/CSS: Add debug request to dump CSS errors 2025-08-04 10:50:09 +01:00
Sam Atkins
01661503b9 LibWeb/CSS: Remove unused Debug.h include from GradientParsing.cpp 2025-08-04 10:50:09 +01:00
Sam Atkins
dc91688f18 LibWeb/CSS: Use ErrorReporter for property/descriptor parsing errors 2025-08-04 10:50:09 +01:00
Sam Atkins
cebdcd9f69 LibWeb/CSS: Use ErrorReporter for value-parsing errors
Also remove some redundant reporting for `<urange>` parsing errors.
2025-08-04 10:50:09 +01:00
Sam Atkins
3b7aa736e7 LibWeb/CSS: Use ErrorReporter for media query parsing 2025-08-04 10:50:09 +01:00
Sam Atkins
1a599ceb98 LibWeb/CSS: Reject @font-face and margin rules that have a prelude
I couldn't find any WPT coverage for this, so here's a homemade test.
2025-08-04 10:50:09 +01:00
Sam Atkins
e072ddfebd LibWeb/CSS: Use ErrorReporter for rule-parsing errors
Unfortunately we already have an InvalidRuleError type defined in the
CSS Parser, so it has to be qualified here, at least for now.
2025-08-04 10:50:09 +01:00
Sam Atkins
0bd83dd996 LibWeb/CSS: Use ErrorReporter for "rule X not allowed in Y" errors
QualifiedRule::for_each_as_declaration_list() now takes a rule_name, so
that the error message can actually be useful - we only know what a
qualified rule is by context.
2025-08-04 10:50:09 +01:00
Sam Atkins
d6cfd56ae6 LibWeb/CSS: Use ErrorReporter for selector parsing errors
Also removed the error reporting from parse_a_n_plus_b_pattern() as its
caller already reports that error.
2025-08-04 10:50:09 +01:00
Sam Atkins
2a2a1986cc LibWeb/CSS: Add dump_string() method to TokenStream
This is to support error reporting. It's not the most elegant way of
getting the source CSS, but it works.
2025-08-04 10:50:09 +01:00
Sam Atkins
012f4735a7 LibWeb/CSS: Introduce structured reporting for CSS errors
Instead of random dbgln_if(CSS_PARSER_DEBUG) messages, this lets us
report what kind of error it was. Repeated errors are combined instead
of spamming the console.

Ideally this would also record where the error occurred, but not yet.
2025-08-04 10:50:09 +01:00
Sam Atkins
b7a108d7cb LibWeb/CSS: Remove unused ParseError::InternalError 2025-08-04 10:50:09 +01:00