Commit graph

8823 commits

Author SHA1 Message Date
Timothy Flynn
c5a22a1a97 LibDevTools+LibWebView: Implement basic support for console logging
This implements support for basic usage of console.log and friends. It
does not implement console.assert, console.trace, console.group, etc.
2025-03-04 15:33:39 -05:00
Timothy Flynn
848ac11495 LibWebView: Rename a couple of console-related callbacks for clarity
The "on_received_console_message" and "on_received_console_messages"
were indistinguishable in purpose based on their name. This renames them
to:

on_console_message_available - WebContent has output a console message
and it is available for the client to retrieve.

on_received_styled_console_messages - WebContent has replied to a
request for the available console messages.

The "styled" qualifier is used here to indicate that the messages have
been styled with CSS for display in a WebView. This is to prepare for
an upcoming patch where DevToolsConsoleClient will not stylize the
output; DevTools will want the raw JS values.
2025-03-04 15:33:39 -05:00
sideshowbarker
38197916c3 LibWeb: Implement HTMLInputElement type=url constraint validation
This change implements HTMLInputElement type=url constraint validation
in such a way as to match the behavior in other existing engines (which
is, however, very different from what the spec currently requires).
2025-03-04 19:15:40 +00:00
Andreas Kling
6606eecce5 LibWeb: Invalidate style (and rule cache) on MediaList changes
This makes dynamic changes to a style sheet's media attribute actually
take effect immediately.
2025-03-04 19:07:40 +01:00
Aliaksandr Kalenik
80c0a16597 LibWeb: Don't invalidate style for animations in idle state 2025-03-04 18:06:46 +01:00
Aliaksandr Kalenik
b92a8553c7 LibWeb: Cancel animations when element is moved in display none subtree
We already have logic to play or cancel animations in an element's
subtree when the display property changes to or from none. However,
this was not sufficient to cover the case when an element starts/stops
being nested in display none after insertion.
2025-03-04 18:06:46 +01:00
Sam Atkins
f148af0a93 LibWeb: Move XMLSerializer into HTML directory
The DOMParsing spec is in the process of being merged into the HTML one,
gradually. The linked spec change moves XMLSerializer, but many of the
algorithms are still in the DOMParsing spec so I've left the links to
those alone.

I've done my best to update the GN build but since I'm not actually
using it, I might have done that wrong.

Corresponds to 2edb8cc7ee
2025-03-04 16:44:41 +00:00
Sam Atkins
d970748eed LibWeb/HTML: Assert that a finished promise has a committed-to-entry
Corresponds to 12c6ce02d8
2025-03-04 16:44:41 +00:00
Totto16
4c54fa10ed LibWeb: Improve Enum generation in IDLGenerator
Generated enums have no underlying type specifier, this adds one
It uses the smallest available, which is mostly u8
2025-03-04 16:35:04 +00:00
Luke Wilde
e34a6c86b9 LibWeb: Introduce Content Security Policy policies and directives
These form the basis of Content Security Policy. A policy is a
collection of directives that are parsed from either the
Content-Security-Policy(-Report-Only) HTTP header, or the `<meta>`
element.

The directives are what restrict the operations can be performed in the
current global execution context. For example, "frame-ancestors: none"
tells us to prevent the page from being loaded in an embedded context,
such as `<iframe>`.

