Commit graph

36180 commits

Author SHA1 Message Date
Aliaksandr Kalenik
2a29e348c9 LibWeb: Delete EditableTextNodeOwner
It's no longer needed after FormAssociatedTextControlElement became
responsible for managing input events for text controls.
2024-11-06 18:05:11 +01:00
Timothy Flynn
34c0303ae1 Revert "LibWeb: Make WebDriver's script executor public"
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 reverts commit e41c668435.
2024-11-06 08:42:17 -05:00
Timothy Flynn
94a0f36b3e Revert "WebContent: Restore ability to use Inspector accessors like $0"
This reverts commit ae1c58fad1.
2024-11-06 08:42:17 -05:00
Timothy Flynn
d40b7d67b1 Revert "LibJS+LibWeb: Remove now-unused lexical environment override"
This reverts commit d39f6975f9.
2024-11-06 08:42:17 -05:00
Sam Atkins
b09b23a162 LibWeb/CSS: Avoid double promotion in CSSColorValue code
Co-authored-by: Nico Weber <thakis@chromium.org>
2024-11-06 11:48:48 +00:00
Piotr
06154b87dd LibWeb: Support for "content-language" http-equiv state
Implemented support for setting the pragma-set default language in the
`<meta/>` tag with an `http-equiv` attribute `content-language`.
2024-11-06 10:56:57 +01:00
Timothy Flynn
413cf6b329 LibWeb+LibWebView+WebContent: Remove unused back/forward navigation IPCs 2024-11-06 10:54:17 +01:00
Timothy Flynn
1a8a3979f9 WebContent: Implement the WebDriver Forward endpoint according spec 2024-11-06 10:54:17 +01:00
Timothy Flynn
d867cd26c4 WebContent: Implement the WebDriver Back endpoint according spec 2024-11-06 10:54:17 +01:00
Timothy Flynn
d4966bc2d8 LibWeb: Add a document observer for pageHide/pageShow events
WebDriver will need to "block" until a pageShow event occurs in some
cases.
2024-11-06 10:54:17 +01:00
Timothy Flynn
3afd88330b WebContent: Handle user prompts in the Take Screenshot endpoint
This is a spec issue, and WPT relies on this behavior.
2024-11-06 10:50:33 +01:00
Timothy Flynn
f4111ef1e1 LibWeb: Implement pausing the event loop a bit closer to the spec
Namely, this is to update the rendering before pausing the event loop.
2024-11-06 10:50:33 +01:00
Andreas Kling
5431db8c1c LibWeb: Avoid unnecessary style recomputation during traversal
While traversing the DOM tree, looking for nodes that need a style
update, we were recomputing style for every node visited along the way,
even nodes that didn't themselves need a style update (but one of their
descendants did).

This avoids a bunch of completely unnecessary style recomputation on
basically every website.
2024-11-06 10:49:32 +01:00
Jonne Ransijn
0de9818470 LibWeb: Remove most of the copying of CSS::Parser::ComponentValue
This class was being copied all over the place, however, most of these
cases can be easily prevented with `auto const&` or `NonnullRawPtr<>`.

It also didn't have a move constructor, causing `Vector` to copy on
every resize as well.

Removing all these copies results in an almost 15% increase in
performance for CSS parsing, as measured with callgrind.
2024-11-06 09:43:15 +00:00
Jonne Ransijn
90b2142658 LibWeb: Make CSS::Parser::ComponentValue immutable
`ComponentValue` instances are never mutated, so let's make them
immutable to indicate that they could potentially be cached in the
future.
2024-11-06 09:43:15 +00:00
Jonne Ransijn
138135e0e6 LibWeb: Fix accidental copy in ComponentValue constructors
These values were being copied, despite being passed in as r-value
references.
2024-11-06 09:43:15 +00:00
Hermes Junior
5dabd468ed LibWeb: Fix out-of-bound crash when there's more table cells than cols
Added a getter to ensure we are within a valid range.
This behavior is accepted by other browsers,
and crashed on some pages.
2024-11-06 09:36:33 +00:00
Gingeh
cd5d8f4d95 LibWeb: Handle steps(x, start) like steps(x, jump-start) 2024-11-06 09:27:53 +00:00
Gingeh
453e034801 LibXML: Read code points when parsing names 2024-11-06 10:07:52 +01:00
Aliaksandr Kalenik
42b31820a6 LibWeb: Use UTF-16 code units length in CharacterData::replace_data()
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
Range API uses UTF-16 code units to represent offsets, so replace_data()
needs to use it instead of bytes count while calculating new offsets.

