Commit graph

71091 commits

Author SHA1 Message Date
Callum Law
7182a537f3 LibWeb: Reduce inaccuracies when creating rotation matrices
When converting rotate transform functions `sin` and `cos` can sometimes
be inaccurate. To avoid these inaccuracies we:
 - Mod the angle to minimise inaccuracies in the first place.
 - Discard tiny (smaller than epsilon) values returned by `sin` and
   `cos` as inaccuracies.

This is in line with  other browsers (e.g. Gecko and WebKit).
2025-08-11 17:10:04 +01:00
Callum Law
719ab5735e LibWeb: Avoid addition to infinity when rounding calc'd z-index 2025-08-11 17:10:04 +01:00
Timothy Flynn
f03c432b52 AK: Use simdutf for searching strings for a single code unit
In the following synthetic benchmark, the simdutf version is 4x faster:

    BENCHMARK_CASE(find)
    {
        auto string = u"😀Foo😀Bar"sv;

        for (size_t i = 0; i < 100'000'000; ++i)
            (void)string.find_code_unit_offset('a');
    }
2025-08-11 16:55:37 +02:00
Andreas Kling
bd7599ccfc LibCore: Remove macro-generated EventReceiver::try_create(...) factories
We can just use the infallible factory everywhere instead.
2025-08-11 16:55:25 +02:00
Andreas Kling
aec1f6aa7e LibCore: Remove unused CustomEvent 2025-08-11 16:55:25 +02:00
Andreas Kling
c47e253c60 LibCore: Remove unused "visible for timer purposes" concept
This was a long-unused leftover from SerenityOS.
2025-08-11 16:55:25 +02:00
Andreas Kling
0037df88d5 LibCore: Remove unused ChildEvent 2025-08-11 16:55:25 +02:00
Andreas Kling
75091016d7 LibCore: Remove parent/child concept from EventReceiver
This ownership model is no longer used.
2025-08-11 16:55:25 +02:00
Andreas Kling
134fd8e413 LibCore: Don't have Promise inherit from EventReceiver
This was only used for parenting promises to each other, but we can do
that with a simple vector of children.
2025-08-11 16:55:25 +02:00
Andreas Kling
dfe776b722 WebDriver: Stop using the ancient Core::EventReceiver parent/child API
Before this change, clients were kept alive by making them children of
the TCPServer object. This ownership model is going away (and this was
the only remaining use of it!) so let's just put the clients in a hash
table instead.
2025-08-11 16:55:25 +02:00
Andreas Kling
045eaa1576 LibLine: Remove unnecessary use of EventReceiver parent/child API 2025-08-11 16:55:25 +02:00
Andreas Kling
b8357bc190 LibCore: Remove unused LocalServer constructor parameter 2025-08-11 16:55:25 +02:00
Andreas Kling
cfcb63239d LibCore: Remove unused ThreadedPromise constructor 2025-08-11 16:55:25 +02:00
Andreas Kling
fa8592b4a9 LibCore: Remove unused UDPServer constructor parameter 2025-08-11 16:55:25 +02:00
Andreas Kling
036aa43a41 LibCore: Remove unused TCPServer constructor parameter 2025-08-11 16:55:25 +02:00
Andreas Kling
d13884e933 LibCore: Remove unused Timer APIs for constructing with a parent 2025-08-11 16:55:25 +02:00
Andreas Kling
4d285d6dce LibCore: Remove an unused Promise constructor 2025-08-11 16:55:25 +02:00
Andreas Kling
ecf0395c27 LibCore: Stop parenting notifiers
There's no need to participate in the ancient EventReceiver parent/child
ownership scheme here. Notifiers are already owned by RefPtrs anyway.
2025-08-11 16:55:25 +02:00
Andreas Kling
34709cc796 LibCore: Remove unused "name" concept from EventReceiver 2025-08-11 16:55:25 +02:00
Tete17
cf211cf99a LibWeb: Migrate TrustedTypes to Utf16String 2025-08-11 12:21:31 +01:00
Tete17
7559084b22 LibWeb: Add wpt test for createPolicy and createXXX
This gives us at least 72 new tests :)
2025-08-11 12:21:31 +01:00
Tete17
53e0f287d1 LibWeb: Implement reporting of trusted-types-policy violations 2025-08-11 12:21:31 +01:00
Tete17
bc9e67a0dc LibWeb: Implement methods dependant on TrustedScriptURL 2025-08-11 12:21:31 +01:00
Tete17
adaad653ca LibWeb: Implement TrustedScriptURL class 2025-08-11 12:21:31 +01:00
Tete17
40691bf25d LibWeb: Implement methods dependant on TrustedScript 2025-08-11 12:21:31 +01:00
Tete17
56cab6955a LibWeb: Implement TrustedScript type
This turns out to be very similar to TrustedHTML.
2025-08-11 12:21:31 +01:00
Tete17
c84c97b339 LibWeb: Implement createHTML for TrustedTypePolicy
This is the main mechanism by which users of the api can create
safe object with a callback for any needed sanitation of the values.
2025-08-11 12:21:31 +01:00
Tete17
966e00fd69 LibWeb: Finish algorithm to block trusted type policy creation with CSP
This is the mechanism that should pages to determine what kind of
policies can be created on their domains mostly based around the HTTP
headers the server responds with.
2025-08-11 12:21:31 +01:00
Tete17
6398e771a3 LibWeb: Implement create_policy function for TrustedTypePolicyFactory
It simply consists of a wrapper around the main algorithm
2025-08-11 12:21:31 +01:00
Tete17
90bcc16a7b LibWeb: Add TrustedTypePolicy class
It is mostly a skeleton with no actual implementation.
2025-08-11 12:21:31 +01:00
Tete17
a73c082f36 LibWeb: Implement is_html method for TrustedTypePolicyFactory
This is used to check the legitimacy of a TrustedHTML object.
2025-08-11 12:21:31 +01:00
Tete17
0a147aa9a1 LibWeb: Implement TrustedHTML class
The TrustedHTML interface represents a string that a developer can
confidently insert into an injection sink that will render it as HTML.

