Commit graph

868 commits

Author SHA1 Message Date
Shannon Booth
7b0dd6ab30 LibTextCodec: Use encoding_rs for legacy codecs
Replace the generated C++ legacy codec implementations with a
small Rust wrapper around encoding_rs.

This keeps the existing LibTextCodec API while moving label lookup,
legacy decode/encode, validation, and streaming decoder state to Rust.
The generated index data and generator are no longer needed.

It also fixes several TextDecoder EOF cases due to a more correct
implementation. encoding_rs finalizes decoders according to the
Encoding Standard, so incomplete UTF-8/Big5 tails and malformed
UTF-16 surrogate tails produce the required single replacement at
end-of-queue instead of being dropped, buffered, or double-counted
by our old hand-written decoders.
2026-06-20 21:56:43 +02:00
sideshowbarker
c96dec10e3 Meta: Update ICU to 78.3 by bumping the vcpkg baseline
Bump the pinned ICU version from 78.2 to 78.3 — the current release — so
the build works on systems that already ship 78.3. And bump our vcpkg
baseline — because 78.3 is newer than our existing baseline. And pin
freetype to 2.13.3 — because the baseline update otherwise pulls in
2.14.3, which has font-rendering changes that break our layout tests.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/10145
2026-06-19 08:59:16 +02:00
Aliaksandr Kalenik
9a8a7798ec Meta+LibWeb: Generate WebGL command proxy scaffolding
Moving WebGL execution into the Compositor needs a serializable command
stream and a client-side proxy that can queue commands before sending
them over IPC. The existing generator metadata only described direct GL
wrappers, so generated code could not distinguish async commands from
sync calls or object factory methods.

This teaches the WebGL metadata and generators about command streams and
adds the unused LibWeb proxy/list types. No rendering behavior changes
yet; the later host wiring can build on these generated interfaces
without mixing the metadata churn into that commit.
2026-06-17 19:07:32 +02:00
Aliaksandr Kalenik
d858c7219b Meta: Use Direct3D instead of Vulkan on Windows
Windows has a platform-native GPU stack based around Direct3D and DXGI.
The browser's Windows integration will need to share GPU resources with
Skia, ANGLE, and the UI process through that stack, especially when
backing stores move from bitmap readback to shared handles. Keeping
Vulkan as the Windows backend would put painting on a parallel API that
does not match the resources the rest of the native Windows pipeline
needs to exchange.
2026-06-15 04:50:29 +02:00
Andreas Kling
97a6807ffa LibJS: Remove JS_BYTECODE_DEBUG
Remove the stale bytecode execution debug hook from Interpreter.cpp now
that bytecode dispatch always enters AsmInt directly. The remaining
bytecode dump flag is separate and still used by parser/codegen paths.
2026-06-14 20:27:59 +02:00
Andreas Kling
78bb7b8d45 LibWebView: Add a UI session history model
Add a browser-side model for top-level history entries and history step
coordinates. This gives the UI process a structure to mirror WebContent
history across process swaps.

Add debug dumping support alongside the model so traversal state can be
inspected while working on back and forward behavior.
2026-06-14 17:38:44 +02:00
Timothy Flynn
7f3cb3efb6 Meta: Move Meta/Lagom/get_linked_lagom_libraries.cmake to Meta/CMake 2026-06-13 10:30:02 -04:00
Aliaksandr Kalenik
5b856595b3 Meta+LibWeb/WebGL: Route all GL calls through generated GLFunctions
LibWeb's WebGL implementation currently reaches ANGLE by calling glFoo()
throughout the WebGL context and extension code. That ties the WebGL
spec layer to the concrete GL executor. A future backend that records
operations, sends them to another process, or executes them from the
Compositor would otherwise need to duplicate the WebGL logic or edit
every call site again.

Introduce GLFunctions as an explicit boundary between WebGL semantics
and GL execution. GLFunctions.json lists the GL entry points used by the
implementation, and the generator emits one forwarding method per entry
point. OpenGLContext implements those methods today, so the current
in-process ANGLE path keeps the same behavior while all callers go
through a single replaceable interface.

