Commit graph

68652 commits

Author SHA1 Message Date
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
Luke Wilde
6cb0f41c57 LibWeb/WebGL: Return from uniform methods if location is null
If location is null, the spec simply tells us to return and ignore the
passed in data.

Fixes #3708.
2025-03-03 08:43:33 +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
Timothy Flynn
cf523137ad headless-browser: Do not log the inner text of crash tests
This re-implements 533c8e910a without
breaking the ability to dump layout trees.
2025-03-02 11:49:49 -05:00
Timothy Flynn
1aa009b0cf Revert "headless-browser: Do not log the inner text of crash tests"
This reverts commit 533c8e910a.

This broke the ability to dump layout trees using headless-browser.
2025-03-02 11:49:49 -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
fryssen
b62a4a1a89 Documentation: Fix a typo on line 52 in Devtools.md
Typo "communcation" replaced with communication on line 52.
2025-03-01 10:31:47 -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
Silvano Cerza
7c8d16ffca UI/AppKit: Fix template keyword misuse causing Mac build failure 2025-03-01 08:35:58 -05: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
Ali Mohammad Pur
ea3b7efd91 LibRegex: Treat the UnicodeSets flag as Unicode
Fixes /.../v not being interpreted as a unicode pattern.
2025-02-28 14:31:45 -05:00
Luke Wilde
14ebcd4881 vcpkg: Explicitly use OpenSSL backend with curl
The generic `ssl` feature selects Secure Transport on macOS, which is a
deprecated library and support for it in curl is also deprecated and
scheduled for removal after May 2025: https://daniel.haxx.se/blog/tag/securetransport/

Secure Transport is replaced by Network Framework, but as per the blog
post above, there's no foreseeable future of curl supporting it.

With this information, we now explicitly use OpenSSL as the backend for
curl, inline with the default choice for Linux.

This gives us some key benefits:
- A maintained and current TLS library
- TLS 1.0 and 1.1 is disabled by default
- TLS 1.3 is now available
- Modern cipher suites
- Removal of TLS_EMPTY_RENEGOTIATION_INFO_SCSV extension
- Opportunity to support HTTP/3 with nghttp3 and OpenSSL's QUIC support
- More extensions, key exchanges, EC point formats, etc.
2025-02-28 14:28:29 -05:00
Sam Atkins
532c01c388 LibWeb: Implement text-decoration: spelling-error and grammar-error 2025-02-28 16:34:08 +00:00
Sam Atkins
7668f91b60 LibWeb/Editing: Allow text-decoration-foo to be a CSSKeywordValue 2025-02-28 16:34:08 +00:00
Sam Atkins
d8a73a8165 LibWeb/Painting: Paint triangle waves using Skia
This has been left unimplemented since we switched to the Skia renderer.
Now `text-decoration-style: wavy` actually paints a wavy line. :^)

We had a text-decoration test, but it only checked `solid` lines, so
I've replaced it with a modified version of the old test page from
Serenity, without the blink option, and with some thickness parameters.

I did experiment with using a `SkPath1DPathEffect` to make it repeat the
pattern for us, but I couldn't make it look good at all.
2025-02-28 16:34:08 +00:00
Luke Wilde
08246bfa8c LibCore: Don't discard subsequent results in Socket::resolve_host
Previously, we only returned the first result that looked like an IPv6
or IPv4 address.

This cropped up when attempting to connect to https://cxbyte.me/ whilst
IPv6 on the server wasn't working. Since we only returned the first
result, which happened to be the IPv6 address, we wasn't able to
connect.

Returning all results allows curl to attempt to connect to a different
IP if one of them isn't working, and potentially make a successful
connection.
2025-02-28 15:14:35 +01:00
Gingeh
93e2babc64 LibWeb: Prevent crash when loading module in worker
The import map is defined for all global objects, not just the window.
2025-02-28 14:51:20 +01:00
Sam Atkins
fc4a2eeba8 UI/AppKit: Support image cursors 2025-02-28 13:50:13 +01:00
Sam Atkins
e0b5e742de UI/AppKit: Extract gfx_bitmap_to_ns_image() code 2025-02-28 13:50:13 +01:00
Sam Atkins
bfd7ac1204 LibWeb+WebContent+UI: Support image cursors
The `cursor` property accepts a list of possible cursors, which behave
as a fallback: We use whichever cursor is the first available one. This
is a little complicated because initially, any remote images have not
loaded, so we need to use the fallback standard cursor, and then switch
to another when it loads.

So, ComputedValues stores a Vector of cursors, and then in EventHandler
we scan down that list until we find a cursor that's ready for use.

The spec defines cursors as being `<url>`, but allows for `<image>`
instead. That includes functions like `linear-gradient()`.

This commit implements image cursors in the Qt UI, but not AppKit.
2025-02-28 13:50:13 +01:00
Sam Atkins
fd2414ba35 LibWeb/Painting: Call Base::resolve_paint_properties() from children 2025-02-28 13:50:13 +01:00
Sam Atkins
d127d412c8 LibWeb/CSS: Implement CursorStyleValue
A cursor is an image, with an optional x,y hotspot.

We know that a CursorStyleValue's bitmap never needs to change size, so
we create the ShareableBitmap once and then cache it, so that we don't
have to repeatedly create an FD for it or do the work of painting.

To avoid repainting that bitmap, we cache the values that were used to
create it - what currentColor is and its length resolution context -
and only repaint when those change.
2025-02-28 13:50:13 +01:00
Sam Atkins
9cbd8a82c7 LibWeb: Only require NodeWithStyle for gradient size resolution
None of the code here actually needs a NodeWithStyleAndBoxModelMetrics,
and we'll need to be able to resolve images from inside
NodeWithStyle::apply_style().
2025-02-28 13:50:13 +01:00
Sam Atkins
a0cd6dd607 LibWeb/CSS: Support CalculatedOr::to_string() for integers and floats
IntegerOrCalculated and NumberOrCalculated's T types don't have a
to_string() method because they're i64 and double respectively, so use
String::number() for them instead.

Also rearrange this method to avoid checking the variant's contents
multiple times.
2025-02-28 13:50:13 +01:00
Sam Atkins
c77456a508 LibWeb/CSS: Clarify types of image-parsing methods
parse_image_value() always returns some kind of AbstractImageStyleValue.
2025-02-28 13:50:13 +01:00