webkit-spike: hidden run result, D-035..D-040, plans 08 WebKit engine S044-S055
GTK 4 host + transparent egui GLArea over WebKitGTK proven hidden (Xvfb + nested niri): pick fall-through, real input and IME, egui menus over video, pacing equal with and without the overlay. Spike fixes: IM client widget, wl-input Y flip, SPIKE_EGUI=0 layout, URL trim. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
parent
b6a5a21481
commit
63b39d7b7e
7 changed files with 640 additions and 16 deletions
|
|
@ -38,3 +38,9 @@
|
|||
- D-032 — 2026-11-13 — Engine switch: Nacre drops Servo and moves to a tuned WebKit (WebKitGTK 6.0 or WPE WebKit 2.54, picked by the 08 spike), Linux only (no Windows builds). Widevine comes later as its own plan (user downloads Google's CDM on first use, never bundled). Reason: engine test (docs/engine/engine-comparison.md, docs/engine/tune/): Servo fails heavy sites (YouTube, Discord, icons); WebKit tuned is at or below Chromium's RAM (2.4–2.5 GB vs 3.3 GB at 10 tabs with page cache off / memory limit) and its VRAM drops with a lighter cache model; WebKit has EME, Web Inspector, mature media. Dropped plans: S011, S029, S030, S032, S033, S037, S038 (Servo-specific; site passes/perf get new WebKit plans). The egui UI, stores, net bridge, ad blocker and nacre:// pages stay. Servo glue (hub.rs, window.rs, vendor/servo-*, gst_mse patches) is removed once WebKit glue works. Supersedes D-028/D-029 order. — user, 2026-11-13 — every remaining plan
|
||||
- D-033 — 2026-11-13 — Engine host: WebKitGTK 6.0 (installed) in a GTK4 window with Nacre's egui UI over/around the WebKit views (spike design (b), `spikes/webkit-egui/`). No WPE WebKit comparison. — user, 2026-11-13 ("keep webkit normally") — 08 WebKit engine plans
|
||||
- D-034 — 2026-11-13 — Unattended run (user asleep): spike and 08 plans run their GUI tests hidden in a nested `kwin_wayland --virtual` (or Xvfb via smoke.sh), never on DP-1, so nothing switches the user's workspace or steals focus; visible runs only when the user is awake and asked. Orchestrator decides recommended options alone (no 🧑 plans run tonight). User goal restated: after the WebKit switch Nacre keeps today's look (egui Material You chrome), then the UI is cleaned up and animated (S039 motion, S043 refine). — orchestrator for the user, 2026-11-13 ("do what you think is best … it should look how it is now, UI needs to be fixed, animations and cleanness") — 08 plans, S039, S043
|
||||
- D-035 — 2026-11-13 — Spike result (extends D-033): the GTK 4 host works — egui in a transparent `Gtk.GLArea` over the WebKitGTK views, GTK's pick sends input to egui only where egui draws, the page gets click/wheel/right click/typing/IME natively, pacing is identical with and without the overlay (`docs/engine/webkit-spike.md`). egui's own IME needs `IMMulticontext::set_client_widget`. GPU path still unproven (hidden runs are software GL). Hidden GUI tests use **Xvfb + a nested niri** (winit backend on X11; `spikes/webkit-egui/run/`), not `kwin_wayland` (not installed): software GL with `LIBGL_ALWAYS_SOFTWARE=1 WEBKIT_DMABUF_RENDERER_FORCE_SHM=1 GSK_RENDERER=gl`, `WL_INPUT_FLIP_Y=1`, short runtime dir; GPU checks only in visible runs (D-034). — orchestrator's session, 2026-11-13 (user asleep, recommended options) — 08 WebKit engine plans, smoke harness
|
||||
- D-036 — 2026-11-13 — Ad blocking on WebKit: network rules compiled to WebKit content filters (`WebKitUserContentFilterStore`, Apple content-blocker JSON from adblock-rust's `content-blocking` conversion), stored once and shared by every web process; cosmetic filters stay page script/user style sheets. A small web process extension (cdylib loaded via `WebContext` extensions dir) does only what filters can't: DNT/Sec-GPC/Save-Data headers, redirect resources (→ `nacre-resource:` URI scheme), tracking-param strip on subresources, blocked counts/network log back to the UI. No adblock engine inside web processes (RAM per process). — content filters run inside WebKit with no IPC per request; an engine per web process would multiply RAM — S049, S050
|
||||
- D-037 — 2026-11-13 — Cookies at rest on WebKit (keeps D-019's rule "never plain on disk"): WebKit's SQLite cookie store lives in the per-run `$XDG_RUNTIME_DIR` (tmpfs, 0700) via `CookieManager::set_persistent_storage`; Nacre fills it from the sealed `cookies.bin` at start and seals it back (D-019 key, XChaCha20-Poly1305) at quit and every 60 s after a cookie change. No keyring → cookies for the run only, as before. Servo-era `cookies.bin` is converted when it parses, else moved aside. — keeps encryption without patching WebKit; tmpfs never touches the disk — S051
|
||||
- D-038 — 2026-11-13 — Profile folder `nacre-servo` → `nacre-browser` (config, data, cache): on first start, if `nacre-browser` is missing and `nacre-servo` exists, it is renamed (one move, logged); Servo-only engine files inside are deleted after the move. `~/.config/nacre` belongs to the Python Nacre and is never touched (the importer reads it). — engine name out of the path; `nacre` is taken by the original — S051
|
||||
- D-039 — 2026-11-13 — Media on WebKit: Nacre's page-script media probe (`inject.rs` `media.*`, mediaSession hook) stays the one source for the new tab card, Discord and MPRIS; WebKit's `is-playing-audio` and `set_is_muted` replace the mute script. If WebKitGTK publishes its own MPRIS player it is not left as a second player (turned off or Nacre's skipped, whichever the plan finds possible; one player only). — one engine-neutral source already feeds three features — S051, S013
|
||||
- D-040 — 2026-11-13 — WebKit tuning defaults (D-032 data, `docs/engine/tune/`): page cache off, memory pressure limit 500 MB per web process, cache model `DocumentViewer`, hardware acceleration policy default (on demand; `never` broke JS checks), related views only for pop-ups. Env overrides for tests (`NACRE_WK_PAGE_CACHE`, `NACRE_WK_MEM_LIMIT`, `NACRE_WK_CACHE_MODEL`, `NACRE_WK_HW`). — lowest PSS/VRAM in the tune runs without failed sites — S052
|
||||
|
|
|
|||
|
|
@ -342,6 +342,14 @@ Later: S010 list: user checks the Discord icon with their own client (the Discor
|
|||
- Removed: `tools/wpt-mse.sh`, `tests/wpt-mse/` (Servo MSE conformance, nothing else used them) and their CLAUDE.md/DESIGN.md mentions.
|
||||
- Not done (on purpose): src/, Cargo.toml, vendor/, build.rs, gst-mse tools and MSE/painter smoke scripts stay until the WebKit glue builds. No cargo run.
|
||||
|
||||
## webkit-spike — GTK 4 host + egui overlay over WebKitGTK, result (D-033/D-035, 2026-11-13)
|
||||
- Done: spike run hidden (Xvfb + nested niri, software GL; kwin_wayland not installed) on YouTube watch, Wikipedia, DuckDuckGo: egui flyout over a playing video, GTK pick routes egui vs page right, real click/wheel/right click/typing/IME reach the page natively; egui context menu from WebKit's hit test opens links in tabs; window.open → tab. Details and numbers: `docs/engine/webkit-spike.md`.
|
||||
- Pacing identical with/without the overlay (29.6 vs 29.4 fps, llvmpipe cap; 628 video frames, 0 dropped); egui 65 renders/15 s, 0.46 ms p50; overlay +~20 MB PSS (1310 vs 1287 MB, one YouTube tab).
|
||||
- Spike fixes: egui IME needs `IMMulticontext::set_client_widget`; `wl-input` `WL_INPUT_FLIP_Y=1` (nested niri mirrors Y); `SPIKE_EGUI=0` layout; URL trim. Harness: `spikes/webkit-egui/run/`.
|
||||
- Decisions D-035 (result + hidden harness), D-036 ad block, D-037 cookies, D-038 profile `nacre-browser`, D-039 media, D-040 tuning.
|
||||
- Plans `08 WebKit engine` S044–S055 written, in INDEX before the other open plans, tracker seeded.
|
||||
- Not proven: GPU/dmabuf path and 60 fps under the overlay (needs a visible run), Web Inspector, full screen, file chooser, HiDPI.
|
||||
|
||||
## Later
|
||||
- Turnstile widget paints as a black half-disc (Servo painting of its iframe/shadow DOM, S006 site doctor).
|
||||
- Google sign-in past the email step: press Next with a real account, by the user (S006).
|
||||
|
|
|
|||
BIN
docs/engine/spike/ctx_link.jpg
Normal file
BIN
docs/engine/spike/ctx_link.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 140 KiB |
BIN
docs/engine/spike/ctxmenu.jpg
Normal file
BIN
docs/engine/spike/ctxmenu.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 155 KiB |
BIN
docs/engine/spike/flyout.jpg
Normal file
BIN
docs/engine/spike/flyout.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 201 KiB |
BIN
docs/engine/spike/ime_preedit_url.png
Normal file
BIN
docs/engine/spike/ime_preedit_url.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2 KiB |
|
|
@ -1,8 +1,71 @@
|
|||
# WebKit embedding spike (D-033, in progress)
|
||||
# WebKit embedding spike (D-033)
|
||||
|
||||
## WIP state (2026-11-13, stopped for the usage limit)
|
||||
## Result (2026-11-13): design (b) works
|
||||
|
||||
**Done**
|
||||
Nacre's chrome as a transparent egui `Gtk.GLArea` over WebKitGTK 6.0 views in a GTK 4 window holds up: egui draws
|
||||
over a playing video, GTK's own pick sends pointer input to egui only where egui has something, everything else
|
||||
reaches WebKit natively (click, wheel, right click, typing, IME), and egui costs almost nothing per frame. D-033
|
||||
stands. The GPU path was not exercised (see Unproven).
|
||||
|
||||
### How it was run (D-034: hidden)
|
||||
`kwin_wayland` is not installed (no sway/weston/cage either), so the hidden session is **Xvfb + a nested niri**:
|
||||
niri's winit backend runs as an X11 client of Xvfb and gives a private Wayland socket with the same protocols the
|
||||
user's niri has (wlr virtual pointer, input-method-v2, virtual keyboard, screencopy for `grim`). Scripts:
|
||||
`spikes/webkit-egui/run/` (`nested.sh start|stop`, `spike.sh`, `seq*.sh`; outputs in `$SPIKE_RUN`, default
|
||||
`/tmp/webkit-spike`). Quirks, all handled there:
|
||||
- Xvfb has no DRI3, so the nested niri renders with llvmpipe and cannot import GPU dmabufs (it died on the first
|
||||
WebKit frame). Clients run with software GL too: `LIBGL_ALWAYS_SOFTWARE=1 WEBKIT_DMABUF_RENDERER_FORCE_SHM=1
|
||||
GSK_RENDERER=gl`. The nested output (`winit`, 1280x800 @ 60 Hz) caps painting at ~30 fps with llvmpipe.
|
||||
- The nested winit output mirrors absolute virtual-pointer Y: `WL_INPUT_FLIP_Y=1` in `wl-input`.
|
||||
- The Wayland socket path must be short (`SUN_LEN`): runtime dir `/run/user/<uid>/nsp`.
|
||||
- `NIRI_SOCKET` from the user's session must be overridden, or `niri msg` talks to the real compositor.
|
||||
- Private bus via `dbus-run-session`; `GTK_A11Y=none NO_AT_BRIDGE=1 GDK_DEBUG=no-portals` keep a11y/portal noise out.
|
||||
|
||||
### Checks (YouTube watch `aqz-KE-bpKQ`, Wikipedia, DuckDuckGo, example.com; real compositor input)
|
||||
| Check | Result |
|
||||
|---|---|
|
||||
| egui flyout over a playing video, transparent elsewhere | yes (`docs/engine/spike/flyout.jpg`) |
|
||||
| `pick` (GTK's hit test): toolbar, open flyout → `NacreEguiArea`; page, and page under a closed flyout → `WebKitWebView` | yes, all 8 points |
|
||||
| real click on page | starts YouTube playback; clicks on recommendations navigate |
|
||||
| real click on an egui flyout item over the page | "Zoom in" applied (zoom 1.1), page got nothing |
|
||||
| wheel over page | `scrollY` 0 → 410 after 5 notches |
|
||||
| right click on YouTube's video | YouTube's own player menu at the pointer (`ctxmenu.jpg`), as in Chromium |
|
||||
| right click on a link elsewhere | WebKit `context-menu` signal (hit test gives the link) → egui menu at the pointer (`ctx_link.jpg`); its "Open link in new tab" opens tab 2 |
|
||||
| typing (virtual keyboard) into the egui URL field + Enter | navigates |
|
||||
| typing into a page textarea (DuckDuckGo) | `abc ` arrives |
|
||||
| IME preedit + commit into a page textarea | native WebKit: `abc 日本語` (preedit visible in the value during composition) |
|
||||
| IME into the egui URL field | first failed (no text-input-v3 enabled); fixed by `IMMulticontext::set_client_widget` (+ cursor location from egui's `platform_output.ime`); then preedit and commit reach egui (`ime_preedit_url.png`; CJK shows as boxes only because the spike's egui has no CJK font, Nacre's font setup has) |
|
||||
| `window.open` | opens as a new tab through `create` with a related view; clicking tab 0 switches back |
|
||||
| video | readyState 4; 628 frames, 0 dropped in 21 s of playback (YouTube served 30 fps) |
|
||||
|
||||
### Pacing and memory (one YouTube tab playing, 15 s window, software GL)
|
||||
| | egui overlay on | `SPIKE_EGUI=0` |
|
||||
|---|---|---|
|
||||
| window frames / fps | 450 / 29.6 | 444 / 29.4 |
|
||||
| frame interval p50 / p95 / max | 33 / 50 / 50 ms | 33 / 50 / 50 ms |
|
||||
| egui renders in 15 s, render ms p50 / p95 | 65, 0.46 / 0.60 ms | — |
|
||||
| video frames / dropped | 628 / 0 | 628 / 0 |
|
||||
| tree PSS median / max (`sample.py`, ~21 processes incl. bwrap sandboxes) | 1310 / 1437 MB | 1287 / 1517 MB |
|
||||
| tree CPU median (% of one core) | 204 % | 188 % |
|
||||
|
||||
egui only repaints on its own events (no repaint per video frame), so the overlay costs no extra frames, ~20 MB of PSS
|
||||
and some llvmpipe compositing of the full-window GLArea texture (+16 % of a core in software; should be far less on
|
||||
the GPU). Pacing is identical with and without the overlay.
|
||||
|
||||
### Fixed in the spike during the run
|
||||
`wl-input` Y flip switch; IM client widget + cursor location; URL field input trimmed; with `SPIKE_EGUI=0` the
|
||||
WebView stack is the overlay's child (a `Gtk.Fixed` child kept its 0x0 natural size).
|
||||
|
||||
### Unproven (carry into the 08 plans)
|
||||
- **GPU path**: dmabuf frames from WebKit composited under the GLArea, 60 fps video with the overlay, VRAM. Needs a
|
||||
run on the real GPU: visible on DP-1 when the user is awake (D-034), or `SMOKE_VISIBLE=1` in the ported harness.
|
||||
- Web Inspector window, fullscreen, file chooser / dialogs, several windows, HiDPI scale > 1, drag and drop,
|
||||
Ctrl+L/T capture keys while the page has focus (code present, not exercised).
|
||||
- egui needs the GLArea to repaint on its own animations (`repaint_delay` timer, present) — the S039 motion work
|
||||
relies on that; check animation smoothness once Nacre's chrome runs on it.
|
||||
|
||||
## Background
|
||||
**Setup (session 1)**
|
||||
- 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).
|
||||
|
|
@ -17,7 +80,7 @@
|
|||
- 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**:
|
||||
- Spike code `spikes/webkit-egui/` (own Cargo workspace and target/):
|
||||
- `src/egui_area.rs`: `Gtk.GLArea` subclass 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.
|
||||
|
|
@ -36,10 +99,3 @@ app.rs (egui-winit → own GTK→egui input glue as in egui_area.rs). WPE would
|
|||
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+).
|
||||
|
|
|
|||
Loading…
Reference in a new issue