That boundary is needed before canvas/WebGL rendering can move to the
Compositor: the WebGL context code can keep doing validation, state
tracking, and spec-visible error handling in LibWeb, while a later
implementation can record the same GL calls and replay them where the
canvas surface is produced. The JSON source also gives the recorder and
replayer one shared description of argument shapes, avoiding two
hand-written views of the GL API drifting apart.
2026-06-13 01:58:43 +02:00
Andreas Kling
0607a181a8 UI/Qt: Present Linux DMABUF frames with QVulkanWindow
Use a native QVulkanWindow child for Linux DMABUF presentation instead
of making WebContentView itself a QRhiWidget. This keeps BrowserWindow
on Qt's normal QWidget backing store path while sampling compositor
DMABUF backing stores directly in Vulkan.

Keep WebContentView's paintEvent as fallback for builds without Vulkan
DMABUF support and for cases where the Vulkan instance or window cannot
be created. Set an explicit Vulkan API version before creating the
shared QVulkanInstance so validation layers do not reject Qt defaults.
2026-06-12 21:45:22 +02:00
Tim Ledbetter
3424c08b27 LibImageDecoders: Decode GIFs using wuffs
Replace the homegrown GIF parser and LZW decompressor with the wuffs
GIF decoder, which is memory-safe by construction and already used in
other engines via Skia.

One behavior change is that `loop_count()` now reports the correct
value, since the raw value stored in the file does not include the
first frane and should be incremented by 1 to be compatible with what
callers expect.
2026-06-10 20:29:11 +02:00
Tim Ledbetter
0fc92a5929 Meta: Add vcpkg overlay port for wuffs 0.3.4
This will be used for GIF decoding.
2026-06-10 20:29:11 +02:00
Shannon Booth
5ef34ecb7a LibURL: Use libpsl for public suffix matching
Replace the generated public suffix table and custom matcher with a
direct LibURL PublicSuffixData implementation backed by libpsl. This
drops our PSL download/generator path and uses the same library already
used by libcurl.

Performance is comparable before and after, while LibURL binary size
is smaller.
2026-06-10 11:43:44 +02:00
Andreas Kling
ec3ea7ed25 Meta: Enable glibc fortify checks on Linux
Define _FORTIFY_SOURCE=3 for Linux builds so glibc can use dynamic
object size checks around fortified libc calls.
2026-06-10 01:33:39 +02:00
Andreas Kling
65eddc925c Meta: Enable stack clash protection on Linux
Pass -fstack-clash-protection for Linux builds. This asks the
compiler to probe large stack allocations incrementally so they cannot
skip over stack guard pages.
2026-06-10 01:33:39 +02:00
Andreas Kling
30ec75ee74 Meta: Enable full RELRO on Linux
Pass -z relro and -z now to ELF linkers on Linux when the
linker supports them. This makes relocation sections read-only after
startup and disables lazy binding so the GOT is protected as well.
2026-06-10 01:33:39 +02:00
Andrew Kaster
076f636667 Meta: Enable Gtk UI on macOS 2026-06-09 17:10:31 +02:00
Shannon Booth
2dc3e3da55 Meta: Remove obsolete Lagom host-tools build 2026-06-08 01:11:40 +02:00
Shannon Booth
efe144552c Meta: Remove obsolete LibWeb BindingsGenerator
Remove the old C++ LibWeb bindings generator now that the build uses
the Python generator.
2026-06-08 01:11:40 +02:00
Shannon Booth
dba62aefc0 LibWeb/Bindings: Port IDL bindings generator to Python
Replace the Lagom C++ bindings generator invocation with the new Python
generator under Meta/Generators/libweb_bindings.

Fold the exposed-interface generation into the same generator entry
point, and keep generated overload metadata using the existing LibIDL
types for now.
2026-06-08 01:11:40 +02:00
sideshowbarker
e97de4fc84 Meta: Retry required-file downloads and cache the WASM spec tests
Problem: CI intermittently fails when a required-file download hiccups;
e.g., the WASM spec test suite fetch failed on both its primary URL and
the Web Archive fallback on the same run — breaking configure under CI.

