Commit graph

71328 commits

Author SHA1 Message Date
Jelle Raaijmakers
84c4eb7aa9 LibWeb: Always update computed properties for finished animations
If an animation got to its finished state before its target's computed
properties could be updated, we would end up with invalid styles. Do not
skip finished animations, but prevent effect invalidation on timeline
updates if the animation is already finished.

This fixes the CI flake on WPT test
`css/css-transitions/inherit-height-transition.html`.
2025-08-26 18:47:57 +02:00
Jelle Raaijmakers
13cba5ecb4 LibWeb: Make KeyframeEffect final 2025-08-26 18:47:57 +02:00
Jelle Raaijmakers
af552856c8 LibWeb: Remove unused TemporaryExecutionContext from Animation
We don't need a temporary execution context to create a promise.
2025-08-26 18:47:57 +02:00
Jelle Raaijmakers
55255586e8 LibWeb: Remove unused include from Animation.cpp 2025-08-26 18:47:57 +02:00
Luke Wilde
e2c935475f LibWeb/Fetch: Enable callbacks in the abort signal algorithm callback
If the request has a body, the abort will interact with promises, which
requires callbacks to be enabled.

Fixes crashing on Atlassian products.
2025-08-26 16:29:35 +02:00
Tim Ledbetter
4acd517d8f LibWeb: Propagate use element width and height to the referenced element 2025-08-26 16:02:57 +02:00
Luke Wilde
847589404b LibWeb: Set filename of module scripts to full URL instead of basename
Atlassian login gets the base URL for its module scripts by throwing an
error and pulling out the current script's URL from error.stack with
regex.

Since we only returned a basename for module scripts, it would fail to
match and try and use `/` as a base URL (because it does
[matched_string] + "/"), which is not a valid base URL.
2025-08-26 15:46:45 +02:00
Ali Mohammad Pur
22448b0c35 LibWasm: Move the interpreter IP out of the configuration object
This, along with moving the sources and destination out of the config
object, makes it so we don't have to double-deref to get to them on each
instruction, leading to a ~15% perf improvement on dispatch.
2025-08-26 15:20:33 +02:00
Ali Mohammad Pur
3e62cae2ad AK: Add Variant::unsafe_get()
This performs no validation and no verifications on release.
only useful when you've already verified the type by external means.
2025-08-26 15:20:33 +02:00
Ali Mohammad Pur
d8ea9e67f8 LibWasm: Access registers directly without bounds checks
The register array is guaranteed to be large enough for all registers
used in the program, so get rid of the bounds checks.
2025-08-26 15:20:33 +02:00
Ali Mohammad Pur
f7bdc596b4 LibWasm: Avoid allocations for the label stack as much as possible
Namely, find an upper bound at validation time so we can allocate the
space when entering the frame.

Also drop labels at once instead of popping them off one at a time now
that we're using a Vector.
2025-08-26 15:20:33 +02:00
Ali Mohammad Pur
191499696b wasm: Make it possible to provide exported functions using js
This can be done by passing
`--export-js <module>.<fn>[(<arg>:type, ...)][:type]=<source>`,
which uses a js function `(arg...) => source` to resolve the requested
import `module::fn`.

