Commit Graph

343 Commits

Author SHA1 Message Date
MacDue
890b4d7980 LibWeb: Replace ARIA role static FlyStrings with an enum
This replaces the FlyStrings for ARIA roles that were constructed in
a [[gnu::constructor]] with a single enum. I came across this as the
DOM inspector was crashing due to a null FlyString for an ARIA role.

After fixing that, I was confused as to why these roles were not an
enum. Looking at the spec there's a fixed list of roles and switching
from references to static strings to an enum was pretty much an
exercise in find and replace :).

No functional changes (outside of fixing the mentioned crash).
2023-01-28 22:09:18 +00:00
Linus Groh
afc055c088 LibWeb: Convert the Location object to IDL
This includes:

- Moving it from Bindings/ to HTML/
- Renaming it from LocationObject to Location
- Removing the manual definitions of the constructor and prototype
- Removing special handling of the Location interface from the bindings
  generator
- Converting the JS_DEFINE_NATIVE_FUNCTIONs to regular functions
  returning DeprecatedString instead of PrimitiveString
- Adding missing (no-op) setters for the various attributes, which are
  expected to exist by the bindings generator
2023-01-18 17:36:39 -05:00
Aliaksandr Kalenik
709fe01f52 LibWeb: Override width calculation for table wrappers
Introduce `TableWrapper` type so table wrappers could be
distinguished from block containers and override width
calculation for table wrappers (CSS 2.2 spec, section 17.5.2)
 inside BFCs in the way that their width should be equal to
width of table box they wrap.
2023-01-14 19:22:08 +01:00
Andreas Kling
0e53003f72 LibWeb: Remove now-unused LayoutRange and LayoutPosition classes :^) 2023-01-12 19:55:10 +01:00
Arda Cinar
283187afc5 AK+LibWeb: Move decode forgiving base64 under Web::Infra namespace
Since the forgiving base64 is part of the web infra standard
2023-01-10 17:54:01 +00:00
Timothy Flynn
af75493883 LibWeb: Move passing of Web object prototypes out of constructors 2023-01-10 16:08:14 +01:00
Jonah
3eef54823a LibWeb: Add Function To Build Accessiblity Tree
With this patch, the accessibility tree can be build from the root
node of a document. This can then be serialzed and sent to (soon
to come) consumers.
2023-01-07 10:51:53 +00:00
Jonah
e63d9d4925 LibWeb: Add Support for the ARIA Element Properties
Element now supports getting and setting ARIA properties from
JS and HTML.
2023-01-07 10:51:53 +00:00
Daniel Ehrenberg
09841f56ed LibWeb: Add initial implementation of structured clone
This implementation only works for cloning Numbers, and does not try to
do all the spec steps for structured serialize and deserialize.

Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2022-11-26 00:47:23 +01:00
Timothy Flynn
e0c7b5747d LibWeb+WebDriver: Begin processing and matching WebDriver capabilities
Still some TODOs here:
* We don't handle all capabilities (e.g. proxy)
* We don't match the capabilities against the running browser

But this will parse the capabilities JSON object received from the
WebDriver client.
2022-11-18 12:21:57 +00:00
Andreas Kling
0555684682 LibWeb: Sketch out basic support for SVG <foreignObject> elements
This patch adds basic DOM construction and IDL bindings for foreign
objects in SVG trees.
2022-11-16 13:01:21 +01:00
Timothy Flynn
4eefa292df LibWeb: Re-implement WebDriver endpoint handling within Web::WebDriver
This moves communication and route matching for WebDriver endpoints into
LibWeb. This is to reduce the amount of duplication required to create a
WebDriver implementation for Ladybird.

