Commit Graph

671 Commits

Author SHA1 Message Date
Andrew Kaster
0c2f758067 LibWeb: Implement the start of the Navigation API
This API is how JavaScript can manipulate the new Navigable concepts
directly. We are still missing most of the interesting algorithms on
Navigation that do the actual navigation steps, and call into the
currently WIP navigable AOs.
2023-08-24 11:03:57 -06:00
Andrew Kaster
51c2835044 LibWeb: Add NavigationCurrentEntryChangeEvent, fired when navigating
This event will be fired by Navigation when changing the current
NavigationHistoryEntry.
2023-08-24 11:03:57 -06:00
Andrew Kaster
3c1d4eab24 LibWeb: Add NavigationHistoryEntry, a wrapper around SessionHistoryEntry 2023-08-24 11:03:57 -06:00
Bastiaan van der Plaat
c88f14902b LibWeb: Add DOMQuad and text tests 2023-08-23 12:11:21 +01:00
Andi Gallo
4c0816b002 LibWeb: Move table grid slots functionality to separate module 2023-08-20 18:38:15 +02:00
Andreas Kling
703c2bb06e LibWeb: Add support for parsing grid-auto-flow CSS property
Co-Authored-By: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
2023-08-20 15:36:18 +02:00
Shannon Booth
27dd2a40ad LibWeb: Implement HTMLFormControlsCollection
This collection is used in the form element for when element lookup
yields multiple elements.
2023-08-20 11:04:03 +02:00
Shannon Booth
daefe744ba LibWeb: Implement RadioNodeList
This interface is used in the interface for HTMLFormControlsCollection
as a live view over its matching elements.

Currently the "value" attribute for this interface is left
unimplemented.
2023-08-20 11:04:03 +02:00
Andreas Kling
c01c4b41e2 LibWeb: Add ViewportPaintable to represent viewports in the paint tree
This patch just adds the new root paintable and updates the tests
expectations. The next patch will move painting logic from the layout
viewport to the paint viewport.
2023-08-20 05:02:59 +02:00
Sam Atkins
199a931da1 LibWeb: Move gradient parsing code to a separate file 2023-08-17 19:39:10 +02:00
Sam Atkins
8e5b2907f6 LibWeb: Move selector parsing code to a separate file 2023-08-17 19:39:10 +02:00
Sam Atkins
1d6c2cb287 LibWeb: Move media-query parsing code to separate file
Parser.cpp is big and complicated enough to make CLion sluggish and
unhappy, so let's move some code out of it.
2023-08-17 19:39:10 +02:00
Bastiaan van der Plaat
eafdb06d87 LibWeb: Add directory entries page when visiting a local directory 2023-08-15 10:41:54 +01:00
Sam Atkins
f76c614a84 LibWeb: Generate PseudoClass metadata
The usual to/from-string functions, and metadata about whether the
pseudo-class is a a function or not, and what type of parameter it
takes.
2023-08-12 16:26:32 +02:00
Jonah
0b2da4f8c6 LibWeb: Add the default user agent MathML stylesheet
We now apply MathML's default user agent style sheet along with other
default styles. This sheet is not mixed in with the other styles in
CSS/Default.css because it is a namespaced stylesheet and so has to
be its own sheet.
2023-08-12 07:59:23 +01:00
Jonah
442602bec8 LibWeb: Generate MathML Elements
We will now generate MathML elements when parsing HTML.
2023-08-12 07:59:23 +01:00
Jonah
52d6df5ee5 LibWeb: Add the MathML Element
This patch introduces the MathML element, which provides the interface
all MathML elements are built from.
2023-08-12 07:59:23 +01:00
Andreas Kling
9e22f01eba LibWeb: Stub out SVGMaskElement
Just enough that we stop creating layout nodes for mask elements, which
was making some SVG content look very wrong. :^)
2023-08-10 11:36:17 +02:00
Andreas Kling
9f6ceff7cf LibWeb: Implement basic version of CSSOM View's VisualViewport
We got some errors while loading https://twinings.co.uk/ about this
interface missing, and it looked fairly simple so I sketched it out.
Note that I did leave some FIXMEs where it's not clear exactly which
metrics we should be returning.
2023-08-06 16:29:24 +02:00
Andreas Kling
ec24d7555a LibWeb: Add a simple internals objects only available during testing
This object is available as `window.internals` (or just `internals`) and
is only accessible while running in "test mode".

This first version only has one API: gc(), which triggers a garbage
collection immediately.

In the future, we can add more APIs here to help us test parts of the
engine that are hard or impossible to reach via public web APIs.
2023-08-06 15:26:34 +02:00
Aliaksandr Kalenik
da2cd73bcf LibWeb: Add place-self css property support 2023-08-06 08:26:36 +02:00
Zaggy1024
ad440f9e9a LibWeb/Ladybird: Use the abstract audio output in a new audio plugin
The implementation of this plugin is meant to eventually replace all
current audio plugins in Ladybird. The benefits over the current Qt-
based audio playback plugin in Ladybird are:

- Low latency: With direct access to PulseAudio, we can ask for a
specific latency to output to allow minimal delay when pausing or
seeking a stream.
- Accurate timestamps: The Qt audio playback API does not expose audio
time properly. When we have access directly to PulseAudio APIs, we can
enable their timing interpolation to get an accurate monotonically-
increasing timestamp of the playing audio.
- Resiliency: With more control over how the underlying audio API is
called, we have the power to fix most bugs we might encounter. The
PulseAudio wrappers already avoid some bugs that occur with QAudioSink
when running through WSLg.
2023-08-04 13:49:36 -06:00
Timothy Flynn
b3f82f724d LibWeb: Implement an ephemeral Blob URL store
The Blob URL store is intended to be a singleton across all WebContent
instances. But for now, this implements a per-WebContent store, which
only lives as long as the WebContent process itself.
2023-08-02 00:52:33 +01:00
Jonah
60e35f2a97 LibWeb: Rough implementation of CSS namespace rule
This provides a rough implementation of the CSS @namespace rule.
Currently we just support default namespaces, namespace prefixes
are still to come.
2023-07-30 20:27:19 +01:00
Sam Atkins
bd7bd1d677 LibWeb: Remove IDL files from CMake SOURCES
The bindings generator already produces a depfile of IDL files for each
JS binding class, so we do not need to manually define these as sources.
2023-07-27 12:53:16 -04:00
Aliaksandr Kalenik
bec07d4af7 LibWeb: Use fixed-point saturated arithmetics for CSSPixels
Using fixed-point saturated arithmetics for CSSPixels allows to avoid
accumulating floating-point errors.

This implementation is not complete yet: currently saturated
arithmetics implemented only for addition. But it is enough to not
regress any of layout tests we have :)

See https://github.com/SerenityOS/serenity/issues/18566
2023-07-25 11:52:02 +02:00
MacDue
b30a1b957d LibWeb: Add support for SVG <tspan> elements 2023-07-23 06:32:39 +02:00
MacDue
0e12503586 LibWeb: Split SVGTextContentElement into spec defined subclasses
As part of this move properties/methods to the correct subclass
(position related properties go under SVGTextPositioningElement).

SVG text element hierarchy:

  SVGTextContentElement
           ^- SVGTextPositioningElement
                     ^- SVGTextElement
                     ^- SVGTSpanElement
           ^- SVGTextPathElement (TODO)
           ^- SVGTRefElement (TODO)
2023-07-23 06:32:39 +02:00
Aliaksandr Kalenik
a8587fe54e LibWeb: Add support for "place-items" CSS property
Adds support for place-items property which allows to specify both
align-items and justify-items in a single declaration.
2023-07-17 18:58:05 +02:00
Kenneth Myhra
0091a60448 LibWeb: Add TransformStreamDefaultController scaffolding
This adds the scaffolding of TransformStreamDefaultController so we can
start implementing the necessary abstract operations for it.
2023-07-15 11:59:39 +02:00
Kenneth Myhra
f1d69d789b LibWeb: Add TransformStream scaffolding
This adds the scaffolding of TransformStream so we can start
implementing the necessary abstract operations for it.
2023-07-15 11:59:39 +02:00
Kenneth Myhra
12ff48047f LibWeb: Add Transformer API
This adds the Transformer API which the TransformStream() constructor
accepts as its first argument.
2023-07-15 11:59:39 +02:00
Sam Atkins
618c0402a7 LibWeb: Generate parsing code for CSS math functions 2023-07-15 10:23:33 +02:00
Ali Mohammad Pur
dd073b2711 Meta/CodeGenerators+LibWeb: Implement parsing CSS easing functions
This only implements the parser bits, no functionality is implemented,
and no properties are parsed because of this.
2023-07-13 05:10:41 +02:00
Ali Mohammad Pur
d60d149e62 LibWeb: Move some static functions from CSS/Parser.cpp into a new file 2023-07-11 09:38:37 +03:30
Ali Mohammad Pur
06c6c40df9 LibWeb+LibJS: Move some code around to make CSS/Parser parse faster
This makes it possible to include fewer full definitions of things,
which makes the file about 30% faster to compile.
2023-07-11 09:38:37 +03:30
Luke Wilde
165abafb80 LibWeb: Add initial implementation of IntersectionObserver
The main missing features are rootMargin, proper nested browsing
context support and content clip/clip-path support.

