From 93b67834a798f2201800428b4452ed95846a342a Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Fri, 9 Oct 2026 00:13:08 +0000 Subject: [PATCH 1/7] build: select compiling Servo and Stylo fork revisions Both Servo hosts tracked the marcoallegretti/servo `servo-weft` branch, which the lockfile resolved to 8e7dc40. That revision's servo-layout does not compile (E0308 and E0716 in build_backdrop_filter). WEFT also resolved upstream Stylo dca3934, where backdrop-filter is gated behind layout.unimplemented, because the Servo fork's own [patch] for Stylo does not apply to dependents. Pin Servo by revision to f0bb1aa (8e7dc40 plus the build fix) and add a root [patch."https://github.com/servo/stylo"] selecting the marcoallegretti/stylo fork at f1ba496 for all eight Stylo crates Servo uses. Cargo.lock changes only the 66 source lines of those packages. Record both pins, their reachable branches, purpose and removal conditions in SERVO_PIN.md, and restate its limitations against executed evidence. Update the Nix outputHashes: the Stylo hash is recomputed for f1ba496 with the method that reproduces the previous dca3934 value; the Servo hash is not yet known for f0bb1aa and is left as lib.fakeHash, so Nix builds report the expected value instead of using a stale one. Validation: - cargo metadata --locked: ok; no servo/stylo sources remain in the lock - cargo check -p weft-servo-shell --features servo-embed --locked: all of Servo, including servo-layout, compiles; the remaining errors are in the shell's own embedder code - cargo fmt --check; portable workspace tests: 78 passed - Nix fetchgit could not run here (archive downloads and the sandbox's TLS to the proxy fail), so the Servo hash remains unverified --- Cargo.lock | 132 ++++++++++++------------- Cargo.toml | 14 +++ README.md | 6 +- crates/weft-app-shell/Cargo.toml | 2 +- crates/weft-servo-shell/Cargo.toml | 2 +- crates/weft-servo-shell/SERVO_PIN.md | 139 +++++++++++++-------------- docs/building.md | 4 +- infra/nixos/weft-packages.nix | 8 +- 8 files changed, 162 insertions(+), 145 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7b87b7e..278fcb4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6476,7 +6476,7 @@ dependencies = [ [[package]] name = "selectors" version = "0.36.0" -source = "git+https://github.com/servo/stylo?rev=dca3934667dae76c49bb579b268c5eb142d09c6a#dca3934667dae76c49bb579b268c5eb142d09c6a" +source = "git+https://github.com/marcoallegretti/stylo?rev=f1ba4969536d63f2e319a561e466c03e78b4a076#f1ba4969536d63f2e319a561e466c03e78b4a076" dependencies = [ "bitflags 2.11.0", "cssparser", @@ -6590,7 +6590,7 @@ dependencies = [ [[package]] name = "servo" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "accesskit", "bitflags 2.11.0", @@ -6651,7 +6651,7 @@ dependencies = [ [[package]] name = "servo-allocator" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "libc", "tikv-jemalloc-sys", @@ -6662,7 +6662,7 @@ dependencies = [ [[package]] name = "servo-background-hang-monitor" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "backtrace", "crossbeam-channel", @@ -6677,7 +6677,7 @@ dependencies = [ [[package]] name = "servo-background-hang-monitor-api" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "serde", "servo-base", @@ -6686,7 +6686,7 @@ dependencies = [ [[package]] name = "servo-base" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "accesskit", "crossbeam-channel", @@ -6711,7 +6711,7 @@ dependencies = [ [[package]] name = "servo-canvas" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "bytemuck", "crossbeam-channel", @@ -6736,7 +6736,7 @@ dependencies = [ [[package]] name = "servo-canvas-traits" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "crossbeam-channel", "euclid", @@ -6758,7 +6758,7 @@ dependencies = [ [[package]] name = "servo-config" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "serde", "serde_json", @@ -6770,7 +6770,7 @@ dependencies = [ [[package]] name = "servo-config-macro" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "proc-macro2", "quote", @@ -6781,7 +6781,7 @@ dependencies = [ [[package]] name = "servo-constellation" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "backtrace", "content-security-policy", @@ -6828,7 +6828,7 @@ dependencies = [ [[package]] name = "servo-constellation-traits" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "content-security-policy", "encoding_rs", @@ -6863,7 +6863,7 @@ dependencies = [ [[package]] name = "servo-deny-public-fields" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "syn", "synstructure", @@ -6872,7 +6872,7 @@ dependencies = [ [[package]] name = "servo-devtools" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "atomic_refcell", "base64 0.22.1", @@ -6901,7 +6901,7 @@ dependencies = [ [[package]] name = "servo-devtools-traits" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "bitflags 2.11.0", "http 1.4.0", @@ -6920,7 +6920,7 @@ dependencies = [ [[package]] name = "servo-dom-struct" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "proc-macro2", "quote", @@ -6930,7 +6930,7 @@ dependencies = [ [[package]] name = "servo-embedder-traits" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "accesskit", "bitflags 2.11.0", @@ -6963,7 +6963,7 @@ dependencies = [ [[package]] name = "servo-fonts" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "app_units", "bitflags 2.11.0", @@ -7016,7 +7016,7 @@ dependencies = [ [[package]] name = "servo-fonts-traits" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "atomic_refcell", "dwrote", @@ -7039,7 +7039,7 @@ dependencies = [ [[package]] name = "servo-geometry" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "app_units", "euclid", @@ -7052,7 +7052,7 @@ dependencies = [ [[package]] name = "servo-hyper-serde" version = "0.13.2" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "cookie 0.18.1", "headers 0.4.1", @@ -7066,7 +7066,7 @@ dependencies = [ [[package]] name = "servo-jstraceable-derive" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "proc-macro2", "syn", @@ -7076,7 +7076,7 @@ dependencies = [ [[package]] name = "servo-layout" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "accesskit", "app_units", @@ -7130,7 +7130,7 @@ dependencies = [ [[package]] name = "servo-layout-api" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "app_units", "atomic_refcell", @@ -7164,7 +7164,7 @@ dependencies = [ [[package]] name = "servo-malloc-size-of" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "accountable-refcell", "app_units", @@ -7204,7 +7204,7 @@ dependencies = [ [[package]] name = "servo-media" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "once_cell", "servo-media-audio", @@ -7217,7 +7217,7 @@ dependencies = [ [[package]] name = "servo-media-audio" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "byte-slice-cast", "euclid", @@ -7240,7 +7240,7 @@ dependencies = [ [[package]] name = "servo-media-derive" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "proc-macro2", "quote", @@ -7250,7 +7250,7 @@ dependencies = [ [[package]] name = "servo-media-dummy" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "ipc-channel", "servo-media", @@ -7264,7 +7264,7 @@ dependencies = [ [[package]] name = "servo-media-player" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "ipc-channel", "malloc_size_of_derive", @@ -7278,7 +7278,7 @@ dependencies = [ [[package]] name = "servo-media-streams" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "malloc_size_of_derive", "servo-malloc-size-of", @@ -7288,7 +7288,7 @@ dependencies = [ [[package]] name = "servo-media-thread" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "euclid", "ipc-channel", @@ -7306,7 +7306,7 @@ dependencies = [ [[package]] name = "servo-media-traits" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "malloc_size_of_derive", "servo-malloc-size-of", @@ -7315,7 +7315,7 @@ dependencies = [ [[package]] name = "servo-media-webrtc" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "log", "servo-media-streams", @@ -7325,7 +7325,7 @@ dependencies = [ [[package]] name = "servo-metrics" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "malloc_size_of_derive", "servo-base", @@ -7340,7 +7340,7 @@ dependencies = [ [[package]] name = "servo-net" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "async-compression", "async-recursion", @@ -7409,7 +7409,7 @@ dependencies = [ [[package]] name = "servo-net-traits" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "content-security-policy", "cookie 0.18.1", @@ -7449,7 +7449,7 @@ dependencies = [ [[package]] name = "servo-paint" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "bitflags 2.11.0", "crossbeam-channel", @@ -7486,7 +7486,7 @@ dependencies = [ [[package]] name = "servo-paint-api" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "bitflags 2.11.0", "crossbeam-channel", @@ -7522,7 +7522,7 @@ dependencies = [ [[package]] name = "servo-pixels" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "euclid", "image", @@ -7537,7 +7537,7 @@ dependencies = [ [[package]] name = "servo-profile" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "libc", "log", @@ -7556,7 +7556,7 @@ dependencies = [ [[package]] name = "servo-profile-traits" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "crossbeam-channel", "ipc-channel", @@ -7573,7 +7573,7 @@ dependencies = [ [[package]] name = "servo-script" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "aes", "aes-gcm", @@ -7712,7 +7712,7 @@ dependencies = [ [[package]] name = "servo-script-bindings" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "bitflags 2.11.0", "crossbeam-channel", @@ -7750,7 +7750,7 @@ dependencies = [ [[package]] name = "servo-script-traits" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "accesskit", "content-security-policy", @@ -7787,7 +7787,7 @@ dependencies = [ [[package]] name = "servo-storage" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "libc", "log", @@ -7817,7 +7817,7 @@ dependencies = [ [[package]] name = "servo-storage-traits" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "malloc_size_of_derive", "serde", @@ -7831,7 +7831,7 @@ dependencies = [ [[package]] name = "servo-timers" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "crossbeam-channel", "malloc_size_of_derive", @@ -7841,7 +7841,7 @@ dependencies = [ [[package]] name = "servo-tracing" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "proc-macro2", "quote", @@ -7851,7 +7851,7 @@ dependencies = [ [[package]] name = "servo-url" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "encoding_rs", "malloc_size_of_derive", @@ -7865,7 +7865,7 @@ dependencies = [ [[package]] name = "servo-webgl" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "bitflags 2.11.0", "byteorder", @@ -7889,7 +7889,7 @@ dependencies = [ [[package]] name = "servo-webgpu" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "arrayvec", "euclid", @@ -7908,7 +7908,7 @@ dependencies = [ [[package]] name = "servo-webgpu-traits" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "arrayvec", "malloc_size_of_derive", @@ -7924,7 +7924,7 @@ dependencies = [ [[package]] name = "servo-webxr" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "crossbeam-channel", "euclid", @@ -7943,7 +7943,7 @@ dependencies = [ [[package]] name = "servo-webxr-api" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "euclid", "ipc-channel", @@ -7959,7 +7959,7 @@ dependencies = [ [[package]] name = "servo-xpath" version = "0.0.1" -source = "git+https://github.com/marcoallegretti/servo?branch=servo-weft#8e7dc40bff42448980b7249798f17e3131547138" +source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" dependencies = [ "log", "malloc_size_of_derive", @@ -7970,7 +7970,7 @@ dependencies = [ [[package]] name = "servo_arc" version = "0.4.3" -source = "git+https://github.com/servo/stylo?rev=dca3934667dae76c49bb579b268c5eb142d09c6a#dca3934667dae76c49bb579b268c5eb142d09c6a" +source = "git+https://github.com/marcoallegretti/stylo?rev=f1ba4969536d63f2e319a561e466c03e78b4a076#f1ba4969536d63f2e319a561e466c03e78b4a076" dependencies = [ "serde", "stable_deref_trait", @@ -8396,7 +8396,7 @@ dependencies = [ [[package]] name = "stylo" version = "0.13.0" -source = "git+https://github.com/servo/stylo?rev=dca3934667dae76c49bb579b268c5eb142d09c6a#dca3934667dae76c49bb579b268c5eb142d09c6a" +source = "git+https://github.com/marcoallegretti/stylo?rev=f1ba4969536d63f2e319a561e466c03e78b4a076#f1ba4969536d63f2e319a561e466c03e78b4a076" dependencies = [ "app_units", "arrayvec", @@ -8452,7 +8452,7 @@ dependencies = [ [[package]] name = "stylo_atoms" version = "0.13.0" -source = "git+https://github.com/servo/stylo?rev=dca3934667dae76c49bb579b268c5eb142d09c6a#dca3934667dae76c49bb579b268c5eb142d09c6a" +source = "git+https://github.com/marcoallegretti/stylo?rev=f1ba4969536d63f2e319a561e466c03e78b4a076#f1ba4969536d63f2e319a561e466c03e78b4a076" dependencies = [ "string_cache", "string_cache_codegen", @@ -8461,7 +8461,7 @@ dependencies = [ [[package]] name = "stylo_derive" version = "0.13.0" -source = "git+https://github.com/servo/stylo?rev=dca3934667dae76c49bb579b268c5eb142d09c6a#dca3934667dae76c49bb579b268c5eb142d09c6a" +source = "git+https://github.com/marcoallegretti/stylo?rev=f1ba4969536d63f2e319a561e466c03e78b4a076#f1ba4969536d63f2e319a561e466c03e78b4a076" dependencies = [ "darling", "proc-macro2", @@ -8473,7 +8473,7 @@ dependencies = [ [[package]] name = "stylo_dom" version = "0.13.0" -source = "git+https://github.com/servo/stylo?rev=dca3934667dae76c49bb579b268c5eb142d09c6a#dca3934667dae76c49bb579b268c5eb142d09c6a" +source = "git+https://github.com/marcoallegretti/stylo?rev=f1ba4969536d63f2e319a561e466c03e78b4a076#f1ba4969536d63f2e319a561e466c03e78b4a076" dependencies = [ "bitflags 2.11.0", "stylo_malloc_size_of", @@ -8482,7 +8482,7 @@ dependencies = [ [[package]] name = "stylo_malloc_size_of" version = "0.13.0" -source = "git+https://github.com/servo/stylo?rev=dca3934667dae76c49bb579b268c5eb142d09c6a#dca3934667dae76c49bb579b268c5eb142d09c6a" +source = "git+https://github.com/marcoallegretti/stylo?rev=f1ba4969536d63f2e319a561e466c03e78b4a076#f1ba4969536d63f2e319a561e466c03e78b4a076" dependencies = [ "app_units", "cssparser", @@ -8499,12 +8499,12 @@ dependencies = [ [[package]] name = "stylo_static_prefs" version = "0.13.0" -source = "git+https://github.com/servo/stylo?rev=dca3934667dae76c49bb579b268c5eb142d09c6a#dca3934667dae76c49bb579b268c5eb142d09c6a" +source = "git+https://github.com/marcoallegretti/stylo?rev=f1ba4969536d63f2e319a561e466c03e78b4a076#f1ba4969536d63f2e319a561e466c03e78b4a076" [[package]] name = "stylo_traits" version = "0.13.0" -source = "git+https://github.com/servo/stylo?rev=dca3934667dae76c49bb579b268c5eb142d09c6a#dca3934667dae76c49bb579b268c5eb142d09c6a" +source = "git+https://github.com/marcoallegretti/stylo?rev=f1ba4969536d63f2e319a561e466c03e78b4a076#f1ba4969536d63f2e319a561e466c03e78b4a076" dependencies = [ "app_units", "bitflags 2.11.0", @@ -8904,7 +8904,7 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "to_shmem" version = "0.3.0" -source = "git+https://github.com/servo/stylo?rev=dca3934667dae76c49bb579b268c5eb142d09c6a#dca3934667dae76c49bb579b268c5eb142d09c6a" +source = "git+https://github.com/marcoallegretti/stylo?rev=f1ba4969536d63f2e319a561e466c03e78b4a076#f1ba4969536d63f2e319a561e466c03e78b4a076" dependencies = [ "cssparser", "servo_arc", @@ -8917,7 +8917,7 @@ dependencies = [ [[package]] name = "to_shmem_derive" version = "0.1.0" -source = "git+https://github.com/servo/stylo?rev=dca3934667dae76c49bb579b268c5eb142d09c6a#dca3934667dae76c49bb579b268c5eb142d09c6a" +source = "git+https://github.com/marcoallegretti/stylo?rev=f1ba4969536d63f2e319a561e466c03e78b4a076#f1ba4969536d63f2e319a561e466c03e78b4a076" dependencies = [ "darling", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index e8cfff7..d8573d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,3 +24,17 @@ rust-version = "1.93" [workspace.lints.rust] unsafe_code = "forbid" + +# Servo's own [patch] tables do not apply to dependents. The servo fork's +# backdrop-filter support needs the stylo fork that removes the property's +# `layout.unimplemented` gate, so the override lives here. Remove it once the +# change is available from upstream stylo at the revision Servo selects. +[patch."https://github.com/servo/stylo"] +selectors = { git = "https://github.com/marcoallegretti/stylo", rev = "f1ba4969536d63f2e319a561e466c03e78b4a076" } +servo_arc = { git = "https://github.com/marcoallegretti/stylo", rev = "f1ba4969536d63f2e319a561e466c03e78b4a076" } +stylo = { git = "https://github.com/marcoallegretti/stylo", rev = "f1ba4969536d63f2e319a561e466c03e78b4a076" } +stylo_atoms = { git = "https://github.com/marcoallegretti/stylo", rev = "f1ba4969536d63f2e319a561e466c03e78b4a076" } +stylo_dom = { git = "https://github.com/marcoallegretti/stylo", rev = "f1ba4969536d63f2e319a561e466c03e78b4a076" } +stylo_malloc_size_of = { git = "https://github.com/marcoallegretti/stylo", rev = "f1ba4969536d63f2e319a561e466c03e78b4a076" } +stylo_static_prefs = { git = "https://github.com/marcoallegretti/stylo", rev = "f1ba4969536d63f2e319a561e466c03e78b4a076" } +stylo_traits = { git = "https://github.com/marcoallegretti/stylo", rev = "f1ba4969536d63f2e319a561e466c03e78b4a076" } diff --git a/README.md b/README.md index ae036f9..0abad34 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ See `docs/security.md`. Key points: ## Servo fork -- Repository: `https://github.com/marcoallegretti/servo`, branch `servo-weft` -- Base revision: `04ca254f` -- Patches: keyboard input, backdrop-filter in stylo +- Servo: `https://github.com/marcoallegretti/servo` at `f0bb1aaf`, pinned by revision +- Stylo: `https://github.com/marcoallegretti/stylo` at `f1ba4969`, through the root `[patch]` +- Patches: `backdrop-filter` parsing (Stylo) and rendering (Servo) - See `crates/weft-servo-shell/SERVO_PIN.md` for Servo integration status and known limitations diff --git a/crates/weft-app-shell/Cargo.toml b/crates/weft-app-shell/Cargo.toml index 68bbeac..1fd1448 100644 --- a/crates/weft-app-shell/Cargo.toml +++ b/crates/weft-app-shell/Cargo.toml @@ -27,7 +27,7 @@ toml = { version = "0.8", optional = true } [dependencies.servo] git = "https://github.com/marcoallegretti/servo" -branch = "servo-weft" +rev = "f0bb1aaf981b65c8dddc848bb647045d4c777d11" optional = true default-features = false diff --git a/crates/weft-servo-shell/Cargo.toml b/crates/weft-servo-shell/Cargo.toml index 42e34db..ef8cf89 100644 --- a/crates/weft-servo-shell/Cargo.toml +++ b/crates/weft-servo-shell/Cargo.toml @@ -27,7 +27,7 @@ tungstenite = "0.24" [dependencies.servo] git = "https://github.com/marcoallegretti/servo" -branch = "servo-weft" +rev = "f0bb1aaf981b65c8dddc848bb647045d4c777d11" optional = true default-features = false diff --git a/crates/weft-servo-shell/SERVO_PIN.md b/crates/weft-servo-shell/SERVO_PIN.md index 82b7c3d..a2b7100 100644 --- a/crates/weft-servo-shell/SERVO_PIN.md +++ b/crates/weft-servo-shell/SERVO_PIN.md @@ -2,13 +2,25 @@ ## Current pin -| Field | Value | -|---------|------------------------------------------------------------------------------------| -| Source | (fork of servo/servo) | -| Branch | `servo-weft` | -| Rev | `04ca254f843ed650d3e5b14e5693ad51a60cc84b` (servo-weft tip, 2026-03-11) | -| Crate | `servo` (package name as of 2026-03-11; previously `libservo`) | -| Feature | `servo-embed` (optional; off by default) | +The selected revisions are the ones recorded in the workspace `Cargo.lock`. + +| Dependency | Source | Revision | Selected by | +|------------|--------|----------|-------------| +| Servo (`servo` crate) | | `f0bb1aaf981b65c8dddc848bb647045d4c777d11` | `rev` in both shell crates' `Cargo.toml` | +| Stylo (`stylo`, `selectors`, `servo_arc`, ...) | | `f1ba4969536d63f2e319a561e466c03e78b4a076` | `[patch."https://github.com/servo/stylo"]` in the root `Cargo.toml` | + +The Servo revision is `servo-weft` commit `8e7dc40` (backdrop-filter rendering) +plus `f0bb1aa`, which fixes that commit's `servo-layout` build errors. It lives +on the fork branch `fix/backdrop-filter-build-errors` until it is merged into +`servo-weft`; keep that branch until then so the revision stays fetchable. + +Servo's own `[patch]` table for Stylo does not apply to WEFT, because Cargo +only honours patches in the root workspace. Without the root override, WEFT +resolves upstream Stylo `dca3934`, where `backdrop-filter` is still gated +behind `layout.unimplemented`. Remove the override once the selected Servo +revision depends on a Stylo that parses the property for Servo. + +The feature is `servo-embed` (optional; off by default). ## Cargo dependencies @@ -25,7 +37,7 @@ servo-embed = ["dep:servo", "dep:winit", "dep:softbuffer"] [dependencies.servo] git = "https://github.com/marcoallegretti/servo" -branch = "servo-weft" +rev = "f0bb1aaf981b65c8dddc848bb647045d4c777d11" optional = true default-features = false @@ -75,72 +87,59 @@ DMA-BUF buffer sharing with the compositor transparently. ## Known limitations at this pin -- **Wayland input events**: ~~not forwarded to Servo~~ **Resolved** — keyboard and - mouse events forwarded via `webview.notify_input_event`; key mapping in `keyutils.rs`. -- **Wayland surface sharing**: ~~`ZweftShellWindowV1` created with `surface = null`~~ **Resolved** — - `ShellClient::connect_with_display(display_ptr, surface_ptr)` uses - `Backend::from_foreign_display` to share winit's `wl_display` connection; the winit - `wl_surface` pointer is passed directly to `create_window`, associating the compositor - shell slot with the actual rendered surface. `ShellClient` is now constructed inside - `resumed()` after the winit window exists, not before the event loop. EGL path and - per-frame event dispatch are unchanged. - Protocol note: `wayland-scanner 0.31` generates `_type` (not `r#type`) for the - `navigation_gesture` event arg named `type`. -- **WebGPU on Mesa**: adapter may fail CTS — validation task, requires Mesa GPU hardware. -- **CSS layout features**: ~~CSS Grid~~ **Grid resolved** (Taffy-backed, fully wired). - ~~CSS `backdrop-filter` unimplemented~~ **`backdrop-filter` resolved** (servo/servo issue - [#41567](https://github.com/servo/servo/issues/41567)). Implemented across two commits: - - `marcoallegretti/stylo` `servo-weft` `f1ba496`: removed `servo_pref = "layout.unimplemented"` - from `backdrop-filter` in `style/properties/longhands.toml` (enables parsing). - - `marcoallegretti/servo` `servo-weft` `8e7dc40`: `Cargo.toml` patched to use the stylo fork; - `style_ext.rs` adds `backdrop-filter` to `establishes_stacking_context` and - `establishes_containing_block_for_all_descendants`; `stacking_context.rs` guards the - WebRender stacking-context early-return on `backdrop_filter.0.is_empty()`; `display_list/mod.rs` - adds `BuilderForBoxFragment::build_backdrop_filter` calling `push_backdrop_filter` before - background paint. -- **Per-app process isolation**: ~~not implemented~~ **Resolved** — each app runs in a separate - `weft-app-shell` and `weft-runtime` OS process pair supervised by `weft-appd`. OS-level - isolation does not require Servo's multi-process constellation architecture. -- **SpiderMonkey sandbox**: SpiderMonkey is not sandbox-isolated beyond process-level isolation. - JIT-compiled JS runs with the same memory permissions as the Servo process. WEFT relies on - SpiderMonkey's own security properties for the JavaScript execution boundary. See - `docs/security.md` for the full bounded statement. Not addressed. +Status is stated against executed evidence; code that exists but has not been +exercised is listed as unverified. + +- **Embedder API**: both `weft-servo-shell` and `weft-app-shell` fail to compile + with `servo-embed` against this revision (keyboard events, mouse actions, + rendering readback, shutdown and window-handle APIs changed). Until they + build and present a frame, input forwarding, surface sharing and rendering + in the shells are unverified. +- **`backdrop-filter`**: the parsing (Stylo `f1ba496`) and rendering (Servo + `8e7dc40`, `f0bb1aa`) patches are selected by the lockfile. Rendering is + unverified until a pixel check passes on the shells. +- **Shell surface association**: the shells pass winit's `wl_display` and + `wl_surface` to `zweft_shell_manager_v1.create_window` through a shared + connection; unverified at this revision. +- **WebGPU on Mesa**: not evaluated. +- **Process separation**: each app runs as separate `weft-app-shell` and + `weft-runtime` processes supervised by `weft-appd`. Separate processes alone + do not confine the renderer; see `docs/security.md`. +- **SpiderMonkey**: JIT-compiled JavaScript runs with the Servo process's + permissions; WEFT relies on SpiderMonkey's own security properties for the + JavaScript boundary. See `docs/security.md`. ## Update policy -The `servo-weft` branch is the working branch for WEFT-specific Servo patches. -Upstream servo/servo changes are merged into it periodically. +`servo-weft` in `marcoallegretti/servo` and `servo-weft` in +`marcoallegretti/stylo` carry WEFT-specific patches. WEFT pins exact revisions +rather than tracking a branch, so a rebuild selects the same code. A pinned +revision must stay reachable from a published branch: never force-push, +rebase or delete a branch that contains a revision a WEFT lockfile selects. +Today Servo `f0bb1aa` is reachable only from `fix/backdrop-filter-build-errors` +and Stylo `f1ba496` only from Stylo's `servo-weft`. -To rebase onto a new upstream commit: +To move to new revisions: -1. In the `marcoallegretti/servo` repo: `git fetch upstream && git rebase upstream/main` on `servo-weft`. -2. Force-push `servo-weft`. -3. Update `Rev` in this file to the new tip SHA. -4. Run `cargo update -p servo` in the WEFT OS workspace. -5. Confirm the compositor and shell tests still pass. +1. Land the Servo or Stylo change on the fork and note its commit. +2. Update the `rev` values in `crates/weft-servo-shell/Cargo.toml`, + `crates/weft-app-shell/Cargo.toml` and, for Stylo, the root `[patch]`. +3. Run `cargo update -p servo` (and `cargo update -p stylo` for a Stylo-only change). +4. Confirm with `grep -A2 'name = "servo"' Cargo.lock` and + `grep -A2 'name = "stylo"' Cargo.lock` that the lockfile selects them, that + `cargo metadata --locked` succeeds, and that `grep -c servo/stylo Cargo.lock` + prints `0`, which shows the override applies to every Stylo crate. +5. Recompute the `outputHashes` in `infra/nixos/weft-packages.nix` for each + changed git source. +6. Run `cargo check -p weft-servo-shell --features servo-embed --locked` and + `cargo check -p weft-app-shell --features servo-embed --locked`, plus the + rendering checks for any behavior the change claims, and update the tables + in this file. -To submit patches upstream: open a PR from `servo-weft` (or a topic branch) to `servo/servo`. +Each fork patch keeps its purpose, upstream status and removal condition here. -## Stylo fork - -The Stylo CSS engine is a separate repo (`servo/stylo`) pinned at rev `dca3934667dae76c49bb579b268c5eb142d09c6a` -in `Cargo.toml`. To patch it for WEFT-specific changes (e.g. enabling `backdrop-filter`): - -1. Fork `servo/stylo` to `marcoallegretti/stylo`, create branch `servo-weft`. -2. Make changes on that branch. -3. Add to this fork's `Cargo.toml` workspace `[patch]` section: - -```toml -[patch."https://github.com/servo/stylo"] -stylo = { git = "https://github.com/marcoallegretti/stylo", branch = "servo-weft" } -stylo_atoms = { git = "https://github.com/marcoallegretti/stylo", branch = "servo-weft" } -stylo_dom = { git = "https://github.com/marcoallegretti/stylo", branch = "servo-weft" } -stylo_malloc_size_of = { git = "https://github.com/marcoallegretti/stylo", branch = "servo-weft" } -stylo_static_prefs = { git = "https://github.com/marcoallegretti/stylo", branch = "servo-weft" } -stylo_traits = { git = "https://github.com/marcoallegretti/stylo", branch = "servo-weft" } -selectors = { git = "https://github.com/marcoallegretti/stylo", branch = "servo-weft" } -servo_arc = { git = "https://github.com/marcoallegretti/stylo", branch = "servo-weft" } -``` - -1. Run `cargo update` to resolve the new stylo deps. -2. Commit both the `Cargo.toml` and `Cargo.lock` changes to `servo-weft`. +| Patch | Fork commit | Purpose | Upstream status | Remove when | +|-------|-------------|---------|-----------------|-------------| +| Stylo: parse `backdrop-filter` for Servo | stylo `f1ba496` | Remove the `layout.unimplemented` gate | Not submitted | Upstream Stylo parses it for Servo | +| Servo: render `backdrop-filter` | servo `8e7dc40` | Stacking context and display list support | servo/servo issue [#41567](https://github.com/servo/servo/issues/41567) | Equivalent upstream support | +| Servo: fix `build_backdrop_filter` types | servo `f0bb1aa` | Make `servo-layout` compile | Part of the patch above | Same as above | diff --git a/docs/building.md b/docs/building.md index 96f1359..c282c5e 100644 --- a/docs/building.md +++ b/docs/building.md @@ -43,7 +43,7 @@ cargo build -p weft-servo-shell --features servo-embed cargo build -p weft-app-shell --features servo-embed ``` -This fetches and compiles the Servo fork (`github.com/marcoallegretti/servo`, branch `servo-weft`). Expect 30–60 minutes on a clean build. Servo's dependencies include SpiderMonkey (C++), which requires `clang` and `python3`. +This fetches and compiles the Servo and Stylo forks at the revisions recorded in `Cargo.lock` (see `crates/weft-servo-shell/SERVO_PIN.md`). Expect 30–60 minutes on a clean build. Servo's dependencies include SpiderMonkey (C++), which requires `clang` and `python3`. ## Demo apps (wasm32-wasip2) @@ -86,7 +86,7 @@ Run with QEMU: bash infra/vm/run.sh ``` -See `infra/nixos/weft-packages.nix` for the package derivations. The `outputHashes` entry for the Servo git dependency must be filled in before the `servo-embed` packages will build under Nix. +See `infra/nixos/weft-packages.nix` for the package derivations. Its `outputHashes` hold one hash per git source in `Cargo.lock` (the Servo and Stylo forks); every package vendors them, so they must match the pinned revisions for any Nix package to build. The Nix shell packages do not yet enable `servo-embed`. ## CI diff --git a/infra/nixos/weft-packages.nix b/infra/nixos/weft-packages.nix index 8ca8e42..2d9ba82 100644 --- a/infra/nixos/weft-packages.nix +++ b/infra/nixos/weft-packages.nix @@ -10,9 +10,13 @@ let cargoLock = { lockFile = ../../Cargo.lock; + # One hash per git source in Cargo.lock: the Servo fork and the Stylo fork + # (keyed by its `selectors` crate). Every package vendors both, so both must + # match the pinned revisions. Recompute them whenever a revision changes. + # The Servo hash is not yet known for f0bb1aa; a Nix build reports it. outputHashes = { - "servo-0.0.1" = "0b803qankr0rs4hi0md26dydf2cvpd6v5x2bxxypzsga0jwfdd26"; - "selectors-0.36.0" = "1x5g61cadq700yhl1wwrjd043grlpdviqqn4n9cm5k68gbx0if81"; + "servo-0.0.1" = pkgs.lib.fakeHash; + "selectors-0.36.0" = "13y6pa19j4w2zsxfhv6mrl03wsa0frazlsssbqkzpwci8k9gzl4i"; }; }; From ef7d10511864125ee5468a90eba1beaabfdcc6ee Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Fri, 9 Oct 2026 00:43:35 +0000 Subject: [PATCH 2/7] fix(appd): drop --wait from the systemd-run scope launch When a systemd user manager was detected, weft-appd launched the runtime with `systemd-run --user --scope --wait ...`. systemd rejects that combination while parsing options ("--wait may not be combined with --scope"), so every app launch on such a host exited immediately and the session stopped without the runtime ever starting. A scope already runs the command in the foreground: systemd-run registers the scope and then executes the command in its own process, so stdout and the exit status still reach appd without --wait. The options now live in one constant. A Linux test runs the installed systemd-run with them against an empty runtime directory and bus address and requires it to reach the manager connection; option and combination errors stop it earlier. The test does not validate the -p property values or start a scope. It requires systemd-run to be installed. This keeps the existing ownership scope for the runtime only; placing the app shell and helpers under the same owner is separate lifecycle work. Validation: - systemd-run 255: the test passes with the new options and fails with the old --wait (and with --pty) using systemd's own message - cargo test -p weft-appd (38 passed), clippy -D warnings, fmt --check --- crates/weft-appd/src/runtime.rs | 68 ++++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 13 deletions(-) diff --git a/crates/weft-appd/src/runtime.rs b/crates/weft-appd/src/runtime.rs index 77e4686..6541f65 100644 --- a/crates/weft-appd/src/runtime.rs +++ b/crates/weft-appd/src/runtime.rs @@ -70,6 +70,22 @@ pub(crate) async fn spawn_ipc_relay( const READY_TIMEOUT: Duration = Duration::from_secs(30); +/// `systemd-run` options that place the runtime in a transient user scope. +/// +/// A scope runs the command in the foreground as systemd-run's own process, +/// so its stdout and exit status reach appd directly. `--wait` only applies +/// to service units; systemd rejects it together with `--scope`. +const SYSTEMD_SCOPE_ARGS: &[&str] = &[ + "--user", + "--scope", + "--collect", + "--slice=weft-apps.slice", + "-p", + "CPUQuota=200%", + "-p", + "MemoryMax=512M", +]; + fn systemd_cgroup_available() -> bool { if std::env::var("WEFT_DISABLE_CGROUP").is_ok() { return false; @@ -240,19 +256,7 @@ pub(crate) async fn supervise( let mut cmd = if systemd_cgroup_available() { let mut c = tokio::process::Command::new("systemd-run"); - c.args([ - "--user", - "--scope", - "--wait", - "--collect", - "--slice=weft-apps.slice", - "-p", - "CPUQuota=200%", - "-p", - "MemoryMax=512M", - "--", - &bin, - ]); + c.args(SYSTEMD_SCOPE_ARGS).arg("--").arg(&bin); c } else { tokio::process::Command::new(&bin) @@ -437,3 +441,41 @@ async fn drain_stderr(stderr: tokio::process::ChildStderr, session_id: u64) { tracing::warn!(session_id, stderr = %line, "app stderr"); } } + +#[cfg(all(test, target_os = "linux"))] +mod tests { + use super::SYSTEMD_SCOPE_ARGS; + + /// systemd-run checks its options and their combinations before it + /// connects to the service manager. Run against an empty runtime + /// directory and bus address, it must get as far as the connection + /// attempt; any option error ends earlier with a different message. This + /// does not validate the `-p` property values, which only the manager + /// checks, and never starts a real scope. + #[test] + fn systemd_run_accepts_scope_options() { + let empty = std::env::temp_dir().join(format!("weft-scope-test-{}", std::process::id())); + std::fs::create_dir_all(&empty).unwrap(); + let output = std::process::Command::new("systemd-run") + .args(SYSTEMD_SCOPE_ARGS) + .args(["--", "true"]) + .env_clear() + .env("PATH", std::env::var_os("PATH").unwrap_or_default()) + .env("LC_ALL", "C") + .env("XDG_RUNTIME_DIR", &empty) + .env( + "DBUS_SESSION_BUS_ADDRESS", + format!("unix:path={}/bus", empty.display()), + ) + .output(); + std::fs::remove_dir_all(&empty).unwrap(); + let output = output.expect("systemd-run is required to check the scope options"); + let stderr = String::from_utf8_lossy(&output.stderr); + // systemd 255 says "Failed to connect to bus"; later releases name the + // transport, e.g. "Failed to connect to user scope bus via local transport". + assert!( + stderr.starts_with("Failed to connect to"), + "systemd-run did not reach the manager connection: {stderr}" + ); + } +} From 64f8cff6fd5668be69824a89e1660b2ab3c6e335 Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Fri, 9 Oct 2026 01:02:26 +0000 Subject: [PATCH 3/7] fix(shells): paint and present Servo frames and report readiness truthfully With servo-embed, weft-servo-shell and weft-app-shell did not compile against the selected Servo revision: the keyboard event shape, key and mouse action variants, frame readback, shutdown, URL type and window handle APIs had changed. The frame path never called WebView::paint; the software path rebuilt its softbuffer surface every frame and read pixels without painting, and the EGL path presented nothing. weft-app-shell printed READY right after creating its WebView, before any frame, and its feature-disabled build printed READY and parked. Servo also disables CSS Grid by default, which the system UI uses. Both hosts now build against the selected API. Each frame is painted with WebView::paint and presented: the software path reads the painted frame back, presents the context and copies it into a persistent softbuffer surface; the EGL path presents its window context. Nothing is presented before Servo's first repaint request. Shutdown drops the WebView and Servo, whose drop completes the shutdown, and exits the event loop. Both hosts enable layout_grid_enabled. weft-app-shell prints READY on the first frame presented after the document has loaded and Servo reports its rendering settled: on load completion it requests WebView::take_screenshot, which completes only once every frame has fired load, render-blocking resources, images and web fonts are done and the rendering is up to date. Feature-disabled builds of both hosts exit with an error instead of reporting readiness. weft-appd does not consume the app shell's READY yet. tests/frame/check_frame.py runs weft-compositor nested on Xvfb with the winit backend, starts a host showing tests/frame/reference.html and checks the presented pixels (four colour quadrants and text). For the app host the page must be on screen within two seconds of READY; --slow-style delays a render-blocking stylesheet that reveals the page, so premature readiness fails. Validation (Ubuntu 24.04, Mesa 25.2.8 llvmpipe, software path): - check_frame.py --host system, --host app and --host app --slow-style 3: 5 of 5 runs pass each - negative fixtures fail: page with red and green swapped; a fake host printing READY without rendering; a local build printing READY on its first presented frame (--slow-style 4, 3 of 3) - cargo clippy -D warnings with and without servo-embed; cargo fmt --check - unverified: EGL path, DRM, resize, output scale, idle wakeup, input --- README.md | 2 +- crates/weft-app-shell/src/embedder.rs | 302 ++++++++++------ crates/weft-app-shell/src/keyutils.rs | 20 +- crates/weft-app-shell/src/main.rs | 6 +- crates/weft-app-shell/src/shell_client.rs | 4 - crates/weft-servo-shell/SERVO_PIN.md | 64 +++- crates/weft-servo-shell/src/embedder.rs | 257 +++++++++----- crates/weft-servo-shell/src/keyutils.rs | 20 +- crates/weft-servo-shell/src/shell_client.rs | 4 - docs/building.md | 24 +- tests/frame/check_frame.py | 370 ++++++++++++++++++++ tests/frame/reference.html | 21 ++ 12 files changed, 840 insertions(+), 254 deletions(-) create mode 100644 tests/frame/check_frame.py create mode 100644 tests/frame/reference.html diff --git a/README.md b/README.md index 0abad34..a43db81 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ WEFT OS is a Wayland compositor and application runtime where every app is a Web **Compositor** — `weft-compositor` is a Smithay-based Wayland compositor with DRM/KMS and winit backends. It implements the `zweft-shell-unstable-v1` protocol extension, which typed shell slots (panel, application) register against. -**System shell** — `weft-servo-shell` embeds Servo (feature-gated, `--features servo-embed`) and renders `system-ui.html` as a Wayland panel. Without `servo-embed`, the binary builds as a no-op stub. Navigation gestures from the compositor are forwarded to `weft-appd` over WebSocket. +**System shell** — `weft-servo-shell` embeds Servo (feature-gated, `--features servo-embed`) and renders `system-ui.html` as a Wayland panel. Without `servo-embed`, the binary exits with an error instead of rendering. Navigation gestures from the compositor are forwarded to `weft-appd` over WebSocket. **App shell** — `weft-app-shell` is a per-process Servo host for application WebViews. It resolves `weft-app:///ui/index.html`, injects a `weftIpc` WebSocket bridge into the page, and registers with the compositor as an application surface. Also feature-gated behind `servo-embed`. diff --git a/crates/weft-app-shell/src/embedder.rs b/crates/weft-app-shell/src/embedder.rs index 6fae473..f9551ca 100644 --- a/crates/weft-app-shell/src/embedder.rs +++ b/crates/weft-app-shell/src/embedder.rs @@ -1,20 +1,22 @@ -#![cfg(feature = "servo-embed")] - +use std::num::NonZeroU32; use std::path::PathBuf; use std::rc::Rc; +use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, Mutex}; use servo::{ - EventLoopWaker, InputEvent, MouseButton as ServoMouseButton, MouseButtonAction, - MouseButtonEvent, MouseMoveEvent, ServoBuilder, ServoDelegate, ServoUrl, UserContentManager, + DeviceIntRect, DeviceIntSize, DevicePoint, EventLoopWaker, InputEvent, LoadStatus, + MouseButton as ServoMouseButton, MouseButtonAction, MouseButtonEvent, MouseMoveEvent, + RenderingContext, RgbaImage, ServoBuilder, ServoDelegate, ServoUrl, UserContentManager, UserScript, WebViewBuilder, WebViewDelegate, }; use winit::{ application::ApplicationHandler, + dpi::PhysicalSize, event::{ElementState, MouseButton, WindowEvent}, event_loop::{ActiveEventLoop, EventLoop, EventLoopProxy}, keyboard::ModifiersState, - platform::wayland::{ActiveEventLoopExtWayland, WindowExtWayland}, + raw_window_handle::{HasDisplayHandle, HasWindowHandle, RawDisplayHandle, RawWindowHandle}, window::{Window, WindowAttributes, WindowId}, }; @@ -48,29 +50,133 @@ impl ServoDelegate for WeftServoDelegate { } } +/// Frame and load progress reported by Servo, shared with the event loop. +#[derive(Default)] +struct FrameSignals { + /// A new frame is waiting to be painted. + redraw: AtomicBool, + /// Servo has requested at least one repaint. + content: AtomicBool, + /// The document has loaded and Servo reports its rendering is up to date. + settled: AtomicBool, +} + struct WeftWebViewDelegate { - redraw_requested: Arc, + signals: Arc, } impl WebViewDelegate for WeftWebViewDelegate { fn notify_new_frame_ready(&self, _webview: servo::WebView) { - self.redraw_requested - .store(true, std::sync::atomic::Ordering::Relaxed); + self.signals.content.store(true, Ordering::Relaxed); + self.signals.redraw.store(true, Ordering::Relaxed); + } + + fn notify_load_status_changed(&self, webview: servo::WebView, status: LoadStatus) { + if status != LoadStatus::Complete { + return; + } + // Servo completes a screenshot request only once every frame has fired + // `load`, render-blocking resources, images and web fonts are done and + // the rendering is up to date, which is the readiness this host reports. + let signals = Arc::clone(&self.signals); + webview.take_screenshot(None, move |result| match result { + Ok(_) => { + signals.settled.store(true, Ordering::Relaxed); + signals.redraw.store(true, Ordering::Relaxed); + } + Err(e) => tracing::error!(?e, "document rendering did not settle; not ready"), + }); } } +/// Servo preferences shared by the WEFT hosts. +fn host_preferences() -> servo::Preferences { + servo::Preferences { + // The system UI and application pages lay out with CSS Grid, which + // Servo disables by default. + layout_grid_enabled: true, + ..Default::default() + } +} + +// ── Rendering ─────────────────────────────────────────────────────────────── + +type BlitSurface = softbuffer::Surface, Arc>; + enum RenderingCtx { - Software(Rc), + /// Servo renders offscreen; each frame is read back and copied to the window. + Software { + context: Rc, + surface: BlitSurface, + }, + /// Servo renders directly to the window's EGL surface. Egl(Rc), } impl RenderingCtx { - fn as_dyn(&self) -> Rc { + fn as_dyn(&self) -> Rc { match self { - Self::Software(rc) => Rc::clone(rc) as Rc, - Self::Egl(rc) => Rc::clone(rc) as Rc, + Self::Software { context, .. } => Rc::clone(context) as Rc, + Self::Egl(context) => Rc::clone(context) as Rc, } } + + /// Paints the webview into this context and presents the frame on the window. + fn paint_and_present(&mut self, webview: &servo::WebView) -> Result<(), String> { + match self { + Self::Software { context, surface } => { + context + .make_current() + .map_err(|e| format!("make_current: {e:?}"))?; + webview.paint(); + let size = context.size(); + let rect = DeviceIntRect::from_size(DeviceIntSize::new( + size.width as i32, + size.height as i32, + )); + let image = context.read_to_image(rect); + context.present(); + let image = image.ok_or("frame readback failed")?; + blit(surface, &image) + } + Self::Egl(context) => { + context + .make_current() + .map_err(|e| format!("make_current: {e:?}"))?; + webview.paint(); + context.present(); + Ok(()) + } + } + } +} + +/// Copies an RGBA frame into the window's software surface and presents it. +fn blit(surface: &mut BlitSurface, image: &RgbaImage) -> Result<(), String> { + let (width, height) = image.dimensions(); + let (Some(w), Some(h)) = (NonZeroU32::new(width), NonZeroU32::new(height)) else { + return Ok(()); + }; + surface.resize(w, h).map_err(|e| format!("resize: {e}"))?; + let mut buffer = surface.buffer_mut().map_err(|e| format!("buffer: {e}"))?; + for (dst, src) in buffer.iter_mut().zip(image.as_raw().chunks_exact(4)) { + *dst = u32::from(src[0]) << 16 | u32::from(src[1]) << 8 | u32::from(src[2]); + } + buffer.present().map_err(|e| format!("present: {e}")) +} + +/// Returns winit's `wl_display` and `wl_surface` pointers when running on Wayland. +fn wayland_handles( + event_loop: &ActiveEventLoop, + window: &Window, +) -> Option<(*mut std::ffi::c_void, *mut std::ffi::c_void)> { + let RawDisplayHandle::Wayland(display) = event_loop.display_handle().ok()?.as_raw() else { + return None; + }; + let RawWindowHandle::Wayland(surface) = window.window_handle().ok()?.as_raw() else { + return None; + }; + Some((display.display.as_ptr(), surface.surface.as_ptr())) } struct App { @@ -82,12 +188,12 @@ struct App { servo: Option, webview: Option, rendering_context: Option, - redraw_requested: Arc, + signals: Arc, waker: WeftEventLoopWaker, shutting_down: bool, ready_signalled: bool, modifiers: ModifiersState, - cursor_pos: servo::euclid::default::Point2D, + cursor_pos: DevicePoint, shell_client: Option, } @@ -108,47 +214,46 @@ impl App { servo: None, webview: None, rendering_context: None, - redraw_requested: Arc::new(std::sync::atomic::AtomicBool::new(false)), + signals: Arc::default(), waker, shutting_down: false, ready_signalled: false, modifiers: ModifiersState::default(), - cursor_pos: servo::euclid::default::Point2D::zero(), + cursor_pos: DevicePoint::origin(), shell_client: None, } } - fn render_frame(window: &Arc, ctx: &RenderingCtx) { - match ctx { - RenderingCtx::Software(rc) => Self::blit_software(window, rc), - RenderingCtx::Egl(_) => {} + /// Paints and presents once Servo has requested its first repaint. + /// + /// Nothing is presented before that request; the first frames can still be + /// blank or unstyled while the document loads. READY is printed after a + /// frame is presented once the document has loaded and its rendering has + /// settled. + fn render_frame(&mut self) { + if !self.signals.content.load(Ordering::Relaxed) { + return; + } + let (Some(webview), Some(context)) = (&self.webview, &mut self.rendering_context) else { + return; + }; + if let Err(e) = context.paint_and_present(webview) { + tracing::warn!("frame not presented: {e}"); + return; + } + if !self.ready_signalled && self.signals.settled.load(Ordering::Relaxed) { + self.ready_signalled = true; + println!("READY"); + use std::io::Write; + let _ = std::io::stdout().flush(); } } - fn blit_software(window: &Arc, rendering_context: &servo::SoftwareRenderingContext) { - let size = window.inner_size(); - let Some(pixels) = rendering_context.read_pixels() else { - return; - }; - let Ok(ctx) = softbuffer::Context::new(Arc::clone(window)) else { - tracing::warn!("softbuffer context creation failed; skipping frame"); - return; - }; - let Ok(mut surface) = softbuffer::Surface::new(&ctx, Arc::clone(window)) else { - tracing::warn!("softbuffer surface creation failed; skipping frame"); - return; - }; - let _ = surface.resize( - std::num::NonZeroU32::new(size.width).unwrap_or(std::num::NonZeroU32::MIN), - std::num::NonZeroU32::new(size.height).unwrap_or(std::num::NonZeroU32::MIN), - ); - let Ok(mut buf) = surface.buffer_mut() else { - return; - }; - for (dst, src) in buf.iter_mut().zip(pixels.chunks(4)) { - *dst = u32::from_be_bytes([0, src[0], src[1], src[2]]); - } - let _ = buf.present(); + /// Drops the webview and Servo; dropping the last `Servo` handle shuts it down. + fn shut_down(&mut self) { + self.shutting_down = true; + self.webview = None; + self.servo = None; } } @@ -171,23 +276,22 @@ impl ApplicationHandler for App { let size = window.inner_size(); self.window = Some(Arc::clone(&window)); - if self.shell_client.is_none() { - if let (Some(disp), Some(surf)) = - (event_loop.wayland_display(), window.wayland_surface()) - { - match crate::shell_client::ShellClient::connect_as_app_with_display( - &self.app_id, - self.session_id, - disp, - surf, - ) { - Ok(sc) => self.shell_client = Some(sc), - Err(e) => tracing::warn!(error = %e, "shell protocol unavailable"), - } + if self.shell_client.is_none() + && let Some((disp, surf)) = wayland_handles(event_loop, &window) + { + match crate::shell_client::ShellClient::connect_as_app_with_display( + &self.app_id, + self.session_id, + disp, + surf, + ) { + Ok(sc) => self.shell_client = Some(sc), + Err(e) => tracing::warn!(error = %e, "shell protocol unavailable"), } } let servo = ServoBuilder::default() + .preferences(host_preferences()) .event_loop_waker(Box::new(self.waker.clone())) .build(); @@ -212,22 +316,15 @@ impl ApplicationHandler for App { let webview = WebViewBuilder::new(&servo, rendering_context.as_dyn()) .delegate(Rc::new(WeftWebViewDelegate { - redraw_requested: Arc::clone(&self.redraw_requested), + signals: Arc::clone(&self.signals), })) .user_content_manager(ucm) - .url(self.url.clone()) + .url(self.url.clone().into_url()) .build(); self.servo = Some(servo); self.webview = Some(webview); self.rendering_context = Some(rendering_context); - - if !self.ready_signalled { - self.ready_signalled = true; - println!("READY"); - use std::io::Write; - let _ = std::io::stdout().flush(); - } } fn user_event(&mut self, _event_loop: &ActiveEventLoop, _event: ServoWake) { @@ -241,28 +338,26 @@ impl ApplicationHandler for App { event_loop.exit(); return; } + let mut compositor_closed = false; if let Some(sc) = &mut self.shell_client { match sc.dispatch_pending() { - Ok(false) => { - self.shutting_down = true; - if let Some(servo) = &self.servo { - servo.start_shutting_down(); - } - } + Ok(false) => compositor_closed = true, Err(e) => tracing::warn!("shell client dispatch error: {e}"), Ok(true) => {} } } + if compositor_closed { + self.shut_down(); + event_loop.exit(); + return; + } if let Some(servo) = &self.servo { servo.spin_event_loop(); } - if self - .redraw_requested - .swap(false, std::sync::atomic::Ordering::Relaxed) + if self.signals.redraw.swap(false, Ordering::Relaxed) + && let Some(w) = &self.window { - if let Some(w) = &self.window { - w.request_redraw(); - } + w.request_redraw(); } } @@ -273,18 +368,13 @@ impl ApplicationHandler for App { event: WindowEvent, ) { match event { - WindowEvent::RedrawRequested => { - if let (Some(window), Some(servo)) = (&self.window, &self.servo) { - if let Some(rc) = &self.rendering_context { - Self::render_frame(window, rc); - } - servo.spin_event_loop(); - } - } + WindowEvent::RedrawRequested => self.render_frame(), WindowEvent::Resized(new_size) => { - let sz = servo::euclid::Size2D::new(new_size.width, new_size.height); + if new_size.width == 0 || new_size.height == 0 { + return; + } if let Some(wv) = &self.webview { - wv.resize(sz); + wv.resize(new_size); } } WindowEvent::ModifiersChanged(mods) => { @@ -297,10 +387,11 @@ impl ApplicationHandler for App { } } WindowEvent::CursorMoved { position, .. } => { - let pt = servo::euclid::default::Point2D::new(position.x as f32, position.y as f32); + let pt = DevicePoint::new(position.x as f32, position.y as f32); self.cursor_pos = pt; if let Some(wv) = &self.webview { - let _ = wv.notify_input_event(InputEvent::MouseMove(MouseMoveEvent::new(pt))); + let _ = wv + .notify_input_event(InputEvent::MouseMove(MouseMoveEvent::new(pt.into()))); } } WindowEvent::MouseInput { state, button, .. } => { @@ -311,22 +402,19 @@ impl ApplicationHandler for App { _ => return, }; let action = match state { - ElementState::Pressed => MouseButtonAction::Click, + ElementState::Pressed => MouseButtonAction::Down, ElementState::Released => MouseButtonAction::Up, }; if let Some(wv) = &self.webview { let _ = wv.notify_input_event(InputEvent::MouseButton(MouseButtonEvent::new( action, btn, - self.cursor_pos.cast_unit(), + self.cursor_pos.into(), ))); } } WindowEvent::CloseRequested => { - self.shutting_down = true; - if let Some(servo) = &self.servo { - servo.start_shutting_down(); - } + self.shut_down(); event_loop.exit(); } _ => {} @@ -337,7 +425,7 @@ impl ApplicationHandler for App { fn build_rendering_ctx( event_loop: &ActiveEventLoop, window: &Arc, - size: winit::dpi::PhysicalSize, + size: PhysicalSize, ) -> Option { if std::env::var_os("WEFT_EGL_RENDERING").is_some() { let display_handle = event_loop.display_handle(); @@ -349,16 +437,26 @@ fn build_rendering_ctx( return Some(RenderingCtx::Egl(Rc::new(rc))); } Err(e) => { - tracing::warn!("EGL rendering context failed ({e}), falling back to software"); + tracing::warn!( + "EGL rendering context failed ({e:?}), falling back to software" + ); } } } } - match servo::SoftwareRenderingContext::new(servo::euclid::Size2D::new(size.width, size.height)) - { - Ok(rc) => Some(RenderingCtx::Software(Rc::new(rc))), + let context = match servo::SoftwareRenderingContext::new(size) { + Ok(rc) => Rc::new(rc), Err(e) => { - tracing::error!("SoftwareRenderingContext failed: {e}"); + tracing::error!("SoftwareRenderingContext failed: {e:?}"); + return None; + } + }; + let surface = softbuffer::Context::new(Arc::clone(window)) + .and_then(|display| softbuffer::Surface::new(&display, Arc::clone(window))); + match surface { + Ok(surface) => Some(RenderingCtx::Software { context, surface }), + Err(e) => { + tracing::error!("software presentation surface failed: {e}"); None } } diff --git a/crates/weft-app-shell/src/keyutils.rs b/crates/weft-app-shell/src/keyutils.rs index c4fd87b..1665cb5 100644 --- a/crates/weft-app-shell/src/keyutils.rs +++ b/crates/weft-app-shell/src/keyutils.rs @@ -1,5 +1,3 @@ -#![cfg(feature = "servo-embed")] - use servo::{Code, Key, KeyState, KeyboardEvent, Location, Modifiers}; use winit::event::ElementState; use winit::keyboard::{Key as WinitKey, KeyLocation, ModifiersState, NamedKey, PhysicalKey}; @@ -14,10 +12,11 @@ pub fn keyboard_event_from_winit( }; let key = match &event.logical_key { + WinitKey::Named(NamedKey::Space) => Key::Character(" ".to_string()), WinitKey::Named(n) => Key::Named(named_key(*n)), - WinitKey::Character(c) => Key::Character(c.to_string().into()), - WinitKey::Unidentified(_) => Key::Unidentified, - WinitKey::Dead(c) => Key::Dead(*c), + WinitKey::Character(c) => Key::Character(c.to_string()), + WinitKey::Unidentified(_) => Key::Named(servo::NamedKey::Unidentified), + WinitKey::Dead(_) => Key::Named(servo::NamedKey::Dead), }; let code = match event.physical_key { @@ -46,15 +45,7 @@ pub fn keyboard_event_from_winit( mods |= Modifiers::META; } - KeyboardEvent { - state, - key, - code, - location, - modifiers: mods, - repeat: event.repeat, - is_composing: false, - } + KeyboardEvent::new_without_event(state, key, code, location, mods, event.repeat, false) } fn named_key(n: NamedKey) -> servo::NamedKey { @@ -74,7 +65,6 @@ fn named_key(n: NamedKey) -> servo::NamedKey { NamedKey::SymbolLock => S::SymbolLock, NamedKey::Enter => S::Enter, NamedKey::Tab => S::Tab, - NamedKey::Space => S::Space, NamedKey::ArrowDown => S::ArrowDown, NamedKey::ArrowLeft => S::ArrowLeft, NamedKey::ArrowRight => S::ArrowRight, diff --git a/crates/weft-app-shell/src/main.rs b/crates/weft-app-shell/src/main.rs index df6c191..36d308c 100644 --- a/crates/weft-app-shell/src/main.rs +++ b/crates/weft-app-shell/src/main.rs @@ -57,10 +57,6 @@ fn embed_app(app_id: &str, session_id: u64, ws_port: u16) -> anyhow::Result<()> #[cfg(not(feature = "servo-embed"))] { let _ = (app_id, session_id, ws_port); - println!("READY"); - use std::io::Write; - let _ = std::io::stdout().flush(); - std::thread::park(); - Ok(()) + anyhow::bail!("weft-app-shell was built without the servo-embed feature and cannot render") } } diff --git a/crates/weft-app-shell/src/shell_client.rs b/crates/weft-app-shell/src/shell_client.rs index 58d8918..3a66eb9 100644 --- a/crates/weft-app-shell/src/shell_client.rs +++ b/crates/weft-app-shell/src/shell_client.rs @@ -215,8 +215,4 @@ impl ShellClient { self.event_queue.flush().context("Wayland flush")?; Ok(!self.data.window_state.closed) } - - pub fn window_state(&self) -> &ShellWindowState { - &self.data.window_state - } } diff --git a/crates/weft-servo-shell/SERVO_PIN.md b/crates/weft-servo-shell/SERVO_PIN.md index a2b7100..928d56f 100644 --- a/crates/weft-servo-shell/SERVO_PIN.md +++ b/crates/weft-servo-shell/SERVO_PIN.md @@ -75,32 +75,64 @@ Install with: `sudo zypper install -y libglvnd-devel libopenssl-devel dbus-1-dev ## Rendering approach -Default: `SoftwareRenderingContext` (CPU rasterisation) blitted to a -`softbuffer`-backed winit window. +Each frame is painted with `WebView::paint` and then presented: -EGL path: set `WEFT_EGL_RENDERING=1` at runtime. The embedder attempts -`WindowRenderingContext::new` using the winit display and window handles. -If construction fails it falls back to software automatically. -When the EGL path is active Servo presents directly to the EGL surface via -surfman's `eglSwapBuffers`; the softbuffer blit is skipped. Mesa handles -DMA-BUF buffer sharing with the compositor transparently. +- **Software (default):** Servo renders into a `SoftwareRenderingContext`. + The host reads the painted frame back with `read_to_image`, presents the + context and copies the pixels into a persistent `softbuffer` surface on the + winit window. +- **EGL:** with `WEFT_EGL_RENDERING=1` the host creates a + `WindowRenderingContext` from winit's display and window handles and + presents it directly. If that fails it falls back to software. + +Neither host presents anything before Servo's first repaint request; the +first frames can still be blank or unstyled while the document loads. Both +enable Servo's `layout_grid_enabled` preference, because the system UI and +application pages use CSS Grid, which Servo disables by default. + +`weft-app-shell` prints `READY` after it presents a frame once the document +has loaded and Servo reports its rendering settled: on load completion it +requests `WebView::take_screenshot`, whose callback runs only after `load` has +fired in every frame, render-blocking resources, images and web fonts are done +and the rendering is up to date. `weft-appd` does not read this signal yet; it +treats the runtime's `READY` as session readiness. Neither host prints `READY` +when built without `servo-embed`; both exit with an error instead. + +`tests/frame/check_frame.py` checks this on a real display path: it runs +`weft-compositor` nested on Xvfb and checks the pixels each host presents for +`tests/frame/reference.html`. For the app host it requires the page on screen +within two seconds of `READY`; `--slow-style` delays a render-blocking +stylesheet that reveals the page, which makes premature readiness visible. A +build that printed `READY` on its first presented frame failed every +`--slow-style 4` run; that build was a local experiment, not part of history. ## Known limitations at this pin Status is stated against executed evidence; code that exists but has not been exercised is listed as unverified. -- **Embedder API**: both `weft-servo-shell` and `weft-app-shell` fail to compile - with `servo-embed` against this revision (keyboard events, mouse actions, - rendering readback, shutdown and window-handle APIs changed). Until they - build and present a frame, input forwarding, surface sharing and rendering - in the shells are unverified. +- **Verified rendering path:** both hosts present the reference page through + `weft-compositor`'s winit backend on Xvfb with Mesa 25.2.8 llvmpipe, using + the software path (Ubuntu 24.04, x86_64; `check_frame.py --host system`, + `--host app` and `--host app --slow-style 3`, five runs each). The EGL path, + DRM sessions, resize, output scale and idle wakeup are unverified. +- **Input:** keyboard and pointer events are forwarded through + `WebView::notify_input_event`; delivery through the compositor is + unverified. - **`backdrop-filter`**: the parsing (Stylo `f1ba496`) and rendering (Servo - `8e7dc40`, `f0bb1aa`) patches are selected by the lockfile. Rendering is - unverified until a pixel check passes on the shells. + `8e7dc40`, `f0bb1aa`) patches are selected by the lockfile; rendering is + unverified. +- **Resources:** the hosts install no Servo resource reader, so Servo logs + `Resource reader not set` and uses empty resources: the public suffix list, + HSTS preload list, Bluetooth blocklist, certificate and network error pages, + crash and directory-listing pages and media controls. Servo falls back to its + built-in placeholder image. +- **Window decorations:** `weft-compositor` offers no server-side decorations, + so winit draws a client-side title bar on both hosts' windows, including the + system panel. - **Shell surface association**: the shells pass winit's `wl_display` and `wl_surface` to `zweft_shell_manager_v1.create_window` through a shared - connection; unverified at this revision. + connection; unverified. - **WebGPU on Mesa**: not evaluated. - **Process separation**: each app runs as separate `weft-app-shell` and `weft-runtime` processes supervised by `weft-appd`. Separate processes alone diff --git a/crates/weft-servo-shell/src/embedder.rs b/crates/weft-servo-shell/src/embedder.rs index 6d7e875..e8c9a8c 100644 --- a/crates/weft-servo-shell/src/embedder.rs +++ b/crates/weft-servo-shell/src/embedder.rs @@ -1,20 +1,22 @@ -#![cfg(feature = "servo-embed")] - +use std::num::NonZeroU32; use std::path::{Path, PathBuf}; use std::rc::Rc; +use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, Mutex}; use servo::{ - EventLoopWaker, InputEvent, MouseButton as ServoMouseButton, MouseButtonAction, - MouseButtonEvent, MouseMoveEvent, ServoBuilder, ServoDelegate, ServoUrl, UserContentManager, + DeviceIntRect, DeviceIntSize, DevicePoint, EventLoopWaker, InputEvent, + MouseButton as ServoMouseButton, MouseButtonAction, MouseButtonEvent, MouseMoveEvent, + RenderingContext, RgbaImage, ServoBuilder, ServoDelegate, ServoUrl, UserContentManager, UserScript, WebViewBuilder, WebViewDelegate, }; use winit::{ application::ApplicationHandler, + dpi::PhysicalSize, event::{ElementState, MouseButton, WindowEvent}, event_loop::{ActiveEventLoop, EventLoop, EventLoopProxy}, keyboard::ModifiersState, - platform::wayland::{ActiveEventLoopExtWayland, WindowExtWayland}, + raw_window_handle::{HasDisplayHandle, HasWindowHandle, RawDisplayHandle, RawWindowHandle}, window::{Window, WindowAttributes, WindowId}, }; @@ -54,31 +56,114 @@ impl ServoDelegate for WeftServoDelegate { // ── WebView delegate ────────────────────────────────────────────────────────── +/// Frame and load progress reported by Servo, shared with the event loop. +#[derive(Default)] +struct FrameSignals { + /// A new frame is waiting to be painted. + redraw: AtomicBool, + /// Servo has requested at least one repaint. + content: AtomicBool, +} + struct WeftWebViewDelegate { - redraw_requested: Arc, + signals: Arc, } impl WebViewDelegate for WeftWebViewDelegate { fn notify_new_frame_ready(&self, _webview: servo::WebView) { - self.redraw_requested - .store(true, std::sync::atomic::Ordering::Relaxed); + self.signals.content.store(true, Ordering::Relaxed); + self.signals.redraw.store(true, Ordering::Relaxed); } } -// ── Rendering context abstraction (GAP-2) ─────────────────────────────────── +/// Servo preferences shared by the WEFT hosts. +fn host_preferences() -> servo::Preferences { + servo::Preferences { + // The system UI and application pages lay out with CSS Grid, which + // Servo disables by default. + layout_grid_enabled: true, + ..Default::default() + } +} + +// ── Rendering ─────────────────────────────────────────────────────────────── + +type BlitSurface = softbuffer::Surface, Arc>; enum RenderingCtx { - Software(Rc), + /// Servo renders offscreen; each frame is read back and copied to the window. + Software { + context: Rc, + surface: BlitSurface, + }, + /// Servo renders directly to the window's EGL surface. Egl(Rc), } impl RenderingCtx { - fn as_dyn(&self) -> Rc { + fn as_dyn(&self) -> Rc { match self { - Self::Software(rc) => Rc::clone(rc) as Rc, - Self::Egl(rc) => Rc::clone(rc) as Rc, + Self::Software { context, .. } => Rc::clone(context) as Rc, + Self::Egl(context) => Rc::clone(context) as Rc, } } + + /// Paints the webview into this context and presents the frame on the window. + fn paint_and_present(&mut self, webview: &servo::WebView) -> Result<(), String> { + match self { + Self::Software { context, surface } => { + context + .make_current() + .map_err(|e| format!("make_current: {e:?}"))?; + webview.paint(); + let size = context.size(); + let rect = DeviceIntRect::from_size(DeviceIntSize::new( + size.width as i32, + size.height as i32, + )); + let image = context.read_to_image(rect); + context.present(); + let image = image.ok_or("frame readback failed")?; + blit(surface, &image) + } + Self::Egl(context) => { + context + .make_current() + .map_err(|e| format!("make_current: {e:?}"))?; + webview.paint(); + context.present(); + Ok(()) + } + } + } +} + +/// Copies an RGBA frame into the window's software surface and presents it. +fn blit(surface: &mut BlitSurface, image: &RgbaImage) -> Result<(), String> { + let (width, height) = image.dimensions(); + let (Some(w), Some(h)) = (NonZeroU32::new(width), NonZeroU32::new(height)) else { + return Ok(()); + }; + surface.resize(w, h).map_err(|e| format!("resize: {e}"))?; + let mut buffer = surface.buffer_mut().map_err(|e| format!("buffer: {e}"))?; + for (dst, src) in buffer.iter_mut().zip(image.as_raw().chunks_exact(4)) { + *dst = u32::from(src[0]) << 16 | u32::from(src[1]) << 8 | u32::from(src[2]); + } + buffer.present().map_err(|e| format!("present: {e}")) +} + +/// Returns winit's `wl_display` and `wl_surface` pointers when running on Wayland. +fn wayland_handles( + event_loop: &ActiveEventLoop, + window: &Window, +) -> Option<(*mut std::ffi::c_void, *mut std::ffi::c_void)> { + let RawDisplayHandle::Wayland(display) = event_loop.display_handle().ok()?.as_raw() else { + return None; + }; + let RawWindowHandle::Wayland(surface) = window.window_handle().ok()?.as_raw() else { + return None; + }; + Some((display.display.as_ptr(), surface.surface.as_ptr())) } // ── Application state ───────────────────────────────────────────────────────── @@ -90,11 +175,11 @@ struct App { servo: Option, webview: Option, rendering_context: Option, - redraw_requested: Arc, + signals: Arc, waker: WeftEventLoopWaker, shutting_down: bool, modifiers: ModifiersState, - cursor_pos: servo::euclid::default::Point2D, + cursor_pos: DevicePoint, shell_client: Option, gesture_thread: Option>, } @@ -108,47 +193,37 @@ impl App { servo: None, webview: None, rendering_context: None, - redraw_requested: Arc::new(std::sync::atomic::AtomicBool::new(false)), + signals: Arc::default(), waker, shutting_down: false, modifiers: ModifiersState::default(), - cursor_pos: servo::euclid::default::Point2D::zero(), + cursor_pos: DevicePoint::origin(), shell_client: None, gesture_thread: None, } } - fn render_frame(window: &Arc, ctx: &RenderingCtx) { - match ctx { - RenderingCtx::Software(rc) => Self::blit_software(window, rc), - RenderingCtx::Egl(_) => {} + /// Paints and presents once Servo has requested its first repaint. + /// + /// Nothing is presented before that request; the first frames can still be + /// blank or unstyled while the document loads. + fn render_frame(&mut self) { + if !self.signals.content.load(Ordering::Relaxed) { + return; + } + let (Some(webview), Some(context)) = (&self.webview, &mut self.rendering_context) else { + return; + }; + if let Err(e) = context.paint_and_present(webview) { + tracing::warn!("frame not presented: {e}"); } } - fn blit_software(window: &Arc, rendering_context: &servo::SoftwareRenderingContext) { - let size = window.inner_size(); - let Some(pixels) = rendering_context.read_pixels() else { - return; - }; - let Ok(ctx) = softbuffer::Context::new(Arc::clone(window)) else { - tracing::warn!("softbuffer context creation failed; skipping frame"); - return; - }; - let Ok(mut surface) = softbuffer::Surface::new(&ctx, Arc::clone(window)) else { - tracing::warn!("softbuffer surface creation failed; skipping frame"); - return; - }; - let _ = surface.resize( - std::num::NonZeroU32::new(size.width).unwrap_or(std::num::NonZeroU32::MIN), - std::num::NonZeroU32::new(size.height).unwrap_or(std::num::NonZeroU32::MIN), - ); - let Ok(mut buf) = surface.buffer_mut() else { - return; - }; - for (dst, src) in buf.iter_mut().zip(pixels.chunks(4)) { - *dst = u32::from_be_bytes([0, src[0], src[1], src[2]]); - } - let _ = buf.present(); + /// Drops the webview and Servo; dropping the last `Servo` handle shuts it down. + fn shut_down(&mut self) { + self.shutting_down = true; + self.webview = None; + self.servo = None; } } @@ -170,18 +245,17 @@ impl ApplicationHandler for App { let size = window.inner_size(); self.window = Some(Arc::clone(&window)); - if self.shell_client.is_none() { - if let (Some(disp), Some(surf)) = - (event_loop.wayland_display(), window.wayland_surface()) - { - match crate::shell_client::ShellClient::connect_with_display(disp, surf) { - Ok(sc) => self.shell_client = Some(sc), - Err(e) => tracing::warn!(error = %e, "shell protocol unavailable"), - } + if self.shell_client.is_none() + && let Some((disp, surf)) = wayland_handles(event_loop, &window) + { + match crate::shell_client::ShellClient::connect_with_display(disp, surf) { + Ok(sc) => self.shell_client = Some(sc), + Err(e) => tracing::warn!(error = %e, "shell protocol unavailable"), } } let servo = ServoBuilder::default() + .preferences(host_preferences()) .event_loop_waker(Box::new(self.waker.clone())) .build(); @@ -205,10 +279,10 @@ impl ApplicationHandler for App { let webview = WebViewBuilder::new(&servo, rendering_context.as_dyn()) .delegate(Rc::new(WeftWebViewDelegate { - redraw_requested: Arc::clone(&self.redraw_requested), + signals: Arc::clone(&self.signals), })) .user_content_manager(Rc::clone(&user_content_manager)) - .url(self.url.clone()) + .url(self.url.clone().into_url()) .build(); self.servo = Some(servo); @@ -227,14 +301,10 @@ impl ApplicationHandler for App { event_loop.exit(); return; } + let mut compositor_closed = false; if let Some(sc) = &mut self.shell_client { match sc.dispatch_pending() { - Ok(false) => { - self.shutting_down = true; - if let Some(servo) = &self.servo { - servo.start_shutting_down(); - } - } + Ok(false) => compositor_closed = true, Err(e) => tracing::warn!("shell client dispatch error: {e}"), Ok(true) => {} } @@ -258,16 +328,18 @@ impl ApplicationHandler for App { } } } + if compositor_closed { + self.shut_down(); + event_loop.exit(); + return; + } if let Some(servo) = &self.servo { servo.spin_event_loop(); } - if self - .redraw_requested - .swap(false, std::sync::atomic::Ordering::Relaxed) + if self.signals.redraw.swap(false, Ordering::Relaxed) + && let Some(w) = &self.window { - if let Some(w) = &self.window { - w.request_redraw(); - } + w.request_redraw(); } } @@ -278,18 +350,13 @@ impl ApplicationHandler for App { event: WindowEvent, ) { match event { - WindowEvent::RedrawRequested => { - if let (Some(window), Some(servo)) = (&self.window, &self.servo) { - if let Some(rc) = &self.rendering_context { - Self::render_frame(window, rc); - } - servo.spin_event_loop(); - } - } + WindowEvent::RedrawRequested => self.render_frame(), WindowEvent::Resized(new_size) => { - let sz = servo::euclid::Size2D::new(new_size.width, new_size.height); + if new_size.width == 0 || new_size.height == 0 { + return; + } if let Some(wv) = &self.webview { - wv.resize(sz); + wv.resize(new_size); } } WindowEvent::ModifiersChanged(mods) => { @@ -302,10 +369,11 @@ impl ApplicationHandler for App { } } WindowEvent::CursorMoved { position, .. } => { - let pt = servo::euclid::default::Point2D::new(position.x as f32, position.y as f32); + let pt = DevicePoint::new(position.x as f32, position.y as f32); self.cursor_pos = pt; if let Some(wv) = &self.webview { - let _ = wv.notify_input_event(InputEvent::MouseMove(MouseMoveEvent::new(pt))); + let _ = wv + .notify_input_event(InputEvent::MouseMove(MouseMoveEvent::new(pt.into()))); } } WindowEvent::MouseInput { state, button, .. } => { @@ -316,22 +384,19 @@ impl ApplicationHandler for App { _ => return, }; let action = match state { - ElementState::Pressed => MouseButtonAction::Click, + ElementState::Pressed => MouseButtonAction::Down, ElementState::Released => MouseButtonAction::Up, }; if let Some(wv) = &self.webview { let _ = wv.notify_input_event(InputEvent::MouseButton(MouseButtonEvent::new( action, btn, - self.cursor_pos.cast_unit(), + self.cursor_pos.into(), ))); } } WindowEvent::CloseRequested => { - self.shutting_down = true; - if let Some(servo) = &self.servo { - servo.start_shutting_down(); - } + self.shut_down(); event_loop.exit(); } _ => {} @@ -344,7 +409,7 @@ impl ApplicationHandler for App { fn build_rendering_ctx( event_loop: &ActiveEventLoop, window: &Arc, - size: winit::dpi::PhysicalSize, + size: PhysicalSize, ) -> Option { if std::env::var_os("WEFT_EGL_RENDERING").is_some() { let display_handle = event_loop.display_handle(); @@ -356,16 +421,26 @@ fn build_rendering_ctx( return Some(RenderingCtx::Egl(Rc::new(rc))); } Err(e) => { - tracing::warn!("EGL rendering context failed ({e}), falling back to software"); + tracing::warn!( + "EGL rendering context failed ({e:?}), falling back to software" + ); } } } } - match servo::SoftwareRenderingContext::new(servo::euclid::Size2D::new(size.width, size.height)) - { - Ok(rc) => Some(RenderingCtx::Software(Rc::new(rc))), + let context = match servo::SoftwareRenderingContext::new(size) { + Ok(rc) => Rc::new(rc), Err(e) => { - tracing::error!("SoftwareRenderingContext failed: {e}"); + tracing::error!("SoftwareRenderingContext failed: {e:?}"); + return None; + } + }; + let surface = softbuffer::Context::new(Arc::clone(window)) + .and_then(|display| softbuffer::Surface::new(&display, Arc::clone(window))); + match surface { + Ok(surface) => Some(RenderingCtx::Software { context, surface }), + Err(e) => { + tracing::error!("software presentation surface failed: {e}"); None } } diff --git a/crates/weft-servo-shell/src/keyutils.rs b/crates/weft-servo-shell/src/keyutils.rs index c4fd87b..1665cb5 100644 --- a/crates/weft-servo-shell/src/keyutils.rs +++ b/crates/weft-servo-shell/src/keyutils.rs @@ -1,5 +1,3 @@ -#![cfg(feature = "servo-embed")] - use servo::{Code, Key, KeyState, KeyboardEvent, Location, Modifiers}; use winit::event::ElementState; use winit::keyboard::{Key as WinitKey, KeyLocation, ModifiersState, NamedKey, PhysicalKey}; @@ -14,10 +12,11 @@ pub fn keyboard_event_from_winit( }; let key = match &event.logical_key { + WinitKey::Named(NamedKey::Space) => Key::Character(" ".to_string()), WinitKey::Named(n) => Key::Named(named_key(*n)), - WinitKey::Character(c) => Key::Character(c.to_string().into()), - WinitKey::Unidentified(_) => Key::Unidentified, - WinitKey::Dead(c) => Key::Dead(*c), + WinitKey::Character(c) => Key::Character(c.to_string()), + WinitKey::Unidentified(_) => Key::Named(servo::NamedKey::Unidentified), + WinitKey::Dead(_) => Key::Named(servo::NamedKey::Dead), }; let code = match event.physical_key { @@ -46,15 +45,7 @@ pub fn keyboard_event_from_winit( mods |= Modifiers::META; } - KeyboardEvent { - state, - key, - code, - location, - modifiers: mods, - repeat: event.repeat, - is_composing: false, - } + KeyboardEvent::new_without_event(state, key, code, location, mods, event.repeat, false) } fn named_key(n: NamedKey) -> servo::NamedKey { @@ -74,7 +65,6 @@ fn named_key(n: NamedKey) -> servo::NamedKey { NamedKey::SymbolLock => S::SymbolLock, NamedKey::Enter => S::Enter, NamedKey::Tab => S::Tab, - NamedKey::Space => S::Space, NamedKey::ArrowDown => S::ArrowDown, NamedKey::ArrowLeft => S::ArrowLeft, NamedKey::ArrowRight => S::ArrowRight, diff --git a/crates/weft-servo-shell/src/shell_client.rs b/crates/weft-servo-shell/src/shell_client.rs index b57ab85..7af2270 100644 --- a/crates/weft-servo-shell/src/shell_client.rs +++ b/crates/weft-servo-shell/src/shell_client.rs @@ -239,10 +239,6 @@ impl ShellClient { Ok(!self.data.window_state.closed) } - pub fn window_state(&self) -> &ShellWindowState { - &self.data.window_state - } - pub fn take_pending_gestures(&mut self) -> Vec { std::mem::take(&mut self.data.pending_gestures) } diff --git a/docs/building.md b/docs/building.md index c282c5e..a6b8af0 100644 --- a/docs/building.md +++ b/docs/building.md @@ -34,7 +34,7 @@ cargo build -p weft-servo-shell cargo build -p weft-app-shell ``` -Without `--features servo-embed`, the servo-shell and app-shell stubs compile and print READY without running an actual WebView. This is the default and the CI baseline. +Without `--features servo-embed`, the servo-shell and app-shell binaries compile for type and lint checks but exit with an error at startup; they never report readiness. This is the default and the CI baseline. ## Servo embedding (optional, slow) @@ -45,6 +45,28 @@ cargo build -p weft-app-shell --features servo-embed This fetches and compiles the Servo and Stylo forks at the revisions recorded in `Cargo.lock` (see `crates/weft-servo-shell/SERVO_PIN.md`). Expect 30–60 minutes on a clean build. Servo's dependencies include SpiderMonkey (C++), which requires `clang` and `python3`. +## Frame check + +`tests/frame/check_frame.py` runs `weft-compositor` nested on Xvfb with the +winit backend, starts a Servo host showing `tests/frame/reference.html`, and +checks the presented pixels. It needs `Xvfb`, `xwd`, ImageMagick's `convert` +and a Mesa OpenGL driver (llvmpipe is sufficient). + +```sh +cargo build -p weft-compositor +cargo build -p weft-servo-shell -p weft-app-shell \ + --features weft-servo-shell/servo-embed,weft-app-shell/servo-embed +python3 tests/frame/check_frame.py --host system +python3 tests/frame/check_frame.py --host app +python3 tests/frame/check_frame.py --host app --slow-style 3 +``` + +`--host app` also requires the page on screen within two seconds of +`weft-app-shell` printing `READY`; `--slow-style` delays a stylesheet that +reveals the page so premature readiness becomes visible. + +Logs and the last capture are written to `target/frame-check`. + ## Demo apps (wasm32-wasip2) Each demo is a standalone crate in `examples/`. Pre-built `app.wasm` binaries are committed. To rebuild: diff --git a/tests/frame/check_frame.py b/tests/frame/check_frame.py new file mode 100644 index 0000000..eacce3f --- /dev/null +++ b/tests/frame/check_frame.py @@ -0,0 +1,370 @@ +"""Check that a Servo host paints and presents a known page through weft-compositor. + +The harness starts Xvfb, runs weft-compositor nested on it with the winit +backend, launches a Servo host as a Wayland client showing `reference.html`, +captures the X screen and checks the presented pixels: four solid quadrants +(red, green, blue, white) in the page's arrangement and dark text pixels +inside the white quadrant. It exits non-zero when the frame never appears or +does not match. + +`--host system` runs weft-servo-shell with the page as its system UI. +`--host app` installs the page as a package in a temporary app store and runs +weft-app-shell for it. The host must print READY, and the page must be on +screen within a short grace period after READY, because the compositor shows +a presented frame slightly later. READY printed within that grace before the +page is presented is therefore not detected. `--slow-style SECONDS` makes +early readiness observable: the page stays hidden until a stylesheet that a +local HTTP server delivers after the delay reveals it, so a host that reports +READY before the document has loaded shows no page within the grace period. + +Requires Xvfb, xwd and ImageMagick's convert. Processes are started from +argument arrays and are always terminated before the harness exits. +""" + +import argparse +import http.server +import os +import re +import shutil +import signal +import subprocess +import sys +import tempfile +import threading +import time +from pathlib import Path + + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +SCREEN = (1024, 768) +COLORS = { + "red": (255, 0, 0), + "green": (0, 255, 0), + "blue": (0, 0, 255), + "white": (255, 255, 255), +} +MIN_SIDE = 40 +MIN_TEXT_PIXELS = 30 +ANSI_ESCAPE = re.compile(r"\x1b\[[0-9;]*m") + + +def parse_ppm(data): + """Decode a binary P6 PPM into (width, height, bytes).""" + tokens = [] + index = 0 + while len(tokens) < 4: + while data[index:index + 1].isspace(): + index += 1 + if data[index:index + 1] == b"#": + index = data.index(b"\n", index) + 1 + continue + end = index + while not data[end:end + 1].isspace(): + end += 1 + tokens.append(data[index:end]) + index = end + magic, width, height, maxval = tokens + if magic != b"P6" or int(maxval) != 255: + raise ValueError("expected an 8-bit P6 image") + width, height = int(width), int(height) + pixels = data[index + 1:index + 1 + width * height * 3] + if len(pixels) != width * height * 3: + raise ValueError("truncated image") + return width, height, pixels + + +def bounding_box(width, height, pixels, color): + """Return (x0, y0, x1, y1) of pixels exactly matching color, or None.""" + target = bytes(color) + xs, ys = [], [] + for y in range(0, height, 2): + row = pixels[y * width * 3:(y + 1) * width * 3] + start = row.find(target) + while start != -1: + if start % 3 == 0: + xs.append(start // 3) + ys.append(y) + start = row.find(target, start + 3) + else: + # A match spanning two pixels; realign on the next byte. + start = row.find(target, start + 1) + if not xs: + return None + return min(xs), min(ys), max(xs), max(ys) + + +def dark_pixels(width, pixels, box): + x0, y0, x1, y1 = box + count = 0 + for y in range(y0, y1 + 1): + for x in range(x0, x1 + 1): + offset = (y * width + x) * 3 + if max(pixels[offset:offset + 3]) < 96: + count += 1 + return count + + +def evaluate(width, height, pixels): + """Return a list of problems with the captured frame; empty means it matches.""" + boxes = {name: bounding_box(width, height, pixels, color) for name, color in COLORS.items()} + problems = [f"no {name} region" for name, box in boxes.items() if box is None] + if problems: + return problems + for name, (x0, y0, x1, y1) in boxes.items(): + if x1 - x0 < MIN_SIDE or y1 - y0 < MIN_SIDE: + problems.append(f"{name} region too small: {x1 - x0 + 1}x{y1 - y0 + 1}") + red, green, blue, white = (boxes[n] for n in ("red", "green", "blue", "white")) + if not green[0] > red[2]: + problems.append("green is not right of red") + if not blue[1] > red[3]: + problems.append("blue is not below red") + if not (white[0] > blue[2] and white[1] > green[3]): + problems.append("white is not below green and right of blue") + if abs(red[1] - green[1]) > 4 or abs(red[0] - blue[0]) > 4: + problems.append("quadrants are not aligned") + text = dark_pixels(width, pixels, white) + if text < MIN_TEXT_PIXELS: + problems.append(f"no text in white region ({text} dark pixels)") + return problems + + +APP_ID = "org.weft.test.frame" +COMPOSITE_GRACE = 2.0 + + +def install_app(store, page): + """Install `page` as the UI entry of a minimal package and return the store root.""" + package = store / APP_ID + (package / "ui").mkdir(parents=True) + shutil.copyfile(page, package / "ui" / "index.html") + (package / "wapp.toml").write_text( + "[package]\n" + f'id = "{APP_ID}"\n' + 'name = "Frame reference"\n' + 'version = "0.0.0"\n' + "\n[runtime]\n" + 'module = "app.wasm"\n' + "\n[ui]\n" + 'entry = "ui/index.html"\n', + encoding="utf-8", + ) + return store + + +def slow_style_server(delay): + """Serve a stylesheet that reveals the page after `delay` seconds.""" + class Handler(http.server.BaseHTTPRequestHandler): + def do_GET(self): + time.sleep(delay) + body = b"body { visibility: visible; }" + self.send_response(200) + self.send_header("Content-Type", "text/css") + self.send_header("Content-Length", str(len(body))) + self.end_headers() + self.wfile.write(body) + + def log_message(self, *args): + pass + + server = http.server.ThreadingHTTPServer(("127.0.0.1", 0), Handler) + threading.Thread(target=server.serve_forever, daemon=True).start() + return server + + +def hidden_until_styled(page, destination, port): + """Copy `page`, hiding its body until the delayed stylesheet loads.""" + html = page.read_text(encoding="utf-8") + link = (f'\n' + f'\n') + if "" not in html: + raise ValueError(f"{page} has no ") + destination.write_text(html.replace("", link, 1), encoding="utf-8") + return destination + + +def capture(display): + xwd = subprocess.run(["xwd", "-root", "-silent", "-display", display], + capture_output=True, check=True, timeout=20) + ppm = subprocess.run(["convert", "xwd:-", "ppm:-"], input=xwd.stdout, + capture_output=True, check=True, timeout=20) + return ppm.stdout + + +def free_display(): + for number in range(90, 140): + if not Path(f"/tmp/.X11-unix/X{number}").exists() and \ + not Path(f"/tmp/.X{number}-lock").exists(): + return f":{number}" + raise RuntimeError("no free X display number") + + +def start(command, log, env): + return subprocess.Popen(command, stdout=log, stderr=subprocess.STDOUT, env=env, + start_new_session=True) + + +def signal_group(process, signum): + try: + os.killpg(process.pid, signum) + except ProcessLookupError: + pass + + +def stop(process): + """Terminate the process and everything left in its process group.""" + if process is None: + return + signal_group(process, signal.SIGTERM) + try: + process.wait(timeout=10) + except subprocess.TimeoutExpired: + signal_group(process, signal.SIGKILL) + process.wait(timeout=10) + signal_group(process, signal.SIGKILL) + + +def wait_for(predicate, timeout, interval=0.5): + deadline = time.monotonic() + timeout + while time.monotonic() < deadline: + result = predicate() + if result: + return result + time.sleep(interval) + return None + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument("--compositor", type=Path, + default=ROOT / "target/debug/weft-compositor") + parser.add_argument("--host", choices=("system", "app"), default="system") + parser.add_argument("--shell", type=Path, + help="host binary (default: target/debug/weft-servo-shell or " + "target/debug/weft-app-shell)") + parser.add_argument("--page", type=Path, default=HERE / "reference.html") + parser.add_argument("--slow-style", type=float, metavar="SECONDS", + help="hide the page until a stylesheet delayed by SECONDS loads") + parser.add_argument("--timeout", type=float, default=120.0, + help="seconds to wait for a matching frame") + parser.add_argument("--output", type=Path, default=ROOT / "target/frame-check", + help="directory for logs and the captured screenshot") + args = parser.parse_args(argv) + if args.shell is None: + name = "weft-servo-shell" if args.host == "system" else "weft-app-shell" + args.shell = ROOT / "target/debug" / name + + for tool in ("Xvfb", "xwd", "convert"): + if shutil.which(tool) is None: + print(f"missing required tool: {tool}", file=sys.stderr) + return 2 + for binary in (args.compositor, args.shell): + if not binary.is_file(): + print(f"missing binary: {binary}", file=sys.stderr) + return 2 + + args.output.mkdir(parents=True, exist_ok=True) + runtime = Path(tempfile.mkdtemp(prefix="weft-frame-")) + runtime.chmod(0o700) + display = free_display() + base_env = {key: value for key, value in os.environ.items() + if key not in ("DISPLAY", "WAYLAND_DISPLAY", "WAYLAND_SOCKET")} + base_env["XDG_RUNTIME_DIR"] = str(runtime) + base_env.setdefault("RUST_LOG", "info") + + page = args.page + style_server = None + if args.slow_style: + style_server = slow_style_server(args.slow_style) + page = hidden_until_styled(args.page, runtime / "page.html", + style_server.server_address[1]) + + processes = [] + logs = {name: open(args.output / f"{name}.log", "w", encoding="utf-8") + for name in ("xvfb", "compositor", "shell")} + try: + xvfb = start(["Xvfb", display, "-screen", "0", f"{SCREEN[0]}x{SCREEN[1]}x24", + "-nolisten", "tcp"], logs["xvfb"], base_env) + processes.append(xvfb) + if not wait_for(lambda: Path(f"/tmp/.X11-unix/X{display[1:]}").exists(), 15): + print("Xvfb did not start", file=sys.stderr) + return 1 + + compositor_env = dict(base_env, DISPLAY=display) + compositor = start([str(args.compositor), "--winit"], logs["compositor"], + compositor_env) + processes.append(compositor) + compositor_log = args.output / "compositor.log" + + def socket_name(): + if compositor.poll() is not None: + return "exited" + text = ANSI_ESCAPE.sub("", compositor_log.read_text(encoding="utf-8", + errors="replace")) + match = re.search(r'socket_name="([^"]+)"', text) + return match and match.group(1) + + socket = wait_for(socket_name, 30) + if socket in (None, "exited"): + print(f"compositor did not open a Wayland socket; see {compositor_log}", + file=sys.stderr) + return 1 + + shell_env = dict(base_env, WAYLAND_DISPLAY=socket) + if args.host == "system": + shell_env["WEFT_SYSTEM_UI_HTML"] = str(page.resolve()) + command = [str(args.shell)] + else: + shell_env["WEFT_APP_STORE"] = str(install_app(runtime / "store", page)) + command = [str(args.shell), APP_ID, "1"] + shell = start(command, logs["shell"], shell_env) + processes.append(shell) + shell_log = args.output / "shell.log" + + def ready_printed(): + text = shell_log.read_text(encoding="utf-8", errors="replace") + return any(line.strip() == "READY" for line in text.splitlines()) + + problems = ["no frame captured"] + screenshot = None + ready_at = None + deadline = time.monotonic() + args.timeout + while time.monotonic() < deadline: + if shell.poll() is not None: + problems = [f"shell exited with status {shell.returncode}"] + break + if args.host == "app" and ready_at is None and ready_printed(): + ready_at = time.monotonic() + ready = ready_at is not None + screenshot = capture(display) + problems = evaluate(*parse_ppm(screenshot)) + if ready and problems and time.monotonic() - ready_at > COMPOSITE_GRACE: + problems = [f"page not on screen {COMPOSITE_GRACE:g} s after READY"] + problems + break + if not problems and (args.host == "system" or ready): + break + if not problems: + problems = ["frame presented but READY not printed"] + time.sleep(1) + + if screenshot is not None: + (args.output / "frame.ppm").write_bytes(screenshot) + if problems: + print("frame check failed: " + "; ".join(problems), file=sys.stderr) + print(f"logs and last capture in {args.output}", file=sys.stderr) + return 1 + print(f"frame check passed; capture in {args.output / 'frame.ppm'}") + return 0 + finally: + for process in reversed(processes): + stop(process) + if style_server is not None: + style_server.shutdown() + for log in logs.values(): + log.close() + shutil.rmtree(runtime, ignore_errors=True) + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tests/frame/reference.html b/tests/frame/reference.html new file mode 100644 index 0000000..4428b86 --- /dev/null +++ b/tests/frame/reference.html @@ -0,0 +1,21 @@ + + + + +WEFT frame reference + + + +
+
+
+
WEFT
+ + From ae176aae93895c74c176e93df63f560d0e75cfdf Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Fri, 9 Oct 2026 01:18:53 +0000 Subject: [PATCH 4/7] test: verify native pointer and keyboard input through weft-compositor Nothing checked that input reaches a page through the compositor; the Servo hosts' input forwarding had only been compiled. tests/frame/check_input.py runs weft-servo-shell with tests/frame/input.html on the nested desktop and injects real X input with xdotool into weft-compositor's window. The compositor's winit backend routes it through its seat to the Wayland client, which has no X display. The page must react in its presented pixels: clicks 6 px either side of the boundary between its halves change only the half under the pointer, and the a and Shift+a key presses arrive with the right key value and modifier. The harness gives the compositor's X window input focus, as a window manager would; the client's keyboard focus comes from the compositor's click-to-focus. The nested desktop setup shared with check_frame.py moves to tests/frame/session.py. Xvfb now reports the display it picked through -displayfd, so concurrent runs cannot share an X server, and a run clears only the logs and capture it writes. Validation: - check_input.py: 3 of 3 runs pass; two concurrent runs pass - negative pages fail: no script; left click handled by the right half; an element extending the left half 20 px across the boundary; a key handler ignoring Shift - check_frame.py --host system, --host app, --host app --slow-style 3 pass after the refactor - unverified: key release and repeat, pointer motion and button release events, wheel, focus loss, non-US layouts, non-ASCII text, scale changes, weft-app-shell input --- crates/weft-servo-shell/SERVO_PIN.md | 13 +- docs/building.md | 10 + tests/frame/check_frame.py | 269 ++++++--------------------- tests/frame/check_input.py | 140 ++++++++++++++ tests/frame/input.html | 31 +++ tests/frame/session.py | 209 +++++++++++++++++++++ 6 files changed, 460 insertions(+), 212 deletions(-) create mode 100644 tests/frame/check_input.py create mode 100644 tests/frame/input.html create mode 100644 tests/frame/session.py diff --git a/crates/weft-servo-shell/SERVO_PIN.md b/crates/weft-servo-shell/SERVO_PIN.md index 928d56f..3b1ebfd 100644 --- a/crates/weft-servo-shell/SERVO_PIN.md +++ b/crates/weft-servo-shell/SERVO_PIN.md @@ -116,9 +116,16 @@ exercised is listed as unverified. the software path (Ubuntu 24.04, x86_64; `check_frame.py --host system`, `--host app` and `--host app --slow-style 3`, five runs each). The EGL path, DRM sessions, resize, output scale and idle wakeup are unverified. -- **Input:** keyboard and pointer events are forwarded through - `WebView::notify_input_event`; delivery through the compositor is - unverified. +- **Input:** `tests/frame/check_input.py` verifies, on the same nested + setup, that left clicks 6 px either side of a boundary reach the element + under the pointer, and that `a` and `Shift+a` key presses reach the page with + the right key value and modifier, using real X input that `weft-compositor` + routes to `weft-servo-shell` (three runs). The harness gives the compositor's + X window input focus, as a window manager would; the client's keyboard focus + comes from the compositor's click-to-focus. Unverified: key release and + repeat, pointer motion, enter/leave and button release events, other buttons, + wheel, focus loss, non-US layouts, non-ASCII text, scale changes and + `weft-app-shell` input. - **`backdrop-filter`**: the parsing (Stylo `f1ba496`) and rendering (Servo `8e7dc40`, `f0bb1aa`) patches are selected by the lockfile; rendering is unverified. diff --git a/docs/building.md b/docs/building.md index a6b8af0..ec8fab1 100644 --- a/docs/building.md +++ b/docs/building.md @@ -67,6 +67,16 @@ reveals the page so premature readiness becomes visible. Logs and the last capture are written to `target/frame-check`. +`tests/frame/check_input.py` uses the same nested desktop to send real X +pointer and keyboard input (with `xdotool`) through `weft-compositor` to +`weft-servo-shell` showing `tests/frame/input.html`, and checks that the +page reacts to clicks on either side of a boundary and to the `a` and +`Shift+a` keys. Logs and the last capture are written to `target/input-check`. + +```sh +python3 tests/frame/check_input.py +``` + ## Demo apps (wasm32-wasip2) Each demo is a standalone crate in `examples/`. Pre-built `app.wasm` binaries are committed. To rebuild: diff --git a/tests/frame/check_frame.py b/tests/frame/check_frame.py index eacce3f..8fd89a0 100644 --- a/tests/frame/check_frame.py +++ b/tests/frame/check_frame.py @@ -17,27 +17,22 @@ early readiness observable: the page stays hidden until a stylesheet that a local HTTP server delivers after the delay reveals it, so a host that reports READY before the document has loaded shows no page within the grace period. -Requires Xvfb, xwd and ImageMagick's convert. Processes are started from -argument arrays and are always terminated before the harness exits. +Requires Xvfb, xwd and ImageMagick's convert; see session.py. """ import argparse import http.server -import os -import re import shutil -import signal -import subprocess import sys -import tempfile import threading import time from pathlib import Path +sys.dont_write_bytecode = True +from session import ROOT, Desktop, SessionError, bounding_box, missing_tools, parse_ppm # noqa: E402 + HERE = Path(__file__).resolve().parent -ROOT = HERE.parents[1] -SCREEN = (1024, 768) COLORS = { "red": (255, 0, 0), "green": (0, 255, 0), @@ -46,52 +41,6 @@ COLORS = { } MIN_SIDE = 40 MIN_TEXT_PIXELS = 30 -ANSI_ESCAPE = re.compile(r"\x1b\[[0-9;]*m") - - -def parse_ppm(data): - """Decode a binary P6 PPM into (width, height, bytes).""" - tokens = [] - index = 0 - while len(tokens) < 4: - while data[index:index + 1].isspace(): - index += 1 - if data[index:index + 1] == b"#": - index = data.index(b"\n", index) + 1 - continue - end = index - while not data[end:end + 1].isspace(): - end += 1 - tokens.append(data[index:end]) - index = end - magic, width, height, maxval = tokens - if magic != b"P6" or int(maxval) != 255: - raise ValueError("expected an 8-bit P6 image") - width, height = int(width), int(height) - pixels = data[index + 1:index + 1 + width * height * 3] - if len(pixels) != width * height * 3: - raise ValueError("truncated image") - return width, height, pixels - - -def bounding_box(width, height, pixels, color): - """Return (x0, y0, x1, y1) of pixels exactly matching color, or None.""" - target = bytes(color) - xs, ys = [], [] - for y in range(0, height, 2): - row = pixels[y * width * 3:(y + 1) * width * 3] - start = row.find(target) - while start != -1: - if start % 3 == 0: - xs.append(start // 3) - ys.append(y) - start = row.find(target, start + 3) - else: - # A match spanning two pixels; realign on the next byte. - start = row.find(target, start + 1) - if not xs: - return None - return min(xs), min(ys), max(xs), max(ys) def dark_pixels(width, pixels, box): @@ -183,57 +132,6 @@ def hidden_until_styled(page, destination, port): return destination -def capture(display): - xwd = subprocess.run(["xwd", "-root", "-silent", "-display", display], - capture_output=True, check=True, timeout=20) - ppm = subprocess.run(["convert", "xwd:-", "ppm:-"], input=xwd.stdout, - capture_output=True, check=True, timeout=20) - return ppm.stdout - - -def free_display(): - for number in range(90, 140): - if not Path(f"/tmp/.X11-unix/X{number}").exists() and \ - not Path(f"/tmp/.X{number}-lock").exists(): - return f":{number}" - raise RuntimeError("no free X display number") - - -def start(command, log, env): - return subprocess.Popen(command, stdout=log, stderr=subprocess.STDOUT, env=env, - start_new_session=True) - - -def signal_group(process, signum): - try: - os.killpg(process.pid, signum) - except ProcessLookupError: - pass - - -def stop(process): - """Terminate the process and everything left in its process group.""" - if process is None: - return - signal_group(process, signal.SIGTERM) - try: - process.wait(timeout=10) - except subprocess.TimeoutExpired: - signal_group(process, signal.SIGKILL) - process.wait(timeout=10) - signal_group(process, signal.SIGKILL) - - -def wait_for(predicate, timeout, interval=0.5): - deadline = time.monotonic() + timeout - while time.monotonic() < deadline: - result = predicate() - if result: - return result - time.sleep(interval) - return None - - def main(argv=None): parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) @@ -255,115 +153,68 @@ def main(argv=None): name = "weft-servo-shell" if args.host == "system" else "weft-app-shell" args.shell = ROOT / "target/debug" / name - for tool in ("Xvfb", "xwd", "convert"): - if shutil.which(tool) is None: - print(f"missing required tool: {tool}", file=sys.stderr) - return 2 - for binary in (args.compositor, args.shell): - if not binary.is_file(): - print(f"missing binary: {binary}", file=sys.stderr) - return 2 + missing = missing_tools() + [str(b) for b in (args.compositor, args.shell) if not b.is_file()] + if missing: + print("missing: " + ", ".join(missing), file=sys.stderr) + return 2 - args.output.mkdir(parents=True, exist_ok=True) - runtime = Path(tempfile.mkdtemp(prefix="weft-frame-")) - runtime.chmod(0o700) - display = free_display() - base_env = {key: value for key, value in os.environ.items() - if key not in ("DISPLAY", "WAYLAND_DISPLAY", "WAYLAND_SOCKET")} - base_env["XDG_RUNTIME_DIR"] = str(runtime) - base_env.setdefault("RUST_LOG", "info") - - page = args.page style_server = None - if args.slow_style: - style_server = slow_style_server(args.slow_style) - page = hidden_until_styled(args.page, runtime / "page.html", - style_server.server_address[1]) - - processes = [] - logs = {name: open(args.output / f"{name}.log", "w", encoding="utf-8") - for name in ("xvfb", "compositor", "shell")} try: - xvfb = start(["Xvfb", display, "-screen", "0", f"{SCREEN[0]}x{SCREEN[1]}x24", - "-nolisten", "tcp"], logs["xvfb"], base_env) - processes.append(xvfb) - if not wait_for(lambda: Path(f"/tmp/.X11-unix/X{display[1:]}").exists(), 15): - print("Xvfb did not start", file=sys.stderr) - return 1 - - compositor_env = dict(base_env, DISPLAY=display) - compositor = start([str(args.compositor), "--winit"], logs["compositor"], - compositor_env) - processes.append(compositor) - compositor_log = args.output / "compositor.log" - - def socket_name(): - if compositor.poll() is not None: - return "exited" - text = ANSI_ESCAPE.sub("", compositor_log.read_text(encoding="utf-8", - errors="replace")) - match = re.search(r'socket_name="([^"]+)"', text) - return match and match.group(1) - - socket = wait_for(socket_name, 30) - if socket in (None, "exited"): - print(f"compositor did not open a Wayland socket; see {compositor_log}", - file=sys.stderr) - return 1 - - shell_env = dict(base_env, WAYLAND_DISPLAY=socket) - if args.host == "system": - shell_env["WEFT_SYSTEM_UI_HTML"] = str(page.resolve()) - command = [str(args.shell)] - else: - shell_env["WEFT_APP_STORE"] = str(install_app(runtime / "store", page)) - command = [str(args.shell), APP_ID, "1"] - shell = start(command, logs["shell"], shell_env) - processes.append(shell) - shell_log = args.output / "shell.log" - - def ready_printed(): - text = shell_log.read_text(encoding="utf-8", errors="replace") - return any(line.strip() == "READY" for line in text.splitlines()) - - problems = ["no frame captured"] - screenshot = None - ready_at = None - deadline = time.monotonic() + args.timeout - while time.monotonic() < deadline: - if shell.poll() is not None: - problems = [f"shell exited with status {shell.returncode}"] - break - if args.host == "app" and ready_at is None and ready_printed(): - ready_at = time.monotonic() - ready = ready_at is not None - screenshot = capture(display) - problems = evaluate(*parse_ppm(screenshot)) - if ready and problems and time.monotonic() - ready_at > COMPOSITE_GRACE: - problems = [f"page not on screen {COMPOSITE_GRACE:g} s after READY"] + problems - break - if not problems and (args.host == "system" or ready): - break - if not problems: - problems = ["frame presented but READY not printed"] - time.sleep(1) - - if screenshot is not None: - (args.output / "frame.ppm").write_bytes(screenshot) - if problems: - print("frame check failed: " + "; ".join(problems), file=sys.stderr) - print(f"logs and last capture in {args.output}", file=sys.stderr) - return 1 - print(f"frame check passed; capture in {args.output / 'frame.ppm'}") - return 0 + with Desktop(args.compositor, args.output, outputs=["frame.ppm"]) as desktop: + page = args.page + if args.slow_style: + style_server = slow_style_server(args.slow_style) + page = hidden_until_styled(args.page, desktop.runtime / "page.html", + style_server.server_address[1]) + if args.host == "system": + shell = desktop.launch_client( + "shell", [args.shell], {"WEFT_SYSTEM_UI_HTML": str(page.resolve())}) + else: + store = install_app(desktop.runtime / "store", page) + shell = desktop.launch_client( + "shell", [args.shell, APP_ID, "1"], {"WEFT_APP_STORE": str(store)}) + problems, screenshot = watch(desktop, shell, args) + except SessionError as error: + print(error, file=sys.stderr) + return 1 finally: - for process in reversed(processes): - stop(process) if style_server is not None: style_server.shutdown() - for log in logs.values(): - log.close() - shutil.rmtree(runtime, ignore_errors=True) + + if screenshot is not None: + (args.output / "frame.ppm").write_bytes(screenshot) + if problems: + print("frame check failed: " + "; ".join(problems), file=sys.stderr) + print(f"logs and last capture in {args.output}", file=sys.stderr) + return 1 + print(f"frame check passed; capture in {args.output / 'frame.ppm'}") + return 0 + + +def watch(desktop, shell, args): + """Capture until the frame matches, the host exits or the time runs out.""" + def ready_printed(): + return any(line.strip() == "READY" for line in desktop.log_text("shell").splitlines()) + + problems = ["no frame captured"] + screenshot = None + ready_at = None + deadline = time.monotonic() + args.timeout + while time.monotonic() < deadline: + if shell.poll() is not None: + return [f"shell exited with status {shell.returncode}"], screenshot + if args.host == "app" and ready_at is None and ready_printed(): + ready_at = time.monotonic() + screenshot = desktop.capture() + problems = evaluate(*parse_ppm(screenshot)) + if ready_at is not None and problems and time.monotonic() - ready_at > COMPOSITE_GRACE: + return [f"page not on screen {COMPOSITE_GRACE:g} s after READY"] + problems, screenshot + if not problems and (args.host == "system" or ready_at is not None): + return [], screenshot + if not problems: + problems = ["frame presented but READY not printed"] + time.sleep(1) + return problems, screenshot if __name__ == "__main__": diff --git a/tests/frame/check_input.py b/tests/frame/check_input.py new file mode 100644 index 0000000..950d989 --- /dev/null +++ b/tests/frame/check_input.py @@ -0,0 +1,140 @@ +"""Check that native pointer and keyboard input reaches a page through weft-compositor. + +The harness runs weft-servo-shell with `input.html` on a nested desktop (see +session.py) and injects real X input into the compositor's window with +xdotool (after giving that window X input focus, since Xvfb runs without a +window manager), which weft-compositor's winit backend receives and routes to +the focused Wayland client. Each step must change the page as the page's script +defines, as seen in the presented pixels: + +1. A click 6 px inside the left half's right edge turns only the left half + green; the right half must stay blue. +2. Typing `a` turns the right half yellow. +3. Typing `Shift+a` turns the right half magenta, which checks the modifier. +4. A click 6 px inside the right half's left edge turns the right half white. + +The two clicks straddle the boundary between the halves, so a pointer +position that is scaled or offset by more than a few pixels fails. + +Requires Xvfb, xwd, ImageMagick's convert and xdotool. +""" + +import argparse +import shutil +import subprocess +import sys +import time +from pathlib import Path + +sys.dont_write_bytecode = True +from session import ROOT, Desktop, SessionError, bounding_box, missing_tools, parse_ppm # noqa: E402 + + +HERE = Path(__file__).resolve().parent +RED, GREEN, BLUE = (255, 0, 0), (0, 255, 0), (0, 0, 255) +WHITE, YELLOW, MAGENTA = (255, 255, 255), (255, 255, 0), (255, 0, 255) +MIN_SIDE = 40 + + +def region(screenshot, color): + """Bounding box of `color` if it covers a page half, else None.""" + box = bounding_box(*parse_ppm(screenshot), color) + if box and box[2] - box[0] >= MIN_SIDE and box[3] - box[1] >= MIN_SIDE: + return box + return None + + +STARTUP_TIMEOUT = 120.0 +EDGE_INSET = 6 + + +class Steps: + def __init__(self, desktop, shell, timeout): + self.desktop = desktop + self.shell = shell + self.timeout = timeout + self.screenshot = None + self.xdotool_path = shutil.which("xdotool") + + def expect(self, description, present, absent=(), timeout=None): + """Wait until every colour in `present` and none in `absent` is shown.""" + deadline = time.monotonic() + (self.timeout if timeout is None else timeout) + while time.monotonic() < deadline: + if self.shell.poll() is not None: + raise AssertionError(f"shell exited with status {self.shell.returncode}") + self.screenshot = self.desktop.capture() + boxes = {color: region(self.screenshot, color) for color in present} + if all(boxes.values()) and not any(region(self.screenshot, c) for c in absent): + return boxes + time.sleep(0.5) + raise AssertionError(f"{description}: expected page state not shown") + + def xdotool(self, *arguments): + subprocess.run([self.xdotool_path, *arguments], env={"DISPLAY": self.desktop.display}, + check=True, timeout=20) + + def click(self, x, y): + self.xdotool("mousemove", "--sync", str(x), str(y)) + self.xdotool("click", "1") + + +def run(steps): + boxes = steps.expect("initial page", [RED, BLUE], timeout=STARTUP_TIMEOUT) + # Xvfb runs without a window manager, so give the compositor's window the + # X input focus that a real session's window manager would. + steps.xdotool("search", "--class", "weft-compositor", "windowfocus", "--sync") + left, right = boxes[RED], boxes[BLUE] + middle = (left[1] + left[3]) // 2 + steps.click(left[2] - EDGE_INSET, middle) + steps.expect("click near the right edge of the left half", [GREEN, BLUE], + absent=[RED, WHITE]) + steps.xdotool("key", "a") + steps.expect("key a", [GREEN, YELLOW], absent=[BLUE]) + steps.xdotool("key", "shift+a") + steps.expect("key Shift+a", [GREEN, MAGENTA], absent=[YELLOW]) + steps.click(right[0] + EDGE_INSET, middle) + steps.expect("click near the left edge of the right half", [GREEN, WHITE], + absent=[MAGENTA, RED]) + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument("--compositor", type=Path, default=ROOT / "target/debug/weft-compositor") + parser.add_argument("--shell", type=Path, default=ROOT / "target/debug/weft-servo-shell") + parser.add_argument("--page", type=Path, default=HERE / "input.html") + parser.add_argument("--timeout", type=float, default=30.0, + help="seconds to wait for each expected page state") + parser.add_argument("--output", type=Path, default=ROOT / "target/input-check", + help="directory for logs and the last capture") + args = parser.parse_args(argv) + + missing = missing_tools() + [tool for tool in ("xdotool",) if shutil.which(tool) is None] + missing += [str(b) for b in (args.compositor, args.shell) if not b.is_file()] + if missing: + print("missing: " + ", ".join(missing), file=sys.stderr) + return 2 + + try: + with Desktop(args.compositor, args.output, outputs=["input.ppm"]) as desktop: + shell = desktop.launch_client("shell", [args.shell], + {"WEFT_SYSTEM_UI_HTML": str(args.page.resolve())}) + steps = Steps(desktop, shell, args.timeout) + try: + run(steps) + except AssertionError as failure: + print(f"input check failed: {failure}", file=sys.stderr) + print(f"logs and last capture in {args.output}", file=sys.stderr) + return 1 + finally: + if steps.screenshot is not None: + (args.output / "input.ppm").write_bytes(steps.screenshot) + except SessionError as error: + print(error, file=sys.stderr) + return 1 + print("input check passed") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tests/frame/input.html b/tests/frame/input.html new file mode 100644 index 0000000..b0bf76c --- /dev/null +++ b/tests/frame/input.html @@ -0,0 +1,31 @@ + + + + +WEFT input reference + + + +
+ + + + diff --git a/tests/frame/session.py b/tests/frame/session.py new file mode 100644 index 0000000..0b45837 --- /dev/null +++ b/tests/frame/session.py @@ -0,0 +1,209 @@ +"""Nested WEFT desktop for graphical tests: Xvfb, weft-compositor and Wayland clients. + +`Desktop` starts Xvfb and weft-compositor with its winit backend, launches +clients on the compositor's Wayland socket, captures the X screen and +terminates every process it started when the `with` block ends. Processes are +started from argument arrays in their own process groups. +""" + +import os +import re +import shutil +import signal +import subprocess +import tempfile +import time +from pathlib import Path + + +ROOT = Path(__file__).resolve().parents[2] +SCREEN = (1024, 768) +ANSI_ESCAPE = re.compile(r"\x1b\[[0-9;]*m") +REQUIRED_TOOLS = ("Xvfb", "xwd", "convert") + + +class SessionError(Exception): + """The nested desktop could not be started.""" + + +def parse_ppm(data): + """Decode a binary P6 PPM into (width, height, bytes).""" + tokens = [] + index = 0 + while len(tokens) < 4: + while data[index:index + 1].isspace(): + index += 1 + if data[index:index + 1] == b"#": + index = data.index(b"\n", index) + 1 + continue + end = index + while not data[end:end + 1].isspace(): + end += 1 + tokens.append(data[index:end]) + index = end + magic, width, height, maxval = tokens + if magic != b"P6" or int(maxval) != 255: + raise ValueError("expected an 8-bit P6 image") + width, height = int(width), int(height) + pixels = data[index + 1:index + 1 + width * height * 3] + if len(pixels) != width * height * 3: + raise ValueError("truncated image") + return width, height, pixels + + +def bounding_box(width, height, pixels, color): + """Return (x0, y0, x1, y1) of pixels exactly matching color, or None.""" + target = bytes(color) + xs, ys = [], [] + for y in range(0, height, 2): + row = pixels[y * width * 3:(y + 1) * width * 3] + start = row.find(target) + while start != -1: + if start % 3 == 0: + xs.append(start // 3) + ys.append(y) + start = row.find(target, start + 3) + else: + # A match spanning two pixels; realign on the next byte. + start = row.find(target, start + 1) + if not xs: + return None + return min(xs), min(ys), max(xs), max(ys) + + +def pixel(width, pixels, x, y): + offset = (y * width + x) * 3 + return tuple(pixels[offset:offset + 3]) + + +def missing_tools(): + return [tool for tool in REQUIRED_TOOLS if shutil.which(tool) is None] + + +def wait_for(predicate, timeout, interval=0.5): + deadline = time.monotonic() + timeout + while time.monotonic() < deadline: + result = predicate() + if result: + return result + time.sleep(interval) + return None + + +def _signal_group(process, signum): + try: + os.killpg(process.pid, signum) + except ProcessLookupError: + pass + + +def _stop(process): + """Terminate the process and everything left in its process group.""" + _signal_group(process, signal.SIGTERM) + try: + process.wait(timeout=10) + except subprocess.TimeoutExpired: + _signal_group(process, signal.SIGKILL) + process.wait(timeout=10) + _signal_group(process, signal.SIGKILL) + + +class Desktop: + """Xvfb plus weft-compositor; logs are written to `output/.log`.""" + + def __init__(self, compositor, output, outputs=()): + """`outputs` names further files in `output` that this run will write.""" + self.compositor = Path(compositor) + self.output = Path(output) + self.own_outputs = ["xvfb.log", "compositor.log", "shell.log", *outputs] + self.processes = [] + self.logs = {} + + def __enter__(self): + self.output.mkdir(parents=True, exist_ok=True) + for name in self.own_outputs: + (self.output / name).unlink(missing_ok=True) + self.runtime = Path(tempfile.mkdtemp(prefix="weft-desktop-")) + self.runtime.chmod(0o700) + self.env = {key: value for key, value in os.environ.items() + if key not in ("DISPLAY", "WAYLAND_DISPLAY", "WAYLAND_SOCKET")} + self.env["XDG_RUNTIME_DIR"] = str(self.runtime) + self.env.setdefault("RUST_LOG", "info") + try: + self._start_display() + self._start_compositor() + except BaseException: + self.__exit__(None, None, None) + raise + return self + + def __exit__(self, *exc): + for process in reversed(self.processes): + _stop(process) + for log in self.logs.values(): + log.close() + shutil.rmtree(self.runtime, ignore_errors=True) + return False + + def launch(self, name, command, env=None): + """Start a process with its output in `.log`.""" + log = open(self.output / f"{name}.log", "w", encoding="utf-8") + self.logs[name] = log + process = subprocess.Popen([str(part) for part in command], stdout=log, + stderr=subprocess.STDOUT, env=dict(self.env, **(env or {})), + start_new_session=True) + self.processes.append(process) + return process + + def launch_client(self, name, command, env=None): + """Start a Wayland client of the compositor.""" + return self.launch(name, command, dict(env or {}, WAYLAND_DISPLAY=self.socket)) + + def log_text(self, name): + text = (self.output / f"{name}.log").read_text(encoding="utf-8", errors="replace") + return ANSI_ESCAPE.sub("", text) + + def capture(self): + """Return the X screen as a P6 PPM.""" + xwd = subprocess.run(["xwd", "-root", "-silent", "-display", self.display], + capture_output=True, check=True, timeout=20) + ppm = subprocess.run(["convert", "xwd:-", "ppm:-"], input=xwd.stdout, + capture_output=True, check=True, timeout=20) + return ppm.stdout + + def _start_display(self): + # Xvfb picks a free display itself and writes its number to the pipe + # once it accepts connections, so concurrent runs cannot share one. + read_end, write_end = os.pipe() + log = open(self.output / "xvfb.log", "w", encoding="utf-8") + self.logs["xvfb"] = log + try: + xvfb = subprocess.Popen( + ["Xvfb", "-displayfd", str(write_end), "-screen", "0", + f"{SCREEN[0]}x{SCREEN[1]}x24", "-nolisten", "tcp"], + stdout=log, stderr=subprocess.STDOUT, env=self.env, + start_new_session=True, pass_fds=(write_end,)) + finally: + os.close(write_end) + self.processes.append(xvfb) + with os.fdopen(read_end) as reported: + number = reported.readline().strip() + if not number.isdigit() or xvfb.poll() is not None: + raise SessionError("Xvfb did not start") + self.display = f":{number}" + + def _start_compositor(self): + compositor = self.launch("compositor", [self.compositor, "--winit"], + {"DISPLAY": self.display}) + + def socket_name(): + if compositor.poll() is not None: + return "exited" + match = re.search(r'socket_name="([^"]+)"', self.log_text("compositor")) + return match and match.group(1) + + socket = wait_for(socket_name, 30) + if socket in (None, "exited"): + raise SessionError("compositor did not open a Wayland socket; see " + f"{self.output / 'compositor.log'}") + self.socket = socket From 1e19326d3953440a231ea8b08cbd3ff6e2ea7b5f Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Thu, 8 Oct 2026 22:58:47 +0000 Subject: [PATCH 5/7] fix(compositor): collapse nested submit condition in winit backend The nested if around backend.submit failed clippy::collapsible_if under -D warnings, breaking the linux-only clippy job. Use a let chain instead. --- crates/weft-compositor/src/backend/winit.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/weft-compositor/src/backend/winit.rs b/crates/weft-compositor/src/backend/winit.rs index 087b04c..7575211 100644 --- a/crates/weft-compositor/src/backend/winit.rs +++ b/crates/weft-compositor/src/backend/winit.rs @@ -157,10 +157,8 @@ pub fn run() -> anyhow::Result<()> { false } }; - if render_ok { - if let Err(e) = backend.submit(Some(&[full_damage])) { - tracing::warn!(?e, "backend submit failed"); - } + if render_ok && let Err(e) = backend.submit(Some(&[full_damage])) { + tracing::warn!(?e, "backend submit failed"); } state.space.elements().for_each(|window| { From 29a7f6f50845f2a137e3702950c60a67542644f6 Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Fri, 9 Oct 2026 08:16:59 +0000 Subject: [PATCH 6/7] ci: build and test on Linux only WEFT OS targets Linux and systemd. The Windows runner only compiled and tested the crates without Linux system libraries, which says nothing about a supported configuration, and was the slowest job in every run. The job is now `portable` on Ubuntu, matching the verification profile of the same name. The building guide, README and development environment notes now state that builds are validated on Linux only. --- .github/workflows/ci.yml | 16 +++++----------- README.md | 2 +- docs/building.md | 4 ++-- infra/vm/linux-dev-environment.md | 2 +- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c131fe..ab8c084 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,15 +7,9 @@ on: pull_request: jobs: - # Crates that must compile on every supported host platform. - cross-platform: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: - - ubuntu-latest - - windows-latest + # Crates that build without Wayland or other Linux system libraries. + portable: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable @@ -24,14 +18,14 @@ jobs: components: rustfmt, clippy - name: cargo fmt run: cargo fmt --all --check - - name: cargo clippy (cross-platform crates) + - name: cargo clippy (portable crates) run: > cargo clippy --workspace --exclude weft-compositor --exclude weft-servo-shell --exclude weft-app-shell --all-targets -- -D warnings - - name: cargo test (cross-platform crates) + - name: cargo test (portable crates) run: > cargo test --workspace --exclude weft-compositor diff --git a/README.md b/README.md index ae036f9..8bd1cbb 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ See `docs/building.md` for full instructions including Wasm component builds, Ni Three jobs on every push and pull request: -- `cross-platform` — fmt, clippy, tests on Ubuntu and Windows +- `portable` — fmt, clippy and tests for the crates that need no Linux system libraries - `linux-only` — clippy and tests for compositor and shell crates - `servo-embed-linux` — `cargo check --features servo-embed` for both servo crates diff --git a/docs/building.md b/docs/building.md index 96f1359..91eca21 100644 --- a/docs/building.md +++ b/docs/building.md @@ -2,7 +2,7 @@ ## Prerequisites -Linux (x86_64 or aarch64). Building on Windows is supported for workspace validation only; runtime components require Linux kernel interfaces. +Linux (x86_64 or aarch64). WEFT OS is built and validated on Linux only; runtime components require Linux kernel interfaces. System packages (openSUSE): @@ -92,6 +92,6 @@ See `infra/nixos/weft-packages.nix` for the package derivations. The `outputHash Three jobs run on every push to `main` and on pull requests: -- `cross-platform` — fmt, clippy, tests on Ubuntu and Windows (excludes Wayland crates) +- `portable` — fmt, clippy, tests for the crates that need no Linux system libraries (excludes Wayland crates) - `linux-only` — clippy and tests for `weft-compositor`, `weft-servo-shell`, `weft-app-shell` - `servo-embed-linux` — `cargo check --features servo-embed` for servo-shell and app-shell diff --git a/infra/vm/linux-dev-environment.md b/infra/vm/linux-dev-environment.md index 22784b5..877ef94 100644 --- a/infra/vm/linux-dev-environment.md +++ b/infra/vm/linux-dev-environment.md @@ -22,7 +22,7 @@ The guest is the validation target for: ## Host versus target boundary -The Windows host is acceptable for editing, documentation, and workspace validation. +The Windows host is acceptable for editing and documentation. Builds and tests are validated on Linux only; CI does not build on Windows. The Linux guest is authoritative for: From b0bd763e704aac3609d4a542b4780be08e2cbe4c Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Thu, 8 Oct 2026 22:58:47 +0000 Subject: [PATCH 7/7] fix(compositor): collapse nested submit condition in winit backend The nested if around backend.submit failed clippy::collapsible_if under -D warnings, breaking the linux-only clippy job. Use a let chain instead. --- crates/weft-compositor/src/backend/winit.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/weft-compositor/src/backend/winit.rs b/crates/weft-compositor/src/backend/winit.rs index 087b04c..7575211 100644 --- a/crates/weft-compositor/src/backend/winit.rs +++ b/crates/weft-compositor/src/backend/winit.rs @@ -157,10 +157,8 @@ pub fn run() -> anyhow::Result<()> { false } }; - if render_ok { - if let Err(e) = backend.submit(Some(&[full_damage])) { - tracing::warn!(?e, "backend submit failed"); - } + if render_ok && let Err(e) = backend.submit(Some(&[full_damage])) { + tracing::warn!(?e, "backend submit failed"); } state.space.elements().for_each(|window| {