All literal wasm value types (i<n> and v128) are supported as both
parameter and return types.
2025-08-26 15:20:33 +02:00
Ali Mohammad Pur
6732e1cdc3 LibWasm: Don't clobber registers on (most) calls
This still passes the values on the stack, but registers are now allowed
to cross a call boundary.
This is a very significant (>50%) improvement on the small call
microbenchmarks on my machine.
2025-08-26 15:20:33 +02:00
Kenneth Myhra
4963dea504 LibWeb/XHR: Remove outdated FIXME about Streams not integrated in XHR
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
Streams were integrated into XHR::send() in: https://github.com/SerenityOS/serenity/pull/24132
2025-08-26 07:18:49 -04:00
Kenneth Myhra
5d94119f4c LibWeb/XHR: Add missing spec comment for step 12 in XHR::send() 2025-08-26 07:18:49 -04:00
Kenneth Myhra
e6a3307955 LibWeb/XHR: Remove outdated FIXMEs about propagating errors
The methods these FIXMEs refer to is no longer fallible.
2025-08-26 07:18:49 -04:00
Kenneth Myhra
2b832fdc31 LibWeb/XHR: MUST handle_{errors,response_end_of_body} in async context
These cannot throw in an async context and we no longer care about minor
OOM errors so let's MUST these.
2025-08-26 07:18:49 -04:00
rmg-x
ac755d0916 Tests/LibWeb: Reset zoom on web view before running tests
This prevents test failures when running locally if the user set a
default zoom level other than 1.0
2025-08-26 06:31:22 -04:00
rmg-x
9b0157523d Base+UI: Implement user interface for defaultZoomLevelFactor setting 2025-08-26 06:31:22 -04:00
rmg-x
333164ecf9 LibWebView: Add defaultZoomLevelFactor setting and necessary plumbing 2025-08-26 06:31:22 -04:00
Idan Horowitz
73266c8498 LibWeb: Add missing cookie-age-limit steps to CookieStore::set() 2025-08-26 06:28:10 -04:00
Idan Horowitz
e059c9d5a3 WebContent: Add missing step in WebDriver cookie serialization 2025-08-26 06:28:10 -04:00
Idan Horowitz
e3a5d117a6 LibWeb: Mark CookieChangeEvent's changed and deleted as CachedAttribute
This makes them actually conform to the [SameObject] extended attribute.
2025-08-26 06:28:10 -04:00
Idan Horowitz
4c49ce5fe5 LibWeb: Add support for caching IDL attribute values
This lets us properly implement for [SameObject] for generated
constructs like FrozenArray<T>.
2025-08-26 06:28:10 -04:00
Callum Law
912ffc3f84 LibWeb: Remove unnecessary ComputedProperties::maybe_null_property
We know that all (longhand) properties have a value so this is
unnecessary.
2025-08-26 12:17:55 +02:00
Callum Law
6bccc7c242 LibWeb: Don't allocate space for shorthands in ComputedProperties
Only longhands have computed values so allocating space for shorthands
is just wasted memory
2025-08-26 12:17:55 +02:00
Callum Law
9f5696e9c5 LibWeb: Avoid getting shorthand property from ComputedProperties
ComputedProperties only includes longhands so we shouldn't try to get
shorthands - this will be asserted in a later commit.
2025-08-26 12:17:55 +02:00
Callum Law
1ba64a1d7e LibWeb: Remove StyleComputer as friend of ComputedProperties
Everything we need to do with ComputedProperties in StyleComputer can be
done via the public APIs
2025-08-26 12:17:55 +02:00
Callum Law
ed947940d7 LibWeb: Simplify conversion of percentage line-height to absolute length
We can take advantage of the fact that we already do this in
`compute_line_height`.
2025-08-26 12:17:55 +02:00
Callum Law
1a3da3d825 LibWeb: Don't store separate computed value for font_size
The StyleValue stored in m_property_values is already in it's computed
form and it's trivial to pull the underlying value out so there is no
need to store this separately.

Also removes unnecessary handling of percentage values in
`absolutize_values` - this is already handled within `compute_font`.
2025-08-26 12:17:55 +02:00
Callum Law
8682a97933 LibWeb: Only include longhands when dumping resolved style
Shorthands will always be null so are not useful
2025-08-26 12:17:55 +02:00
Callum Law
487d0abd7c LibWeb: Only consider longhands when recomputing inherited style
Only longhands have computed values so checking shorthand values is
unnecessary
2025-08-26 12:17:55 +02:00
Callum Law
c635a43c18 LibWeb: Only consider longhand properties when computing invalidation
We only store computed values for longhand properties so checking
shorthand properties is unnecessary
2025-08-26 12:17:55 +02:00
Callum Law
fba4187c8f LibWeb: Add a constant for the number of longhand properties
We use this in multiple places (and will in more places in the future)
so it's worth having as a constant from a clarity point of view
2025-08-26 12:17:55 +02:00
Callum Law
58431603ca LibWeb: Remove unused Element::resolved_css_values 2025-08-26 12:17:55 +02:00
Callum Law
5431f1534a LibWeb: Remove unnecessary check on ComputedProperties array size
This is a constant length array - this check will always be false
2025-08-26 12:17:55 +02:00
Jelle Raaijmakers
65910dc343 LibWeb: Update focusing spec steps
Update a couple of focus-related spec steps and their implementations.
The most relevant change is that we no longer allow focusing on elements
that return false for `->is_focusable()`, which necessitates fixing a
broken test that tried to `.focus()` on `<div>`s that were not
focusable. That test's output now more accurately reflects the expected
outcome as seen in other browsers.
2025-08-26 10:25:59 +02:00
Jelle Raaijmakers
cc19dd3fb0 LibWeb: Simplify getting the document's root element in elementFromPoint 2025-08-26 10:25:59 +02:00
Jelle Raaijmakers
518c048eb4 LibWeb+WebContent: Rename Document::focused_element to ::focused_area
And make it a DOM::Node, not DOM::Element. This makes everything flow
much better, such as spec texts that explicitly mention "focused area"
as the fact that we don't necessarily need to traverse a tree of
elements, since a Node can be focusable as well.