This makes images appear on some sites, such as YouTube and
howstuffworks.com.
2023-07-07 05:27:25 +02:00
Timothy Flynn
8ec7b4401a LibWeb: Add a helper class to work around empty execution context stack
We've peppered this workaround around the code base as needed in a few
different ways. This adds a helper class to perform this workaround in
order to simplify doing so, and ensure cleanup occurs in a RAII fashion.
This also makes it easier to grep for places where this workaround is
employed.
2023-07-06 15:18:50 -04:00
Jonah
e9840bfd4e LibWeb: Build out the ARIA role model
We now have implemented the ARIA role model. These classes will
control which states and properties are exposed to end users.
2023-07-06 11:21:36 +01:00
Jonah
125792e5ff LibWeb: Add helper functions for handling ARIA state and properties
These will make serializing and calculating default values easier.
2023-07-06 11:21:36 +01:00
Jonah
57a6d577ad LibWeb: Add AriaData object to parse ARIAMixin data
This provides an easily serializeable interface for us to use in IPC.
2023-07-06 11:21:36 +01:00
Andi Gallo
f544132fe8 LibWeb: Some improvements for painting of collapsed table borders
Follow the specification in making the borders centered on the grid
lines. This avoids visual bugs due to double-rendering of borders on
either side of an edge and paves the way for a full implementation of
the harmonization algorithm for collapsed borders.

Currently, this still lacks complete handling of row and column spans.
Also, the box model for cells still considers the full width of the
internal borders instead of just half, as the specification requires.
Some additional handling of rounding issues will be needed to avoid very
subtle visual bugs.

Despite these limitations, this improves the appearance of all the
tables with collapsed borders I've tried while limiting the amount of
change to something reasonable.
2023-07-06 10:31:51 +02:00
Sam Atkins
be7093ab0d LibWeb: Implement CSSNumericType
This represents the type of a calculation, which may involve multiplying
or dividing the various numeric types together (eg, length*length, or
length/time, or whatever).

For now, I've made "Return failure" in each algorithm return an empty
Optional. This may or may not be a good solution but we'll see. :^)
2023-07-06 09:28:16 +02:00
Andreas Kling
8f927eaa68 LibWeb: Add HTMLDocument class
This class is currently not in the spec, but it *is* still in all the
major browser engines. For compatibility reasons, let's do what other
engines do.

There is discussion about bringing HTMLDocument back into specs:
- https://github.com/whatwg/html/issues/4792
- https://github.com/whatwg/dom/issues/221
2023-06-21 16:30:27 +02:00
Shannon Booth
f86c3ab148 LibWeb: Implement ByteLengthQueuingStrategy highWaterMark property 2023-06-21 12:27:04 +02:00
Shannon Booth
c9941ba95b LibWeb: Implement CountQueuingStrategy highWaterMark property 2023-06-21 12:27:04 +02:00
Andreas Kling
34591ff3d9 LibWeb: Use a separate class for shared image requests
As it turns out, making everyone piggyback on HTML::ImageRequest had
some major flaws, as HTMLImageElement may decide to abort an ongoing
fetch or wipe out image data, even when someone else is using the same
image request.

To avoid this issue, this patch introduces SharedImageRequest, and then
implements ImageRequest on top of that.

Other clients of the ImageRequest API are moved to SharedImageRequest
as well, and ImageRequest is now only used by HTMLImageElement.

This fixes an issue with image data disappearing and leading to asserts
and/or visually absent images.
2023-06-14 14:23:17 +02:00
Timothy Flynn
ac2238ee70 LibWeb: Begin implementing the HTMLAudioElement for audio playback
This uses LibAudio to attempt to decode resoures downloaded with <audio>
elements, and draws some basic media controls for the element.
2023-06-13 06:14:01 +02:00
Timothy Flynn
c89fd6dff0 LibWeb: Implement the AudioTrack and AudioTrackList interfaces
These are used to own and manage the playing of audio data.
2023-06-13 06:14:01 +02:00
Timothy Flynn
a34e369252 Ladybird+LibWeb+WebContent: Create a platform plugin for playing audio
This creates (and installs upon WebContent startup) a platform plugin to
play audio data.

On Serenity, we use AudioServer to play audio over IPC. Unfortunately,
AudioServer is currently coupled with Serenity's audio devices, and thus
cannot be used in Ladybird on Lagom. Instead, we use a Qt audio device
to play the audio, which requires the Qt multimedia package.

While we use Qt to play the audio, note that we can still use LibAudio
to decode the audio data and retrieve samples - we simply send Qt the
raw PCM signals.
2023-06-13 06:14:01 +02:00
Timothy Flynn
ee48d7514f LibWeb: Extract media element timeline painting to a base class
This moves the painting of the media timeout out of VideoPaintable into
a base MediaPaintable. This is to allow re-using the same timeline logic
and controls for audio elements.
2023-06-13 06:14:01 +02:00
Andreas Kling
2ebb3639aa LibWeb: Remove ImageLoader and ImageResource
The old image loading mechanism is no longer used, as everything has
been moved on top of HTML::ImageRequest! :^)
2023-06-11 20:37:12 +02:00
Aliaksandr Kalenik
0d8d7ae94e LibWeb: Implement painting for svg text
The implementation of painting for SVG text follows the same pattern
as the implementation of painting for SVG geometries. However, instead
of reusing the existing PaintableWithLines to draw text, a new class
called SVGTextPaintable is introduced. because everything that is
painted inside an SVG is expected to inherit from SVGGraphicsPaintable.
Therefore reusing the text painting from regular text nodes would
require significant refactoring.
2023-06-09 17:20:34 +02:00
PrestonLTaylor
e2a935b1dc LibWeb: Implement the <style> SVG element
The `<style>` element is allowed to be in the SVG namespace, so we now
support this element.