Fixes incorrectly thrown exception when non-latin string is passed into
replace_data().
2024-11-06 05:46:30 +00:00
Timothy Flynn
185255efc3 WebContent: Close top-level traversables asynchronously
The spec is a bit out-of-date here, so this works around an issue with
closing top-level traversables while a dialog is open in another window
within the same agent.
2024-11-05 10:58:34 -07:00
Timothy Flynn
4c61ce5b10 WebDriver: Don't remove windows if attempting to close the window failed
For example, if a dialog is open and the session is configured to ignore
dialogs (instead of automatically closing them), then the Close Window
endpoint will have failed. We can't remove the client-side window handle
in that case.
2024-11-05 10:58:34 -07:00
Timothy Flynn
7f4d2ef0d6 WebDriver: Pass capability-related options along to new windows 2024-11-05 10:58:34 -07:00
Timothy Flynn
d66b54fec5 WebContent+WebDriver: Transfer WebDriver capability init to Session
Capabilities are configured on a per-session basis, but we were only
applying these options to the first WebContent process created. We will
need to pass these options to new windows created from that process.
This patch re-organizes capability processing so that our session can
remember them for new windows.
2024-11-05 10:58:34 -07:00
Shannon Booth
9598ed1d17 LibWeb: Hook up the HostInitializeShadowRealm callback
This is enough for a basic shadow realm to work :^)

There is more that we still need to implement here such as module
loading and fixing up the global object, but this is enough to get some
basic usage working.
2024-11-05 10:43:08 -07:00
Shannon Booth
b24cd3ecf6 LibWeb: Wire up synthetic realm to settings object and execution context 2024-11-05 10:43:08 -07:00
Shannon Booth
c69a9812c8 LibWeb: Introduce the 'ShadowRealmGlobalScope' interface
This object represents the global object for a shadow realm. The IDL
generator will need to be adjusted to the '[Global]' extended attribute
and no '[Exposed]' field (the change in the test is not correct, as I
understand it), but this should be enough to get us started on
shadow realms.
2024-11-05 10:43:08 -07:00
Shannon Booth
b105c06824 LibWeb: Introduce a SyntheticHostDefined class
This class is the host defined field of a synthetic realm created as
part of a shadow realm.
2024-11-05 10:43:08 -07:00
Shannon Booth
5154df020b LibWeb: Rename Bindings::HostDefined to Bindings::PrincipalHostDefined
With the introduction of shadow realms, there will be two different
possible host defined objects. For clarity, rename the existing host
defined object to PrincipalHostDefined.
2024-11-05 10:43:08 -07:00
stasoid
16ab3c5f9d LibCore: Port DirIterator to Windows using vcpkg dirent.h 2024-11-05 10:42:44 -07:00
stasoid
cf198d0d60 Partially revert "LibCore: Add Windows version of DirIterator"
This reverts commit d92a96c40a, but
keeps changes to AK/Error{.h,.cpp} (function Error::from_windows_error)
2024-11-05 10:42:44 -07:00
Gingeh
a4b38dda56 LibWeb: Use substrings instead of pointers when parsing unicode ranges
Fixes a segfault when parsing a wildcard-only unicode range
2024-11-05 14:01:45 +00:00
Andreas Kling
ceedfb34d2 LibWeb: Look at both namespace & tag name in HTML parser stack checks
We were neglecting to check the namespace when looking for a specific
type of element on the stack of open elements in many cases.

