Commit graph

72712 commits

Author SHA1 Message Date
Luke Wilde
82bd3d3891 LibWeb: Avoid invoking Trusted Types where avoidable
Prevents observably calling Trusted Types, which can run arbitrary JS,
cause crashes due to use of MUST and allow arbitrary JS to modify
internal elements.
2025-11-06 11:43:06 -05:00
Luke Wilde
fb9406ddcd LibWeb: Make Trusted Types injection sink names more readable
No functional change.
2025-11-06 11:43:06 -05:00
Luke Wilde
60e1a136aa LibWeb: Use qualified names for SVG attribute reflectors 2025-11-06 11:43:06 -05:00
Luke Wilde
d211df8118 LibWeb: Implement Trusted Types for HTMLIFrameElement#srcdoc 2025-11-06 11:43:06 -05:00
stelar7
0f3a9a6958 LibWeb/CSS: Use correct property when looking up container-type 2025-11-06 13:28:17 +01:00
ayeteadoe
eb4ff07d83 LibWeb: Define SVGImageElement destructor for Core::Timer forward decl
This fixes a "error: member access into incomplete type 'Core::Timer'"
build error on clang-cl Windows.
2025-11-06 07:10:23 -05:00
Sam Atkins
1bcc489310 LibWeb/CSS: Subdivide into iterations when reading from StylePropertyMap 2025-11-06 10:34:48 +00:00
Sam Atkins
7292714592 LibWeb/CSS: Mark cursor as not a list-valued property
This is apparently supposed to always be treated as a single composite
value, for Typed OM at least.
2025-11-06 10:34:48 +00:00
Tim Ledbetter
478cf4f42c LibWeb: Explicitly disallow skipping 0 characters in HTML tokenizer
Previously, this caused the source position of an ambiguous ampersand
to be incorrect.
2025-11-06 10:59:54 +01:00
Zaggy1024
9037f4e832 LibMedia: Signal EOF to decoders in the data providers
This lets the FFmpeg H.264 decoder know when we've reached the end of
the available data, so that it will output the remaining buffered video
frames.

Not sure why it needs this signal to output the buffered frames, but
surely there's a good reason. :^)
2025-11-05 18:40:02 +01:00
Zaggy1024
0e9c746b48 LibMedia: Allow signalling of EOF to decoders
This is used by FFmpeg's H.264 decoder to determine when to output any
buffered frames after data runs out.
2025-11-05 18:40:02 +01:00
Zaggy1024
634e5ff491 LibMedia: Move CICP values from CodedFrame to Track
All our current demuxers have these constant for an entire track, so we
don't need to get them for every frame we output.
2025-11-05 18:40:02 +01:00
Zaggy1024
22585db022 LibMedia: Make the default values of CICP unspecified 2025-11-05 18:40:02 +01:00
Zaggy1024
6bd7e338fd LibMedia: Remove redundant parameter names in Demuxer 2025-11-05 18:40:02 +01:00
Timothy Flynn
e0a8eb3767 LibWeb+WebContent: Hook Fetch's HTTP cache into the clear-cache action
And fix a typo in an invocation to clear the cache.
2025-11-05 18:27:36 +01:00
Timothy Flynn
ac246caa0c LibWeb: Remove now-unused Resource and ResourceClient
And deal with the fallout of transitive includes.
2025-11-05 18:27:36 +01:00
Timothy Flynn
6057719f63 LibWeb: Use fetch to retrieve all HTMLLinkElement resources
HTMLLinkElement is the final user of Resource/ResourceClient (used for
preloads and icons). This ports these link types to use fetch according
to the spec.

Preloads were particularly goofy because they would be stored in the
ResourceLoader's ad-hoc cache. But this cache was never consulted for
organic loads, thus were never used. There is more work to be done to
use these preloads within fetch, but for now they at least are stored
in fetch's HTTP cache for re-use.
2025-11-05 18:27:36 +01:00
Timothy Flynn
c61fa1d7aa LibWeb: Pass the HTMLLinkElement fetched resource around as a ByteBuffer
Instead of passing around a large variant, which can only contain a
ByteBuffer, let's extract the ByteBuffer ahead of time and pass that
around.
2025-11-05 18:27:36 +01:00
Timothy Flynn
523433d57d LibWeb: Organize HTMLLinkElement more consistently with other IDL types
We don't typically put spec links for methods in both the .h and .cpp
(we just put them in the .cpp).

