4.1 KiB
WebKit embedding spike (D-033, in progress)
WIP state (2026-11-13, stopped for the usage limit)
Done
- Read: CLAUDE.md, HANDOFF "Orchestrator resume (2026-11-13)", D-032,
engine-comparison.md,docs/engine/tune/(check jsons + samples),tools/engine-test/webkit_shell.py. Not yet read:docs/engine/servo-removal.md(baa3b7f; 4 open decisions: ad-block interception, cookie encryption, profile dir rename, Media Session/MPRIS). - Tuning data, all-tabs-idle row (PSS / tree VRAM): base 2989 / 1562 MB; no-page-cache 2414 / 1019; mem500 2377 / 1139; cache-viewer 2816 / 873; hw-never 2298 / 58 (JS checks fail: "Unsupported result type"); related 2933 / 1380. Base WebKitGTK plays the YouTube watch page (t=14.8 s, readyState 4) in the tune runs; the blank tabs of the first comparison run were a shell problem.
- System:
webkitgtk-6.02.54.2,gtk44.24.1,libadwaita1.10 installed.wpewebkit2.54.2 in extra, not installed (provides libWPEWebKit-2.0, no libwpe/wpebackend-fdo dependency = new WPE Platform API; needs the user'ssudo pacman -S wpewebkit, not asked yet). niri exposeszwlr_virtual_pointer_manager_v1,zwp_input_method_manager_v2,zwp_text_input_manager_v3,zwp_virtual_keyboard_manager_v1;wtype,grimpresent. - Crates (pinned in the spike):
gtk4 =0.11.5(feature v4_20),webkit6 =0.6.1(feature v2_52; latest, no v2_54 feature),egui/egui_glow =0.37.0,glow =0.17.0,wayland-client =0.31.15,wayland-protocols-wlr/-misc =0.3.12. No usable Rust crate for WPE Platform 2.x (would need gir/bindgen). - Spike code
spikes/webkit-egui/(own Cargo workspace and target/), builds, never run yet:src/egui_area.rs:Gtk.GLAreasubclass painting egui with egui_glow (GL via eglGetProcAddress), transparent clear;contains()takes the pointer only outside egui's page rect or over an egui Area, so GTK's pick falls through to the WebView for page input; GTK motion/click/scroll/key controllers +IMMulticontext→ egui events.src/main.rs: Gtk.Overlay { Gtk.Fixed { Gtk.Stack of WebViews moved/sized to egui's page rect }, EguiArea }; egui toolbar (tabs, back/forward/reload, URL field, ⋮ flyout over the page), egui context menu from WebKit'scontext-menusignal, popups viacreate(related view → new tab), Web Inspector, zoom, capture-phase Ctrl+L/T. D-032 knobs on by default (page cache off, 500 MB memory limit, DOCUMENT_VIEWER); env knobs in the file header. Driver:SPIKE_CMD=<file>command file (open/go/tab/menu/js/shot/stats/pick/state/focus/sleep/mark/quit);stats= GTK frame-clock pacing + egui render ms.src/bin/wl-input.rs: real compositor input for tests:wl-input DP-1 move|click|scroll …,ime TEXT [secs](test input method: preedit, then commit).
Design leaning: (b) GTK 4 host. WebKitGTK gives input, IME, scroll, dialogs, printing, Web Inspector natively, has maintained Rust bindings, and egui keeps drawing all chrome through the overlay; winit is replaced by GTK events in app.rs (egui-winit → own GTK→egui input glue as in egui_area.rs). WPE would need hand-written bindings, our own input translation and frame import, and has no Inspector UI. Unproven until the spike runs: GLArea transparency over the WebView, pick fall-through, frame pacing with video under the overlay.
Exact next step: ask the orchestrator/user how to run visibly (the user rejected a run that switched DP-1 to an
empty workspace and maximized the window; options: visible without moving focus, or hidden nested
kwin_wayland --virtual). Then run spikes/webkit-egui/target/release/webkit-egui with a throwaway HOME and
SPIKE_CMD, YouTube watch page: shots (toolbar, ⋮ flyout over playing video, context menu), pick toolbar vs page,
stats during playback (with and without SPIKE_EGUI=0), wl-input click/scroll/right click/IME into URL field and a
page input, popup, two tabs; RAM via tools/engine-test/sample.py; Chromium reference shot in the browser pane
(D-031). Then finish this doc + D-033, pull, read servo-removal.md, plan-generate → Plans/08 WebKit engine/ (S044+).