This caused us to confuse HTML and SVG elements.
2024-11-05 12:29:27 +01:00
Andreas Kling
7d7f8f1b48 LibWeb: Remove outdated FIXME in "in body" insertion mode
We are actually setting `onlyAddToElementStack` here. :^)
2024-11-05 12:29:27 +01:00
Andreas Kling
49b88fc095 LibWeb: Don't compare against HTML-uppercased tag names in HTML parser
Element::tag_name() returns an uppercased string for HTML elements,
which is usually not what's expected by the parser algorithms that look
at tag names.
2024-11-05 12:29:27 +01:00
Andreas Kling
79613eae7f LibWeb: Add spec comments to the "in template" insertion mode 2024-11-05 12:29:27 +01:00
Gingeh
d1b967bca5 LibWeb: Consider every row when calculating table width 2024-11-05 10:58:11 +00:00
Gingeh
c67ecf37f7 LibWeb: Implement linear easing according to latest spec 2024-11-05 10:41:29 +00:00
Gingeh
3f79d93bd3 LibWeb: Break Easing Function definitions into separate functions 2024-11-05 10:41:29 +00:00
Kostya Farber
373c80db68 LibWeb: Start implementing letter spacing
Letter spacing is applied during text shaping and `shape_text` is used
in places other `InlineLevelIterator` so way may have more work to do,
however this is a good start :^).
2024-11-05 10:40:22 +00:00
Simek
09420406b8 LibWeb: Do not allow focusing "Actually Disabled" elements 2024-11-05 10:39:29 +01:00
justus2510
6d9dab5a29 LibGfx: Support APNG more completely
This fixes 3/4 of the remaining test failures in wpt/png/apng. Also,
about half of the APNG files on
https://commons.wikimedia.org/wiki/Category:Animated_PNG_files
used to be broken, and they all seem to work properly now :^)

I also refactored the code to be (at least to me) simpler and more
similar to what the spec describes. As a nice side effect, there are now
fewer lines of code than before.

Lastly, I replaced DeprecatedPainter with Painter.
2024-11-05 10:38:01 +01:00
Tim Ledbetter
c31d44ee18 LibWeb: Ensure inputs are repainted when their checkedness is toggled
Previously, input elements weren't always repainted when their
checkedness was set programmatically.
2024-11-05 10:36:32 +01:00
Shannon Booth
424a0cda93 LibJS: Align ShadowRealmConstructor closer with latest spec
Some checks are pending
Push notes / build (push) Waiting to run
Lint Code / lint (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
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
The current shadow realm constructor implementation was based off a
merge request to the shadow realm proposal for integration into the
web platform. However, this merge request had a bug which we had
applied a workaround for by popping off the execution stack.

Since then, the spec has had an update of:

https://github.com/tc39/proposal-shadowrealm/commit/28b0cc

Which closer aligned the mainline spec to the proposed merge request.

Now, the original shadow realm proposal merge request has been closed
and a new one has been reopened with a much more minimal set of changes
that merely adds extra arguments to HostInitializeShadowRealm, which
this commit aligns with.
2024-11-04 17:15:15 -07:00
Shannon Booth
b927d7f658 LibJS: Update ShadowRealm to not hold an ExecutionContext
Noone needs to use this any more :^)

This is somewhat AD-HOC in the constructor as it is based on an open
shadow realm merge request, but applies the intent of the change without
any change in behaviour.
2024-11-04 17:15:15 -07:00
Shannon Booth
3cb62265ab LibJS: Use GetShadowRealmContext for PerformShadowRealmEval 2024-11-04 17:15:15 -07:00
Shannon Booth
6a55865bf6 LibJS: Use GetShadowRealmContext for ShadowRealmImportValue
Removing one user of the ExecutionContext slot of ShadowRealm.
2024-11-04 17:15:15 -07:00
Shannon Booth
3f24008b31 LibJS: Implement ShadowRealm AO GetShadowRealmContext
This is a new AO introduced in the spec which allows the
[[ExecutionContext]] slot of the ShadowRealm object to be removed.
2024-11-04 17:15:15 -07:00
Shannon Booth
c1998f96c2 LibJS: Update HostEnsureCanCompileStrings arguments to latest spec 2024-11-04 17:15:15 -07:00
Shannon Booth
6da0ac3aa7 LibJS: Update CreateDynamicFunction to latest spec
The use of extract_parameter_arguments_and_body() here is to make things
a little less awkward. If we were to exactly follow spec there would be
an awkward handling of the case that no arguments were provided and we
needed to provide an empty string.

To do this, we would need to either:
  - Provide an Optional<Value> for bodyString to CreateDynamicFunction
  - Create a new empty PrimitiveString wrapped in a JS Value.

Either case is somewhat awkward. Instead, just refactor this logic
outside of CreateDynamicFunction and make the caller do it.