Let's also generally organize the methods in spec-order, which for
HTMLLinkElement generally goes: init fetch -> fetch -> process data.
Makes it a bit easier to scroll through the spec and the code at the
same time.
2025-11-05 18:27:36 +01:00
Timothy Flynn
5b40398c39 LibWeb: Invoke process_response_consume_body with null in error cases
We were previously invoking it with an empty ByteBuffer, which will be
interpreted as a successful load by HTMLLinkElement in a future commit.
2025-11-05 18:27:36 +01:00
Tim Ledbetter
713191a078 LibGfx: Remove unused alpha premultiplication functions 2025-11-05 15:39:14 +01:00
Tim Ledbetter
d37eb3de32 LibGfx: Use Skia to speed up alpha conversions on Linux 2025-11-05 15:39:14 +01:00
Tim Ledbetter
706d075835 LibGfx: Don't attempt alpha conversion for opaque images 2025-11-05 15:39:14 +01:00
Jelle Raaijmakers
3741d3040c LibWeb: Support percentage values in min/max flex item size constraints
Originally, 7200b3a16c introduced a two-pass system to determine
hypothetical cross sizes. Later, this was partially reverted in
0084d992d4, but some code was left behind that caused resolution of
percentages in `{min/max}-{width/height}` size constraints not to work.

Through intrinsic sizing, we can potentially end up with a definite
available space for the items in the last FC run. At that point we
should be able to resolve percentages against the available space, but
we were never doing that.
2025-11-05 12:01:40 +01:00
Jelle Raaijmakers
4ff17fc8d7 LibWeb: Only consider main size for item height in intrinsic sizing
We did not actually check whether we are in intrinsic sizing mode, and
should actually use the available space in all other cases. This will
allow for proper determination of the hypothetical cross size in the
next commit.
2025-11-05 12:01:40 +01:00
Jelle Raaijmakers
f9b4fa9702 LibWeb: Add CSS::Size::is_intrinsic_sizing_constraint() 2025-11-05 12:01:40 +01:00
Tim Ledbetter
8d81421526 LibWeb: Cache font matching algorithm results
The majority of time in `compute_font()` was spent in
`font_matching_algorithm()` repeatedly computing the same values. We
now cache these values to avoid unnecessary work.
2025-11-05 09:12:02 +01:00
Andreas Kling
4ed6eac5be LibWeb: Use new DecodedImageData::paint() API in ImagePaintable 2025-11-05 09:11:49 +01:00
Andreas Kling
213e20c97b LibWeb: Use new DecodedImageData::paint() API in ImageStyleValue 2025-11-05 09:11:49 +01:00
Andreas Kling
4c2a02370d LibWeb: Add API to allow DecodedImageData to paint itself directly
Instead of painting DecodedImageData by first asking it for a bitmap
and then painting that, this commit adds two new APIs:

- frame_rect(frame_index):

    Gets the size of the animation frame at the given index.

- paint(context, ...):

    Paints the DecodedImageData into a DisplayListRecordingContext.

