Commit Graph

72096 Commits

Author SHA1 Message Date
Callum Law
102edf638d LibWeb: Support interpolation of SuperellipseStyleValue 2025-10-09 10:23:20 +01:00
Callum Law
20a2e8ab12 LibWeb: Store corner-*-shape properties in computed form 2025-10-09 10:23:20 +01:00
Callum Law
397e39f316 LibWeb: Support corner-*-shape logical properties 2025-10-09 10:23:20 +01:00
Callum Law
7305b3fa28 LibWeb: Parse corner-*-shape physical shorthands 2025-10-09 10:23:20 +01:00
Callum Law
814efa9809 LibWeb: Parse corner-*-shape physical longhands 2025-10-09 10:23:20 +01:00
Callum Law
0bf6014001 Tests: Import css corner-shape tests 2025-10-09 10:23:20 +01:00
Luke Wilde
6d83fd92b6 LibWeb/IndexedDB: Add additional debug output for async operations 2025-10-08 17:25:29 +02:00
Luke Wilde
d87c2a55b0 LibWeb/IndexedDB: Remove spin_until from checking finished transactions 2025-10-08 17:25:29 +02:00
Luke Wilde
52b53e52fb LibWeb/IndexedDB: Remove spin_until from waiting for connection closure 2025-10-08 17:25:29 +02:00
Luke Wilde
e6dc52a52b LibWeb/IndexedDB: Remove spin_until from waiting for tasks to complete 2025-10-08 17:25:29 +02:00
Luke Wilde
5c69784ef9 LibWeb/IndexedDB: Remove spin_until from request processing 2025-10-08 17:25:29 +02:00
Luke Wilde
6d43e3cc93 LibGC: Mark Ptr::as_nonnull as a const function 2025-10-08 17:25:29 +02:00
Jelle Raaijmakers
a91031e1f3 CI: Use COMMIT file in JS repl archive to determine build commit hash
The upstream workflow `head_sha` contains the wrong hash in case the
workflow was run manually against a provided commit hash. We use the
COMMIT file that cpack adds to the archive to determine the actual
commit hash that was used to build the binaries.

Note that this will only work for builds since the introduction of that
file, so we cannot process benchmarks for older commits, unfortunately.
2025-10-08 14:42:09 +02:00
Jelle Raaijmakers
5c5de0e30e Meta: Add COMMIT file to cpack archives
This new file in the root of the archives contains the git commit hash,
to be used by e.g. the js-benchmarks webhook to determine which commit
was used to build the utilities.
2025-10-08 14:42:09 +02:00
Jelle Raaijmakers
915a89a93e Meta: Remove unused CPACK_PACKAGE_FILE_NAME
This went unused since the introduction of the explicit
CPACK_ARCHIVE_JS_FILE_NAME.
2025-10-08 14:42:09 +02:00
R-Goc
62e7d1b5c8 AK: Remove FreeLibrary call in assertion handler
The call to FreeLibrary was incorrect as GetModuleHandle does not
increment the reference count of the DLL.
2025-10-08 07:07:57 +02:00
R-Goc
3c7bad32cd AK: Clean up backtraces
This commit replaces the default backtrace logic with cpptrace, for
nicer, colored backtraces. Cpptrace runs on all of our supported
platforms excpet android. As such backtrace.h is left in place.

All the backtrace functions are made noinline to have a consistent
number of frames. A maximum depth parameter is added to dump_backtrace
with a default of 100. This should be enough, and can be easily
changed, and allows for limiting the maximum depth.

Setting the LADYBIRD_BACKTRACE_SNIPPETS environment variable enables
surrouding code snippets in the backtrace. Specifically 2 lines above
and below. This number can be changed by calling snippet_context on the
formatter. For the whole list of options of what can be done with
formatting see the cpptrace repository.

On Windows we skipped frames when verification fails and when
dump_backtrace was added the logic was wrong and would have skipped
frames we care about.

This commit also implements skipping frames on Linux.
The only time where this does not skip all frames is when the call to
backtrace gets intercepted. Then we will end up skipping one frame less
than needed.

To keep delayload on Windows a patch and overlay port is used. When
upstream accepts these changes and vcpkg bumps the version the patch
could be removed to have just the cmake define.
2025-10-08 07:07:57 +02:00
Lorenz A
1e6ac54b75 LibGfx+LibWeb: Don't display Glyphs that are not on the path 2025-10-08 03:34:53 +01:00
Rocco Corsi
b6b56910e8 LibIPC: Shutdown IPC handler when transport is lost during sync event
If the Ladybird process crashes or just ends normally, the IPC transport
connection with WebContent may be shutdown after a send sync event (for
example: WebContentClient DidRequestCookie) was sent from WebContent,
but before the Ladybird process provided the matching sync event
response (for example: WebContentClient DidRequestCookieResponse). This
can lead to a runaway WebContent process if other IPC events (for
example: WebContentServer DidPaint, or SetSystemVisibilityState, or
MouseEvent, or CloseServer, etc...) are also queued when the IPC
connection is shutdown.

