Commit graph

64591 commits

Author SHA1 Message Date
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
sideshowbarker
58b07bc531 Tests: Import WPT html/dom/aria-attribute-reflection.html test
This change imports the WPT html/dom/aria-attribute-reflection.html test
into being an in-tree test — and deletes the related existing test
from https://github.com/LadybirdBrowser/ladybird/commit/a924e8747a4
previously “ported” from the WPT with changes to run under our (non-WPT)
in-tree test harness.
2024-10-30 08:47:23 +01:00
Andreas Kling
d78c81a9fd Tests: Import LICENSE.md from WPT 2024-10-30 08:28:51 +01:00
Nico Weber
421cf8d9bf LibWeb: Parse stroke-{linejoin,miterlimit} attributes
Some checks are pending
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
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
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
Similar to LadybirdBrowser/ladybird#1714.

We don't implement the linejoin values `miter-clip` and `arcs`, because
according to the SVG 2 spec:

> The values miter-clip and arcs of the stroke-linejoin property are at
> risk. There are no known browser implementations. See issue Github
> issue w3c/svgwg#592.

Nothing uses this yet. The next step is to change
SVGPathPaintable::paint() to read `graphics_element.stroke_linejoin()`
and `graphics_element.stroke_miterlimit()` when painting.
2024-10-29 22:37:00 +00:00
Nico Weber
eafcd82e82 LibWeb: Support stroke-linecap as attribute as well
This should have been part of #1714.