Otherwise, this commit prepares for the new definition of
HostEnsureCanCompileStrings.
2024-11-04 17:15:15 -07:00
Timothy Flynn
6bc339b737 WebContent: Ensure we mark a driver endpoint as complete in early return
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
Fixes a mistake from 3da20aca65.
2024-11-04 16:16:44 -05:00
Timothy Flynn
c0a45394a9 LibWeb: Make the completion callbacks for dismissing dialogs required
All callers have been made async, i.e. they now all provide a completion
callback. Let's make the callback required to discourage any future sync
usage.
2024-11-04 16:16:44 -05:00
stasoid
38aa051f12 LibCore: Port DateTime to Windows 2024-11-04 12:20:53 -07:00
stasoid
3ca2790a43 LibCore: Port most of StandardPaths to Windows
Co-authored-by: Cameron Youell <cameronyouell@gmail.com>
Co-authored-by: Andrew Kaster <akaster@serenityos.org>
Co-authored-by: Konrad <25054764+konradekk@users.noreply.github.com>
2024-11-04 12:20:11 -07:00
stasoid
95bae0c321 LibCore: Port Environment to Windows 2024-11-04 12:20:11 -07:00
Pavel Shliak
38bb8ce0de LibWeb: Modify table formatting according to spec
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
Makes Sub, Super, TextBottom, TextTop vertical aligns equal to Baseline
2024-11-04 14:54:32 +00:00
Jelle Raaijmakers
1388b6866e LibGfx: Return descriptive errors when decoding PNGs
We had an interesting tri-state `ErrorOr<bool>` going on when decoding
PNGs; replace it with `ErrorOr<void>` and add some descriptive errors.
2024-11-04 14:47:37 +01:00
Jelle Raaijmakers
2ce7ec8251 LibGfx: Use libpng's built-in signature verification 2024-11-04 14:47:37 +01:00
Sam Atkins
0a569a9034 LibWeb/CSS: Use writing-mode enum for writing-mode property 2024-11-04 14:47:07 +01:00
Piotr
e2613090ed LibWeb: Handle empty string in lang attribute
If the attribute value is the empty string `(lang="")`, the language
is set to unknown. `lang` attribute higher up in the document tree
will no longer be applied to the content of that element.
2024-11-04 12:06:32 +00:00
Quentin Ligier
ff39f6cec5 LibWeb: Parse the keyword 'none' in the CSS4 color functions
This updates the CSS parser to support the keyword 'none' in the CSS4
color functions. The underlying CSSColorValue already supports this
keyword, meaning the parser can instantiate the color directly.
2024-11-04 10:48:10 +00:00
Quentin Ligier
fac3ea77d8 LibWeb: Fail the parsing of an invalid HSL legacy syntax 2024-11-04 10:48:10 +00:00
Tim Ledbetter
56441fe3e6 LibWeb: Don't crash when input with no associated text node loses focus 2024-11-04 10:08:34 +00:00
Timothy Flynn
5010e42cd3 WebContent: Treat <frame> elements as navigable containers in WebDriver 2024-11-04 09:54:32 +00:00
Timothy Flynn
27a678322f LibWebView: Inspect <frameset> elements the same as <body> elements
We track this node ID to navigate to a default element when opening the
Inspector. So for all intents and purposes, <frameset> and <body> should
be treated the same.
2024-11-04 09:54:32 +00:00
Timothy Flynn
50a31f9728 LibWeb: Abort early processing frame/iframe attrs for null navigables
We guarded one step against a null navigable, but the very next step
also needs to be protected. Let's just abort early instead. This was
caught by the following imported WPT test:

html/dom/elements/the-innertext-and-outertext-properties/innertext-setter.html

This test adds a <frame> element and immediately removes it, but the
task to process the src attribute is already queued. Note that <iframe>
would have the same issue, but this test does not include them.
2024-11-04 09:54:32 +00:00
Timothy Flynn
16def85153 LibWeb: Implement HTMLFrameElement as a NavigableContainer
NavigableContainer is our home grown concept which already contains the
AOs needed for frame and iframe elements. This patch simply aligns our
HTMLFrameElement implementation with this class.

A couple of notes:

1. The <script> in the <head> element is intentional. The <frameset>
   element effectively takes the place of the <body> element, and we
   cannot add a <script> to a <frameset> element.

2. We don't render <frameset> or <frame> at all. Rendering is defined
   in the following spec:
   https://html.spec.whatwg.org/multipage/rendering.html#frames-and-framesets

