Commit graph

64505 commits

Author SHA1 Message Date
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
Shannon Booth
755b63132b LibWeb: Implement DedicatedWorkerGlobalScope postMessage(msg, transfer)
Unfortunately the added test (which passes locally) is skipped as it is
based off other Worker tests which are also skipped due to being flakey
in CI.
2024-10-28 22:56:39 +01:00
Shannon Booth
70599d3f8d LibWeb: Add support for dictionaries in overload resolution
By making use of the known set of supported dictionary names in that
overload set. Note that this list is typically very small (the max that
we have currently is 1).
2024-10-28 22:56:39 +01:00
Shannon Booth
013c2a1c7c LibWeb: Verify that all overloads contain Unscopable if present
It would be strange for the IDL to be defined as such, so instead of
leaving a FIXME comment, let's just verify that this doesn't happen in
practise incase it does end up happening in reality.
2024-10-28 22:56:39 +01:00
Lucas CHOLLET
48bbebc636 LibWeb/CSS: Start parsing the color() function
This is really bare bone as we only support the `xyz-d50` color space
for the moment.

It makes us pass the following WPT tests:
 - css/css-color/predefined-016.html
 - css/css-color/xyz-d50-001.html
 - css/css-color/xyz-d50-002.html
2024-10-28 22:55:57 +01:00
Grubre
a6794627b0 LibWeb: Use Element::lang() in matches_lang_pseudo_class
The previous implementation went up the DOM tree until it found lang
attribute. The new version uses lang() function from the spec.
2024-10-28 17:55:05 -04:00
Grubre
95c511a3f6 LibWeb: Use the correct locale when applying titlecase
Previously with lang="nl" and text-transform: capitalize, inner text
"ijsland" would turn to "Ijsland" instead of "IJsland", now it's as it
should be.

This fixes:
https://wpt.fyi/results/css/css-text/text-transform/text-transform-tailoring-001.html
2024-10-28 17:55:05 -04:00
Grubre
5ac1a24255 LibWeb: Implement lang() function for DOM::Element
This is in accordance with:
https://html.spec.whatwg.org/multipage/dom.html#the-lang-and-xml:lang-attributes
2024-10-28 17:55:05 -04:00
Jonne Ransijn
5c1bbd3eff LibWeb: Make CSSRule::type() non-virtual
All its overrides return constants, and without virtual dispatch the
`qualified_layer_name` and `absolutized_selectors` functions can benefit
from slightly better optimizations.

`CSSRule`s aren't allocated that often, so the memory impact is minimal.
2024-10-28 22:53:57 +01:00
Kostya Farber
2f41be733f LibWeb: Add word spacing to tab size correctly
We should be adding the computed value for word spacing not letter
spacing twice.
2024-10-28 22:53:37 +01:00
Jelle Raaijmakers
1b82cb43c2 LibWeb+LibGfx: Fix SVG userSpaceOnUse gradient coordinate transformation
We were transforming coordinates for SVG gradients in a pretty
convoluted way: an inverse, unscaled transformation matrix was set up in
order to work around some (old?) technical limitations.

Rework this so the coordinate transformation no longer needs to be
inversed. This fixes gradients with "userSpaceOnUse" for its
gradientUnits attribute, which might cause coordinates to lie outside of
the bounding box of the gradient.

Two tests have updated reference screenshots with minor pixel updates;
this is probably the result of floating point precision improvements by
not inversing the matrix.

