Commit graph

64578 commits

Author SHA1 Message Date
sideshowbarker
120bc52f23 Tests: Import WPT accname/name/comp_embedded_control.html test
This change imports the WPT accname/name/comp_embedded_control.html
test, along with related resources files it depends on.

Note that in the wai-aria/scripts/aria-utils.js file, this changes the
get_computed_label call to use our window.internals.getComputedLabel.
2024-10-31 01:16:47 +00:00
sideshowbarker
1b4e609eb2 LibWeb: Expose Node::accessible_name via window.internals
This adds window.internals.getComputedLabel, for exposing
Node::accessible_name (for accessibility-testing purposes).
2024-10-31 01:16:47 +00:00
sideshowbarker
65bda00274 LibWeb: Support getting accessible name for labeled form controls
This change implements the “C: Embedded Control” step at
https://w3c.github.io/accname/#step2C in the “Accessible Name and
Description Computation” spec — to compute the accessible names for
labeled form controls.
2024-10-31 01:16:47 +00:00
Timothy Flynn
e8cd3749c8 LibWeb: Implement WebDriver shadow references according to the spec
Similar to commit a9c858fc78, this patch
implements the WebDriver spec concept of shadow references grouped
according to their browsing context groups.
2024-10-31 00:42:29 +00:00
Timothy Flynn
ad9d623664 WebContent+WebDriver: Make the element locator endpoints asynchronous
We currently spin the event loop to wait for the specified element to
become available. As we've seen with other endpoints, this can result
in dead locks if another web component also spins the event loop.

This patch makes the locator implementations asynchronous.
2024-10-31 00:42:29 +00:00
Timothy Flynn
80b3de8f9e Meta: Ignore virtual Python environments 2024-10-31 00:42:29 +00:00
Jelle Raaijmakers
a0ee86db04 LibWeb: Prevent painting grid items twice as a stacking context
We paint grid item nodes as a stacking context when they have no
`z-index` style set. However, a grid item could already have a stacking
context established - for example, when the `filter` style is applied.
This causes these nodes to be drawn twice.

