Commit Graph

71705 Commits

Author SHA1 Message Date
Aliaksandr Kalenik
d45f8a3081 LibJS: Add inline caching for adding new own properties to objects
We already had IC support in PutById for the following cases:
- Changing an existing own property
- Calling a setter located in the prototype chain

This was enough to speed up code where structurally identical objects
(same shape) are processed in a loop:
```js
const arr = [{ a: 1 }, { a: 2 }, { a: 3 }];
for (let obj of arr) {
    obj.a += 1;
}
```

However, creating structurally identical objects in a loop was still
slow:
```js
for (let i = 0; i < 10_000_000; i++) {
    const o = {};
    o.a = 1;
    o.b = 2;
    o.c = 3;
}
```

This change addresses that by adding a new IC type that caches both the
source and target shapes, allowing property additions to be fast-pathed
by directly jumping to the shape that already includes the new property.
2025-09-17 12:44:44 +02:00
Aliaksandr Kalenik
a54215c07d LibJS: Make internal_define_own_property() save added property offset
...in `PropertyDescriptor`. This is required for the upcoming change
that needs to know offset of newly added properties to set up inline
caching.
2025-09-17 12:44:44 +02:00
Timothy Flynn
ede6314cb6 LibWebView+UI/AppKit: Display icons in the macOS UI on Tahoe
On macOS Tahoe, it is now recommended to show menu item icons. We use
system symbols for this now. Symbols do not have constant variable names
and must be found via the SF Symbols app.

The symbols chosen here were to match Safari as close as possible.
2025-09-17 11:29:01 +01:00
Timothy Flynn
8ebc20a4f0 UI/AppKit: Make the location field bordered on Tahoe
Otherwise, it sticks out on macOS Tahoe when it is unbordered. This
matches Safari's look.
2025-09-17 11:29:01 +01:00
Timothy Flynn
e0a7217c4b UI/AppKit: Hide button borders when the button should be invisible
On macOS Tahoe, the zoom button's border is visible when the button
itself is hidden. This feels like a macOS bug, but for now let's hide
the borders as well.
2025-09-17 11:29:01 +01:00
Rocco Corsi
55d4adc614 LibWasm: Missing argument formatter (Wasm::Value) for WASI_DEBUG
Formatting code was removed in PR #960 for performance improvements.
Adding Wasi::Value back as u128 to allow WASI_DEBUG MACRO compilation
2025-09-16 22:13:23 +02:00
Jelle Raaijmakers
49817a1c6a CI+Meta: Add option to enable baseline CPU target for CI
We currently have the issue that our macOS builds are being hosted by
both Apple M1 and M4 runners. By default, these target `-mcpu=apple-m1`
and `-mcpu=apple-m3` respectively, causing their ccache artifacts to be
incompatible and effectively thrashing each other's ccache cache on each
run.

Add a new CMake option `ENABLE_CI_BASELINE_CPU` that toggles a baseline
`-mcpu/-march` compile option for each of the supported build platforms.
When disabled (the default), we now default to `-march=native` which on
Linux could theoretically lead to better performance.

