Commit graph

72160 commits

Author SHA1 Message Date
Tete17
74aa7e8a82 LibWeb: Hook TrustedTypes to the Workers api 2025-10-13 13:22:01 +01:00
Tete17
e6ac064a34 LibWeb: Hook TrustedTypes to the SharedWorkers api 2025-10-13 13:22:01 +01:00
Tete17
bd4e3fd3e0 LibWeb: Hook TrustedTypes to the Range Dom api 2025-10-13 13:22:01 +01:00
Tim Ledbetter
701ef22952 LibWeb: Use correct percentage basis when resolving line height 2025-10-13 10:17:58 +01:00
Sam Atkins
078bc1a471 LibWeb/CSS: Allow converting CSSMathValues to StyleValues
Because we store calculations as a tree of CalculationNodes inside a
CalculatedStyleValue, instead of a tree of StyleValues directly, this
implements a create_calculation_node() method on CSSNumericValue.
CSSMathValue::create_an_internal_representation() then calls
create_calculation_node() on itself, and wraps it in a
CalculatedStyleValue.

Lots of WPT passes again! Some regressions, which are expected: `cursor`
fails a test for the same reason it fails other that set it to some
kind of numeric value: We don't distinguish between "can contain a
number" and "can accept a number by itself". This will affect any
similar properties, but overall this is a big improvement.
2025-10-13 09:59:38 +01:00
Sam Atkins
37cffba30e LibWeb/CSS: Forward-declare some calculation-related types
Saves us having to include CalculatedStyleValue.h from some headers.
2025-10-13 09:59:38 +01:00
Sam Atkins
df7abe1dc2 LibWeb/CSS: Extract CSSUnitValue -> CSS Value code
create_numeric_value() will be used next to create a CalculationNode,
and I didn't want to have to duplicate the "create a value based on the
unit name" code.

No behaviour change.
2025-10-13 09:59:38 +01:00
Sam Atkins
0afa93e639 LibWeb/CSS: Add a Property -> CalculationContext factory method
We have this code duplicated in multiple places, and we'll want to
handle registered custom properties too at some point, so wrap it in a
reusable `CalculationContext::for_property()` method.

Noticed while doing this that ValueParsingContext will eventually need
to take a PropertyNameAndID, not a PropertyID, so I've added a FIXME.
2025-10-13 09:59:38 +01:00
=
a3e973970a LibWeb/CSS: Check overflow value before determining box baseline
The CSS spec says the baseline of an inline-block should be the bottom
margin when either the overflow property is not 'visible' or there are
no in-flow line boxes. Previously, only the latter case was checked.

This fixes 1 WPT test:
https://wpt.live/css/css-align/baseline-of-scrollable-1a.html
2025-10-13 09:47:32 +01:00
Tim Ledbetter
1a640b1d95 LibWeb: Avoid crash when shadow root has null focused area 2025-10-12 22:50:12 +01:00
Andreas Kling
a76f420207 LibJS: Add fast path for division of two numbers
We already had fast paths for Add, Sub and Mul. Might as well do Div.

1.18x speed-up on this micro-benchmark:

    (() => {
        let a = 1234;
        for (let i = 0; i < 100_000_000; ++i)
            a / a;
    })()
2025-10-11 20:08:58 +02:00
Andreas Kling
755c8d8cd6 LibJS: Sprinkle [[likely]] on the fast paths in ValueInlines.h
1.04x speed-up on JetStream/quicksort.c.js
2025-10-11 20:08:58 +02:00
Andreas Kling
7462c10ee2 LibJS: Sprinkle [[unlikely]] on the PutBy* cache miss code paths
These caches are gonna be hitting most of the time, so let's give the
compiler a hint about this.

1.01x speed-up on MicroBench/pic-add-own.js
2025-10-11 20:08:58 +02:00
Andreas Kling
b47f8f94fe LibJS: Split PutBy* instructions into specialized per-kind variants
This allows the compiler to fold away lots of unused code for each kind.

1.10x speed-up on MicroBench/pic-add-own.js :^)
2025-10-11 20:08:58 +02:00
Andreas Kling
d13b4f3e39 LibJS: Remove unused member PutPrivateById::m_kind
Private property puts never have a PutKind.
2025-10-11 20:08:58 +02:00
Andreas Kling
e7a3c4dbad LibJS: Rename Bytecode::Op::PropertyKind => Bytecode::PutKind
This is only used to specify how a property is being added to an object
by Put* instructions, so let's call it PutKind.