In doing so, this introduces some cleanup of WebDriver handling. Routes
are now a compile-time array, and matching a route is nearly free of
allocations (we still allocate a Vector for parsed parameters). This
implementation also makes heavier use of TRY semantics to propagate
errors into one handler.
2022-11-13 16:41:07 +00:00
Timothy Flynn
cb4b9108d1 LibWeb+WebDriver: Move the timeouts configuration object to LibWeb 2022-11-11 22:03:23 +00:00
Timothy Flynn
40b9d248be LibWeb: Implement screenshot painting inside Web::WebDriver
This will allow for implementing the screenshot action closer to the
spec, as we can now use HTMLCanvasElement to encode the bitmap, and
capture the screenshot on the animation frame loop.
2022-11-11 11:36:07 +00:00
Timothy Flynn
15916e5c14 LibWeb: Implement the element location strategies in Web::WebDriver 2022-11-10 13:10:16 +00:00
Timothy Flynn
8ae10ba0fd LibWeb+WebDriver: Add an IPC-transferable Web::WebDriver::Response class
This is essentially an ErrorOr<JsonValue, Web::WebDriver::Error> class.
Unfortunately, that ErrorOr would not be default-constructible, which is
required for the generated IPC classes. So this is a thin wrapper around
a Variant<JsonValue, Web::WebDriver::Error> to emulate ErrorOr.
2022-11-08 19:58:34 -05:00
Timothy Flynn
0246abec80 LibWeb+WebDriver: Move WebDriverError to Web::WebDriver::Error
This is to prepare for WebContent becoming the WebDriver client.
2022-11-08 19:58:34 -05:00
Luke Wilde
547e006a12 LibWeb: Extract the (un)focus steps out of HTMLElement
The (un)focus steps have no dependency on HTMLElement, thus we can
extract them into their own file. This allows them to be called
anywhere.
2022-11-07 14:10:41 +01:00
Linus Groh
b572a91a6f LibWeb+WebContent: Add WebDriver infrastructure for executing scripts
This cannot be done on the Browser or WebDriver ends, or via the
existing run_javascript() IPC endpoint, as we cannot transfer JS objects
through the IPC boundary (yet), only serialized JSON, so the individual
WebDriver steps around script execution need to run in the WebContent
process.
2022-11-02 23:46:30 +00:00
Tim Schumacher
ce2f1b845f Everywhere: Mark dependencies of most targets as PRIVATE
Otherwise, we end up propagating those dependencies into targets that
link against that library, which creates unnecessary link-time
dependencies.

Also included are changes to readd now missing dependencies to tools
that actually need them.
2022-11-01 14:49:09 +00:00
Linus Groh
1de1d6423b LibWeb: Implement the fetch() method :^)
With so much infrastructure implemented, we can finally add the last
piece of this puzzle - the fetch() method itself!

This contains a few hundred lines of generated code as handling the
RequestInfo and RequestInfo parameter types manually is not feasible,
but we can't use the IDL definition as the Window object is handwritten
code at the moment.
It's neatly tucked away in Bindings/ and will be removed eventually.
2022-10-30 20:10:29 +00:00
Linus Groh
c8d121fa32 LibWeb: Implement most of the 'Fetching' AOs
This implements the following operations from section 4 of the Fetch
spec (https://fetch.spec.whatwg.org/#fetching):

- Fetch
- Main fetch
- Fetch response handover
- Scheme fetch
- HTTP fetch
- HTTP-redirect fetch
- HTTP-network-or-cache fetch (without caching)

It does *not* implement:

- HTTP-network fetch
- CORS-preflight fetch

Instead, we let ResourceLoader handle the actual networking for now,
which isn't ideal, but certainly enough to get enough functionality up
and running for most websites to not complain.
2022-10-30 20:10:29 +00:00
Linus Groh
14e722617c LibWeb: Implement 'Queue a fetch task' AO 2022-10-30 20:10:29 +00:00
Linus Groh
361ab205fa LibWeb: Implement 'CORS check' / 'TAO check' AOs 2022-10-30 20:10:29 +00:00
Linus Groh
5d86eae119 LibWeb: Implement 'fetch params' struct 2022-10-30 20:10:29 +00:00
Linus Groh
ba31547fa0 LibWeb: Implement container class for fetch algorithms 2022-10-30 20:10:29 +00:00
Linus Groh
dd5d3e2f4f LibWeb: Implement 'fetch controller' struct 2022-10-30 20:10:29 +00:00
Linus Groh
fef331a03f LibWeb: Implement 'fetch timing info' struct 2022-10-30 20:10:29 +00:00
Linus Groh
1f8ed8fca7 LibWeb: Implement 'connection timing info' struct 2022-10-30 20:10:29 +00:00
Linus Groh
1e5cac9e9c LibWeb: Implement 'Strip url for use as a referrer' AO 2022-10-30 20:10:29 +00:00
Linus Groh
d56a6eb508 LibWeb: Implement 'Is origin potentially trustworthy?' AO 2022-10-30 20:10:29 +00:00
Linus Groh
58ad6de954 LibWeb: Implement 'Should response be blocked due to nosniff?' AO 2022-10-30 20:10:29 +00:00
Linus Groh
7e46150a71 LibWeb: Implement 'Should response be blocked due to its MIME type?' AO 2022-10-30 20:10:29 +00:00
Linus Groh
62228f0870 LibWeb: Implement 'Should request be blocked due to a bad port' AO 2022-10-30 20:10:29 +00:00
Aliaksandr Kalenik
501fb1cccb LibWeb: Dispatch "wheel" event 2022-10-23 15:58:16 +02:00
Tobias Christiansen
2c808958b9 LibWeb: Make Cookie::Cookie transportable over IPC 2022-10-15 22:28:34 +02:00
Andrew Kaster
2d5bee256e LibWeb: Re-implement HTML::Navigator using IDL
Get rid of the bespoke NavigatorObject class and use the modern IDL
strategies for creating platform objects to re-implement Navigator and
its associcated mixin interfaces. While we're here, implement it in a
way that brings WorkerNavigator up to spec :^)
2022-10-09 10:14:57 +02:00
Sam Atkins
462c49ad55 LibWeb: Remove duplicate reference to SVGElement.cpp 2022-10-06 21:45:07 +01:00
networkException
f0c4f8931c LibWeb: Implement fetching module scripts
This patch adds various algorithms required to fetch and link module
scripts.

