Nacre/Plans/08 WebKit engine/S048-ui-callbacks.md
astar76 72709e07b9 S048: WebKit UI callbacks: pop-ups, dialogs, context menu, permissions, full screen, Web Inspector, PiP
- Pop-ups as related-view tabs; a blocked one's URL opens on "Allow"
- Closing a tab runs beforeunload (try_close, 3 s fallback); HTTP sign-in checked
- egui takes the pointer over the page while a dialog or menu is open; colour picker closes on Escape/outside
- Permission reasons recomputed for WebKit; media stream/WebRTC on; saved notification answers given to WebKit
- Notifications no longer dropped after a non-remembered allow
- F12 opens Web Inspector; nacre://devtools lists tabs and remote inspection (D-046); console/network page removed
- PiP moves the tab's own view into the PiP window and back (no reload)
- Smokes: dialogs, basics extended; pip.txt, auth.txt (server /auth), visible-ui.txt

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-13 08:03:51 -06:00

3.2 KiB

S048 — WebKit UI callbacks: pop-ups, dialogs, menus, permissions, full screen, inspector, PiP

Category 08 WebKit engine · Model: Opus · Effort: high · Depends on: S047 · Size: L · Human: no · cargo (main target/) Files touched: src/engine/, src/app.rs (on_create_new, on_permission, on_control, on_notification, fullscreen, PiP), src/tabs.rs, src/ui/{dialogs,menus,mod}.rs, src/ui/pages/devtools.rs, src/store/permissions.rs (unavailable()), tests/smoke/{dialogs,basics,integ-}.txt

Goal

Every engine request that needs the UI goes through Nacre's egui: pop-ups as tabs/windows (related views), alert/ confirm/prompt/beforeunload, file chooser, colour chooser, <select> (show-option-menu), Nacre's own context menu (context-menu + hit test → PageMenu), permission requests → store::permissions, HTTP auth, notifications, full screen, Web Inspector (replaces the Servo devtools pages), PiP by moving the view (state kept).

Read

  • docs/engine/servo-removal.md §3.2 (all request/show rows), §3.10, §3.12 (ui/menus.rs, ui/dialogs.rs, permissions reasons).
  • spikes/webkit-egui/src/main.rs (connect_create, connect_context_menu), src/app.rs on_create_new/on_permission/on_control, src/ui/menus.rs PageMenu, src/ui/dialogs.rs header.

Steps

  • create → actions::on_navigation pop-up rules → related view as tab or pop-up window; close signal.
  • run-dialog (alert/confirm/prompt/before-unload) and authenticate → tabs::Dialog egui dialogs, answered asynchronously.
  • run-file-chooser (rfd/portal as today), run-color-chooser, show-option-menu → existing egui pickers positioned at the element rect.
  • context-menu → PageMenu (link/image/selection/editable from HitTestResult), actions via execute_editing_command + Nacre actions; WebKit's own menu suppressed.
  • permission-request (geolocation, notifications, user media, device info, pointer lock, clipboard, media key system → "later" for Widevine) → store::permissions; recompute unavailable() reasons for WebKit (remove the Servo 0.7 texts).
  • show-notification → system notification; enter/leave-fullscreen → window full screen and chrome hidden.
  • Web Inspector (enable-developer-extras, inspector window attached/detached); nacre://devtools console/network either fed from WebKit or replaced by an "Open Web Inspector" page — pick the smaller, record in PROGRESS.
  • PiP: move the playing view into the PiP window and back (no reload); check page state stays.
  • Smoke: dialogs.txt, basics.txt (pop-ups, full screen), PiP steps green hidden; shots of each dialog Read.
  • PROGRESS entry, INDEX line, tracker, commit S048: …, push.

End criteria

  • cargo test green; dialogs.txt and basics.txt exit 0 hidden; a shot of the egui context menu over a page and of a file chooser request Read.

Pitfalls

  • Signal handlers must return quickly; keep the request object (ScriptDialog, PermissionRequest, FileChooserRequest) alive until the egui answer.
  • create must return the new view synchronously.

Handoff (→ PROGRESS.md)

Which requests are wired, which show "unavailable" and why.