Commit graph

66580 commits

Author SHA1 Message Date
Jelle Raaijmakers
c90c5aad29 LibWeb: Implement the "record current states and values" Editing algo 2024-12-21 19:15:58 +01:00
Jelle Raaijmakers
2c51ed8dec LibWeb: Rework obtaining resolved styles in the Editing API
The algorithm referenced to in the Editing spec whenever they talk about
obtaining the "resolved" style or value is actually implemented in
ResolvedCSSStyleDeclaration, so use that instead of going directly to
the computed styles.
2024-12-21 19:15:58 +01:00
Jelle Raaijmakers
433c19c1ed LibWeb: Lay out CommandDefinitions for Editing API a bit nicer
No functional changes.
2024-12-21 19:15:58 +01:00
Jelle Raaijmakers
2d130ffad4 LibWeb: Make new_container in insertParagraph command a GC::Ref
This value will never be null.
2024-12-21 19:15:58 +01:00
Jelle Raaijmakers
5e2cb00f75 LibWeb: Update active range after updating selection in insertParagraph
We were using an old range after collapsing the selection. Fixes 3 WPT
subtests in `editing/run`.
2024-12-21 19:15:58 +01:00
Jelle Raaijmakers
2052792663 LibWeb: Use correct boundaries in Selection::collapse_to_start/end()
We were using the anchor_node() as the boundary point node when
collapsing a selection, but the spec tells us to use the start and end
boundary point nodes.
2024-12-21 19:15:58 +01:00
Sam Atkins
eb11c35640 LibWeb/CSS: Use CSSNumericType for CalculationResult's numeric type
When we originally implemented calc(), the result of a calculation was
guaranteed to be a single CSS type like a Length or Angle. However, CSS
Values 4 now allows more complex type arithmetic, which is represented
by the CSSNumericType class. Using that directly makes us more correct,
and allows us to remove a large amount of now ad-hoc code.

Unfortunately this is a large commit but the changes it makes are
interconnected enough that doing one at a time causes test
regressions.

In no particular order:

- Update our "determine the type of a calculation" code to match the
  newest spec, which sets percent hints in a couple more cases. (One of
  these we're skipping for now, I think it fails because of the FIXMEs
  in CSSNumericType::matches_foo().)
- Make the generated math-function-parsing code aware of the difference
  between arguments being the same type, and being "consistent" types,
  for each function. Otherwise those extra percent hints would cause
  them to fail validation incorrectly.
- Use the CSSNumericType as the type for the CalculationResult.
- Calculate and assign each math function's type in its constructor,
  instead of calculating it repeatedly on-demand.

The `CalculationNode::resolved_type()` method is now entirely unused and
has been removed.
2024-12-21 18:14:28 +01:00
Sam Atkins
8d40550478 LibWeb/CSS: Bring CSSNumericType algorithms up to date with spec
Took the opportunity to pull out a helper function for
entry_with_value_1_while_all_others_are_0(), too.

A couple of these require us to have extra contextual information about
what type percentages should resolve to. Until we have that available,
these are left as FIXMEs with a rough approximation.
2024-12-21 18:14:28 +01:00
Sam Atkins
0d19007cb5 LibWeb/CSS: Make CSSNumericType dump() infallible
This is a remnant of the tiny-OOM-propagation party.
2024-12-21 18:14:28 +01:00
Sam Atkins
9cbd08a330 LibWeb/CSS: Implement "consistent type" concept on CSSNumericType 2024-12-21 18:14:28 +01:00
Sam Atkins
2192868a0e LibWeb/CSS: Remove unused ProductOperation enum 2024-12-21 18:14:28 +01:00
Sam Atkins
0149f7d4e4 LibWeb/CSS: Remove unnecessary CalculatedStyleValue const-casts 2024-12-21 18:14:28 +01:00
Sam Atkins
69a0f28d04 Revert "LibWeb/CSS: Rename CalculatedStyleValue -> CSSMathValue"
This reverts commit 76daba3069.

We're going to need separate types for the JS-exposed style values, so
it doesn't make sense for us to match their names with our internal
types.
2024-12-21 18:14:28 +01:00
Tim Ledbetter
34f78ca152 Meta: Add a --debug-process option to WPT.sh
This passes the `--debug-process` option to WebDriver.
2024-12-20 23:42:02 +01:00
Tim Ledbetter
2528055703 WebDriver: Add a --debug-process option
This forwards the `--debug-process` argument to the browser process
launched by WebDriver.
2024-12-20 23:42:02 +01:00
Aliaksandr Kalenik
30d915c361 LibGfx+LibWeb: Specify bottom left origin for WebGL's PaintingSurface
By doing that we eliminate the need for the vertical flip flag.