It has the same behaviour as the HTML namespace `<style>` element as
described in the spec.

"The semantics and processing of a ‘style’ and its attributes must be
the same as is defined for the HTML ‘style’ element."
2023-06-09 17:14:50 +02:00
PrestonLTaylor
7f7ebc4b8b LibWeb: Extract updating a style block into StyleElementUtils 2023-06-09 17:14:50 +02:00
Timothy Flynn
e2e4e6da52 LibWeb: Implement the SVG title element 2023-06-09 01:12:48 +02:00
PrestonLTaylor
aa691c22d4 LibWeb: Implement the <symbol> SVG element 2023-06-03 05:58:00 +02:00
PrestonLTaylor
c7c3043aa2 LibWeb: Implement the <use> SVG element
The SVG <use> element is used to be able to reuse other SVG graphics
without having to re-write the svg element.

We now support this feature! :^)
2023-06-03 05:58:00 +02:00
stelar7
8773122f6b LibWeb: Implement the <summary> element 2023-06-03 05:56:00 +02:00
Sam Atkins
1160d8186b LibWeb: Implement IntegerStyleValue, for holding <integer>
Having one StyleValue for `<number>` and `<integer>` is making user code
more complicated than it needs to be. We know based on the property
being parsed, whether it wants a `<number>` or an `<integer>`, so we
can use separate StyleValue types for these.
2023-06-01 21:04:21 +02:00
Sam Atkins
ad8565011c LibWeb: Rename NumericStyleValue -> NumberStyleValue
This is in preparation of splitting off a separate IntegerStyleValue.
2023-06-01 21:04:21 +02:00
FalseHonesty
dcead6f5eb LibWeb: Add support for parsing place-content shorthand CSS property 2023-06-01 09:06:13 +02:00
Aliaksandr Kalenik
787f2d2a10 LibWeb: Remove Layout::TableCellBox
Special box types for inner table boxes might conflict with special
types for <button>, <input> or <label>.
2023-05-29 21:36:17 +02:00
Aliaksandr Kalenik
3a3a085404 LibWeb: Remove Layout::TableRowBox
Special box types for inner table boxes might conflict with special
types for <button>, <input> or <label>.
2023-05-29 21:36:17 +02:00
Aliaksandr Kalenik
578a937f94 LibWeb: Remove Layout::TableRowGroupBox
Special box types for inner table boxes might conflict with special
types for <button>, <input> or <label>.
2023-05-29 21:36:17 +02:00
Aliaksandr Kalenik
258f3ea952 LibWeb: Remove Layout::TableBox
Solves conflict in layout tree "type system" when elements <label> (or
<button>) can't have `display: table` because Box can't be
Layout::Label (or Layout::ButtonBox) and Layout::TableBox at the same
time.
2023-05-29 14:12:29 +02:00
Ali Mohammad Pur
e90752cc21 LibWeb: Add preliminary support for CSS animations
This partially implements CSS-Animations-1 (though there are references
to CSS-Animations-2).
Current limitations:
- Multi-selector keyframes are not supported.
- Most animation properties are ignored.
- Timing functions are not applied.
- Non-absolute values are not interpolated unless the target is also of
  the same non-absolute type (e.g. 10% -> 25%, but not 10% -> 20px).
- The JavaScript interface is left as an exercise for the next poor soul
  looking at this code.

With those said, this commit implements:
- Interpolation for most common types
- Proper keyframe resolution (including the synthetic from-keyframe
  containing the initial state)
- Properly driven animations, and proper style invalidation

Co-Authored-By: Andreas Kling <kling@serenityos.org>
2023-05-29 05:35:41 +02:00
Ali Mohammad Pur
279924242d LibWeb: Add CSS CompositeStyleValue
This represents the value of properties assigned via their shorthands,
and is expanded when computing actual property values.
2023-05-29 05:35:41 +02:00
Luke Wilde
a5936864d9 LibWeb: Stub AudioContext constructor
This is enough to make Discord not throw up "Well this is awkward" on
login.
2023-05-22 06:07:05 +02:00
Andreas Kling
6f46bff4df LibWeb: Stub out a new SVGDecodedImageData class
This class will implement isolated SVG layout and rendering.
2023-05-21 07:44:29 +02:00
Andreas Kling
4ee1e5b224 LibWeb: Make DecodedImageData an abstract class
The existing implementation moves down into a new subclass called
AnimatedBitmapDecodedImageData.