3. If you load the test page in your browser, you won't see anything,
   regardless of (2). Our test infra adds a <pre> element to the "body"
   element (which is the <frameset> element here). Such children will
   never be rendered. In the future, we could come up with something
   better for our test infra to do, but this isn't important anyways
   for this test - we can still grab the <pre> element's innerText.
2024-11-04 09:54:32 +00:00
Timothy Flynn
0e04d49b44 LibWeb: Implement most WebDriver element locator strategies
Notably missing here is an XPath implementation.
2024-11-03 20:42:46 -05:00
Timothy Flynn
64a8fcc4ef LibWeb: Begin implementing a Selenium-like method to get element text
Unfortunately, there isn't an exact spec method to get the rendered text
of an element, including its shadow DOM. The WebDriver spec requires
just doing exactly what Selenium does.

This patch does not implement this, but is a step in the right direction
as we will now handle text transforms.
2024-11-03 20:42:46 -05:00
Timothy Flynn
a4daf6f928 WebContent: Implement WebDriver's Switch Frame endpoint for numeric IDs 2024-11-03 20:42:46 -05:00
Timothy Flynn
cfcb29bdfd AK+LibUnicode: Add a method to trim non-ASCII whitespace from a String
Required by WebDriver.
2024-11-03 20:42:46 -05:00
Andreas Kling
969ee0f3e0 LibJS: Make DataView::byte_offset() return u32
This fixes structured serialization of DataView. It was expected
to be uniform with TypedArray, which returns u32 for byte_offset().

This was covered by a number of WPT infrastructure tests, which this
commit also imports.
2024-11-04 00:22:40 +01:00
Jonne Ransijn
7402ae3a00 LibWeb: Use the realm from the ServiceWorker client
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
`vm.realm()` might not exist, and was probably not even the right realm
to use in the first place.
2024-11-03 15:26:45 -07:00
Timothy Flynn
3da20aca65 WebContent+WebDriver: Convert all user prompt handlers to be async
Making these async were all actually pretty trivial. This patch does so,
and removes the deprecated synchronous user prompt handler.
2024-11-03 22:11:19 +01:00
rmg-x
0db171c36e LibWeb/Crypto: Fix sizes being passed into generate_aes_key()
Previously, callers were passing the size in bytes, but the method
expected bits. This caused a crash in LibCrypto when verifying the key
size later on.

Also make the naming of local variables and parameters a little more
clear between the different AES algorithms :^)
2024-11-03 21:55:43 +01:00
Andreas Kling
64747c0397 LibWeb: Make HTML parser "current node" APIs return nullable pointer
It's actually possible for there to be no adjusted current node, when
the stack of open elements is empty. This was covered by one of the WPT
parsing tests.
2024-11-03 20:32:32 +01:00
Andreas Kling
ebce483278 LibWeb: Add spec comments to the "in head noscript" parser state 2024-11-03 20:32:32 +01:00
Andreas Kling
0a47d8cb08 LibWeb: Handle more MathML/HTML integration points in the parser 2024-11-03 20:32:32 +01:00
Andreas Kling
ae39c54e51 LibWeb: Fix SVG tag adjustment for feSpotLight, feTile, feTurbulence 2024-11-03 20:32:32 +01:00
rmg-x
c755a09376 RequestServer/ConnectionFromClient: Remove unused header directives 2024-11-03 20:02:52 +01:00
rmg-x
fc53422e1c RequestServer: Implement preconnect for CreateConnection cache level 2024-11-03 20:02:52 +01:00
Aliaksandr Kalenik
feba8e6218 LibWeb: Replace nested_browsing_context() with content_navigable() 2024-11-03 18:43:51 +01:00
Aliaksandr Kalenik
fec4737255 LibWeb: Remove unused members in PaintableFragment
Those are no longer used after we got rid of InlinePaintable.
2024-11-03 18:43:51 +01:00
Timothy Flynn
fd3f8b7645 LibWeb+WebContent: Fully implement WebDriver JSON deserialization 2024-11-03 17:51:58 +01:00
Timothy Flynn
7e1caf30a7 LibWeb: Implement some window/frame reference WebDriver AOs
We must also be careful in how we decide if a window's active browsing
context is top-level.
2024-11-03 17:51:58 +01:00
Timothy Flynn
0371097e2c LibWeb: Add overloads of some element reference AOs for JS objects
We currently only use these methods with AK JSON objects, but they're
actually spec'd for JS objects, as the WebDriver spec sort of assumes
we are sending encoded JS objects over the wire.