Skip painting grid item nodes if a stacking context is already present.
2024-10-31 00:59:32 +01:00
Jelle Raaijmakers
185335ac63 LibWeb: Remove superfluous VERIFY from StackingContext
We just checked if it's an SVG box, let's not do it again.
2024-10-31 00:59:32 +01:00
Sam Atkins
760943d584 LibWeb/CSS: Correct matching of calc() against <number-percentage>
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (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
Push notes / build (push) Waiting to run
This seems to have vanished from the spec, but in any case, we still
need it. Without this change we erroneously thought that calculations
that match <percentage> did not match <number-percentage>.
2024-10-30 20:58:16 +01:00
Shannon Booth
797b0d0f43 LibJS+LibWeb: Remove remaining use and reference to SafeFunction 2024-10-30 20:55:45 +01:00
Shannon Booth
716e86f042 LibJS: Use HeapFunction for async body closure in Array.fromAsync 2024-10-30 20:55:45 +01:00
Shannon Booth
e6d1123ce8 LibWeb: Make ResourceLoader callbacks HeapFunctions 2024-10-30 20:55:45 +01:00
Shannon Booth
1c18b900e2 LibWeb: Port EventLoop::spin_XXX to HeapFunction 2024-10-30 20:55:45 +01:00
Shannon Booth
29cea5bd24 LibWeb: Make EventLoopPlugin::deferred_invoke take a HeapFunction 2024-10-30 20:55:45 +01:00
Shannon Booth
7487a782db LibWeb: Use HeapFunction for EventLoopPlugin::spin_until 2024-10-30 20:55:45 +01:00
Shannon Booth
de1a805898 LibWeb: Use HeapFunction for Platform::Timer 2024-10-30 20:55:45 +01:00
Shannon Booth
ede3c91688 LibWeb: Make Platform::Timer GC-allocated
This will allow us to remove the use of SafeFunction in it's
implementation. This requires a fair amount of plumbing to wire up the
GC heap to the appropriate places in order to create the timers.
2024-10-30 20:55:45 +01:00
Shannon Booth
e44702f090 LibWeb: Construct ResourceLoader with a GC Heap
This will allow us to easily make use of HeapFunctions instead of
SafeFunction for all of the callbacks in ResourceLoader.
2024-10-30 20:55:45 +01:00
Aliaksandr Kalenik
a8077f79cc LibWeb: Separate text control input events handling from contenteditable
This input event handling change is intended to address the following
design issues:
- Having `DOM::Position` is unnecessary complexity when `Selection`
  exists because caret position could be described by the selection
  object with a collapsed state. Before this change, we had to
  synchronize those whenever one of them was modified, and there were
  already bugs caused by that, i.e., caret position was not changed when
  selection offset was modified from the JS side.
- Selection API exposes selection offset within `<textarea>` and
  `<input>`, which is not supposed to happen. These objects should
  manage their selection state by themselves and have selection offset
  even when they are not displayed.
- `EventHandler` looks only at `DOM::Text` owned by `DOM::Position`
  while doing text manipulations. It works fine for `<input>` and
  `<textarea>`, but `contenteditable` needs to consider all text
  descendant text nodes; i.e., if the cursor is moved outside of
  `DOM::Text`, we need to look for an adjacent text node to move the
  cursor there.

With this change, `EventHandler` no longer does direct manipulations on
caret position or text content, but instead delegates them to the active
`InputEventsTarget`, which could be either
`FormAssociatedTextControlElement` (for `<input>` and `<textarea>`) or
`EditingHostManager` (for `contenteditable`). The `Selection` object is
used to manage both selection and caret position for `contenteditable`,
and text control elements manage their own selection state that is not
exposed by Selection API.

This change improves text editing on Discord, as now we don't have to
refocus the `contenteditable` element after character input. The problem
was that selection manipulations from the JS side were not propagated
to `DOM::Position`.

I expect this change to make future correctness improvements for
`contenteditable` (and `designMode`) easier, as now it's decoupled from
`<input>` and `<textarea>` and separated from `EventHandler`, which is
quite a busy file.
2024-10-30 19:29:56 +01:00
Aliaksandr Kalenik
380907cd48 LibWeb: Allow TextCursor hit-testing mode select empty contenteditable 2024-10-30 19:29:56 +01:00
Aliaksandr Kalenik
20852443d3 LibWeb: Clamp end offset in CharacterData::replace_data()
Makes this method to not fail if updating of start offset (which happens
before update of the end offset) already moved end offset to the end of
string on the following step:

> 1. If range’s root is not equal to node’s root, or if bp is after the
     range’s end, set range’s end to bp.
2024-10-30 19:29:56 +01:00
Aliaksandr Kalenik
da26941b50 LibWeb: Use cached word segmenter for word selection in EventHandler 2024-10-30 19:29:56 +01:00
Andreas Kling
33507578e0 Tests: Skip css/css-flexbox/abspos/position-absolute-001.html for now
This test is too slow for our GCC CI :^(
2024-10-30 18:45:14 +01:00
Sam Atkins
51fc87bc1b LibWeb/CSS: Return 0 from CSSRule.type for non-spec types
We use the CSSRule::Type enum for identifying the type of a CSSRule, but
the spec requires that only some of these types are exposed via the
`type` attribute. For the rest, we're required to return 0, so let's do
so. :^)
2024-10-30 17:30:58 +01:00
Pavel Shliak
4998385c7a LibAudio: Initialize GainNode properly
That helps to pass WPT tests
under /webaudio/the-audio-api/the-gainnode-interface/ctor-gain.html
2024-10-30 17:30:51 +01:00
stelar7
5630a0d6b4 Meta: Add a script to import WPT tests 2024-10-30 17:29:03 +01:00
Aliaksandr Kalenik
04289fe24e LibWeb: Remove usage of math functions from std namespace
Fixes compilation error with clang from Homebrew introduced in
https://github.com/LadybirdBrowser/ladybird/pull/1962
2024-10-30 17:10:31 +01:00
Florian Cramer
df7cac539e LibXML: Set the doctype when parsing via Parser::parse_with_listener
This fixes at least one WPT test under /domparsing
2024-10-30 14:53:36 +01:00
Gingeh
bd25d0b1b4 LibWeb: Parse drop-shadow filter with missing or starting color
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (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
Push notes / build (push) Waiting to run
2024-10-30 12:41:02 +01:00
Pavel Shliak
0e9c865805 LibWeb: Remove variable self-assignment 2024-10-30 07:40:24 -04:00
Andreas Kling
3180df3337 LibJS: Parse dates like "Tuesday, October 29, 2024, 18:00 UTC"
This format is used on https://jetbrains.com/
2024-10-30 10:47:48 +01:00
Khaled Lakehal
14e1e55319 LibWeb: Implement HTML spec-compliant rules for floating-point parsing
Attempt to implement HTML specs for parsing floating-point number
https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-floating-point-number-values
2024-10-30 10:47:41 +01:00
Pavel Shliak
ba71cb1ca4 LibJS: Add calendar id getter to ZonedDateTimePrototype 2024-10-30 10:29:48 +01:00
Pavel Shliak
2ad48b64ca LibJS: Add calendar id getter to PlainMonthDayPrototype 2024-10-30 10:29:48 +01:00
Pavel Shliak
0e1e8c908e LibJS: Add calendar id getter to PlainYearMonthPrototype 2024-10-30 10:29:48 +01:00
Pavel Shliak
44fa8410c0 LibJS: Add calendar id getter to PlainDateTimePrototype 2024-10-30 10:29:48 +01:00
Pavel Shliak
f7cf7382c9 LibJS: Add calendar id getter to PlainDatePrototype 2024-10-30 10:29:48 +01:00
Pavel Shliak
e60c1ddd4d LibJS: Adds calendar_id identifier 2024-10-30 10:29:48 +01:00
Jonne Ransijn
04920d06f0 AK: Use simdutf when appending UTF-16 to StringBuilder
Adds a fast path for valid UTF-16 using `simdutf`, and fall back to
the slow path for unmatched surrogates.
2024-10-30 10:28:24 +01:00
Jonne Ransijn
ff6020c207 LibJS: Optimize IsStringWellFormedUnicode using simdutf
`simdutf` has a function for this that is much faster.
2024-10-30 10:28:24 +01:00
Alan Kemp
d2fbbabd89 LibWeb: Pageshow event dispatched by the user agent should be trusted
The spec says that "isTrusted is a convenience that indicates whether
an event is dispatched by the user agent (as opposed to using
dispatchEvent())"

But when dispatching a pageshow event the flag was incorrectly set
to false.

This fixes https://wpt.fyi/results/html/syntax/parsing/the-end.html
2024-10-30 10:27:20 +01:00
Andreas Kling
64f18a93c2 LibWeb: Make align-content on flex container behave more correctly
In particular, this property now interacts correctly when the flex
container has flex-wrap: wrap-reverse.

This caused some "regressions" in WPT tests for negative overflow in
flex containers, but the previous behavior wasn't correct either,
it just happened to give false positives on tests.
2024-10-30 10:17:21 +01:00
Andreas Kling
abd24d001d Tests: Import a bunch of WPT tests from /css/css-flexbox 2024-10-30 10:17:21 +01:00
Andreas Kling
0ebdac0b35 Tests: Don't print full error messages in imported WPT tests
...when running in test mode. This cuts down on the time it takes to run
the imported WPT tests, and you can still get the full error by opening
tests in the browser.
2024-10-30 10:17:21 +01:00
Timothy Flynn
53d5c7084e UI/AppKit: Extract bare minimum WebView functionality into its own class
When a window containing a WebView becomes visibile, we have to inform
WebContent. This was only implemented for the Tab class (not Inspector
or Task Manaager).

This patch adds LadybirdWebViewWindow to contain the bare minimum needed
to render a LadybirdWebView. All windows containing a WebView inherit
from this class, to ensure their WebContent processes know they became
visible.
2024-10-30 08:51:14 +01:00
Timothy Flynn
7b3a3c2066 LibJS+LibWeb: Remove now-unused lexical environment override
In our current bytecode interpreter, this override cannot work anyways.
2024-10-30 08:50:31 +01:00
Timothy Flynn
2e71e300ee WebContent: Restore ability to use Inspector accessors like "$0"
We implement these built-in accessors via a lexical environment override
on the inspected document's global scope. However, ClassicScript will
parse the script we provide as a JS program, in which any evaluated
bindings will be interpreted as global bindings. Our global binding
lookup in the bytecode interpreter does not search the lexical env for
the binding, thus scripts like "$0" fail to evaluate.

Instead, we can create an ECMAScriptFunctionObject to evaluate scripts
entered into the Inspector. These are not evaluated as JS programs, and
thus any evaluated bindings are interpreted as non-global bindings. The
lexical environment override we set will then be considered.
2024-10-30 08:50:31 +01:00
Timothy Flynn
99d4c2de29 LibWeb: Make WebDriver's script executor public and a bit more general
The steps to execute a function body in WebDriver is exactly the
behavior we want with the Inspector.
2024-10-30 08:50:31 +01:00
Tim Ledbetter
464a875416 LibWebSocket: Don't send closing frame if connection is already closed 2024-10-30 08:48:17 +01:00
Aliaksandr Kalenik
e95226839e LibWeb: Fix infinite recursion when max-width is min/max-content in GFC
Treat max-width as auto when it's specified to min/max-content and
available size is intrinsic constraint.

Fixes stack overflow on https://claude.ai/
2024-10-30 08:47:52 +01:00