Commit graph

71431 commits

Author SHA1 Message Date
Callum Law
829437c11d LibWeb: Implement autocorrect attribute 2025-08-29 15:47:17 +01:00
Callum Law
a6fb7c84e9 LibWeb: Implement the autocapitalize attribute 2025-08-29 15:47:17 +01:00
Callum Law
11457e533a LibWeb: Update is_autocapitalize_inheriting method name with spec
This was changed when the autocorrect attribute was introduced:
7bab05a
2025-08-29 15:47:17 +01:00
Callum Law
e539990c7f LibWeb: Implement writingSuggestions attribute 2025-08-29 15:47:17 +01:00
Callum Law
87e0523664 LibWeb: Implement the spellcheck attribute 2025-08-29 15:47:17 +01:00
Sam Atkins
7be645a091 LibWeb/CSS: Implement CSSNumericType.equals()
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-29 11:57:10 +02:00
Sam Atkins
d29084997e LibWeb/CSS: Reify math functions into CSSMathValue types 2025-08-29 11:57:10 +02:00
Sam Atkins
9264f540dd LibWeb/CSS: Correct definition of CSSNumericType
What I thought was a spec issue was actually a combination of my own
misunderstanding and a bug in our IDL generator. With that bug fixed, I
can correct this to how it is in the spec.
2025-08-29 11:57:10 +02:00
Sam Atkins
ffb236adbd IDLGenerators: Correctly treat optional enums as optional
Specifically, this makes enums in dictionaries not cause compile errors.
2025-08-29 11:57:10 +02:00
Sam Atkins
e174215845 LibGC: Add Ptr::as_nonnull()
Convert from a GC::Ptr to a GC::Ref directly, instead of having to write
`GC::Ref { *thing }`.
2025-08-29 11:57:10 +02:00
Sam Atkins
277117eed5 LibWeb/CSS: Implement CSSNumericValue.parse()
Reifying the result gets quite ad-hoc. Firstly because "parse a
component value" produces a ComponentValue, not a full StyleValue like
we need for math functions. And second, because not all math functions
can be reified as a CSSNumericValue:

Besides the fact that I haven't implemented CalculatedStyleValue
reification at all yet, there are a lot of math functions with no
corresponding CSSMathValue in the spec yet. If the calculation tree
contains any of those, the best we can do is reify as a CSSStyleValue,
and that isn't a valid return value from CSSNumericValue.parse(). So, I
made us throw a SyntaxError in those cases. This seems to match
Chrome's behaviour. Spec issue:
https://github.com/w3c/css-houdini-drafts/issues/1090
2025-08-29 11:57:10 +02:00
Sam Atkins
73d7d6b831 LibWeb: Generate a math_function_from_string() function
This will be used as a convenient way to see if a string is the name of
a math function.
2025-08-29 11:57:10 +02:00
Sam Atkins
177395155a LibWeb/CSS: Implement CSSMathClamp
As the final CSSMathFoo class, this makes the serialization test finally
run instead of crashing.
2025-08-29 11:57:10 +02:00
Sam Atkins
dd3007dcd7 LibWeb/CSS: Implement CSSMathMax
Basically the same as CSSMathMin.
2025-08-29 11:57:10 +02:00
Sam Atkins
1a35795f47 LibWeb/CSS: Implement CSSMathMin 2025-08-29 11:57:10 +02:00
Sam Atkins
8efd0639cd LibWeb/CSS: Implement CSSMathInvert
This is almost identical to CSSMathNegate.
2025-08-29 11:57:10 +02:00
Sam Atkins
f2ec04d20d LibWeb/CSS: Implement CSSMathNegate 2025-08-29 11:57:10 +02:00
Sam Atkins
e21610180f LibWeb/CSS: Implement CSSMathProduct
This is almost identical to CSSMathSum.
2025-08-29 11:57:10 +02:00
Sam Atkins
e17052a343 LibWeb/CSS: Implement CSSMathSum 2025-08-29 11:57:10 +02:00
Sam Atkins
a46c980629 LibWeb/CSS: Implement CSSNumericArray 2025-08-29 11:57:10 +02:00
Sam Atkins
6c8876cdb8 LibWeb/CSS: Implement CSSMathValue
This is a base class for the various math functions, so it's not used
directly anywhere.
2025-08-29 11:57:10 +02:00
Sam Atkins
ef8ca729cc IDLGenerators: Make 'operator' a reserved word
This is the name of an attribute of CSSMathValue.
2025-08-29 11:57:10 +02:00
Sam Atkins
4791f9e88f IDLGenerators: Make attribute names C++-safe 2025-08-29 11:57:10 +02:00
Sam Atkins
46b55f0f46 LibWeb/CSS: Implement rectify_a_numberish_value() 2025-08-29 11:57:10 +02:00
Tuur Martens
222ca9e2cd Documentation: Rectify incorrect preset name 2025-08-29 11:54:16 +02:00
Bernard Niset
de99dd42a2 Tests: Use 127.0.0.1 instead of localhost in HTTP test server
This fixes slow test execution on macOS where localhost resolution
has a 200ms delay due to IPv6 fallback behavior in libcurl.