(stroke-linecap still isn't implemented, but once it is, it will
now work in attribute form as well.)
2024-10-29 22:37:00 +00:00
Piotr
205155a7ab LibWeb: Set textarea rows and cols default value if 0
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 (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (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
The cols and rows attributes are limited to only positive numbers with
fallback. The cols IDL attribute's default value is 20. The rows IDL
attribute's default value is 2.

The default value was returned only for the negative number. I added an
additional check for the case when the attribute is 0 to match the
specification.
2024-10-29 16:05:32 +01:00
Sam Atkins
5723ed3443 Tests: Add clip-path to calc() coverage test 2024-10-29 16:05:16 +01:00
Sam Atkins
ec9d67ae17 Tests: Add filter and backdrop-filter to calc() coverage test
Neither of these currently work correctly. This is just so we keep track
of them.
2024-10-29 16:05:16 +01:00
stelar7
2b65e86ec7 LibWeb: Add debug log message for missing calc() context 2024-10-29 14:40:40 +00:00
stelar7
488436fb54 LibWeb: Parse the rotate css property 2024-10-29 14:40:40 +00:00
Pavel Shliak
8ac60273a6 LibAudio: Manage channelCount in DynamicsCompressorNode
That helps to pass more WPT tests
under /webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor.html
2024-10-29 13:31:52 +00:00
Pavel Shliak
f2ed59879f LibAudio: Manage channelCountMode in DynamicsCompressorNode
That helps to pass more WPT tests
under /webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor.html
2024-10-29 13:31:52 +00:00
Tim Ledbetter
ed658154d2 Meta: Set LADYBIRD_GIT_VERSION environment variable in WPT.sh
This ensures the `browser_version` field of any wptreport format log
files include the current git commit hash.
2024-10-29 13:30:12 +00:00
Tim Ledbetter
472d5e87e9 Meta+LibCore: Include git hash in version string
If the `LADYBIRD_GIT_VERSION` environment variable is set, then use it
to set the version number printed by the `--version` argument.
2024-10-29 13:30:12 +00:00
Tim Ledbetter
e815847f86 LibCore: Remove SerenityOS specific version number code 2024-10-29 13:30:12 +00:00
Gingeh
ebb8342cf2 LibWeb: Implement and use "isomorphic decoding" 2024-10-29 08:26:13 -04:00
Tim Ledbetter
d79fcceb8a Meta: Replace realpath usage with cross-platform function in WPT.sh
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-29 07:30:32 -04:00
Tim Ledbetter
cd0b9c4ec0 Meta: Add cross-platform function for absolutizing paths 2024-10-29 07:30:32 -04:00
Timothy Flynn
8132587b3b headless-browser: Implement WebView callbacks for WebDriver rect changes 2024-10-29 11:03:20 +00:00
Timothy Flynn
3ca2ee9c72 LibWeb+WebContent+WebDriver+UI: Make window min/maximize asynchronous
This follows suit of previous changes to never block the WebContent
process in WebDriver endpoints.
2024-10-29 11:03:20 +00:00
Timothy Flynn
9e10010c54 LibWeb: Add a document observer for visibility state changes 2024-10-29 11:03:20 +00:00
Timothy Flynn
bc67bdb160 LibWeb+UI: Initialize the system visibility state to 'hidden'
Not only does this match the spec, but otherwise when the UI process
sends us the initial visibility update, we would ignore the message as
we believed we were already visible (thus the update would not reach the
document).
2024-10-29 11:03:20 +00:00
Timothy Flynn
fa83cc722c LibWeb+WebContent+WebDriver+UI: Make window rect updates asynchronous
It's currently possible for window size/position updates to hang, as the
underlying IPCs are synchronous. This updates the WebDriver endpoint to
be async, to unblock the WebContent process while the update is ongoing.
The UI process is now responsible for informing WebContent when the
update is complete.
2024-10-29 11:03:20 +00:00
Timothy Flynn
42984a10e9 IPCCompiler: Transfer DevicePixelRect by value 2024-10-29 11:03:20 +00:00
Timothy Flynn
e4f0e745a4 UI/Qt: Send the rect of the window itself to WebContent
This ensures that the live values we return to WPT match the requested
values.
2024-10-29 11:03:20 +00:00
Timothy Flynn
54f6db01af UI/Qt: Do not multiply window position/size by the device pixel ratio
On macOS, this is resulting in values of window.screenX, window.screenY,
window.outerWidth and window.outerHeight that are 2x larger than Safari,
Firefox, and our AppKit UI.
2024-10-29 11:03:20 +00:00
Timothy Flynn
00a486d072 UI/AppKit: Convert window origins sent from WebDriver to AppKit's origin
Window origins in AppKit are the bottom-left position of the NSWindow,
relative to the bottom-left of the screen. So we must do some alignment
of the top-left position received from WebDriver.
2024-10-29 11:03:20 +00:00
Timothy Flynn
102a125ea5 UI/AppKit: Inform WebContent of the UI window position/size
This is required for APIs like window.screenX, as well as for WebDriver
and WPT.
2024-10-29 11:03:20 +00:00
Timothy Flynn
777eec095b headless-browser: Implement dialog-related WebView callbacks
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 allows us to headlessly run WPT tests which involve dialogs.
2024-10-28 23:27:55 +01:00
Timothy Flynn
6590b8a1a7 headless-browser: Send a dummy screen rect to WebContent
The window.open spec assumes the User Agent knows its screen size. Send
a fake screen from headless-browser to WebContent.
2024-10-28 23:27:55 +01:00
Timothy Flynn
47af8c6733 LibWeb: Defer handling of WebDriver endpoint invocations
We can currently crash on WebDriver session shutdown when we receive a
Delete Session command. This destroys the WebDriver client while we are
inside the client's socket's on_ready_to_read callback. This is not
allowed by AK::Function.

To avoid this, we now only read data from the socket in the callback. We
then defer handling the message to break out of the callback.
2024-10-28 23:27:25 +01:00
Timothy Flynn
db1bcb2c56 LibHTTP: Make HttpRequest default-movable
Otherwise, clangd correctly warns that this type is only copyable.
2024-10-28 23:27:25 +01:00
Lucas CHOLLET
f253246a6c LibWeb/CSS: Add support for the lch color function
This makes us pass all `css/css-color/lch-00*.html` tests.
2024-10-28 23:26:19 +01:00
Lucas CHOLLET
e8fc731b8c LibWeb/CSS: Introduce a base class for LCH-based color values
This will be used by both CSSLCH and CSSOKLCH.
2024-10-28 23:26:19 +01:00
Lucas CHOLLET
7a94709cd2 LibWeb/CSS: Factorize the parsing code for lch-like color functions 2024-10-28 23:26:19 +01:00
Shannon Booth
2c5cfbb968 LibWeb: Expose MessagePort.postMessage(message, transfer)
The overload resolution is no longer an issue, and we already had this
implemented :^)
2024-10-28 22:56:39 +01:00
Shannon Booth
897ba19e0f LibWeb: Use FIXME extended attribute for ServiceWorker.postMessage
The old FIXME is no longer relevant :^)
2024-10-28 22:56:39 +01:00
Shannon Booth
bf81e2fd64 LibWeb: Implement Worker.postMessage(message, transfer) 2024-10-28 22:56:39 +01:00