Commit graph

65968 commits

Author SHA1 Message Date
Shannon Booth
05b4676917 LibWeb: Ensure global objects are an event target
All global objects current need to be event targets so that they
can have events dispatched to them. This allows for removing of
verify_cast for these global objects.
2024-12-03 00:18:11 +01:00
Jelle Raaijmakers
6a85677f70 LibWeb: Expose HTMLElement's content editable state 2024-12-03 00:18:03 +01:00
Jelle Raaijmakers
c9a6bac57f LibWeb: Fix always-enabled copy command in queryCommandEnabled()
The "copy" command is not in the Miscellaneous commands section. The
"defaultParagraphSeparator" command is, however. Let the accompanying
comment reflect that.
2024-12-03 00:18:03 +01:00
Jelle Raaijmakers
3f1523b16c LibWeb: Disable execCommand() commands in plaintext-only editing state 2024-12-03 00:18:03 +01:00
Jelle Raaijmakers
217567981a LibWeb: Implement "plaintext-only" state for contenteditable 2024-12-03 00:18:03 +01:00
Jelle Raaijmakers
7e406ac668 LibWeb: Simplify editing algorithm for "ends in space" condition
Checking if a string ends in a space does not require converting UTF-8
to UTF-16 and reading out its code points.
2024-12-03 00:18:03 +01:00
Milo van der Tier
2ee7e555f2 LibWeb/CSS: Do not ignore self-start/self-end alignment in flex layout
This makes these values the same as `start` and `end`. While this is not
entirely correct, it is better than centering which is what we did
previously.

This fixes misaligned images on https://nos.nl
2024-12-03 00:17:53 +01:00
Sam Atkins
432bbb4a56 CI: Keep test artifacts around longer
From this action's documentation, "0 means using default retention."
There's no reason for this to have a different retention duration than
the CI results themselves.
2024-12-02 18:04:43 -05:00
Sam Atkins
4fd42313ae CI: Ensure uploaded test artifacts have a unique name
Without this, if two CI runs on Linux both fail and want to upload
screenshots, we get an error like this on the second:

> Error: Failed to CreateArtifact: Received non-retryable error: Failed
> request: (409) Conflict: an artifact with this name already exists on
> the workflow run

Using all the inputs as part of the name should make this kind of
conflict impossible.
2024-12-02 18:04:43 -05:00
Pavel Shliak
be0857e390 UI/Qt: Do not pass left shift modifier on every return 2024-12-02 17:57:38 -05:00
Tim Ledbetter
cc1ea02949 LibWeb: Disable test output for imported WPT tests
This reduces the runtime of all imported WPT tests from 8.2 seconds to
4.5 seconds on my local machine.
2024-12-02 22:41:51 +00:00
Tim Ledbetter
61ae388140 Tests: Create imported WPT test output from completion callback data
This allows us to disable test output, which performs expensive assert
tracking. This was making our imported tests run significantly slower
than tests run via `WPT.sh`.

Formatting the output ourselves also allows us to remove unnecessary
information from the test output.

This commit also rebaselines all existing imported WPT tests to follow
the new format.
2024-12-02 22:41:51 +00:00
Jonne Ransijn
e38b206957 AK: Print a more useful error message when a MUST(...) fails
```
VERIFICATION FAILED: !_temporary_result.is_error()
```

is not really a helpful error message.

When we are including `AK/Format.h`, which is most of the time,
we can easily print a much more useful error message:

```
UNEXPECTED ERROR: Cannot allocate memory (errno=12)
```
2024-12-02 20:07:38 +01:00
Gingeh
0afd7f166a LibWeb: Improve grid-template-area parsing and serialization 2024-12-02 16:19:47 +00:00
Gingeh
e1f4e8e6c2 LibWeb: Move CSS character type definitions to new header 2024-12-02 16:19:47 +00:00
Jonne Ransijn
1b3f8e1e9a LibJS: Cache source code positions more often
The source code position cache was moved from a line based approach
to a "chunk"-based approach to improve performance on large, minified
JavaScript files with few lines, but this has had an adverse effect
on _multi-line_ source files.

Reintroduce some of the old behaviour by caching lines again, with
some added sanity limits to avoid caching empty/overly small lines.

Source code positions in files with few lines will still be cached
less often, since minified JavaScript files can be assumed to be
unusually large, and since stack traces for minified JavaScript
are less useful as well.