The purpose of this change is to create an extension point where we can
plug in an SVG renderer. :^)
2023-05-21 07:44:29 +02:00
Luke Wilde
036e1e1bcf LibWeb: Implement performance.{measure,clearMeasures} 2023-05-13 16:31:10 +02:00
Andreas Kling
6fe4fcb74b LibWeb: Add a class to represent the "source set" concept from HTML
Also comes with a little extra CSS parser helper for parsing "sizes"
attributes in images.
2023-05-13 09:08:42 +02:00
Andreas Kling
9281bf7a01 LibWeb: Add class to represent "list of available images" from HTML spec 2023-05-13 09:08:42 +02:00
Andreas Kling
596eabe9e6 LibWeb: Start fleshing out HTML "image requests" and "image data"
This patch adds HTML::ImageRequest and HTML::DecodedImageData.

The latter had to use a different name than "ImageData", as there is
already an IDL-exposed ImageData class in HTML.
2023-05-13 09:08:42 +02:00
Andreas Kling
70db40c9b0 LibWeb: Don't include Layout/Node.h from DOM/Element.h
This required moving the CSS::StyleProperty destruct out of line.
2023-05-08 09:29:44 +02:00
MacDue
9b652842e4 LibWeb: Add an initial implementation of SVG <radialGradient>
This follows on from the SVG linear gradients. It supports the same
features (xlink:href, gradientUnits, gradientTransform).

With this commit I have now implemented all web gradients :^)

(Though we are still missing a few parameters for SVG gradients,
e.g. spreadMethod).
2023-05-04 16:50:01 +02:00
Timothy Flynn
f78eadf00f LibWeb: Add an interface to be notified of Document state changes
Some HTML elements, e.g. HTMLMediaElement, need to take action when the
document becomes inactive.
2023-05-04 16:48:10 +02:00
Aliaksandr Kalenik
804af38a96 LibWeb: Move document loading into separate file
In upcoming navigables refactor new function that uses fetch
instead of ResourceLoader to load document content is going to be
introduced:
https://html.spec.whatwg.org/multipage/browsing-the-web.html#create-navigation-params-by-fetching

`parse_document()` need to be separated from FrameLoader to reuse
code responsible for parsing HTTP response into DOM document.
2023-05-03 09:39:49 +02:00
Emil Militzer
31e1be0438 LibWeb: Support multi-keyword syntax for CSS display property
The Display class already supported all specific values, and now they
will be parsed too. The display property now has a special type
DisplayStyleValue.
2023-05-02 20:27:28 +02:00
martinfalisse
22202715fc LibWeb: Parse grid-template property 2023-04-30 05:56:10 +02:00
martinfalisse
bebf4363db LibWeb: Change name of GridTrackSizeListStyleValue
Change the name of GridTrackSizeStyleValue to
GridTrackSizeListStyleValue which is more accurate.
2023-04-30 05:56:10 +02:00
MacDue
aa3464466e LibWeb: Implement SVGLinearGradientElement (<linearGradient>)
This represents the SVG <linearGradient>. The actual gradient is
converted to a Gfx::PaintStyle for use in SVG fills... There is a little
guesswork in the implementation, but it seems to match Chrome/Firefox.

Note: Still not hooked up to actual painting in this commit.
2023-04-28 09:42:28 +02:00
MacDue
71938550fa LibWeb: Implement SVGGradientElement
This is the base class for all SVG gradient types. This supports:

- The `gradientUnits` attribute
- The `gradientTransform` attribute
- And following `xlink:hrefs` for inheriting <stops>/attributes
2023-04-28 09:42:28 +02:00
MacDue
b19d2634f6 LibWeb: Implement SVGStopElement (<stop>)
This is used to specify the color/position of color stops for SVG
gradients.
2023-04-28 09:42:28 +02:00
MacDue
66d1b78348 LibWeb: Implement SVGAnimatedNumber
See https://www.w3.org/TR/2013/WD-SVG2-20130409/types.html#InterfaceSVGAnimatedNumber
2023-04-28 09:42:28 +02:00
Matthew Olsson
e8ad571082 LibWeb: Add ReadableStreamBYOBReader interface 2023-04-27 07:57:53 +02:00
Timothy Flynn
73a80b7047 LibWeb: Implement the MediaError IDL interface 2023-04-23 16:22:45 +02:00
Sam Atkins
22e0603bf7 LibWeb: Implement integrity-metadata part of fetch algorithm
Specifically, this makes `<link>` elements with an `integrity` attribute
actually work. Previously, we would load their resource, and then drop
it on the floor without actually using it.

The Subresource Integrity code is in `LibWeb/SRI`, since SRI is the name
of the recommendation spec: https://www.w3.org/TR/SRI/

However, the Fetch spec links to the editor's draft, which varies
significantly from the recommendation, and so that is what the code is
based on and what the spec comments link to:
https://w3c.github.io/webappsec-subresource-integrity/