As a side effect it fixes the bug when doing:
`canvasContext2d.drawImage(canvasWithWebGLContext, 0, 0);`
produced a flipped image because we didn't account for different origin
while serializing PaintingSurface into Gfx::Bitmap.

Visual progress on https://ciechanow.ski/curves-and-surfaces/
2024-12-20 20:47:45 +01:00
Sam Atkins
28388f1fd2 LibWeb/CSS: Don't overwrite active font load when requesting a pt size
start_loading_next_url() is a no-op if there's a pending resource load,
but not if that resource load has successfully loaded already. There is
a delay between the font resource loading, and it being processed into
a vector font. Calling font_with_point_size() in that gap would
previously erase the previously-loaded font, if the font had multiple
URLs to choose from.

This fixes the icon font on mods.factorio.com :^)
2024-12-20 18:19:37 +01:00
Feng Yu
b3edbd7bf2 LibWeb: Implement the ClipboardItem API
Spec: https://w3c.github.io/clipboard-apis/#clipboard-item-interface
2024-12-20 15:29:18 +00:00
Gingeh
bdd6729d78 LibWeb: Use paintables when calculating mouse event offset 2024-12-20 15:50:41 +01:00
Aliaksandr Kalenik
c9105955f6 LibWeb/WebGL: Add support for ANGLEInstancedArrays extension
This is only WebGL 1.0 extension. It's enabled in ANGLE by default.

Progress on https://ciechanow.ski/curves-and-surfaces/ that relies on
this extension.
2024-12-20 15:31:58 +01:00
Aliaksandr Kalenik
99b49a5978 CodeGenerators: Add support for LegacyNoInterfaceObject IDL attribute
When applied, corresponding interface object will not be exposed on the
global object, e.g. for the following IDL:
```
Exposed=(Window,Worker), LegacyNoInterfaceObject]
interface ANGLE_instanced_arrays {
};
```

executing `"ANGLE_instanced_arrays" in window` will return `false`.
2024-12-20 15:31:58 +01:00
sideshowbarker
3365cae4a9 Tests: Import more WPT ARIA tests (more regression coverage); no code 2024-12-20 06:23:21 -08:00
Tyler Dence
0378645c25 LibWeb: PlatformObject::DefineOwnProperty fix 'has own property' check
PlatformObjects with named properties does not qualify as 'has own
property' just by virtue of a named property existing.

This fixes at least one WPT test, which is imported.
2024-12-20 15:10:24 +01:00
Tim Ledbetter
9585700876 LibWeb: Don't try to wait for HTTP server to exit if kill call fails 2024-12-20 14:59:56 +01:00
Tim Ledbetter
a450d64ffa LibCore: Return correct error code from Process::wait_for_termination 2024-12-20 14:59:56 +01:00
Pavel Shliak
4cd1ef12d7 LibWeb: Refer a spec issue in Location::internal_get_own_property 2024-12-20 14:46:28 +01:00
Pavel Shliak
361c6f1b64 LibWeb: Update Location initialization according to spec 2024-12-20 14:46:28 +01:00
sideshowbarker
695ce3763e LibWeb: Replace ARIA “synonym” roles with their preferred synonyms
This change does replacement of ARIA roles that have newer synonyms.

There are a number of newer ARIA roles that are synonyms for older
roles. https://wpt.fyi/results/wai-aria/role/synonym-roles.html has a
number of subtests which expect that when retrieving the value of an
explicitly- specified role attribute, if the value is one of the older
role values, implementations must replace that with its newer synonym.
2024-12-20 05:45:59 -08:00
sideshowbarker
e9dedeee34 Tests: Import ARIAMixin string attributes CEReactions tests (no code) 2024-12-20 05:17:05 -08:00
R-Goc
579484e065 LibCore: Fix compilation of EventLoopImplementationWindows.cpp 2024-12-20 13:57:43 +01:00
R-Goc
9cb397914e Meta: Enable warning for the use of VLAs
This commit enables warnings when using variable length arrays. For
disabling this warning locally use -Wno-vla, as it will work both across
Clang and GCC.
2024-12-20 09:37:56 +01:00
R-Goc
74309ce8c2 Tests: Remove use of VLAs from TestRSA.cpp
This commit removes the use of variable length arrays from the tests for
RSA. This is the last remaining place using VLAs.
2024-12-20 09:37:56 +01:00
Timothy Flynn
edd3b14ddf LibCrypto: Protect the SignedBigInteger ctor against integer overflow
In particular, if given a value of -2147483648, we would invoke signed
integer overflow (which is UB).
2024-12-19 23:37:30 +01:00
Totto16
540c840755 LibWeb: Add test for getComputedStyle with a PseudoElement argument
This test checks the case, where an unknown pseudo element is used as
second argument to getComputedStyle
2024-12-19 19:35:57 +00:00
Totto16
d21bfda900 LibWeb: Handle special cases of PseudoElement::Type correctly
There are some special values for CSS::Selector::PseudoElement::Type
which are after `KnownPseudoElementCount` and therefore not present in
various arrays of pseudo elements, this leads to some errors, if a type
after `KnownPseudoElementCount` is used without checking first. This
adds explicit checks to all usages
2024-12-19 19:35:57 +00:00
devgianlu
8620a2af47 LibCrypto: Ensure RSA decryption with CRT works for all inputs
Ensure becomes `m1` greater than `m2` even when smaller by more than
one `p`. Since the next operations on `m1` are modulus `p` we can add it
as many times as it's needed.
2024-12-19 18:43:23 +01:00
Sam Atkins
1c9f0601e9 Tests: Re-enable slow WPT svg-in-iframe/object tests
These all use `<meta name=timeout content=long>` and so should now be
safe to run without timing out.