At the core of the issue is that the loop waiting for the matching
send sync response will prioritize waiting for the response and remain
spinning even if the IPC connection is reporting that it was shutdown,
but only if there happens to be other unrelated events received before
the IPC shutdown is detected. These unrelated events will not be
processed because the loop is stuck waiting for the response that due
to the Ladybird process having stopped, will never be sent.

Because the shutdown of the IPC connection is not handled when other
events happen to be also present, new events may be posted for transfer
by the WebContent process if the page is very active. If many new events
are posted this could lead to a slow or very quick memory leak in the
WebContent process due to the queue growing large, sometimes all the way
to total system memory exhaustion. If no events or only a few new events
are sent, then the leak may be hard to detect.

This PR fixes the faulty IPC shutdown handling by not getting stuck if
any messages are present in the receive queue. Before returning to the
caller any remaining messages will be immediately processed.
2025-10-07 17:04:32 -05:00
Andreas Kling
695f02e8e5 LibJS: Give Interpreter a direct pointer to the identifier table
This gets rid of a lot of pointer chasing from interpreter to executable
to identifier table to the actual identifier.

1.05x speed-up on Kraken/ai-astar.js
2025-10-07 23:50:51 +02:00
Andreas Kling
d0df7c8c62 LibJS: Use [[likely]] annotations for cached environment lookups
These will generally be cached the vast majority of the time except on
first encounter, and sprinkling [[likely]] gives us a nice boost.

1.10x speed-up on this micro-benchmark:

    (() => {
        var a = 3;
        for (let i = 0; i < 100_000_000; ++i) { a; }
        eval("");
    })();
2025-10-07 23:50:51 +02:00
Pavel Shliak
8e439a3c09 LibWeb: Bring test script src reflection test back
This test was removed in 56ded2b9cc05cc820ba4a870aeb0df952eff5f5c
2025-10-07 21:52:06 +02:00
Pavel Shliak
4ff7c9043b LibWeb: Make HTMLScriptElement.src getter resolve to absolute URL
The src IDL attribute was previously implemented as an inline getter
that returned the raw attribute value. This broke spec semantics and
sites like Telegram Web that rely on document.currentScript.src to
compute Webpack’s publicPath.

According to the HTML Standard:
https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#reflecting-content-attributes-in-idl-attributes

For URL-reflecting attributes:
  1. If contentAttributeValue is null, then return the empty string.
  2. Let urlString be the result of encoding-parsing-and-serializing
     a URL given contentAttributeValue,
     relative to element’s node document.
  3. If urlString is not failure, then return urlString.

This patch moves the getter to HTMLScriptElement.cpp and implements
these steps.
2025-10-07 21:52:06 +02:00
Luke Wilde
f44e42d27c LibWeb: Don't drop mouse wheel events sent to subframes unless handled
Otherwise scrolling gets stuck when you scroll over a non-scrollable
subframe.
2025-10-07 19:43:07 +02:00
Luke Wilde
adeedabf54 LibWeb: Don't class mousewheel as handled if scroll offset isn't updated
Before this change, you could only scroll the current hovered scroll
container, even if it was at the beginning or end and thus having no
effect.

Now, if it doesn't update, it will not be classed as handled and will
move onto the next scroll container.
2025-10-07 19:43:07 +02:00
Andreas Kling
38e224cd9f LibJS: Make overflowing arithmetic on 2x Int32 values faster
Instead of converting them to doubles and doing double math, just do the
arithmetic operation in i64 space instead.

This gives us a ~1.25x speed-up on this kind of micro-benchmark:

    (() => {
        let a = -2124299999;
        for (let i = 0; i < 100_000_000; ++i) {
            a + a;
        }
    })()

Same idea for Add, Sub, and Mul.

There's a fair bit of overflowing Int32 arithmetic in some of the
JetStream benchmarks, and this seems like an obvious improvement.
2025-10-07 18:28:26 +02:00
Jelle Raaijmakers
d696f107be CI: Add js-benchmarks commit hash to webhook payload 2025-10-07 15:12:21 +02:00
Jelle Raaijmakers
5e9d2461f3 CI: Always run latest version of js-benchmarks
Currently we default to GITHUB_REF for the checkout of js-benchmarks,
and if we've built up a large backlog of benchmark jobs to run, this can
mean we're running against a severely outdated version of js-benchmarks.