The XMLHttpRequest-override-mimetype-blob.html test now runs in ~0.6s
instead of ~16s on macOS.

Fixes #4850
See also: https://github.com/curl/curl/issues/2281
2025-08-29 10:34:43 +01:00
Tim Ledbetter
d4f05bc4ef LibWeb: Implement <feImage> SVG filter 2025-08-29 10:15:24 +01:00
Tim Ledbetter
5eff541804 LibWeb: Construct filter chain at paint time
This allows us to use style and box metrics when applying filters.
2025-08-29 10:15:24 +01:00
Jelle Raaijmakers
054b4dace0 LibWeb: Hit test StackingContext's children before testing visibility
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
If a node that establishes a StackingContext has `pointer-events: none`,
hit testing should first proceed with hit testing the SC's children
before deciding to bail. We were checking for `pointer-events` too
early, causing large parts of certain websites to be noninteractive.

Fixes #6017.
2025-08-29 01:25:01 +02:00
Jelle Raaijmakers
8bbb3429b4 LibWeb: Simplify reverse child traversal in StackingContext::hit_test()
No need for manual index fiddling, use Vector::in_reverse().
2025-08-29 01:25:01 +02:00
Timothy Flynn
2fa6655dcb LibJS: Ensure NudgeToCalendarUnit is given a non-zero duration sign
Otherwise, we trip internal Temporal spec assertions.

This is an editorial change in the Temporal spec. See:
30f8575
2025-08-29 01:14:20 +02:00
Timothy Flynn
0c038bf12e LibJS: Read user options in a Temporal AO sooner
This is a normative change in the Temporal proposal. See:
9924aa4
2025-08-29 01:14:20 +02:00
Timothy Flynn
355589a89e LibJS: Read user options in some Temporal toString methods sooner
This is a normative change in the Temporal proposal. See:
3eaaadf
2025-08-29 01:14:20 +02:00
Jelle Raaijmakers
d87b3030a7 LibWeb: Prevent creation of new UsedValues for nested inline nodes
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
In LayoutState, used_values_per_layout_node should not be modified in
order to determine inline nodes' dimensions - all the required values
should already be in there. In 2585f2da0d
we did accidentally create new values, causing the code further down to
try and get a PaintableBox from an anonymous container and crashing.

Fixes #6015.
2025-08-28 22:38:15 +02:00
Tim Ledbetter
b23fd1f440 LibWeb: Update layout when view box properties are changed 2025-08-28 15:42:56 +02:00
Tim Ledbetter
ea41aba6c7 LibWeb: Move common SVGViewport code into an SVGFitToViewBox class
Special handling for SVGClipPathElement and SVGMaskElement, which use a
a ViewBox and PreserveAspectRatio value internally, has been moved to
`SVGFormattingContext`.
2025-08-28 15:42:56 +02:00
Jelle Raaijmakers
c8d24d4966 LibWeb: Correctly position absolute inline boxes in last line
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
If we were calculating the static position for an absolutely positioned
inline box that resides in the last line of its containing block, we
would not have yet provided the fragments in that line with their
final positions. Additionally, we would always move the box beneath the
fragment, which was incorrect.

Fixes #5867.
2025-08-28 13:45:37 +02:00
Jelle Raaijmakers
349fdd9f47 LibWeb: Explicitly update LineBuilder's last line at end of IFC run
Currently we're relying on LineBuilder's destructor to handle updating
the last line, if required. In order to fix an issue with our absolute
positioning code, we need to be able to update the last line earlier
than that. Remove the destructor and replace it with an explicit call to
LineBuilder::update_last_line().