Eventually this will need to be a struct with a separate "focused area"
and "DOM anchor", but this change will make it easier to achieve that.
2025-08-26 10:25:59 +02:00
Jelle Raaijmakers
90f1c8724b LibWeb: Nested editing host focus should propagate to farthest ancestor
Nested editing hosts should act as a single big editing host, as long as
there are no uneditable elements in between.
2025-08-26 10:25:59 +02:00
Jelle Raaijmakers
6c0a0b86ba LibWeb: Simplify delete and return actions in EditingHostManager
No functional changes.
2025-08-26 10:25:59 +02:00
Jelle Raaijmakers
60a501d824 LibWeb: Do not update selection on uneditable contents without Shift key
If selection navigation happens through an editing host, we should
enforce that for collapsed navigations (i.e. moving the caret) it can
only happen if the focus node of the selection is editable.
2025-08-26 10:25:59 +02:00
Jelle Raaijmakers
09645875ea LibWeb: Clean up Selection::move_offset_to_* methods
No functional changes.
2025-08-26 10:25:59 +02:00
Jelle Raaijmakers
2e910dd6e1 LibIDL: Change overload sets to be ordered
We fill these overload sets from vectors, which means that by the time
we iterated over them, any semblance of their original ordering was
lost. Their ordering is important, because we invoke
define_native_function() for them which eventually stores ordered
properties.

This should not be an issue as long as iterating over a HashMap that was
filled in exactly the same way results in the same ordering. However,
HashTable utilizes kmalloc_good_size() to determine a good allocation
size - and the implementation for kmalloc_good_size() on Linux and macOS
differs, causing a different capacity and ordering on those platforms.

This was not caught by CI, because we run that with sanitizers enabled
which overrides malloc_good_size() on macOS, resulting in the same
behavior as on Linux.

Change the overload sets to be OrderedHashMaps instead and rebaseline
the failing test.
2025-08-26 10:14:22 +02:00
Jelle Raaijmakers
3522ff16c0 Meta: Reuse "define the operations" algorithm for generated namespaces
This is one step closer to the spec. No functional changes.
2025-08-26 10:14:22 +02:00
Tim Ledbetter
cb1a1a5cb5 LibWeb: Replace is<T>() with as_if<T>() where possible
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-25 18:45:00 +02:00
Andreas Kling
3d97251da3 LibWeb: Wrap out-of-flow table children in anonymous table cells
This fixes an issue where floating children of a table box would not get
laid out at all if they were surrounded by nothing but whitespace.
2025-08-25 14:55:19 +02:00
norbiros
92b560edce LibWeb/CSS: Fix basic absolute positioning inside grid containers
Now elements with position `absolute` properly resolve their position
inside parent elements with `grid`. I also imported some WPT tests
related to that topic.

Part 2 of resolving issues on https://hack4krak.pl
2025-08-25 14:09:12 +02:00
norbiros
2ed7e0422e LibWeb/CSS: Import absolute positioning tests inside grid containers 2025-08-25 14:09:12 +02:00
Jelle Raaijmakers
305dfe3f40 AK: Don't remove CV qualifiers from types in Optional<T>
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
CV qualifiers are already ignored by __is_base_of(), which is what
IsBaseOf<T,U> uses.
2025-08-25 11:02:42 +02:00