On WPT tests with large JavaScript dependencies like
`css/css-masking/animations/clip-interpolation.html` this reduces the
amount of time spent in `SourceCode::range_from_offsets` by as much as
99.98%, for the small small price of 80KB extra memory usage.
2024-12-02 11:42:11 +01:00
Ben Wiederhake
079fdf50d4 Meta+Documentation: Update config for QtCreator
We no longer use C or raw assembly (*.S), and generated include files
have moved to Build/release/Lagom/.
2024-12-02 09:45:32 +00:00
Tim Ledbetter
44cf457fd2 LibWeb: Limit HTMLTableColElement span to allowed values
This change ensures that `span` is clamped to the maximum value of 1000
if the given value is larger than 2147483647.
2024-12-02 10:25:27 +01:00
Tim Ledbetter
9fc2a63131 LibWeb: Limit HTMLTableCellElement rowSpan to allowed values
This change ensures that `rowSpan` is clamped to the maximum value of
65534 if the given value is larger than 2147483647.
2024-12-02 10:25:27 +01:00
Tim Ledbetter
4630b1a44b LibWeb: Limit HTMLTableCellElement colSpan to allowed values
This change ensures that `colSpan` is clamped to the maximum value of
1000 if the given value is larger than 2147483647.
2024-12-02 10:25:27 +01:00
Tim Ledbetter
d02b763cd6 LibWeb: Add parse_integer_digits methods
The rules for parsing integers don't specify an upper bound on the
value that can be returned, so the `parse_integer_digits` method can be
used to check whether the given arbitrarily-large StringView is valid
according to these rules. The `parse_integer` and
`parse_non_negative_integer` methods would fail for values larger than
2147483647 when they shouldn't have.
2024-12-02 10:25:27 +01:00
Tim Ledbetter
7097152ebc LibWeb: Restrict HTMLTextAreaElement::min_length to the range of i32 2024-12-02 10:25:27 +01:00
Tim Ledbetter
ac7fad52f6 LibWeb: Restrict HTMLTextAreaElement::max_length to the range of i32 2024-12-02 10:25:27 +01:00
Tim Ledbetter
bc484258c2 LibWeb: Restrict HTMLInputElement::min_length to the range of i32 2024-12-02 10:25:27 +01:00
Tim Ledbetter
40d6b9d44e LibWeb: Restrict HTMLInputElement::max_length to the range of i32 2024-12-02 10:25:27 +01:00
stasoid
163ec18593 LibCore: Fix link error in EventLoopImplementationWindows.cpp 2024-12-02 10:12:57 +01:00
Konstantin Konstantin
1915574165 LibWeb: Fix NavigationType enum to string conversion
Convert NavigationType to lowercase strings, as described in the spec.

Import related WPT test.
2024-12-02 06:47:49 +00:00
Pavel Shliak
4d5acc7a00 LibWeb: Remove IDBRequest.idl FIXME 2024-12-01 22:04:05 +01:00
Pavel Shliak
e02fd4ca8c Tests: Reimport Event-constants WPT
I reimported and rebaselined it using the latest version
of our WPT importer. Now it passes.
2024-12-01 22:01:48 +01:00
Aliaksandr Kalenik
86f1c03c06 LibWeb: Fix CSS filters painting
restore() corresponding to ApplyFilters should be called after stacking
context content is painted, not before.

Fixes regression introduced in c94b4316e7
2024-12-01 21:27:29 +01:00
Jess
f4cc9c6426 Docs: Update Nixos build instructions 2024-12-01 13:27:59 -05:00
Jess
43746ca52d flake: Fix broken dev-shell
Many dependencies aren't currently included in the devShell. As ladybird
is already packaged downstream, we can pull in those buildInputs along
with the extra dev dependencies already defined.
2024-12-01 13:27:59 -05:00
Jess
c59363e0e2 flake: Update flake.lock 2024-12-01 13:27:59 -05:00
Aliaksandr Kalenik
a7bd3704c5 LibWeb: Use separate restore() for each ApplyOpacity display list item
ApplyOpacity internally calls canvas.saveLayer() which requires a
matching canvas.restore() to be called.