No functional changes.
2025-08-28 13:45:37 +02:00
Jelle Raaijmakers
90bc805cb0 LibWeb: Simplify UsedValues::static_position()
No functional changes.
2025-08-28 13:45:37 +02:00
Andreas Kling
a26007f195 LibWeb: Don't die when transferring the same MessagePort more than once
One MessagePort can be entangled with another MessagePort, either in the
same agent, or in another agent.

In the same-agent case, the MessagePort objects point to each other via
the MessagePort::m_remote_port field.

In the separate-agent case, they live in separate processes entirely and
thus can't point at each other.

In both cases, the MessagePorts have an underlying transport channel,
which means they are "entangled". However, we can't assume that being
entangled means having a non-null m_remote_port.

This patch simply adds a missing null check for m_remote_port and thus
makes https://vscode.dev/ stop crashing with a null dereference.
2025-08-28 13:42:06 +02:00
Timothy Flynn
e36cd6d82d Tests/LibWeb: Ensure SIGINT causes test-web to exit with a non-zero code
Sending a ctrl+c to a program should generally cause it to exit with a
non-zero status code.
2025-08-28 13:25:33 +02:00
Sam Atkins
f93819eda2 LibWeb/CSS: Remove unused <an+b># code for pseudo-classes
This reverts e7890429aa and partly reverts
a59c15481f.

The one pseudo-class that accepted multiple of these was :heading(), and
since that got changed to take integers instead, there's no need to keep
this extra complexity (and memory usage) around.
2025-08-28 12:40:03 +02:00
Sam Atkins
d461e96f40 LibWeb/CSS: Make :heading() pseudo-class take integers not AN+B
Corresponds to 8eb3787e34
2025-08-28 12:40:03 +02:00
Sam Atkins
9ffc15ba3f LibWeb/CSS: Serialize :heading(...) pseudo-class properly
We originally had special handling for `:host()` as that had been the
only pseudo-class that could be both an identifier or a function.
However, this meant duplicating the serialization logic, and also we
had to manually remember to add the same hack for any other
identifier-and-function cases. Which I forgot to do with `:heading()`!

So instead, for these cases, detect if they actually have arguments
specified and use that to determine which form to serialize as. We do
still have to write a check for each one of these pseudo-classes, but
the VERIFY should make it easier to remember.
2025-08-28 12:40:03 +02:00
Tim Ledbetter
277b81ca97 LibWeb/SVG: Respect paint-order when painting SVG paths 2025-08-28 10:31:09 +01:00
Tim Ledbetter
a87a9156d5 LibWeb/CSS: Parse the paint-order property 2025-08-28 10:31:09 +01:00
Callum Law
1052ee20b0 LibWeb: Move snap_a_length_as_a_border_width to StyleComputer.cpp
All users are in this file so it makes more sense to have it here
2025-08-28 09:29:46 +01:00
Callum Law
0ce6cc38b7 LibWeb: Store outline-width in computed form in ComputedProperties
We now also store `outline-width` in ComputedValues as a `CSSPixels`
since we know it's an absolute length at `apply_style` time - this saves
us some work in converting to CSSPixels during layout.

Gains us 46 new passes since we now interpolate keywords (thick, thin,
etc) correctly.

Also loses us 4 WPT tests as we longer clamp negative values produced by
interpolation from the point of view of getComputedStyle (although the
'used' value is still clamped).
2025-08-28 09:29:46 +01:00
Callum Law
6eae92511f LibWeb: Store border-*-width in computed form in ComputedProperties
Gains us 112 new passes since we now interpolate keywords (thick, thin,
etc) correctly.

Also loses us 4 WPT tests as we longer clamp negative values produced by
interpolation from the point of view of getComputedStyle (although the
'used' value is still clamped).
2025-08-28 09:29:46 +01:00
Callum Law
3b8c2a97c0 LibWeb: Don't resolve UnresolvedStyleValues in set_keyframes
If the custom property related to this UnresolvedStyleValue changed
we would not reflect the up to date value in the animation.
2025-08-28 09:29:46 +01:00