Commit Graph

516 Commits

Author SHA1 Message Date
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