Fixes missing header on https://supabase.com/
2024-12-01 16:33:16 +01:00
Tim Ledbetter
a486c86eee LibWeb: Limit HTMLCanvasElement width and height to allowed values
Setting the `width` or `height` properties of `HTMLCanvasElement` to a
value greater than 2147483647 will now cause the property to be set to
its default value.
2024-12-01 15:12:04 +00:00
Tim Ledbetter
b05bc71002 LibWeb: Limit HTMLImageElement width and height to allowed values
Setting the `width` or `height` properties of `HTMLImageElement` to a
value greater than 2147483647 will now cause the property to be set to
0.
2024-12-01 15:12:04 +00:00
Aliaksandr Kalenik
c94b4316e7 LibWeb: Use separate restore() for each ApplyFilters display list item
ApplyFilter internally calls canvas.saveLayer() which requires a
matching canvas.restore() to be called.

Fixes painting on https://supabase.com/ regressed by
8562b0e33b
2024-12-01 15:49:32 +01:00
Shannon Booth
30c8510725 LibWeb: Ensure requests modules is not empty before indexing into it
Regression from 5af613aa65

Fixes: #2676
2024-12-01 15:49:16 +01:00
Shannon Booth
2ff03ea7d2 LibWeb: Remove module validation in "create a JavaScript module script"
This is uneeded and not present for this function in the spec now that
HostLoadImportedModule performs this validation.
2024-12-01 11:56:18 +01:00
Shannon Booth
bb68f09855 LibWeb: Remove irrelevant FIXMEs about implementing some module hooks
Both of these module-related host hooks are not present in the latest
version of the HTML spec.
2024-12-01 11:56:18 +01:00
Shannon Booth
5af613aa65 LibWeb: Implement early validation of modules
This is part of a normative change to the HTML space for WebAssembly JS
module integration and the source phase import proposal, see:

https://github.com/whatwg/html/commit/10ed38ee7

Further changes are required, but this is a start :^)
2024-12-01 11:56:18 +01:00
Shannon Booth
1a15e2cec6 LibJS: Allow comparing module records by equality 2024-12-01 11:56:18 +01:00
Shannon Booth
431faa1044 LibWeb: Throw an error on DynamicImport for Worklets or ServiceWorkers
We can't actually create either of these yet, but let's just get this
check out of the way while it is convenient.
2024-12-01 11:56:18 +01:00
rmg-x
c490118b6c RequestServer: Free curl string lists and check result before setting
Previously, we leaked the `curl_slist`s on every request. This also
validates the pointer we get from `curl_slist_append` before setting the
option.

Also, use the `set_option` helper for CURLOPT_RESOLVE as it will print
when there is an error.
2024-12-01 11:32:45 +01:00
rmg-x
32358df13e RequestServer: Remove unused global "g_dns_cache"
`curl_slist_append` copies the string so we don't need to keep it around
ourselves.
2024-12-01 11:32:45 +01:00
rmg-x
9b8987e34e RequestServer: Use existing type for buffered UDP socket 2024-12-01 11:32:45 +01:00
rmg-x
4a16c89603 LibDNS: Fix deadlock when receiving invalid lookup result
Previously, we would stop the repeat timer even if we got a null result.
This caused the pending lookup to:
- Never resolve, and
- Never get purged for too many retries

I believe the underlying issue is something on the socket level, but we
should handle this case regardless.
2024-12-01 11:32:45 +01:00
Jonne Ransijn
3f5e32ee84 LibWeb: Stop allocating Tokens and ComponentValues unnecessarily
When the "Consume a component value from input, and do nothing."
step in `Parser::consume_the_remnants_of_a_bad_declaration` was
executed, it would allocate a `ComponentValue` that was then
immediately discarded.

Add explicitly `{}_and_do_nothing` functions for this case that never
allocate a `ComponentValue` in the first place.

Also remove a `(Token)` cast, which was unnecessarily copying a `Token`
as well.
2024-12-01 11:30:06 +01:00
Jonne Ransijn
58631e9eef LibJS: Add missing CommonPropertyNamess and StringMayBeNumber::Nos 2024-12-01 10:42:49 +01:00
Jonne Ransijn
cfb00ba494 LibJS: Stop lazily coercing numeric PropertyKeys
Lazily coercing might have made sense in the past, but since hashing
and comparing requires the `PropertyKey` to be coerced, and since a
`PropertyKey` will be used to index into a hashmap 99% of the time,
which will hash the `PropertyKey` and use it in comparisons, the
extra complexity and branching produced by lazily coercing has
become more trouble than it is worth.

Remove the lazy coercions, which then also neatly allows us to
switch to a `Variant`-based implementation.
2024-12-01 10:42:49 +01:00