You can see it a bit like OpenBSD's pledge() functionality, but for the
web platform: https://man.openbsd.org/pledge.2
2025-03-04 14:27:19 +01:00
Rok Povsic
cff48febf0 LibWeb: Fix moving through tabs with keyboard shortcuts
Previously, despite CTRL being held, the webpage elements such as
checboxes (if existing) could 'hijact' moving to the next and previous
tab with CTRL+TAB and CTRL+SHIFT+TAB.
2025-03-04 07:37:36 -05:00
Timothy Flynn
532f156f4a LibJS: Remove some single-use Intl.DurationFormat variables
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/4c139f1
https://github.com/tc39/ecma402/commit/da498c2
https://github.com/tc39/ecma402/commit/ed5c716
2025-03-04 07:36:10 -05:00
Timothy Flynn
1e462daa9b LibJS: Simplify the Intl.DurationFormat GetDurationUnitOptions AO
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/d097048
2025-03-04 07:36:10 -05:00
Timothy Flynn
2f023c2d9c LibJS: Simplify Intl.DurationFormat.prototype.resolvedOptions
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/e3d3406
2025-03-04 07:36:10 -05:00
Timothy Flynn
56a6daee4d LibJS: Standardize the spec-order of Intl.DurationFormat definitions
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/54ca35d
https://github.com/tc39/ecma402/commit/6cdcab3
https://github.com/tc39/ecma402/commit/e4cbfba
2025-03-04 07:36:10 -05:00
Timothy Flynn
aa61307392 LibJS: Re-arrange and rename a few Intl properties
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/a46e37d
https://github.com/tc39/ecma402/commit/e102741
https://github.com/tc39/ecma402/commit/67a8417
https://github.com/tc39/ecma402/commit/ecb086c
2025-03-04 07:36:10 -05:00
sideshowbarker
8b0f6cb876 LibWeb: Implement “convert a string to a number” for type=time inputs 2025-03-04 12:33:09 +00:00
Totto16
678f531fe5 LibWeb: Fix IDL Generation error for enums
In the case, where IDL enums start with a character, that is an invalid
start character for C++ identifiers (e.g. a number), the C++ generaion
for enums fails. An example would be "2d" see #3788
2025-03-04 08:31:26 +00:00
Totto16
1182ee6c69 LibIDL: Report empty types with a separate error
Previously the IDL Parser Complained, that a type with the name ''
(an empty string) couldn't be found. It wasn't that easy to see the
mistake, as the not named type is printed without '' around it, so the
message seemed to miss a type. This now catches this specify error
earlier and reports it cleanly to the user. An example of this
occurring would be ''typedef A (B or //FIXME: C )
2025-03-04 08:31:26 +00:00
sideshowbarker
d14856e3c5 LibWeb: Implement “suffering from a step mismatch” constraint validation 2025-03-04 08:21:51 +00:00
Andreas Kling
12f5e9c5f8 LibWeb: Only put connected elements into document's by-name-or-id cache
This fixes an issue where disconnected elements were incorrectly
accessible as named properties on the document.
2025-03-04 00:51:50 +01:00
InvalidUsernameException
5f1a146afd LibWeb: Draw floating replaced elements more correctly
Previously floating replaced elements were drawn incorrectly and also
twice.
2025-03-03 21:49:44 +01:00
aplefull
80b2c11c81 LibJS: Implement Math.sumPrecise 2025-03-03 21:46:22 +01:00
Aliaksandr Kalenik
c769271e82 LibWeb: Don't invalidate display list in update_animated_style_if_needed
All necessary invalidations are issued while invalidating animated
style. There is no need to drop display list simply because there are
some animations that might need an update.
2025-03-03 21:45:23 +01:00
Aliaksandr Kalenik
1ce1a8f8f1 LibWeb: Reset and update animated style in a single pass
...and skip resetting animated style of finished animations.
2025-03-03 21:45:23 +01:00
Aliaksandr Kalenik
8e481f65f5 LibWeb: Don't invalidate style of finished animations
Removes lots of completely unnecessary work, especially when animated
property affects layout.
2025-03-03 21:45:23 +01:00
R-Goc
94de31ff3b AK: Remove fast_u32_xxx apis from Memory.h
This commit removes the fast_u32_fill and fast_u32_copy functions,
as they were only used in one place, and are not optimal.
2025-03-03 15:58:27 +01:00
Andreas Kling
fe2b752083 LibWeb: Don't begin link element fetch until browsing-context connected
Note that "becomes browsing-context connected" is defined as:

> When the insertion steps are invoked with it as the argument and it is
> now browsing-context connected.

This fixes an issue where WPT editing tests would clone the entire DOM
thousands of times and re-fetch all the linked CSS files once per clone.
2025-03-03 14:49:20 +01:00
Timothy Flynn
b11ba4cc90 LibWeb: Clear the document's page's focused navigable upon destruction
We set the page's focused navigable upon mouse-down events from the UI.
However, we neglected to ever clear that focused navigable upon events
such as subsequent page navigations. This left the page with a stale
reference to a no-longer-active navigable. The effect was that any key
events from the UI would not be sent to the new page until either the
reference was collected by GC, or another mouse-down event occurred.

In the test added here, without this fix, the text sent to the input
element would not be received, and the change event would not fire.
2025-03-02 17:27:24 -05:00
aplefull
53cdb04ee8 LibJS: Fix parseFloat(-0) returning -0 instead of +0
The optimization that skips the string conversion for number values was
causing -0 to be returned as-is. This patch adds a check for this case.
2025-03-02 11:30:34 -05:00
aplefull
61744322ad LibRegex: Ensure nullable quantifiers backtrack when input remains
Makes patterns like `/(a?b??)*/` correctly match the string
2025-03-02 15:19:04 +01:00
devgianlu
40c71ff3c0 LibCrypto: Remove unused GHash class 2025-03-02 15:11:38 +01:00
devgianlu
05f3b1f361 LibCrypto+LibWeb: Refactor AES implementation with OpenSSL 2025-03-02 15:11:38 +01:00
devgianlu
75841f5920 LibCrypto: Do not print OpenSSL errors with redundant newline 2025-03-02 15:11:38 +01:00
devgianlu
80fe259dab LibCrypto: Refactor HMAC implementations with OpenSSL 2025-03-02 15:11:38 +01:00
Vaxry
c5d0af54d0 LibWeb: Don't handle scroll if no axes are accepted
In some cases, we might be hovering directly on an element
scrollable e.g. horizontally, but we are scrolling vertically.
In these cases, we need to delegate the scroll to the parent
instead of stalling the user's scroll.
2025-03-01 23:54:48 +01:00
Timothy Flynn
010463c424 LibUnicode: Specify ICU 76 in LibUnicode/CMakeLists.txt
We upgraded to ICU 76 in 6a564376fc. This
CMakeLists.txt should have been updated to match.
2025-03-01 15:09:41 -05:00
Timothy Flynn
29c8e7c203 LibJS: Disallow large dates in ToTemporalMonthDay
This is a normative change in the Temporal proposal. See:
https://github.com/tc39/proposal-temporal/commit/bd5ac12

Note: No test added here because this only affects non-ISO-8601
calendars, which we do not yet support.
2025-03-01 14:49:20 +01:00
Timothy Flynn
080d32c7d0 LibJS: Use Intl.DurationFormat for Temporal.Duration.p.toLocaleString
This is an normative change in the Temporal proposal. See:
https://github.com/tc39/proposal-temporal/commit/ffb4fb5
2025-03-01 14:49:20 +01:00
Timothy Flynn
8f51d1dd04 LibJS: Integrate Temporal.Duration into Intl.DurationFormat
This is a normative change in the Temporal proposal. See:
https://github.com/tc39/proposal-temporal/commit/2d97205
2025-03-01 14:49:20 +01:00
Timothy Flynn
f16fe66def LibJS: Migrate IsValidDuration to ECMA-262
This is an editorial change in the Temporal proposal. See:
https://github.com/tc39/proposal-temporal/commit/03770bb

Note: We were actually already using the Temporal definition of this AO
in Intl.DurationFormat, so there's no change needed there.
2025-03-01 14:49:20 +01:00
Timothy Flynn
aa737bb654 LibJS: Migrate ToIntegerIfIntegral to ECMA-262
This is an editorial change in the Temporal proposal. See:
https://github.com/tc39/proposal-temporal/commit/5f76109
2025-03-01 14:49:20 +01:00
Timothy Flynn
a8d6e5c3db LibJS: Migrate Temporal updates to ECMA-262 AOs to the main AO file
These are going to be included in the ECMA-262 AOs once Temporal reaches
stage 4. There's no need to keep them in the Temporal namespace. Some
upcoming Temporal editorial changes will get awkward without this patch.
2025-03-01 14:49:20 +01:00
Timothy Flynn
ea52952774 LibJS: Update Date AOs to use Temporal
Neglected to do this after the Temporal rewrite. This lets us eliminate
the duplicated GetUTCEpochNanoseconds definition in Temporal.
2025-03-01 14:49:20 +01:00
Timothy Flynn
5764eeab05 LibJS: Update spec numbers for the Intl.DurationFormat proposal
This proposal has reached stage 4 and was merged into the ECMA-402 spec.
See: https://github.com/tc39/ecma402/commit/3ff3cc7
2025-03-01 14:49:20 +01:00
Tim Ledbetter
19961e2b45 LibWeb: Don't halt track loading steps after sending fetch request
Previously, we would initiate a fetch request and immediately return
from the track loading steps, so the following steps would never be
executed.
2025-03-01 08:24:59 -05:00
Tim Ledbetter
6aeb3e8839 LibWeb: Fire error event if HTMLTrackElement src is empty on load
Previously, we would hang while waiting for the track to load.
2025-03-01 08:24:59 -05:00
Aliaksandr Kalenik
4d1329e0ea LibWeb: Optimize the case when invalidation set contains "whole subtree"
Instead of marking all nodes in the subtree for style recalculation,
including subtrees of subsequent siblings, we can fall back to the
default invalidation path, which is optimized to skip siblings
unaffected by sibling selectors.

Makes scrolling on https://frame.work/pl/en/about go a lot smoother.
2025-03-01 13:42:10 +01:00
stelar7
b353211700 LibWeb: Update spec comment with latest changes 2025-03-01 12:41:35 +00:00
Aliaksandr Kalenik
0f697193f0 LibWeb: Check if navigable has active window before navigating
Fixes https://github.com/LadybirdBrowser/ladybird/issues/3733
2025-02-28 23:15:35 +01:00