When we fully implement JSON deserialization for executing scripts, we
will need to invoke these AOs with JS objects.
2024-11-03 17:51:58 +01:00
Timothy Flynn
dc188329df LibWeb: Use C-style function pointers for ActionsOptions callbacks
This is a bit unfortunate, but if a function provided to this struct is
overloaded, the C++ compiler cannot distinguish which overload should be
assigned to the Function object. This is explained in detail here:
https://stackoverflow.com/a/30394755

C-style function pointers do work, however, and are fine here because
we only ever assign global free functions to these members.
2024-11-03 17:51:58 +01:00
Timothy Flynn
6fb8500a7a LibWeb+WebContent: Simplify hand-rolled script execution result struct
Instead of maintaining a list of script execution result types, which we
then map to WebDriver error types, just return the WebDriver error that
is specified by the spec. Then perform the JSON clone algorithm from the
caller in WebDriverConnection, again as specified by the spec. To do so,
this moves the JSON clone algorithm to its own file. This will also be
the future home of the JSON deserialize algorithm, which will need some
of the internal AOs implemented there.
2024-11-03 17:51:58 +01:00
Timothy Flynn
a5ca036d36 LibWeb+WebContent: Update and fully implement the JSON clone algorithm
We have the facilities now to fully implement this AO. Do so, and update
the AO to match the latest spec.
2024-11-03 17:51:58 +01:00
Timothy Flynn
3d0bbb4bcf LibWeb: Get the length property from collection through standard getters
DOMTokenList and FileList do not have the 'length' own property - their
prototypes have this property instead. So we must go through [[Get]] to
retrieve this property, which will consider the prototype.
2024-11-03 17:51:58 +01:00
Timothy Flynn
627eb90086 LibWeb: Update WebDriver's list of collection types
HTMLAllCollection and HTMLFormControlsCollection were implemented since
this AO was written, and DOMTokenList was added to the spec.
2024-11-03 17:51:58 +01:00
Andreas Kling
102cf345ba LibWeb: Recompute targetStep once more in "apply the history step"
This is an ad-hoc change to account for the fact that we may run
arbitrary code while waiting for the tasks in this function to complete.

Same exact idea as ac48222ed7, once again.
2024-11-03 17:51:44 +01:00
Andreas Kling
b82e34ed00 LibWeb: Flesh out the "in frameset" parsing state and add spec comments
This also implements two FIXMEs, which were covered by WPT tests.
2024-11-03 17:51:44 +01:00
Andreas Kling
ecc9fdf377 LibWeb: Fix incomplete assertion in the "in body" parsing state
We were incorrectly tripping an assertion failure on some WPT tests.
2024-11-03 17:51:44 +01:00
Andreas Kling
40ac3cc2c8 LibWeb: Implement HTML frameset parsing in the "in body" state
Covered by many WPT parsing tests, which will be imported.
2024-11-03 17:51:44 +01:00
Andreas Kling
cfa820922b LibWeb: Bail nicely on EOF in HTML parser "in body" state
If we reach the end of the token stream when "ignoring and moving on
to the next token" in the "in body" state, we should just not move
on to the next token, since there isn't one.

Covered by various WPT HTML parsing tests that will be imported in
a subsequent commit.
2024-11-03 17:51:44 +01:00
Gingeh
c2cd191864 LibWeb: Use machine epsilon when approximating cubic bezier 2024-11-03 17:35:20 +01:00
BenJilks
9395b266c6 LibWeb: Support vertical text hit detection and selection
If a PaintableFragment has a vertical orientation, use y instead of x to
compute the offset of each character in the text fragment.
2024-11-03 17:01:54 +01:00
BenJilks
02276360e9 LibWeb: Draw text vertically, for fragments with vertical writing-mode
For fragments with a vertical `writing-mode`. Rotate the text, so that
it is rendered on its side. This makes it fit into its layout box.
2024-11-03 17:01:54 +01:00
BenJilks
80e7e6dd7d LibWeb: Layout inline elements respective of writing-mode
Use the `writing-mode` property to determine what values should be used
for computing each element's rect on the screen. If it is a vertical
mode, swap the inline and block, lengths and offsets.

This only lays out whole inline formatting contexts vertically, and does
not currently support mixing the two orientations in a single context.
2024-11-03 17:01:54 +01:00