Cause: download_file_multisource was trying each source only once — so a
single transient HTTP error could break the whole build. The WASM spec
test tarball was also being fetched fresh every run — rather than from
the shared download cache — so each build was exposed to that flakiness.

Fix: Retry each fetch a few times across all sources — for every config-
time download: the WASM spec tests, HSTS preload list, and public-suffix
list. Cache the WASM spec test tarball across CI runs — keyed by commit,
so it’s (re)fetched only once per commit bump.
2026-06-07 11:33:29 +02:00
Andreas Kling
dfb2656d9c Utilities: Replace LibLine with libedit
Use libedit's readline-compatible interface for the JavaScript REPL so
line editing, history, and tab completion no longer depend on LibLine.
The REPL keeps its existing multiline input and completion behavior,
but no longer provides LibLine's live syntax highlighting.

Remove the unused LibLine dependency from the wasm utility and delete
the LibLine library from the build now that it has no remaining
consumers.
2026-06-05 00:09:37 +02:00
Andreas Kling
164ed80244 Meta: Enable exit-time destructor warnings for libraries
Enable -Wexit-time-destructors for all in-tree library targets and
update process-lifetime library statics so they no longer register
exit-time destructors. Long-lived caches, lookup tables, singleton
registries, and generated constants now use NeverDestroyed or leaked
references where the data is intended to live until process exit.

Update LibWeb, LibLine, and the binding generators so regenerated
sources follow the same rule instead of reintroducing destructed
statics.
2026-06-04 19:20:49 +02:00
sideshowbarker
ad6f646d6d Meta: Rebuild Rust crates when the toolchain changes, not just sources
Problem: After a git pull of master, builds fail with an error message
about multiple/duplicate rust_eh_personality definitions/symbols.

Cause: LibWeb links two Rust staticlibs: libweb_content_blocker_rust and
libweb_rust. Both bundle Rust’s standard library (std). When we re-pin
rust-toolchain.toml, a git pull moves a rustup user’s compiler — but we
were only rebuilding the crate whose .rs also changed. So that left one
crate on the old std, and the other crate on the new std.

Fix: Make the cargo custom commands also depend on rust-toolchain.toml
and rustc — so a toolchain change re-triggers every Rust crate.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/9854
Fixes https://github.com/LadybirdBrowser/ladybird/issues/9643
2026-06-04 07:41:45 -04:00
Luke Wilde
d4d9fc12f7 Meta: Generate HSTS preload data from Chromium's static list
Download transport_security_state_static.json on configure and
emit a sorted flat array of (name, include_subdomains) pairs.
The generator keeps only force-https entries, drops IP literals,
and validates names against [a-z0-9.-] so the emitted C++ string
literals need no escaping.

Matches Firefox's HSTS preload source:
https://searchfox.org/firefox-main/rev/ca47ec6bb1f3e46a384cd1ebb11c5996cceef90f/taskcluster/docker/periodic-updates/scripts/getHSTSPreloadList.js
2026-05-29 22:23:33 +02:00
Sam Atkins
d3ad37e635 Meta: Define helper processes for Ladybird and test-web in one place
These both require the same helper processes, and maintaining the same
list in multiple places is error-prone. For example, I spent too long
debugging why test-web was crashing, when the issue was that Compositor
hadn't been rebuilt as test-web didn't depend on it. That problem can
no longer happen if we define the same dependency list for both.
2026-05-28 14:45:48 +01:00
Shannon Booth
6248296f86 LibWeb/Bindings: Normalize bindings generator include paths
Pass source/build Libraries roots via --header-include-path and
canonicalize them in BindingsGenerator so generated dependency includes
use LibWeb/... paths instead of local absolute paths.

For example:

`#include "/home/shannon/ladybird/Libraries/LibWeb/DOMURL/DOMURL.h"`

becomes:

`#include "LibWeb/DOMURL/DOMURL.h"`
2026-05-24 16:37:28 +02:00
Andreas Kling
bcdbdbb5b3 LibWeb: Add adblock-rust FFI hooks
Add adblock-rust to a dedicated LibWeb content blocker Rust crate
and expose FFI entry points for creating an engine, matching network
requests, and producing cosmetic CSS. Export a string result type for
returning generated CSS to C++ callers.

Regenerate the Flatpak cargo source list for the new Rust
dependencies.
2026-05-24 08:16:46 +02:00
Martin Chrástek
cd3c72dfda LibWeb: Implement chardetng-based encoding detection for HTML parsing 2026-05-23 11:57:33 +02:00
Shannon Booth
e75f5255f2 Meta: Generate LibWeb Bindings/Forward.h from Python
Port Bindings/Forward.h generation into
generate_window_or_worker_interfaces.py and remove the old C++
generate_forward_header path from BindingsGenerator.
2026-05-15 17:52:52 +01:00
Zaggy1024
27e555c20e Meta: Give generate-cargo-sources.py's sources explicit typing 2026-05-13 08:13:51 -05:00
Callum Law
a9d2b1dde6 Meta: Read dimensions from Units.json in CSS grammar parser
Avoids us having to maintain a separate hardcoded list.

This does mean we don't support parsing of `decibel` but it's not used
anywhere yet and will be supported automatically when added to
Units.json
2026-05-13 11:00:07 +01:00
Andreas Kling
584b2748ee LibWeb: Move RenderingThread into Compositor
Create Libraries/LibWeb/Compositor and make the existing rendering
thread the first owner in that subsystem. Rename RenderingThread to
CompositorThread so later commits can grow it into the presentation
owner without leaving that vocabulary in HTML.

Keep display-list rasterization and delivery behavior unchanged in this
commit. Add COMPOSITOR_DEBUG to AK/Debug.h.in in the same step so
compositor diagnostics live beside the rest of the project-wide debug
toggles from the start of the stack.
2026-05-12 20:57:08 +02:00
Timothy Flynn
fc401bd830 Meta: Treat Rust warnings as errors
We do the same in C++ files.
2026-05-10 20:50:20 +02:00
Timothy Flynn
0914e00c78 Meta: Extract common Rust compilation functionality to a helper
Lots of shared setup code between these functions. This will let us add
compilation flags in a single location in an upcoming commit.
2026-05-10 20:50:20 +02:00
Shannon Booth
4b9f6450bd LibWeb: Treat support IDLs like normal bindings inputs
Allow the WebIDL parser to accept files without a top-level interface,
and have the exposed-interface generator skip those modules.

With that in place, register support IDLs through
libweb_js_bindings() as well, including generated CSS IDLs from the
build directory, and remove the separate support-idl plumbing.

This is enabled now that the IDL generator rules have been simplified
so that every IDL file produces a corresponding header and cpp file.
2026-05-10 20:11:46 +02:00
Ali Mohammad Pur
a33e148339 LibWasm+Meta: Add Cranelift AOT compilation backend
Add an optional Cranelift-based AOT compiler for WebAssembly functions,
enabled via -DENABLE_CRANELIFT_JIT=ON.
2026-05-10 16:41:42 +02:00
Andreas Kling
fb4095ae50 LibGC: Implement incremental sweeping for reduced GC pause times
Instead of sweeping all heap blocks in one go after marking, sweep
incrementally, one block at a time, interleaved with program execution.
This significantly reduces worst-case GC pause times by spreading
sweep work across multiple smaller time slices.

Sweep is driven by two complementary mechanisms:

1. Timer-based sweeping: A 16ms repeating timer drives background
   sweep work, processing blocks for up to 5ms per timer fire.

2. Allocation-directed sweeping: Each allocator sweeps its own
   pending blocks before creating new ones, ensuring forward
   progress even without timer events.

Each allocator maintains its own list of blocks pending sweep,
and allocators with pending work are tracked in a separate list
for efficient timer-driven sweeping.

Key implementation details:

- Newly allocated cells during sweep are marked immediately to
  prevent premature collection.

- Mark bits are cleared incrementally as each block is swept,
  rather than in a separate pass over the entire heap.

- Finalization and weak reference processing remain stop-the-world
  since they must complete atomically before any sweeping occurs.
2026-05-10 10:58:11 +02:00
Shannon Booth
5adfd1c43a LibWeb/Bindings: Generate struct definitions from IDL dictionaries
Previously we were inconsistent by generating code for enum definitions
but not generating code for dictionaries. With future changes to the
IDL generator to expose helpers to convert to and from IDL values
this produced circular depdendencies. To solve this problem, also
generate the dictionary definitions in bindings headers.
2026-05-09 10:49:49 +02:00
Shannon Booth
dc238476e6 Meta: Generate bindings files for all LibWeb IDLs
Teach LibWeb codegen to emit a generated bindings header and
implementation for every IDL in the CMake inputs, including support only
IDLs.

For IDLs that do not yet produce bindings content, keep generation going
through IDLGenerators and emit empty placeholder files. This prepares
per-IDL generated definitions without changing the overall generation
flow.
2026-05-09 10:49:49 +02:00
Martin Chrástek
2eb8306cb0 LibUnicode: Update icu4x's calendar module to 2.2.1 2026-05-06 09:02:21 -04:00
Undefine
542f3e5cca AK+Meta: Make AK / ObjC interop MacOS only
This is entirely unused but still could be useful in the AppKit port.
Originally this was meant for Swift interop which is why it had support
for other platforms, but now it's causing issues on systems like
FreeBSD, so lets just gate it behind the only platform it's useful for.
We also assume that Objective C blocks and Arc are supported for the
AppKit port to build so no need to check for that in CMake.
2026-05-05 22:08:24 +02:00
Undefine
b9fec5edbf Meta: Rename and merge some lagom_* and ladybird_*
We had both {lagom,ladybird}_test and {lagom,ladybird}_lib, now both
are just one helper. Also rename all other lagom_* helpers to be
ladybird_*.
2026-05-05 22:08:24 +02:00
Undefine
77966f66cb Meta: Remove add_ladybird_subdirectory
It went unused.
2026-05-05 22:08:24 +02:00
Undefine
1d83e8c896 Meta: Move all remaining dependency checks to check_for_dependencies
This also allows us to get rid of a couple of files that were meant
for dependency specific checks.
2026-05-05 22:08:24 +02:00
Jelle Raaijmakers
69f5876abb Meta: Do not require branch/commit consistency in Flatpak
Our Flatpak builds currently start failing once a commit ID no longer
matches with the commit pointed to by the configured `branch`. This is
becoming pretty annoying for Skia, since the `chrome/mXYZ` branches are
effectively moving targets.

Change the `branch` key in the Flatpak config to `x-branch`, which
removes the constraint and allows Flatpak to work with just the pinned
commit IDs. Change the linter to still use `x-branch` as the reference
to compare with our vcpkg configuration, so we make sure to still keep
things consistent between vcpkg and Flatpak.
2026-05-05 12:03:42 +02:00
Jelle Raaijmakers
3564dc1c81 Meta: Update flatpak commit for Skia
The M144 tag was updated:

https://skia.googlesource.com/skia/+/cd0c5f445516ea4e90e02b5f634cbc5ca23b5a44
2026-05-05 12:03:42 +02:00
Jelle Raaijmakers
3658fbe814 AK+Meta: Remove unused debug macros 2026-04-30 21:15:24 +02:00
Jelle Raaijmakers
23a3ce1f2f LibCore+LibIPC: Remove SharedSingleProducerCircularQueue
This went unused.
2026-04-30 21:15:24 +02:00
Jelle Raaijmakers
f32bcbc5c9 LibGfx: Remove BooleanDecoder
This went unused.
2026-04-30 21:15:24 +02:00
Johan Dahlin
1454e90c93 Meta: Add vcpkg overlay port for pdf.js 5.6.205 2026-04-30 07:46:12 +02:00