Some parts such as actually creating a request and error handling are
not implemented or use temporary non spec compliant code to get us
further.

Co-authored-by: davidot <davidot@serenityos.org>
2022-10-06 16:41:36 +02:00
networkException
4de4e1828a LibWeb: Implement ModuleScript and JavaScriptModuleScript
This patchs adds the Web::HTML::Script subclass ModuleScript and
JavaScriptModuleScript as a type of ModuleScript as well as various
algorithms related to JavaScript module scripts.

Co-authored-by: davidot <davidot@serenityos.org>
2022-10-06 16:41:36 +02:00
networkException
992311c0ee LibWeb: Implement ModuleMap and expose it on EnvironmentSettingsObject
This patch adds the ModuleMap class used to keep track of the type and
url of a module as well as the fetching state associated. Each
environment settings object now also has a module map.
2022-10-06 16:41:36 +02:00
Linus Groh
32ad939e44 LibWeb: Rename HighResolutionTime/{CoarsenTime => TimeOrigin}.cpp/h
This is being used for more than just time coarsening now, so let's use
the spec's section title for the name.
2022-10-05 09:12:59 +01:00
Andrew Kaster
ffab9fb44e LibWeb: Add FileList from the FileAPI spec 2022-10-04 22:05:14 +02:00
Linus Groh
7760c00714 LibWeb: Move strip_and_collapse_whitespace() to Infra/
...and make it spec compliant by considering all ASCII whitespace,
greatly simplifying it in the process :^)
2022-10-02 21:32:49 +02:00
Andrew Kaster
c61a4f35dc LibWeb: Move Web prototypes and constructors to new Intrinsics object
This Intrinsics object hangs off of a new HostDefined struct that takes
the place of EnvironmentSettingsObject as the true [[HostDefined]] slot
on JS::Realm objects created by LibWeb.

This gets the intrinsics off of the GlobalObject, Window, similar to the
previous refactor of LibJS to move the intrinsics into the Realm's
[[Intrinics]] internal slot.

A side effect of this change is that we cannot fully initialize a Window
object until the [[HostDefined]] slot has been installed into the realm,
which happens with the creation of the WindowEnvironmentSettingsObject.

As such, any Window usage that has not been funned through a WindowESO
will not have any cached Web prototyped or constructors, and will not
have Window APIs available to javascript code. Currently this seems
limited to usage of Window in the CSS parser, but a subsequent commit
will clean those up to take Realm as well. However, this commit compiles
so let's cut it off here :^).
2022-10-01 21:05:32 +01:00
Andreas Kling
df416bb822 LibWeb: Add AvailableSpace.cpp to CMakeLists.txt 2022-09-29 20:05:28 +02:00
Linus Groh
0b52b883af LibWeb: Implement '5.5. Response class' from the Fetch API :^) 2022-09-27 14:56:17 +01:00
Linus Groh
9fb672e981 LibWeb: Implement '5.4. Request class' from the Fetch API :^) 2022-09-27 14:56:17 +01:00
Linus Groh
5ad6283331 LibWeb: Implement '5.3. Body mixin' from the Fetch API :^)
This will be used to share functionality between Request and Response.
2022-09-27 14:56:17 +01:00
Linus Groh
37972e9f0c LibWeb: Implement most WebIDL promise operations 2022-09-27 14:56:17 +01:00