These objects are immutable wrappers around a string, constructed via a
TrustedTypePolicy’s createHTML method.
2025-08-11 12:21:31 +01:00
Tete17
68c55b0ef1 LibWeb: Implement getPropertyType for TrustedTypePolicyFactory
This allows authors to check if a Trusted Type is required for the given
Elements property.

This adds 28 more passing WPT tests :)
2025-08-11 12:21:31 +01:00
Sam Atkins
4bcfc4bacc LibWeb/HTML: Add cross-site ancestor flag to environment
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Corresponds to baec061a70
2025-08-11 11:08:04 +01:00
Sam Atkins
cfdc4bad7c LibWeb: Update more navigation code to spec
Partly corresponds to 80ebad5fbf

This is mostly to handle null source_documents, which is something that
needs more work elsewhere. The spec change above is about the deferred
fetch quota.
2025-08-11 11:08:04 +01:00
Sam Atkins
0e5fd11bdc LibWeb/HTML: Create navigation params for browser-UI navigations
Step 4 corresponds to 3b6a99b1d9

The rest is from some earlier spec change.
2025-08-11 11:08:04 +01:00
Sam Atkins
cf969abba7 LibWeb/HTML: Add missing "else" to create_navigation_params_by_fetching 2025-08-11 11:08:04 +01:00
Sam Atkins
0b998b8379 LibWeb: Update base URL change processing
Corresponds to 49f5cd381e
2025-08-11 11:08:04 +01:00
Sam Atkins
7c8c05ee82 LibWeb/Layout: Support visibility:collapse on table-row elements
When a table row (or its group) is set to collapse, the row takes up no
vertical space in the layout.

We have to account for this in multiple places, so I've cached whether a
row is collapsed in the TableGrid::Row.
2025-08-11 11:07:47 +01:00
Sam Atkins
3b97bdc7bf Tests: Import WPT tests for table rows with visibility:collapse
These mostly fail for now.
2025-08-11 11:07:47 +01:00
Sam Atkins
5f986b2c33 LibWeb/Painting: Paint ridge and groove border styles 2025-08-11 11:07:15 +01:00
Sam Atkins
5d4a4e44fe LibWeb/Painting: Paint border-style: double using two solid borders
Call paint_border() recursively, once for the outer line, and once for
the inner one. This is done in a lambda so that we can reuse it for a
couple of other line styles.

Border-radius behaviour doesn't match other browsers, and goes a bit
haywire in some cases. I've left some FIXMEs for someone who
understands the maths here better than I do. 😅

The LineStyle handling is moved to the start of the function, to avoid
unnecessary work.
2025-08-11 11:07:15 +01:00
Sam Atkins
c660df70b4 LibWeb/Painting: Note that inset and outset borders are implemented 2025-08-11 11:07:15 +01:00
Sam Atkins
7c2b8f6ee7 LibWeb/Painting: Move per-edge getter into BordersDataDevicePixels
Reduces some duplication.
2025-08-11 11:07:15 +01:00
Timothy Flynn
e2b245add1 LibJS: Handle out-of-range prefixed numbers in Token::double_value
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This regressed in cd15b1a2c9.

If a prefixed number is out-of-range of a u64, stroul would previously
fall back to ULONG_MAX. This patch restores that behavior.
2025-08-10 13:35:37 +02:00
Aliaksandr Kalenik
652a457f52 LibWeb: Fix grid layout for replaced items with percentage max-width
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
CSS grid specification states that for grid items with a replaced
element and a percentage preferred size or maximum size, the percentage
should be resolved against 0 during content-based minimum size
calculation. This makes sense, as it prevents replaced items from
overshooting their grid track while intrinsic track sizes are
calculated, and allows later track size resolution steps to scale
replaced items to fit their grid track.
2025-08-10 11:07:02 +02:00
Timothy Flynn
57b5df21c7 LibWeb: Select the entire input when double clicking password fields
This matches the behavior of other browsers, and hides any indication
of word boundaries in the password.
2025-08-10 11:05:49 +02:00
Timothy Flynn
ded337cfec LibWebView: Gracefully handle RequestServer death
This works exactly the same as ImageDecoder death handling.
2025-08-10 11:02:50 +02:00
Timothy Flynn
b1b218596f LibWeb+WebContent: Add IPC to re-establish RequestServer connections 2025-08-10 11:02:50 +02:00
Timothy Flynn
6f4be4791a LibRequests: Add hooks to handle RequestServer death 2025-08-10 11:02:50 +02:00