Fixes #18408
2023-04-21 20:44:47 +01:00
Luke Wilde
1f863de9aa LibWeb: Add XMLDocument stub
Required by old versions of Pixi.js's XMLFormat bitmap font loader.
db824181dc/packages/text-bitmap/src/formats/XMLFormat.ts (L16)
2023-04-21 07:59:50 +02:00
Linus Groh
e6be5c37c0 LibWeb/WebDriver: Handle WindowProxy in internal_json_clone_algorithm()
To test:

```console
curl http://0.0.0.0:8000/session \
  -H 'Content-Type: application/json' \
  -d '{"capabilities": {}}'
curl http://0.0.0.0:8000/session/0/execute/sync \
  -H 'Content-Type: application/json' \
  -d '{"script": "return window;", "args": []}'
```

Which should result in:

```json
{
  "value": {
    "window-fcc6-11e5-b4f8-330a88ab9d7f":
    "86307df6-e2f1-4175-85cb-77295ff90898"
  }
}
```
2023-04-20 14:41:31 -04:00
Andreas Kling
74a6f50c91 LibWeb: Add HTML::TraversableNavigable
This is the "traversable navigable" concept from the HTML spec.

Co-authored-by: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
2023-04-19 18:26:45 +02:00
Andreas Kling
2d602dcb34 LibWeb: Add HTML::Navigable
This is the first step towards implementing the new "navigable" concept
from the HTML spec.

Co-authored-by: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
2023-04-19 18:26:45 +02:00
Andreas Kling
d8ccc2d54e LibWeb: Rename BrowsingContextContainer => NavigableContainer
The "browsing context container" concept in the HTML spec has been
replaced with "navigable container". Renaming this is the first step of
many towards implementing the new world.

Co-authored-by: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
2023-04-19 18:26:45 +02:00
Timothy Flynn
680a9f748e LibWeb: Stub out the HTML TimeRanges IDL interface
This is used by media elements. Provide a stub for websites which depend
on the interface existing.
2023-04-19 07:57:52 +02:00
Timothy Flynn
7966fc4780 LibWeb+LibWebView+WebContent: Add APIs to manage an autoplay allowlist
The spec defines a Permissions Policy to control some browser behaviors
on a per-origin basis. Management of these permissions live in their own
spec: https://w3c.github.io/webappsec-permissions-policy/

This implements a somewhat ad-hoc Permissions Policy for autoplaying
media elements. We will need to implement the entire policy spec for
this to be more general.
2023-04-18 16:30:02 +02:00
Andreas Kling
1df52ea94c LibWeb: Add HTML::DocumentState
This represents the new "document state" concept from the HTML spec.
Document states are primarily used in session history entries.

Co-authored-by: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
2023-04-15 14:05:00 +02:00
Andreas Kling
3b0e5a87db LibWeb: Make SessionHistoryEntry GC-allocated
These will need to float around more than they're currently able to.
Put them on the GC heap to prepare for that.

Co-authored-by: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
2023-04-15 14:05:00 +02:00
Matthew Olsson
819b6332d1 LibWeb: Add ReadableStreamByteController interface 2023-04-12 01:47:48 +02:00
Matthew Olsson
c7aa4fa166 LibWeb: Add ReadableStreamBYOBRequest interface 2023-04-12 01:47:48 +02:00
MacDue
92d9b6edb8 LibWeb: Add simple canvas path clipper
This adds CanvasPathClipper and ScopedCanvasPathClip. These allow
clipping the canvas by some arbitrary path.

This initial implementation is fairly naive, with a good few
allocations, though this can probably be improved in future.
2023-04-09 18:42:45 +02:00
Kenneth Myhra
fb96966f1e LibWeb: Add WebGL::EventNames 2023-04-09 17:27:27 +02:00
Matthew Olsson
868cd95069 LibWeb: Add the WritableStreamDefaultController 2023-04-09 17:14:48 +02:00
Timothy Flynn
f156d3d5e5 LibWeb: Create a basic layout node for HTMLVideoElement 2023-04-07 16:02:22 +02:00
Timothy Flynn
460e1bd072 LibWeb: Implement TrackEvent for media events 2023-04-07 16:02:22 +02:00
Timothy Flynn
3f1badf9b2 LibWeb: Implement VideoTrack and VideoTrackList
This implements the IDL for these types and some event handling around
them.
2023-04-07 16:02:22 +02:00
Matthew Olsson
bdab61ad93 LibWeb: Add the WritableStreamDefaultWriter interface 2023-04-06 22:54:58 +02:00
Matthew Olsson
e93560b769 LibWeb: Add the WritableStream interface 2023-04-06 22:54:58 +02:00
Luke Wilde
034aaf3f51 LibWeb: Introduce CustomElementRegistry and creating custom elements
The main missing feature here is form associated custom elements.
2023-04-06 11:36:56 +02:00
MacDue
2a659693bc LibWeb: Add EdgeStyleValue
This represents a single edge and offset, this will be needed for
the values of background-position-x/y.
2023-04-03 07:10:33 +02:00
Matthew Olsson
66dec1bf54 LibWeb: Add UnderlyingSource struct for ReadableStream constructor 2023-04-01 23:43:07 +01:00
Matthew Olsson
bc9919178e LibWeb: Add ReadableStreamDefaultController 2023-04-01 23:43:07 +01:00
Matthew Olsson
222e3c32cd LibWeb: Add ReadableStreamDefaultReader 2023-04-01 23:43:07 +01:00
Matthew Olsson
fe69d66a4e LibWeb: Add the ReadableStreamGenericReader mixin interface 2023-04-01 23:43:07 +01:00
Sam Atkins
88d64fcb55 LibWeb: Add HTMLAnchorElement.referrerPolicy property 2023-03-31 11:36:41 +01:00
Sam Atkins
1280d70d74 LibWeb: Split CalculatedStyleValue out of StyleValue.{h,cpp} 2023-03-30 21:29:50 +02:00
Sam Atkins
0c14103025 LibWeb: Move PercentageOr and subclasses into PercentageOr.{h,cpp}
This solves an awkward dependency cycle, where CalculatedStyleValue
needs the definition of Percentage, but including that would also pull
in PercentageOr, which in turn needs CalculatedStyleValue.