Also add an enumeration X macro for it to prepare for upcoming
specializations.
2025-10-11 20:08:58 +02:00
Tim Ledbetter
1c10421316 LibWeb: Support font-stretch SVG presentation attribute 2025-10-11 08:12:38 +01:00
Tim Ledbetter
14be5106d7 LibWeb: Add missing SVG presentation attributes 2025-10-11 08:12:38 +01:00
Timothy Flynn
0cae8dd712 LibWeb: Do not drop favicon resolution callbacks
Commit 77f6edaf71 tried to map the promise
returned from the ImageCodecPlugin to the same promise type used for SVG
decoding. However, `map` drops the existing resolution callbacks on the
floor.

Instead, let's keep the ImageCodecPlugin promise alone, and resolve the
returned promise explicitly.
2025-10-10 15:10:20 -04:00
Timothy Flynn
e57176b484 LibWebView: Move headless clipboard management to LibWebView
We only supported headless clipboard management in test-web. So when WPT
tests the clipboard APIs, we would blindly try to access the Qt app,
which does not exist.

Note that the AppKit UI has no such restriction, as the NSPasteboard is
accessible even without a GUI.
2025-10-10 15:10:03 -04:00
Timothy Flynn
a4a15b9a1e LibWeb+UI/AppKit: Ignore unknown clipboard MIME types
This prevents the AppKit UI from sending unknown MIME types to LibWeb,
where we would previously blindly dereference the result of parsing the
MIME string. We now ignore unknown MIME types as well.
2025-10-10 15:10:03 -04:00
Timothy Flynn
281bf227ad Meta: Support importing WPT resources in fetch() invocations 2025-10-10 15:10:03 -04:00
Timothy Flynn
a229a9d7e1 Meta: Store parsed WPT resources as a set
If a resource appears in a test more than once, such as:

    <script src="/foo.png">
    <script src="/foo.png">

Then we end up replacing "/foo.png" in the test source that many times
as we iterate over the resource array, like so:

    source.replace("/foo.png", "../foo.png")

So we end up with:

    <script src="..../foo.png">
    <script src="..../foo.png">

Store the resources as a set instead.
2025-10-10 15:10:03 -04:00
Dowsley
c6b289c3dc LibWeb: Derive implicit aria-level for h1–h6 from tag name 2025-10-10 17:18:02 +01:00
Aliaksandr Kalenik
d7f830cdd1 LibWeb: Execute rasterization callback on the rendering thread
Previously, we enqueued a task on the main thread's event loop to
execute the callback. This meant that even though the rendering thread
had finished producing the next frame, there was still a delay before
the main thread notified the UI process.

This change makes the rendering thread execute the callback directly.
This should be safe, as the only pointer captured by the callback is the
traversable `PageClient`, which is expected to remain alive for as long
as the rendering thread exists. The callback then invokes either
`page_did_paint()` or `page_did_take_screenshot()`, both of which
enqueue an IPC message, which is safe to do since `SendQueue` is
protected by a mutex.
2025-10-10 17:25:55 +02:00
Aliaksandr Kalenik
9e3e581e14 LibWeb: Delete unused m_combined_css_transform from PaintableBox 2025-10-10 16:58:51 +02:00
Aliaksandr Kalenik
72aaef5a0f LibWeb: Delete non-const layout_node_with_style_and_box_metrics()
...from PaintableBox. It was used exclusively to go to corresponding DOM
node which could be done via direct DOM node pointer owned by paintable.
2025-10-10 16:58:51 +02:00
Aliaksandr Kalenik
0fbadba2e1 LibWeb: Add a test to ensure "resize" event on VV is fired on pinch-zoom 2025-10-10 15:37:45 +02:00
Aliaksandr Kalenik
835081d66e LibWeb+LibWebView+WebContent: Reset pinch-to-zoom state on Ctrl/Cmd+0 2025-10-10 15:37:45 +02:00
Aliaksandr Kalenik
eb4c616974 LibWeb: Dispatch "resize" event on VisualViewport size change 2025-10-10 15:37:45 +02:00
Aliaksandr Kalenik
9862d8b4a6 LibWeb: Implement pinch-to-zoom support
Adds pinch event handling that adjusts the VisualViewport scale and
offset. VisualViewport's (offset, scale) is then used to construct a
transformation matrix which is applied before display list execution.
2025-10-10 15:37:45 +02:00
Aliaksandr Kalenik
b477c6bfc4 LibWeb: Implement VisualViewport aware viewport scrolling
Implements spec algorithm for viewport scrolling that first checks if
it's possible to use delta to move the visual viewport before falling
back to scrolling the layout viewport. This is a part of pinch-to-zoom
support.
2025-10-10 15:37:45 +02:00
Aliaksandr Kalenik
7ba34e8bd1 LibGfx: Implement AffineTransform::to_matrix() 2025-10-10 15:37:45 +02:00
Aliaksandr Kalenik
c630de17ab LibWeb+UI+WebContent: Pipe pinch events from AppKit UI to WebContent 2025-10-10 15:37:45 +02:00
Lorenz A
e6831003c6 LibWeb: Check for Svg & MathML tags in stack of open elements scope
list & button scope need to check svg & mathml elements besides the list
from s_base_list see
https://html.spec.whatwg.org/multipage/parsing.html#has-an-element-in-the-specific-scope
2025-10-10 12:09:20 +01:00
Manuel Zahariev
125b13a0cb LibWeb/CSS: Test cases for content inside the ::marker pseudo-element 2025-10-10 12:02:16 +01:00
Manuel Zahariev
9d77221c4d LibWeb/CSS: Add support for content to the ::marker pseudo-element
A ::marker pseudo-element is created for list item nodes (nodes
with display:list-item).

