Commit graph

69763 commits

Author SHA1 Message Date
Andrew Kaster
ab661467e7 Meta: Support Swift_Release preset in ladybird.py 2025-06-11 11:54:52 -06:00
Andrew Kaster
a0173b342f CMake: Add preset with swift interop enabled 2025-06-11 11:54:52 -06:00
Andrew Kaster
0b7a6ef4c9 Meta: Record desired swift toolchain version in .swift-version
This makes it easier to ensure everyone is using the same version of
Swift when building the project, especially for CI environments.

`swiftly install` will automatically read this file and install the
specified version if it is not already installed. It also tells swiftly
what version to use for the project, independent of the global default
version.
2025-06-11 11:54:52 -06:00
Andrew Kaster
3b9756d9b1 Meta: Add optional cwd argument to run_command helper
This just passes it through to subprocess.Popen, so it can be used to
run commands in a specific directory if needed.
2025-06-11 11:54:52 -06:00
Andrew Kaster
a267743095 LibGfx: Avoid importing FilterImpl into swift
This header uses skia directly, and is not needed in swift.
2025-06-11 11:54:52 -06:00
Ali Mohammad Pur
4b5664f867 LibWebView+RequestSever: Wire up a validate-DNSSEC setting option to RS 2025-06-11 18:16:29 +02:00
Ali Mohammad Pur
b24fb0a836 LibDNS: Add support for local DNSSEC validation 2025-06-11 18:16:29 +02:00
Ali Mohammad Pur
59b6293182 LibCore: Add a Promise::after(promises) API
This is equivalent to Promise.all() in js, more or less.
2025-06-11 18:16:29 +02:00
Ali Mohammad Pur
6c312188dc AK: Let CountingStream take an initial value for the counter 2025-06-11 18:16:29 +02:00
Ali Mohammad Pur
3dd246a8e1 LibCrypto: Add support for raw EC keys and SECPxxxr1 signatures 2025-06-11 18:16:29 +02:00
Ali Mohammad Pur
b374322e38 LibTLS: Make TLSv12::can_read_without_blocking() respect the timeout arg
Previously this function's return value was not reliable, as available
data on the underlying socket did not necessarily translate to available
application data on the TLS socket.
2025-06-11 18:16:29 +02:00
Sam Atkins
00f76ccbf4 LibWeb/CSS: Add alternative src() syntax for URLs
url() has some limitations because of allowing unquoted URLs as its
contents. For example, it can't use `var()`. To get around this, there's
an alternative `src()` function which behaves the same as `url()` except
that it is parsed as a regular function, which makes `var()` and friends
work properly.

There's no WPT test for this as far as I can tell, so I added our own.
2025-06-11 16:26:23 +02:00
Andreas Kling
ea0bfda1b9 LibWeb: Cache the font in StyleComputer::initial_font()
This function is bogus, but it's still getting called a lot during media
query evaluation, so let's at least cache the font instead of recreating
it every single time.
2025-06-11 16:25:42 +02:00
Andreas Kling
07ff75bbec LibWeb: Don't traverse entire layout tree in every HTML::EventLoop tick
Instead, collect a list of all the elements with content-visibility:auto
after layout.

This way we can skip the tree traversal when updating the rendering.