One test (svg-text-effects) has a bigger change: the gradient stops seem
to have moved along the text. This does seem to match other browsers
slightly better, so I'm moving forward with this ref update.
2024-10-28 22:53:17 +01:00
Jelle Raaijmakers
4d7da9878d LibWeb: Implement gradient offset clamping for color stops 2024-10-28 22:53:17 +01:00
Jelle Raaijmakers
66925a3d80 LibWeb: Misc. SVG improvements
No functional changes: added spec comments, moved some code, removed an
unused member.
2024-10-28 22:53:17 +01:00
Ben Wiederhake
3553861046 LibWeb: Omit padding in WebCrypto AES-CBC exportKey 2024-10-28 21:15:59 +01:00
Lucas CHOLLET
15121d63ad LibWeb/CSS: Make all children of CSSLabLike share the create() method
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
Small code deduplication. NFC.
2024-10-28 20:35:57 +01:00
66542e
9b44a99617 Documentation: Rename class name on Images/classes.png
Updated class name on diagram according to rename in the
commit(3a71748e5d).
2024-10-28 11:06:38 -04:00
Tim Ledbetter
0a3a75cf35 Meta: Use correct WPT log file path when an absolute path is given 2024-10-28 10:22:48 -04:00
Tim Ledbetter
c544d1fa1f Meta: Use correct certificate path when invoking WPT
We now ensure that the directory for the currently selected build
preset is used as the base certificate path.
2024-10-28 10:22:48 -04:00
Ben Wiederhake
4a6ce210b0 LibWeb: Refuse to fill float array with random values
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 passes an additional test in WPT:
WebCryptoAPI/getRandomValues.any
2024-10-28 10:42:27 +01:00
Michael Boonstra
157dbbad83 LibWebView: Fix ProcessAndClient template deduction
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 resolves compiler errors in HelperProcess.cpp when instantiating
Process::spawn() with various client types like WebContentClient and
RequestClient.
2024-10-27 19:57:53 -07:00
Jonne Ransijn
c97af00355 LibCore: Respect system hard limit in set_resource_limits
This avoids an "Invalid argument (errno=22)" error
on systems with lower hard limits.
2024-10-27 16:15:43 -04:00
Andreas Kling
c5a54f1166 LibWeb: Allow intrinsic size keywords for min-height and max-height 2024-10-27 21:02:54 +01:00
Andreas Kling
5a9d538acc LibWeb: Disallow none for min-width and min-height 2024-10-27 21:02:54 +01:00
Andreas Kling
ce6a7ba050 Tests: Import WPT tests from /css/css-sizing/parsing 2024-10-27 21:02:54 +01:00
Andreas Kling
037c034468 Tests: Remove an imported WPT test we can't run without WebDriver
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
We can bring this back if we gain the necessary faculties later.
2024-10-27 18:40:20 +01:00
Andreas Kling
6c75a93ec0 LibWeb: Fix select element state update in three ways
1. We were not propagating selectedness updates from option to select
   if the option was inside an optgroup.

2. When two or more options were selected, we were always favoring the
   last one in tree order, instead of the last one that got checked.

3. We were neglecting to return in the `display size is 1` case when
   all elements were disabled.

This was covered by some of the :has() selector tests. :^)
2024-10-27 18:40:20 +01:00
Andreas Kling
6dad8ea584 LibWeb: Move pessimistic :has() invalidation hack to invalidate_style()
We basically need to do this for every invocation of invalidate_style()
right now, so let's just do it inside invalidate_style() itself.

Fixes one missing invalidation issue caught by a WPT test. :^)
2024-10-27 18:40:20 +01:00
Jonne Ransijn
22a66bb1c2 AK: Pass (Deprecated)FlyString::is_one_of arguments by reference
This avoid unnecessairy reference counting.
2024-10-27 12:03:04 -04:00
Jonne Ransijn
7f3269fb02 AK: Add ASCII fast path for Utf8View::contains
This also makes `Utf8View::trim` significantly faster, since most
strings start and end with ASCII.
2024-10-27 16:13:36 +01:00
Kostya Farber
b953b5cc71 Documentation: Change in name from Serenity to Ladybird
Probably a remnant from Ladybird being in Serenity :^).
2024-10-27 14:33:24 +01:00
Andreas Kling
85bf1d6033 Meta: Ignore LibWeb text tests for newline-at-eof check 2024-10-27 13:33:46 +01:00
Andreas Kling
a640fcc693 LibWeb: Import a bunch of :has() selector tests from WPT 2024-10-27 13:33:46 +01:00
Andreas Kling
9e080e197c LibWeb: Make :has() actually work for non-descendant relative selectors
The traversal for these was incorrect and awkward. Now it's less
incorrect but still very awkward. We should find better ways to
implement this, but for now this at least passes many more WPT tests.
2024-10-27 13:33:46 +01:00
Andreas Kling
f24b91b01e LibWeb: Invalidate whole document style on attr change if :has() present
This sucks, and we're gonna have to do better, but for now let's
invalidate the whole document's style, so that we get correct behavior
if there are :has() selectors present.
2024-10-27 13:33:46 +01:00
Andreas Kling
690d9c8752 LibWeb: Be more thorough when marking selectors as "contains :has()"
We were missing this flag on a lot of selectors, which led to
insufficient invalidation in some cases.
2024-10-27 13:33:46 +01:00
Jonne Ransijn
07cd7d479f LibWeb: Remove reference counting for CSS::StyleProperties
`AK::CopyOnWrite` already does reference counting, so there is no need
to do it again.
2024-10-27 13:26:30 +01:00
Jonne Ransijn
e636f3976d AK: Fix ambiguity in AK::Optional specialization
The specialization for the destructor of `AK::Optional` is ambiguous
when `T` is neither TriviallyDestructible nor Destructible.
The fix adds an additional check for `Destructible` when generating the
destructor of `AK::Optional`, since it calls the destructor of `T`, and
therefore already required `T` to be `Destructible` anyway.
2024-10-27 13:26:30 +01:00