The main powerful thing here is that this allows SVGDecodedImageData
to render itself using the GPU when available.
2025-11-05 09:11:49 +01:00
Andreas Kling
cebd4cc10d LibWeb: Add ImageProvider virtual to access the DecodedImageData
...and also the current frame index, in case of animations.
2025-11-05 09:11:49 +01:00
Undefine
5b88b76b84 LibWeb: Deduplicate WebGL1 implementations from WebGL2
This makes the WebGL2 implementation file inherit from the WebGL1
implementation file. This is actually closer to what the IDL files
describe and allows us to not have to maintain two copies of the same
functions.
2025-11-05 02:19:32 +01:00
Undefine
7a1668fe22 LibWeb: Switch include in WebGLRenderingContextImpl to OpenGL ES 3
The reasoning behind this is that in the next commit some of the WebGL2
specific parameters will be moved here. This header is needed to give
us access to those defines. Note that when in WebGL1 nothing from ES3
will be used as it's locked behind WebGL2 checks (it wouldn't work
anyways as we request ES2 from ANGLE).
2025-11-05 02:19:32 +01:00
Undefine
395bc3ee27 LibWeb: Add a webgl_version getter to OpenGLContext 2025-11-05 02:19:32 +01:00
Undefine
df1aeda955 LibWeb: Deduplicate the WebGL null_terminated_string helper 2025-11-05 02:19:32 +01:00
Undefine
6c115171da LibWeb: Split off WebGL2RenderingContextImpl to Impl and Overloads
This mostly analogous to the previous commit that does the same with
the WebGL1 Impl file.
2025-11-05 02:19:32 +01:00
Undefine
c70886ab1f LibWeb: Split off WebGLRenderingContextImpl to Impl and Overloads
This is more like what the IDL files specify with two different mixins,
but the inheritance structure here is slightly different for easier
maintenance. This will also allow the WebGL2 Impl to inherit from the
WebGL1 Impl as WebGL versions don't share the functions defined in the
Overloads interfaces.
2025-11-05 02:19:32 +01:00
Undefine
7f0f1c3266 LibWeb: Add missing WebGL includes 2025-11-05 02:19:32 +01:00
Aliaksandr Kalenik
ed921b66f5 LibGfx+LibWeb: Delete unused Line class and Rect methods 2025-11-04 23:16:02 +01:00
norbiros
aa5b3ff95a LibGfx: Pass font variation settings to HarfBuzz
Enhance `Font::harfbuzz_font()` to include font variation information
when creating HarfBuzz fonts. This required updating the `Font` struct
to store details about font variations.

I wasn’t aware of this, but it also fixed some visual artifacts with
variable fonts, so big thanks to @Lubrsi for the suggestion!
2025-11-04 21:44:32 +01:00
norbiros
d8e80718d7 LibWeb/CSS: Absolutize values while computing font variation settings
Makes the `compute_font_variation_settings` function match other
`compute_font_*` by absolutizing values passed into them. It resolves a
crash related to using `siblings-count` inside `font-variation-settings`

Co-authored-by: Sam Atkins <sam@ladybird.org>
2025-11-04 21:44:32 +01:00
norbiros
3829a85fde LibWeb: Add basic variable font support
Integrates the new `FontVariationSettings` from LibGfx into LibWeb to
enable initial variable font functionality. Currently, only the `wght`
(weight) axis is fully supported and tested. This update also introduces
support for the CSS `font-variation-settings` property.
2025-11-04 21:44:32 +01:00
norbiros
489381698f LibGfx: Introduce FontVariationSettings
This change lays the groundwork for variable font support in LibWeb.
FontVariationSettings enables customization of existing font axes such
as weight (wght) and width (wdth).
2025-11-04 21:44:32 +01:00
norbiros
a01360832c LibGfx: Implement comparison operator and hash function for FourCC 2025-11-04 21:44:32 +01:00
Gabe
9d1b54b436 Meta: Fix typo in URL
Corresponds with LadybirdBrowser/ladybird.org#204
2025-11-04 17:06:56 +01:00
Luke Wilde
8adde0980a LibWeb/WebGL: Respect UNPACK_PREMULTIPLY_ALPHA
Fixes splats on https://superspl.at having dark splotches, as they
expect textures with unpremultiplied alpha.
2025-11-04 17:06:24 +01:00
Zaggy1024
8f666c6360 LibMedia: Support parsing Matroska BlockGroup elements
This allows us to read WebM files that have blocks with additional data
attached to each block for an alpha frame. For now, only the main coded
data is used, the additional data containing the alpha channel is
ignored.
2025-11-04 16:59:50 +01:00
Sam Atkins
e026c98d64 LibWeb/CSS: Insert required comments when serializing lists of tokens
Certain pairs of tokens are required to have `/**/` inserted between
them to prevent eg two `<ident>`s getting merged together when
round-tripping.
2025-11-04 14:05:31 +01:00
Sam Atkins
9ac0966fc6 Tests: Import serialize-consecutive-tokens test
This had significant regressions after #6646, so let's import it to
track progress and prevent future regressions.
2025-11-04 14:05:31 +01:00
Tim Ledbetter
74940726d0 LibWeb: Add an Internals method to dump the GC graph 2025-11-04 10:34:43 +01:00