Andreas Kling
207afb0d3b
LibWeb: Avoid double dynamic_cast in parent_element_for_event_dispatch()
2025-04-18 14:45:56 +02:00
Andreas Kling
877391d569
LibWeb: Add more fast_is<T> helpers for layout and paintable nodes
2025-04-18 14:45:56 +02:00
Andreas Kling
aecb144df0
LibWeb: Add more fast_is<T> helpers for DOM::Node subclasses
2025-04-18 14:45:56 +02:00
Andreas Kling
0e490e3352
LibWeb: Add fast_is<T> helpers for Navigable & TraversableNavigable
2025-04-18 14:45:56 +02:00
Andreas Kling
f35069d63b
LibJS+LibWeb: Add fast_is<T> helpers for Realm::HostDefined class family
2025-04-18 14:45:56 +02:00
Andreas Kling
a9e415b3c4
LibJS+LibWeb: Add fast_is<T> helpers for HTML::Script class family
2025-04-18 14:45:56 +02:00
Andreas Kling
e7b6b84648
LibWeb: Avoid dynamic_cast in EventTarget initialization
...
Let's use a virtual to tell if something uses the
WindowOrWorkerGlobalScope mixin instead.
2025-04-18 14:45:56 +02:00
Glenn Skrzypczak
c0cbd439a2
LibWeb/HTML: Dispatch command
events
...
Command events are now dispatched when buttons are activated. The
special commands for popovers and dialogs are also implemented.
2025-04-18 12:09:57 +01:00
Glenn Skrzypczak
cce7d8c0fb
LibWeb/HTML: Implement CommandEvent
class
...
This implements the `CommandEvent` class.
2025-04-18 12:09:57 +01:00
Glenn Skrzypczak
ffe0b05abd
LibWeb/HTML: Add the commandForElement attribute to the button element
...
This commit adds the commandForElement attribute to the
button element. Executing commands is not implemented yet.
2025-04-18 12:09:57 +01:00
Glenn Skrzypczak
b2db07f002
LibWeb/HTML: Add the command attribute to the button element
...
This commit adds the getter and setter for the command attribute to the
button element. Executing commands is not implemented yet.
2025-04-18 12:09:57 +01:00
Timothy Flynn
629cd3c42a
LibWeb: Sort remaining stream AOs (mostly) in spec order
...
The remaining AOs can stay where they are. This patch just sorts them in
spec order to match the other AO files. Section 8.1 is last, however, as
these are all templates and need the declarations of other AOs above.
2025-04-18 06:55:40 -04:00
Timothy Flynn
3e8c6dbaff
LibWeb: Move TransformStream AOs into their own file
...
The main streams AO file has gotten very large, and is a bit difficult
to navigate. In an effort to improve DX, this migrates TransformStream
AOs to their own file.
2025-04-18 06:55:40 -04:00
Timothy Flynn
26c01f0957
LibWeb: Move WritableStream AOs into their own file
...
The main streams AO file has gotten very large, and is a bit difficult
to navigate. In an effort to improve DX, this migrates WritableStream
AOs to their own file.
2025-04-18 06:55:40 -04:00
Timothy Flynn
a9ddd427cb
LibWeb: Move ReadableStream AOs into their own file
...
The main streams AO file has gotten very large, and is a bit difficult
to navigate. In an effort to improve DX, this migrates ReadableStream
AOs to their own file. And the helper classes used for the tee and pipe-
to operations are also in their own files.
2025-04-18 06:55:40 -04:00
Timothy Flynn
c35ef36293
LibWeb: Fix typos in ReadableStream AO names
2025-04-18 06:55:40 -04:00
Sam Atkins
141f6cb392
LibWeb/HTML: Use relevant global object's document in History
...
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, 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
Corresponds to dba6e7b6c2
and 4c0401186c
The spec algorithms now use "the relevant global object's associated
document", so remove the concept of the History object itself having an
associated document. The spec has also combined the implementations for
forward/back/go so I've matched that too.
2025-04-18 10:49:56 +02:00
Sam Atkins
5b57856eae
LibWeb/HTML: Check associated document is fully active, not the window
...
This is a spec change, but we already implemented the correct version.
Corresponds to aa39b6b6b0
2025-04-18 10:49:56 +02:00
Sam Atkins
343df5d00f
LibWeb: Update focus-related spec text
...
Corresponds to 03ab71775b
I've also split the `Document::has_focus()` method for clarity. Actually
implementing the "has focus steps" turns out to be quite involved so
I've left it for now.
2025-04-18 10:49:56 +02:00
Sam Atkins
609d568776
LibWeb: Remove "locked for focus" concept
...
Corresponds to 5ba23f9f6d
2025-04-18 10:49:56 +02:00
Shannon Booth
3e17b1c9ae
LibWeb: Make Node::parent_element return GC::Ptr
...
This is useful for people like myself who run with debug mode to
more reliably get stacktraces without spinning up a debugger.
2025-04-18 10:49:02 +02:00
Shannon Booth
a14481ee05
LibWeb/HTML: Handle no parent element for Element::list_owner
...
Fixes a crash when running Speedometer 3.0 as reduced in the included
test case.
2025-04-18 10:48:47 +02:00
Andreas Kling
832b0a0ace
LibWeb: Invalidate style when HTMLDialogElement modal state changes
...
This fixes Layout/input/dialog-open-modal.html which began flaking
super hard after the preceding commits that reduced style invalidation
for focus-related pseudo class selectors.
2025-04-17 19:45:55 +02:00
Andreas Kling
8d51c41a42
LibWeb: Remove no-longer-used StyleInvalidationReasons :^)
2025-04-17 19:45:55 +02:00
Andreas Kling
55ab8ff539
LibWeb: Use optimized invalidation for :active pseudo class
2025-04-17 19:45:55 +02:00
Andreas Kling
6da48c60ca
LibWeb: Use optimized invalidation for target-related pseudo classes
2025-04-17 19:45:55 +02:00
Andreas Kling
414e0cc930
LibWeb: Use optimized invalidation for focus-related pseudo classes
2025-04-17 19:45:55 +02:00
Andreas Kling
e1777f6e79
LibWeb: Make :hover invalidation logic reusable for all pseudo classes
...
We achieve this by keeping track of all checked pseudo class selectors
in the SelectorEngine code. We also give StyleComputer per-pseudo-class
rule caches.
2025-04-17 19:45:55 +02:00
Andreas Kling
ed35f9e7c2
LibWeb: Remove unused MatchingRule::must_be_hovered flag
...
This was a vestige from an earlier version of hover selector work
avoidance optimizations.
2025-04-17 19:45:55 +02:00
Timothy Flynn
60f667fc5a
LibWeb: Use (de)serialization with transfer AOs for structured cloning
...
This is important, for example, to detach transferred array buffers.
2025-04-17 12:13:13 -04:00
Timothy Flynn
5eab109d85
LibWeb: Update structured deserialization to accept its target realm
...
This is a formal parameter to this AO in the spec.
2025-04-17 12:13:13 -04:00
Vishal Biswas
eb165554e1
LibWeb: Use double type in ProgressEvent
...
loaded and total should be double as per spec
https://xhr.spec.whatwg.org/#progressevent
2025-04-17 08:28:47 -04:00
Vishal Biswas
d56f6805d3
LibWeb: Mimic if-condition from spec
...
https://xhr.spec.whatwg.org/#dom-xmlhttprequest-abort
2025-04-17 08:28:47 -04:00
Tim Ledbetter
ca200142e9
LibWeb: Don't construct stylesheet when modifying CSSStyleSheet
rules
...
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, 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
Previously, `CSSStyleSheet.replace()` and `CSSStyleSheet.replaceSync()`
parsed the given CSS text into a temporary stylesheet object, from
which a list of rules was extracted. Doing this had the unintended
side-effect that a fetch request would be started if the given CSS text
referenced any external resources. This fetch request would cause a
crash, since the temporary stylesheet object didn't set the constructed
flag, or constructor document. We now parse the given CSS text as a
list of rules without constructing a temporary stylesheet.
2025-04-16 22:03:12 +01:00
Timothy Flynn
955f6fc9cb
LibWeb: Fulfill TransformStream promises with the correct "reason"
...
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, 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
We need to use the reason provided to the abort algorithm, not the one
from the resolved cancel promise (which will be undefined).
2025-04-16 13:15:33 -04:00
Andrew Kaster
ea68944149
LibWeb: Store LibGfx objects in RefPtr to const for draw commands
2025-04-16 10:41:44 -06:00
Andrew Kaster
c36c7ed67b
LibWeb: Launder const in CSS::Selector::absolutized when returning self
...
This const method tries to return a RefPtr to non-const self. That's
not kosher, but fixing it needs some architecture work.
2025-04-16 10:41:44 -06:00
Andrew Kaster
4b7f4aef10
LibWeb: Pass RefPtr to const to ClippableAndScrollable setters
...
We were already storing the ClipFrame and ScrollFrame in RefPtr to const
but we were passing them as RefPtr to non-const to the setters.
2025-04-16 10:41:44 -06:00
Andrew Kaster
280ae45210
LibWeb: Pass ImageData as non-const to CanvasImageData mixin methods
...
CRC2D needs to manipulate the ImageData object in put_image_data()
2025-04-16 10:41:44 -06:00
Andrew Kaster
be2dd91289
LibGfx+LibWeb: Store Typeface and Font-related types in RefPtr to const
2025-04-16 10:41:44 -06:00
Andrew Kaster
d1f6f5649e
LibWeb: Make storage of CSS::CalculationNodes const-correct
...
Now we consistently use `RefPtr<CalculationNode const>` for all
CalculationNodes.
2025-04-16 10:41:44 -06:00
Andrew Kaster
6d11414957
LibWeb: Make storage of CSS::StyleValues const-correct
...
Now we consistently use `RefPtr<StyleValue const>` for all StyleValues.
2025-04-16 10:41:44 -06:00
Timothy Flynn
3fdad8fe22
LibWeb: Update spec steps for closing TransformStreams
...
This was actually an older change to the Streams spec that we missed
when we implemented TransformStreams. This fixes a crash in the imported
WPT tests.
See: 007d729
2025-04-16 11:39:25 -04:00
Andrew Kaster
8cfac6ed71
LibWeb: Store a SpeculativeHTMLParser on the HTML Parser
...
The parser was previously added, but unused. Actually attaching one to
the HTML Parser will let us test the limits of Swift interop.
2025-04-16 09:02:27 -06:00
Gingeh
bbf4f546af
LibWeb: Only create backdrop when originating element is invalidated
2025-04-16 09:01:08 -06:00
Timothy Flynn
6dd2a4c945
LibWeb: Do not create a RootVector to invoke IDL callbacks
...
These callbacks are evaluated synchronously via JS::Call. We do not need
to construct an expensive RootVector container just to immediately
invoke the callbacks.
Stylistically, this also helps indicate where the actual arguments start
at the call sites, by wrapping the arguments in braces.
2025-04-16 07:32:02 -04:00
Timothy Flynn
b1a189acfa
LibWeb: Use WebIDL::invoke_promise_callback in Streams where appropriate
...
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, 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 avoids an issue where rejected JS::Promise types were converted to
a resolved WebIDL::Promise type.
2025-04-15 20:33:30 -04:00
Timothy Flynn
525343ba79
LibWeb: Add an alternative to WebIDL::invoke_callback to return promises
...
When we need the callback to return a promise, we can use this alternate
invoker to construct the WebIDL::Promise for us. Currently, the Streams
API will use WebIDL::invoke_callback to create a JS::Promise, and then
wrap that result in a resolved WebIDL::Promise. This results in rejected
JS::Promise instances not being propagated.
2025-04-15 20:33:30 -04:00
Timothy Flynn
df1e51b80b
LibWeb: Use the correct realm when initializing streams
...
There is an open issue to clarify exactly what realm is to be used when
creating promises. There are surely many more places we will need to
update to use the correct realm (which will be the realm of `this`'s
relevant global object).
2025-04-15 20:33:11 -04:00
Sam Atkins
9f333c424c
LibWeb/CSS: Ensure a font source format() only contains one string/ident
2025-04-15 21:40:41 +02:00