Many places that previously included StyleValue.h no longer need to. :^)
2023-03-30 21:29:50 +02:00
Sam Atkins
d64ddeaec4 LibWeb: Move PositionValue into its own files
It's in Position.{h,cpp} because it represents a <position> in CSS, even
though it's currently named PositionValue to avoid collisions.
2023-03-30 21:29:50 +02:00
Sam Atkins
bcebca62d3 LibWeb: Move CSS::EdgeRect into its own files
Also remove the unused StyleValue::to_rect() because an EdgeRect is only
ever held by a RectStyleValue.
2023-03-30 21:29:50 +02:00
Sam Atkins
fa90a3bb4f LibWeb: Introduce CalculatedOr type
This is intended as a replacement for Length and friends each holding a
`RefPtr<CalculatedStyleValue>`. Instead, let's make the types explicit
about whether they are calculated or not. This then means a Length is
always a Length, and won't require including `StyleValue.h`.

As noted, it's probably nicer for LengthOrCalculated to live in
`Length.h`, but we can't do that until Length stops including
`StyleValue.h`.
2023-03-30 21:29:50 +02:00
Srikavin Ramkumar
f2dd878fe7 LibWeb: Implement custom element name validation 2023-03-28 07:18:09 -04:00
Sam Atkins
4c54c5d3dd LibWeb: Split StyleValueList out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
3a2de67c7b LibWeb: Split RectStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
1d948f7462 LibWeb: Split UnresolvedStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
cd06b1341b LibWeb: Split TransformationStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
66cb7edffb LibWeb: Split TextDecorationStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
08fa513887 LibWeb: Split ShadowStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
b1ccd30b02 LibWeb: Split PositionStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
f98634586e LibWeb: Split OverflowStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
7f6add1c6e LibWeb: Split NumericStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
fba2dacc7a LibWeb: Split ListStyleStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
9a84151169 LibWeb: Split LengthStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
0f04fa2e6e LibWeb: Split RadialGradientStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
c8ffd82cb7 LibWeb: Split LinearGradientStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
f30b042890 LibWeb: Split ConicGradientStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
35b240c87d LibWeb: Split ImageStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
76de017a51 LibWeb: Split IdentifierStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
d39788556a LibWeb: Split GridTrackSizeStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
486ef3df7f LibWeb: Split GridTrackPlacementStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
402845fe00 LibWeb: Split GridTrackPlacementShorthandStyleValue out of StyleValue 2023-03-25 16:56:04 +00:00
Sam Atkins
675cb3b9da LibWeb: Split GridAreaShorthandStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
4dc99e49a1 LibWeb: Split GridTemplateAreaStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
87f920a299 LibWeb: Split FontStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
e24679f870 LibWeb: Split FlexFlowStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
273b9b4ca1 LibWeb: Split FlexStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
89ed8e59f9 LibWeb: Split FilterValueListStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
9436b7de83 LibWeb: Split ContentStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
77b2826402 LibWeb: Split ColorStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
66bc816284 LibWeb: Split BorderRadiusStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
25114c159d LibWeb: Split BorderRadiusShorthandStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
1c03bc7a6f LibWeb: Split BorderStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
9d5296889f LibWeb: Split BackgroundSizeStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
52cd0b2f47 LibWeb: Split BackgroundRepeatStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
92a0d4c0af LibWeb: Split BackgroundStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
777d3e73f9 LibWeb: Split AngleStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Luke Wilde
cbe0901706 LibWeb: Implement performance.mark and performance.clearMarks 2023-03-23 21:00:43 +00:00
Luke Wilde
31b507afbf LibWeb: Introduce Performance Timeline and its Performance functions 2023-03-23 21:00:43 +00:00
Srikavin Ramkumar
f7176463b5 LibWeb: Implement 'create a potential-CORS request' algorithm 2023-03-19 14:16:15 +00:00
Timothy Flynn
8bba53bdff LibWeb: Remove remaining WebAssemblyObject data to the namespace file 2023-03-16 19:39:17 +00:00
Timothy Flynn
57646c86ef LibWeb: Port the WebAssembly namespace to IDL 2023-03-16 19:39:17 +00:00
Aliaksandr Kalenik
8026c63e10 LibWeb: Introduce RemoteBrowsingContext
Remote browsing context represents top level browsing context that
lives in another WebContent process.
2023-03-16 13:17:37 -04:00
Timothy Flynn
2cfcbccdb5 LibWeb: Port WebAssembly.Table to IDL 2023-03-16 13:54:16 +01:00
Timothy Flynn
ca96f8e364 LibWeb: Port WebAssembly.Memory to IDL 2023-03-16 13:54:16 +01:00
Timothy Flynn
de32c44762 LibWeb: Port WebAssembly.Instance to IDL 2023-03-16 13:54:16 +01:00
Timothy Flynn
fb1f15774f LibWeb: Port WebAssembly.Module to IDL 2023-03-16 13:54:16 +01:00
Timothy Flynn
2d45e1fca5 LibWeb: Port the CSS namespace to IDL 2023-03-15 12:48:25 -04:00
Kenneth Myhra
be52e7171a LibWeb: Add FormDataIterator implementation
This adds the FormDataIterator implementation so we can iterate over
FormData.{keys(),values(),entries()}.
2023-03-08 18:57:36 +00:00
Linus Groh
5cc6b1c4db LibWeb/HTML: Port Window.fetch() to IDL 2023-03-07 23:33:34 +00:00
Linus Groh
de83f5422d LibWeb: Generate Window{Constructor,Prototype} from IDL
The Window object is massive, so let's do the conversion to IDL step
by step. First up: getting rid of the manual constructor and prototype
definitions, which can be generated from an empty `interface Window`.
2023-03-07 23:33:34 +00:00
Luke Wilde
d036862f2b LibWeb: Refactor XHR (almost) exactly to the spec
This makes XHR now rely on Fetch, which allows it to correct send
Origin and Referer headers, CORS-preflight and filtering and many other
goodies.