The new CPU baseline is used by the `lagom-template.yml` and
`js-and-wasm-artifacts.yml` workflows, since they both produce artifacts
or caches that might be picked up by other runners. We also enable it
for Flatpak builds, so they target a fixed architecture instead of
whatever architecture the action runner that picked up the job has.
2025-09-16 10:53:15 -04:00
Callum Law
7a9b1a8033 LibWebView: Show a better error for invalid download dir in headless
Previously if the directory returned by `downloads_directory()` didn't
exist (or wasn't a directory) when taking a screnshot in headless mode
we try to ask the user for the download directory and fail with the
unhelpful error: QWidget: Must construct a QApplication before a QWidget
2025-09-16 10:39:20 -04:00
Jelle Raaijmakers
b9da7baac4 LibWeb: Extend logic for extraneous line breaks in block elements
While editing, we need to consider whether removing a <br> has any
effect on layout to determine whether its extraneous. This new condition
finds most cases for extraneous <br>s inside block elements.
2025-09-16 06:57:30 -04:00
Jelle Raaijmakers
f77f169824 LibWeb: Reformat code and comments in Editing::split_the_parents()
Mainly rewrapping the spec text to 120 characters. No functional
changes.
2025-09-16 06:57:30 -04:00
Jelle Raaijmakers
c557db8315 LibWeb: Pass existing DOM::BoundaryPoints in delete_the_selection() 2025-09-16 06:57:30 -04:00
Jelle Raaijmakers
9b614eebb3 LibWeb: Make TreeNode::child_at_index() accept a size_t
This gets rid of IDE warnings when the call site already uses a size_t.
2025-09-16 06:57:30 -04:00
Jelle Raaijmakers
b51cc00478 LibWeb: Resolve Unicode FIXME in forwardDelete 2025-09-16 06:57:30 -04:00
Tete17
82f56e30ed LibWeb: Adapt the parsing of script elements to accommodate TrustedTypes 2025-09-16 10:57:34 +02:00
Tete17
f7c05013c7 LibWeb: Add innerText attribute of HTMLScriptElement for TrustedTypes 2025-09-16 10:57:34 +02:00
Tete17
6b9c44390f LibWeb: Add textContent attribute of HTMLScriptElement for TrustedTypes 2025-09-16 10:57:34 +02:00
Tete17
f65dca1b53 LibWeb: Extend src attribute of HTMLScriptElement with TrustedTypes
The field does no longer have the Reflect and URL attributes so we
remove it from our internal unit test.
2025-09-16 10:57:34 +02:00
Tete17
664a3b536a LibWeb: Extend set_text of HTMLScriptElement to accommodate TrustedTypes 2025-09-16 10:57:34 +02:00
Timothy Flynn
b4df857a57 LibWeb+LibWebView+WebContent: Replace DNT with GPC
Global Privacy Control aims to be a replacement for Do Not Track. DNT
ended up not being a great solution, as it wasn't enforced by law. This
actually resulted in the DNT header serving as an extra fingerprinting
data point.

GPC is becoming enforced by law in USA states such as California and
Colorado. CA is further working on a bill which requires that browsers
implement such an opt-out preference signal (OOPS):

https://cppa.ca.gov/announcements/2025/20250911.html

This patch replaces DNT with GPC and hooks up the associated settings.
2025-09-16 10:38:20 +02:00
Timothy Flynn
d9ebd44924 UI/Qt: Remove unused/undefined declaration from Qt settings 2025-09-16 10:38:20 +02:00
Zaggy1024
850aea7e17 LibWeb: Remove a FIXME and simplify the painting of video frames
The extra representations of a video element are unnecessary to specify
in VideoPaintable, as the playback system itself should take care of
all the details of the representation as specified.
2025-09-16 10:26:03 +02:00
Zaggy1024
861c10f37f LibWeb: Use an IIFE to determine a VideoPaintable's representation 2025-09-16 10:26:03 +02:00
Timothy Flynn
7b3465ab55 LibWeb: Do not require multipart form data to end with CRLF
According to RFC 2046, the BNF of the form data body is:

    multipart-body := [preamble CRLF]
                      dash-boundary transport-padding CRLF
                      body-part *encapsulation
                      close-delimiter transport-padding
                      [CRLF epilogue]

Where "epilogue" is any text that "may be ignored or discarded". So we
should stop parsing the body once we encounter the terminating delimiter
("--").

Note that our parsing function is from an attempt to standardize the
grammar in the spec: https://andreubotella.github.io/multipart-form-data
This proposal hasn't been updated in ~4 years, and the fetch spec still
does not have a formal definition of the body string.
2025-09-15 18:28:48 +02:00
Callum Law
34b8947ca0 LibWeb: Support text-underline-position: under 2025-09-15 15:24:20 +01:00
Callum Law
b0e3af7d10 LibWeb: Parse text-underline-position property
This introduces the `TextUnderlinePositionStyleValue` class, it is
possible to represent `text-underline-position` as a `StyleValueList`
but would have required ugly workarounds for either serialization or in
`ComputedProperties::text_underline_position`
2025-09-15 15:24:20 +01:00
Callum Law
a6812e1005 LibWeb: Store parsed shorthands in canonical order 2025-09-15 15:24:20 +01:00
Sam Atkins
d127eb5117 LibWeb/Geometry: Correct typos in DOMMatrix "not 0 or -0" checks
Assuming 0 and -0 are distinct values, `a != 0 || a != -0` is always
true.
2025-09-15 13:34:24 +02:00
Aliaksandr Kalenik
85e029b2e7 LibJS+LibWeb: Inline fast path for Value::to_object()
Adds inline implementation for the most common case when `Value` is
already an object.

1.47x improvement on the following benchmark:
```js
const o = {};
for (let i = 0; i < 10_000_000; i++) {
    o.a = 1;
    o.b = 2;
    o.c = 3;
}
```
2025-09-15 12:16:58 +02:00
Tim Ledbetter
f5fd6338d5 LibWeb: Handle interpolation of mixed-type LengthPercentages 2025-09-15 10:41:01 +01:00
Tim Ledbetter
7409c564d7 LibWeb: Extract mixed-type interpolation to a separate method 2025-09-15 10:41:01 +01:00
Tim Ledbetter
b19fee9962 LibWeb: Interpolate ellipse() function by computed value 2025-09-15 10:34:43 +01:00
Tim Ledbetter
f146207a04 LibWeb: Interpolate circle() function by computed value 2025-09-15 10:34:43 +01:00
Tim Ledbetter
4a0fe65923 LibWeb: Interpolate polygon() function by computed value 2025-09-15 10:34:43 +01:00
Tim Ledbetter
853bedeb31 LibWeb: Interpolate rect() function by computed value 2025-09-15 10:34:43 +01:00
Tim Ledbetter
0c89e86ff7 LibWeb: Interpolate xywh() function by computed value 2025-09-15 10:34:43 +01:00
Tim Ledbetter
be94c8d456 LibWeb: Interpolate inset() function by computed value 2025-09-15 10:34:43 +01:00
Lorenz A
47796e7967 LibWeb: Serialize HTML attribute names as per spec 2025-09-15 10:08:12 +02:00
Luke Wilde
4772e1b0c9 LibWeb/Fetch: Add missing spec step for checking for tuple origin
Fixes https://github.com/LadybirdBrowser/ladybird/issues/6188
2025-09-15 09:58:33 +02:00
Sam Atkins
5904694844 LibWeb/CSS: Implement CSSImageValue and reify images as it
This is specced to be opaque, so there's not much to it.
2025-09-15 08:47:10 +01:00
Sam Atkins
eb39c0162c Tests: Import a selection of CSS Typed-OM property tests
This is an arbitrary set of tests intended to cover the different
CSSStyleValue types without too much overlap.

Right now they all fail, because testsuite.js attempts to create one of
every type of CSSStyleValue on load, and we don't have most of them.
2025-09-15 08:47:10 +01:00
Callum Law
50239b58aa LibWeb: Reset border-image to initial value when using border
Also includes associated handling for serialization of the `border`
shorthand.
2025-09-15 08:42:22 +01:00
Callum Law
588c611e7e LibWeb: Use correct initial value for border-image
Omitting the `/`s meant that `1` and `0` were parsed as part of
border-slice instead of their intended values.

No functional changes but this will be relied on in a later commit.
2025-09-15 08:42:22 +01:00
ayeteadoe
9f23b0a069 Services/WebDriver: Enable on Windows 2025-09-15 09:19:52 +02:00
ayeteadoe
69e92f69a7 LibCore: Implement SIGTERM-based kill() on Windows
There is no direct Win32 API equivalent, but calling WM_CLOSE on
the top-level windows allows for a graceful shutdown where resources
are able to clean themselves up properly
2025-09-15 09:19:52 +02:00
Pavel Shliak
bbb9159883 LibWeb: Fix Request() TypeError message typo for mode='navigate'
The Request constructor’s mode validation threw
  "Mode must not be 'navigate"
missing the closing quote. Add the trailing quote so the error reads:
  "Mode must not be 'navigate'".
2025-09-15 08:19:34 +01:00
Kemal Zebari
faf3c19026 LibWeb/MimeSniff: Match spec change by using correct font essence
Spec change was made to fix a typo; application/font-off ->
application/font-otf
2025-09-15 07:31:02 +01:00
MFMF-EGY
fff09ed330 LibWeb: Handle interpolation of BorderRadius style value type 2025-09-14 16:49:20 +01:00
Shivendra Kumar
b3e8784f92 LibCrypto: Fix typo in comment 2025-09-14 10:45:41 +01:00
Marcos Del Sol Vives
40792aa85d LibWeb/CSS: Fix compilation with CSS_TRANSITIONS_DEBUG
A new parameter was added to Web::CSS::StyleValue::to_string() in
PR #2820 but this debug message was never updated. If
CSS_TRANSITIONS_DEBUG was enabled, compilation would fail.
2025-09-13 23:33:57 +02:00
Aliaksandr Kalenik
0076ab74b2 LibJS: Don't attempt to cast property key to number in PutByIdWithThis
Property key for this instruction cannot be a number.
2025-09-13 20:02:28 +02:00