This was previously eating up ~300 µs of the 60fps frame budget on
our GitHub repo pages (and even more on large pages).
2025-06-11 16:25:42 +02:00
Timothy Flynn
df0dc32006 LibWebView: Defer creating services until after application init
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (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
In particular, we need to defer creating the process manager until after
we have decided whether or not to create a UI-specific event loop. If we
create the process manager sooner, its event loop signal registration
does not work, and we don't handle child processes exiting.
2025-06-11 08:26:29 -04:00
Timothy Flynn
39da2d9a2f LibWebView+UI: Migrate some UI process init to LibWebView
No need to do this setup in every UI's main().
2025-06-11 07:26:32 -04:00
Timothy Flynn
6430b215af LibWebView: Make WEB_VIEW_APPLICATION switch back to a private section
Let's not leave everything after the WEB_VIEW_APPLICATION invocation
public.
2025-06-11 07:26:32 -04:00
Timothy Flynn
b425ce93b1 LibWebView+UI: Don't declare a magic ctor for Application subclasses
You would have to just know that you need to define the constructor with
this declaration. Let's allow subclasses to define constructors as they
see fit.
2025-06-11 07:26:32 -04:00
Timothy Flynn
3a4f2faf2e Meta: Use Optional[str] instead of str | None for python 3.9 compat
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (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
2025-06-10 18:59:01 -04:00
Timothy Flynn
fa164083fd LibWebView+UI: Do not create a QApplication in headless mode
This is causing errors on the WPT runner, which does not have a display
output. To do this requires shuffling around the Main::Arguments struct,
as we now need access to it from overridden WebView::Application methods
after construction.
2025-06-10 23:10:48 +01:00
Timothy Flynn
f66cac3417 LibWebView+UI: Define concrete Application::the accessor automatically
This avoids assuming that the Qt Application is a QApplication, which
will not be the case in an upcoming commit.
2025-06-10 23:10:48 +01:00
ayeteadoe
f2a10bda32 CMake: Simplify preset structure for Windows
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (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
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
As we now are only officially supporting the Ninja generator for
Windows, the old preset structure can now be simplified. Also, we
now follow the naming conventions of the non-hidden presets.
2025-06-10 11:29:29 -06:00
Timothy Flynn
9a5b31ccd1 LibWebView+Tests+UI: Migrate headless-browser to test-web
Now that headless mode is built into the main Ladybird executable, the
headless-browser's only purpose is to run tests. So let's move it to the
testing directory and rename it to test-web (a la test-js / test-wasm).
2025-06-10 12:04:59 -04:00
Timothy Flynn
c011dc766f LibWebView+WebDriver+UI: Migrate headless browsing to main Ladybird exe
We currently create a separate headless-browser application to serve two
purposes:

1. Allow headless browsing to take a screenshot of a page or print its
   layout tree / internal text.
2. Run the LibWeb test framework.

This patch migrates (1) to the main Ladybird executable. The --headless
flag enables this mode. This matches the behavior of other browsers, and
means we have one less executable to ship at distribution time.

We want to avoid creating too many AppKit / Qt facilities in headless
mode. So this involves some shuffling of application init to ensure we
don't create them until after we've parsed the command line arguments.
Namely, we avoid creating the NSApp in AppKit and QCoreApplication in
Qt. Doing so also requires that we don't create the application event
loop until we've parsed the command line as well, because the loop we
create depends on whether we're creating those UI facilities.
2025-06-10 12:04:59 -04:00
Timothy Flynn
3894d8efec headless-browser: Don't go through Application to create web views
We currently create web views through the headless Application, so that
the Application can store the views for easy iteration/management. We
would like to move HeadlessWebView into LibWebView to make headlessness
a feature of the primary Ladybird binaries. In order to do so, we need
to remove this indirection, as we won't have this test-only Application
class in Ladybird.
2025-06-10 12:04:59 -04:00
Timothy Flynn
0416961133 LibWebView: Forward declare WebView option structures 2025-06-10 12:04:59 -04:00
Timothy Flynn
fc4a7477a8 UI: Remove outdated references to LADYBIRD_SOURCES
This list is no longer set.
2025-06-10 12:04:59 -04:00
Sam Atkins
3d630e676e LibWeb/WebIDL: Bring IDL::construct() up to date with the spec
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (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
As with a few other functions in this file, this is a combination of the
current spec, and a PR that integrates shadow realms.
2025-06-10 11:57:00 +02:00
Timothy Flynn
1b7b531d61 Meta: Use "extend-select" to enable non-default python linters
Some checks failed
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (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
Build Dev Container Image / build (push) Has been cancelled
This way we don't have to track the defaults.
2025-06-09 17:49:35 -04:00
Timothy Flynn
ba58c7ecf9 Meta: Remove black configuration
I left this here originally thinking that black and ruff are compatible,
so either could be used as a local formatter. But it turns that while
code formatted with ruff will be unchanged by black, the reverse is not
always true. So let's just enforce using ruff.
2025-06-09 17:49:35 -04:00
Luke Wilde
3139f6a25a LibWeb/WebGL: Use eglWaitUntilWorkScheduledANGLE instead of glFlush
With the Metal backend, glFlush flushes the command buffer, but doesn't
wait for the commands to be scheduled on the GPU.

eglWaitUntilWorkScheduledANGLE does wait, hence the name.

This fixes flickering on Rive animations rendered with WebGL.
2025-06-09 15:40:41 -06:00
Luke Wilde
426cd455bc LibWeb/WebGL: Enable robust resource initialization
By default, allocated resources are uninitialized. This setting
enables their initialization.
2025-06-09 15:40:41 -06:00
Luke Wilde
2a11670ef0 LibWeb/WebGL: Specifically request ANGLE Metal backend on macOS 2025-06-09 15:40:41 -06:00
Luke Wilde
0c2dd57d62 LibWeb/WebGL: Use WebGL version to determine ES version and extensions 2025-06-09 15:40:41 -06:00
Andrew Kaster
e3b23e6f73 Meta: Enable metal feature for angle 2025-06-09 15:40:41 -06:00
Andrew Kaster
d5a84b402b LibWeb: Support GL_TEXTURE_2D for the ANGLE target
This will be the returned egl configuration attribute for
EGL_BIND_TO_TEXTURE_TARGET_ANGLE once we transition to using the
Metal ANGLE backend directly.
2025-06-09 15:40:41 -06:00
Andrew Kaster
41dbdbc816 CMake: Add metal feature to angle port 2025-06-09 15:40:41 -06:00
Luke Wilde
d9563cf9d8 vcpkg: Update ANGLE to chromium/7085 2025-06-09 15:40:41 -06:00
Andrew Kaster
13214d1b29 CMake: Add angle overlay port 2025-06-09 15:40:41 -06:00
Timothy Flynn
c204149bbd Meta+CI: Enforce python linting with ruff
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (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
We could use flake8 for linting, but ruff is compatible with black
formatting out-of-the-box. It also seems to catch more than flake8,
such as unnecessary f-strings.
2025-06-09 11:25:14 -04:00
Timothy Flynn
18718e0876 Meta: Sort all python imports 2025-06-09 11:25:14 -04:00
Timothy Flynn
c53ee261dd Meta: Do not use mutable default arguments in ladybird.py
Caught by ruff.
2025-06-09 11:25:14 -04:00
Timothy Flynn
8bfbb944d1 Meta: Remove unnecessary enumerate invocation
Caught by ruff.
2025-06-09 11:25:14 -04:00
Timothy Flynn
58cfa2e40e LibWeb: Remove unnecessary f-string
Caught via ruff.
2025-06-09 11:25:14 -04:00
Timothy Flynn
34e178d0e7 LibGfx: Convert single quote string to double quotes
Caught via ruff. Not sure why black didn't catch this one previously.
2025-06-09 11:25:14 -04:00
Timothy Flynn
7d4b010f30 Meta: Remove unused import from ladybird.py
Caught via ruff.
2025-06-09 11:25:14 -04:00
AmusedNetwork
7c85e57c32 LibWeb: Unit test for Anchor element covered by pseudo-element 2025-06-09 16:20:43 +01:00
AmusedNetwork
836955ef57 LibWeb: Fix incorrect event handling with pseudo-elements
When a ::before or ::after pseudo-element covered an anchor element
events were not successfully sent to the underlying anchor.

This fix allows before and after pseudo-elements
to be dispatched correctly.

Fixes #5020
2025-06-09 16:20:43 +01:00
Ben Eidson
bd68a99f14 LibWeb/MimeSniff: Add MP3 without ID3 sniffing
Removes the associated FIXME in match_an_audio_or_video_type_pattern().
Sniffing process is a simplified version of the full spec, as it only
checks one frame of the mp3. To fully align with the spec, it would
also have to check a second frame by calculating frame size as
described in the spec.
2025-06-09 07:50:26 -06:00
Callum Law
a9eecf76df LibWeb: Dont compute style when CSSStyleProperties lacks owner node
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (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
Some instances of CSSStyleProperties can lack an owner node, for
instance the return value of a call to `window.getComputedStyle` where
the specified pseudo-element is invalid. In this case we should treat
the computed style as empty, as there is no node to compute the style
for.
2025-06-09 12:28:41 +01:00