Fixes #2792
2024-12-19 17:27:33 +00:00
Sam Atkins
f62ccb010d Tests: Let WPT tests set their own timeout
The official WPT runner supports a `<meta name=timeout content=long>`
tag to let tests opt-in to a longer timeout. Modify our harness to pass
that custom timeout to our runner, so that we don't incorrectly time
out if our default time is shorter than the requested one.
2024-12-19 17:27:33 +00:00
Sam Atkins
be6a9940ad headless-browser: Let tests set their own timeout duration
Some tests take longer than others, and so may want to set a custom
timeout so that they pass, without increasing the timeout for all other
tests. For example, this is done in WPT.

Add an `internals.setTestTimeout(milliseconds)` method that overrides
the test runner's default timeout for the currently-run test.
2024-12-19 17:27:33 +00:00
Andreas Kling
9164c9784d LibGfx: Treat PNG files with invalid frame data as transparent
If we have a valid PNG header with geometry info etc, we should still
display it as *something*, even if the image data itself is missing or
corrupted.

This matches the behavior of other browsers, and is something that
Cloudflare Turnstile checks for.

To achieve this, we split the PNG decoder's initialization into two
steps: "everything except reading frame data" and "reading frame data".
If the latter step fails, we yield a transparent bitmap with the
geometry from the PNG's IHDR chunk.
2024-12-19 16:49:28 +01:00
Andreas Kling
f44166ebd0 LibGfx: Allow IPC encode/decode of empty BitmapSequence
This would fail with EINVAL earlier, due to an attempt to create a
zero-length Core::AnonymousBuffer.

We fix this by transferring the buffer length separately, and only
going down the AnonymousBuffer allocation path if the length is
non-zero.
2024-12-19 16:49:28 +01:00
Andreas Kling
6737b8b065 IPCCompiler: Don't silently ignore failure to encode IPC message
When message encoding failed for some reason, we'd just swallow the
error without saying a word, and carry on without sending anything.

This led to some very confusing situations.
2024-12-19 16:49:28 +01:00
Tim Ledbetter
e74d8a6003 LibWeb: Report exceptions that occur during resize observer callback 2024-12-19 15:25:08 +00:00
Tim Ledbetter
62ecff0b40 LibWeb: Report exceptions that occur during microtask callback 2024-12-19 15:25:08 +00:00
Tim Ledbetter
7a41ab960c LibWeb: Report exceptions when invoking intersection observer callback 2024-12-19 15:25:08 +00:00
Tim Ledbetter
7cacf5ca55 LibWeb: Report exceptions when invoking custom element reactions 2024-12-19 15:25:08 +00:00
Tim Ledbetter
d8511e39c9 LibWeb: Report exceptions that occur during mutation observer microtask 2024-12-19 15:25:08 +00:00
Tim Ledbetter
4a6e457d4b LibWeb: Update run_timer_initialization_steps to the latest spec
This fixes a number of WPT tests, which expect an error to be reported
if an exception is thrown in the timer callback.
2024-12-19 15:25:08 +00:00
Tim Ledbetter
1f57df34f1 LibWeb: Update WebIDL::invoke_callback() to follow the latest spec
`WebIDL::invoke_callback()` now takes an `exception_behavior`
parameter, which can be set to `report` to report an exception before
returning. Setting `exception_behavior` to `rethrow` retains the
previous behavior.
2024-12-19 15:25:08 +00:00
Aliaksandr Kalenik
07635d4554 LibWeb/WebGL: Set INVALID_OPERATION if object does not belong to context 2024-12-19 13:38:43 +01:00