Before:
    - The content of the ::marker element is created magically from
    the value of the ordinal (for <ol>) or from a template (for <ul>).
    The style `content` is ignored for ::marker pseudo-elements.

After:
    - If a "list item node" has CSS `content` specified for its ::marker
    pseudo-element, use this to layout the pseudo-element,
    https://drafts.csswg.org/css-lists-3/#content-property
    - Otherwise, layout the list item node as before.
2025-10-10 12:02:16 +01:00
R-Goc
24ace9f183 Vcpkg: Disable cpptrace for freeBSD
Cpptrace is not supported on freeBSD, so until that changes it will not
be built from vcpkg.
2025-10-10 12:46:20 +02:00
R-Goc
ba5ef052e4 AK: Fix libbacktrace fallback
Introducing cpptrace as the primary backtrace library broke the
backtrace fallback during the code move. This commit properly links AK
to libbacktrace.

It also fixes the function signatures for the fallback backtrace
handlers.
2025-10-10 12:46:20 +02:00
R-Goc
5deeb55461 Meta: Add cpptrace to flatpak manifest
This commit adds cpptrace to the flatpak manifest, fixing the build.

Co-authored-by: Jan Koudijs <theappgineer@gmail.com>
2025-10-10 12:46:20 +02:00
Jelle Raaijmakers
5153b9ef45 CI: Trigger Flatpak CI builds with 'flatpak' PR label
Similar to the 'windows' label, this triggers Flatpak builds for x86_64
and aarch64.
2025-10-10 09:28:38 +02:00
Aliaksandr Kalenik
83fb690bce LibWeb: Remove usage of layout_node() in dom_node_for_event_dispatch
No need to go through layout node when paintable has a direct pointer to
the DOM node.
2025-10-10 09:03:39 +02:00
Aliaksandr Kalenik
b786935169 LibWeb: Delete CheckBoxPaintable::layout_box()
No need for this method when we could reach into DOM node directly from
Paintable.
2025-10-10 09:03:39 +02:00
Aliaksandr Kalenik
38ca745a59 LibWeb: Delete CanvasPaintable::layout_box()
No need for this method when we could reach into DOM node directly from
Paintable.
2025-10-10 09:03:39 +02:00
Aliaksandr Kalenik
d3f40e9a72 LibWeb: Delete AudioPaintable::layout_box()
No need for this method when we could reach into DOM node directly from
Paintable.
2025-10-10 09:03:39 +02:00
Aliaksandr Kalenik
33a8fbd22c LibWeb: Delete unused SVGGraphicsPaintable::layout_box() 2025-10-10 09:03:39 +02:00
Aliaksandr Kalenik
3675560804 LibWeb: Delete unused SVGSVGPaintable::layout_box() 2025-10-10 09:03:39 +02:00
Aliaksandr Kalenik
2c2584ee99 LibWeb: Delete VideoPaintable::layout_box()
No need for this method when we could reach into DOM node directly from
Paintable.
2025-10-10 09:03:39 +02:00
Aliaksandr Kalenik
5c699e1a45 LibWeb: Delete NavigableContainerViewportPaintable::layout_box()
No need for this method when we could reach into DOM node directly from
Paintable.
2025-10-10 09:03:39 +02:00
lukasxcs
c1ff2a845c LibWeb: Implement DataTransfer.set_data() 2025-10-10 08:02:16 +01:00