This new behavior allows us to see a failed js-benchmarks job, fix the
bug, and restart the failed job. This is important since we're testing a
specific commit and build from the upstream JS/WASM workflow.
2025-10-07 14:32:11 +02:00
Tim Ledbetter
03fa367d9d LibWeb: Parse the anchor-scope property 2025-10-07 11:30:23 +01:00
Tim Ledbetter
85a15ea1d4 LibWeb: Parse the position-visibility value 2025-10-07 11:30:23 +01:00
Tim Ledbetter
47966ed589 LibWeb: Parse the position-try-order property 2025-10-07 11:30:23 +01:00
Tim Ledbetter
2bde14b148 LibWeb: Parse the position-try-fallbacks property 2025-10-07 11:30:23 +01:00
Tim Ledbetter
27cdf3a2c8 LibWeb: Parse the position-anchor property 2025-10-07 11:30:23 +01:00
Tim Ledbetter
7374a07fbc LibWeb: Parse the anchor-name property 2025-10-07 11:30:23 +01:00
Callum Law
846f1626dd LibWeb: Remove unused {Calculated,Percentage}Or::absolutized methods
Reverts c8bd58c and 0df9c22. These were used to absolutize values stored
within other `StyleValue`s but we should instead store these values as
`StyleValue`s directly instead of within `{Calculated,Percentage}Or`.
2025-10-07 10:50:01 +01:00
Callum Law
e772a992be LibWeb: Store CursorStyleValue sub-values directly
Storing these within NumberOrCalculated is unnecessary
2025-10-07 10:50:01 +01:00
Callum Law
25192d3c20 LibWeb: Store BorderRadiusStyleValue sub-values directly
Storing these within LengthPercentage is unnecessary
2025-10-07 10:50:01 +01:00
Callum Law
2ebf446cbf LibWeb: Store BackgroundSizeStyleValue sub-values directly
Storing these within LengthPercentage is unnecessary
2025-10-07 10:50:01 +01:00
Callum Law
309ff33278 LibWeb: Add convenience from_style_value for LengthPercentage{OrAuto} 2025-10-07 10:50:01 +01:00
Callum Law
4a998879d5 LibWeb: Add absolutized method for TransformStyleValue 2025-10-07 10:50:01 +01:00
Callum Law
e675b95f51 LibWeb: Add absolutized method to OpenTypeTaggedStyleValue 2025-10-07 10:50:01 +01:00
Callum Law
2c7b56511b LibWeb: Add absolutized method to CounterDefinitionsStyleValue
This avoids a crash when a counter value relies on relative units
2025-10-07 10:50:01 +01:00
Callum Law
52192a308b LibWeb: Update absolutize to take a ComputationContext struct
This struct will in the future hold information other than a length
resolution context (e.g. context for tree counting functions) and a
single struct is easier to work with than multiple parameters.
2025-10-07 10:50:01 +01:00
Callum Law
47ffffb775 LibWeb: Absolutize value at start of compute_value_of_property
This saves us having to do it in various places later on.
2025-10-07 10:50:01 +01:00
Callum Law
28c12324c2 LibWeb: Remove unused NumericCalculationNode::to_style_value 2025-10-07 10:50:01 +01:00
Callum Law
f2a302663c LibWeb: Simplify value parsing code
We know that `parse_calculated_value` returns a
`RefPtr<CalculatedStyleValue const>` so we can avoid various checks on
the StyleValue type.
2025-10-07 10:50:01 +01:00
Andreas Kling
4d99f9f5d1 LibJS: Try to avoid a [[GetOwnProperty]] when setting Object property
The [[Set]] operation on objects will normally end up doing
[[GetOwnProperty]] twice, but if the object and the receiver are one on
the same, we can avoid the double work.

AFAIK this is not observable via proxies or other mechanisms.

1.10x speed-up on MicroBench/object-set-with-rope-strings.js
2025-10-07 11:34:19 +02:00
Callum Law
2098e516d2 LibWeb: Update layout of ancestor documents when getting computed style
Pending changes to an ancestor document's layout can affect an element's
computed style e.g. an IFrame's width being changed can affect media
query evaluation and the value of the `vw` unit.
2025-10-07 10:32:59 +01:00
Callum Law
05c336ea4e LibWeb: Use document's viewport when resolving lengths in media queries
Previously we would always use the window's viewport which was incorrect
if we were within an iframe.

This is likely applicable to all uses of
`Length::ResolutionContext::for_window`.
2025-10-07 10:32:59 +01:00
Callum Law
c33be71df9 LibWeb: Use correct value for font size in MediaFeature::compare
We were using the font's point size instead of it's pixel size, we were
already computing this information earlier in the function anyway so
let's just use that.
2025-10-07 10:32:59 +01:00