The main thing that's missing is Streams, which means we can't properly
produce progress events or switch to the Loading ready state.

This also doesn't implement the Document responseType just yet.
2023-03-07 11:51:12 +00:00
Linus Groh
1a6b61b0cc LibWeb/HTML: Move WindowOrWorkerGlobalScope code into a mixin class
This will allow us to easily share the implementations of these methods
between Window and WorkerGlobalScope. The mixin class mirrors what I
already did for the Fetch API's Body mixin in 5ad62833.
2023-03-06 11:02:25 +00:00
Luke Wilde
4d0277cd9a LibWeb: Implement navigator.{plugins,mimeTypes} 2023-02-28 12:36:14 +01:00
Andreas Kling
7e76a51cb0 LibWeb: Rename Layout::InitialContainingBlock to Layout::Viewport
The name "initial containing block" was wrong for this, as it doesn't
correspond to the HTML element, and that's specifically what it's
supposed to do! :^)
2023-02-28 12:21:56 +01:00
Luke Wilde
a90667e79c LibWeb: Add initial implementation of DOMMatrix(ReadOnly)
This is currently missing a lot of functions and initialisation from a
<transform-list> string, but is enough for Ruffle.
2023-02-27 20:55:09 +01:00
Kenneth Myhra
a6cdf6374f LibWeb: Introduce the FormDataEvent interface 2023-02-12 00:18:09 +00:00
Kenneth Myhra
d5b5b94a35 LibWeb: Introduce the FormData interface from the XHR specification 2023-02-12 00:18:09 +00:00
MacDue
f74e2da875 LibWeb: Implement CanvasRenderingContext2D.createPattern()
This is a first pass at implementing CRC2D.createPattern() and the
associated CanvasPattern object. This implementation only works for a
few of the required image sources [like CRC2D.drawImage()], and does
not yet support transforms. Other than that it supports everything
else (which is mainly the various repeat modes).
2023-02-03 20:36:21 +01:00
Linus Groh
8556d47240 LibWeb: Move ARIA-related code into the Web::ARIA namespace
ARIA has its own spec and is not part of the DOM spec, which is what the
Web::DOM namespace is for (https://www.w3.org/TR/wai-aria-1.2/).

This allows us to stay closer to the spec with function names and don't
have to add the word "ARIA" to identifiers constantly - the namespace
now provides that clarity.
2023-01-29 00:02:55 +00:00
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