S045: YouTube plays after a real click in the hidden run; address field lets go when a page takes focus
The hidden click landed on <html> because YouTube keeps its main thread busy ~7 s after load and swaps its skeleton for the player meanwhile; web.txt now clicks once the point hits #movie_player. focus_page drops egui's text focus and attaches the view first; new foreground web tabs, tab switches and new views use it. Selftest status gets ui_typing and page_focused. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
parent
bff018bcfc
commit
4eeb72a25a
9 changed files with 43 additions and 20 deletions
|
|
@ -23,8 +23,8 @@ egui's page rect }, EguiArea }`, today's egui Material You chrome drawn unchange
|
|||
- [x] Keys: GTK key events → `keys.rs` (rename `to_servo` → `to_page`/drop), capture-phase shortcuts so Ctrl+L/T/W/Tab work while the page has focus; page keys go to WebKit natively.
|
||||
- [x] Page actions: load, back/forward, reload/hard reload, **stop** (new), zoom, show/hide on tab switch; `ui/chrome.rs load_estimate` uses real progress.
|
||||
- [x] `nice cargo build --release -j 2` green (fix compile errors in place); `nice cargo test --release -j 2` green.
|
||||
- [ ] Hidden check with the spike harness (`spikes/webkit-egui/run/nested.sh`, adapt `spike.sh` to run `target/release/nacre` with a throwaway home): new tab page, https://en.wikipedia.org/wiki/Web_browser, YouTube watch plays after a click; `grim` shots of chrome dark/light next to a pre-switch shot of the same page (`target/smoke` from an older launch run, or check out the last Servo commit's shots in PROGRESS) — Read them, list differences.
|
||||
- [ ] PROGRESS entry (what is stubbed for S047/S048: dialogs, pop-ups, menus, permissions, scripts), INDEX line, tracker, commit `S045: …`, push.
|
||||
- [x] Hidden check with the spike harness (`spikes/webkit-egui/run/nested.sh`, adapt `spike.sh` to run `target/release/nacre` with a throwaway home): new tab page, https://en.wikipedia.org/wiki/Web_browser, YouTube watch plays after a click; `grim` shots of chrome dark/light next to a pre-switch shot of the same page (`target/smoke` from an older launch run, or check out the last Servo commit's shots in PROGRESS) — Read them, list differences.
|
||||
- [x] PROGRESS entry (what is stubbed for S047/S048: dialogs, pop-ups, menus, permissions, scripts), INDEX line, tracker, commit `S045: …`, push.
|
||||
|
||||
## End criteria
|
||||
- `cargo tree -i servo` fails (no Servo in the graph); release build and `cargo test` green.
|
||||
|
|
@ -39,10 +39,9 @@ egui's page rect }, EguiArea }`, today's egui Material You chrome drawn unchange
|
|||
## Handoff (→ PROGRESS.md)
|
||||
Where each `Event` comes from; what is stubbed; how to run Nacre hidden until S046 lands.
|
||||
|
||||
## WIP state / resume at (2026-11-13)
|
||||
Boxes 1–9 done (commit 6c748ba + fixes). Box 10: run `HIDDEN_TIMEOUT=400 tools/hidden.sh tests/hidden/web.txt "" -- tests/hidden/web-driver.sh`
|
||||
(outdir default target/hidden/web-<time>): Wikipedia, new tab, tabs pass; YouTube renders but the real click on the player
|
||||
(410,450 → page 402,354) dispatches to `<html>` and the video stays paused (`clicks.json`). Resume there: check
|
||||
`document.elementFromPoint(402,354)` and the player's layout/hit test (privacy/cosmetic scripts off as a variant), then
|
||||
finish box 10 and box 11 (INDEX line, tracker done).
|
||||
|
||||
## Result (2026-11-13)
|
||||
Box 10 done: `tools/hidden.sh tests/hidden/basic.txt` and `HIDDEN_TIMEOUT=400 tools/hidden.sh tests/hidden/web.txt "" -- tests/hidden/web-driver.sh`
|
||||
pass (YouTube `currentTime` 3.7 s after the real click). The earlier miss was timing, not hit testing: YouTube keeps the
|
||||
page's main thread busy ~7 s after load (software GL; same with the ad blocker, cosmetic filter, memory limit or cache model off) and swaps
|
||||
its skeleton for the player meanwhile, so the click landed on `<html>`; web.txt now waits until the point hits
|
||||
`#movie_player`. Focus fix: `BrowserWindow::focus_page` drops egui's text focus and attaches the view first.
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ Engine switch to WebKit (D-032): new category `08 WebKit engine` comes first; Se
|
|||
|
||||
## 08 WebKit engine
|
||||
- [x] [S044 — Engine seam: pure logic out of the Servo files](08%20WebKit%20engine/S044-engine-seam.md) · Opus medium
|
||||
- [ ] [S045 — GTK 4 host with the egui overlay; WebKitGTK views; Servo out of the build](08%20WebKit%20engine/S045-gtk-host.md) · Opus high
|
||||
- [x] [S045 — GTK 4 host with the egui overlay; WebKitGTK views; Servo out of the build](08%20WebKit%20engine/S045-gtk-host.md) · Opus high
|
||||
- [ ] [S046 — Smoke harness and selftest on the GTK host (hidden nested niri)](08%20WebKit%20engine/S046-smoke-harness.md) · Opus medium
|
||||
- [ ] [S047 — Page scripts, page messages, find and JS on WebKit](08%20WebKit%20engine/S047-page-channel.md) · Opus medium
|
||||
- [ ] [S048 — WebKit UI callbacks: pop-ups, dialogs, menus, permissions, full screen, inspector, PiP](08%20WebKit%20engine/S048-ui-callbacks.md) · Opus high
|
||||
|
|
|
|||
|
|
@ -356,14 +356,14 @@ Later: S010 list: user checks the Discord icon with their own client (the Discor
|
|||
- Verified: release build green, `cargo test` 74 green (was 70), smokes launch, basics, input, net-adblock, net-privacy exit 0 (hidden, Servo).
|
||||
- Not done here: boxes 3–5 (ViewId, neutral payload types, selftest) moved to S045 (D-041).
|
||||
|
||||
## S045 — GTK 4 host, WebKitGTK views, Servo out (2026-11-13, WIP: box 10 open)
|
||||
- Done: `src/engine/` (ViewId, neutral Event payloads, NetworkSession/WebContext/Settings per profile, one WebView per tab, signals → Event), `src/egui_area.rs` (spike + clipboard, cursor, HiDPI, focus), GTK `App` (Rc<RefCell>, idle pump, 100 ms tick), GTK capture-phase shortcuts, stop/reload/zoom/back-forward, real load progress; Servo, winit, gilrs, gst rpath out (`cargo tree -i servo` fails).
|
||||
- Verified: release build + `cargo test` 73 green; hidden runs (`tools/hidden.sh`, new): `tests/hidden/basic.txt` (new tab, chrome dark/light, tabs open/switch/close, offline) and `web.txt` (Wikipedia renders under the chrome, YouTube renders) — shots read.
|
||||
- Shots vs Servo `target/smoke/chrome5`: chrome identical (tabs, toolbar, bookmarks bar, card corners, fonts); differences: the address field keeps focus (ring) after opening a tab; page text 1 px higher; no media button (old run's state); output 1280x800 vs 820.
|
||||
- Fixed on the way: repaints asked for during an egui render were lost (UI froze); a `Gtk.Fixed` size request grew the window; views after the first got a NaN zoom without a desktop font DPI (blank pages); shots need a persistent WidgetPaintable.
|
||||
- Not done (box 10): YouTube does not start after a real wl-input click on the player: the click reaches the page at the right point (402,354) but its target is `<html>` (hit test finds no element) — next step: elementFromPoint there, compare with the Servo-free spike (which played).
|
||||
- Stubbed for S047/S048: picture in picture (toast), page `rclick`/`pagescroll`/`pagetype` in selftest go through page JS, request policy `net::policy::decide` and ad-block request blocking not wired (cosmetic/page scripts only), cookie persistence (S051), `Shortcut` per-app window class, console messages from pages.
|
||||
- Later: system dark detection may be polluted by Nacre's own prefer-dark setting; Wikipedia stays light with Nacre dark (check prefers-color-scheme).
|
||||
## S045 — GTK 4 host, WebKitGTK views, Servo out (2026-11-13)
|
||||
- Done: `src/engine/` (ViewId, neutral Event payloads, NetworkSession/WebContext/Settings per profile, one WebView per tab, signals → Event), `src/egui_area.rs` (spike + clipboard, cursor, HiDPI, focus), GTK `App` (Rc<RefCell>, idle pump, 100 ms tick), capture-phase shortcuts, stop/reload/zoom/back-forward, real load progress; Servo, winit, gilrs, gst rpath out (`cargo tree -i servo` fails).
|
||||
- Verified: release build + `cargo test` 73 green; `tools/hidden.sh tests/hidden/basic.txt` (new tab, chrome dark/light, tabs open/switch/close, focus status) and `web.txt` + `web-driver.sh` (Wikipedia under the chrome; YouTube `currentTime` 3.7 after a real wl-input click, media button and tab speaker show) — shots read.
|
||||
- YouTube "click hit `<html>`": YouTube keeps the page's main thread busy ~7 s after load in the hidden session (software GL; same with ad blocker/cosmetic/memory limit/cache model off) and swaps its skeleton for the player meanwhile; web.txt now clicks once the point hits `#movie_player`.
|
||||
- Fixed: the address field kept egui focus (ring) after a new tab's page opened: `focus_page` drops egui text focus, attaches the view first; new foreground web tabs, tab switches and new views call it.
|
||||
- Shots vs Servo `target/smoke/chrome5`: chrome identical; page text 1 px higher; output 1280x800 vs 820. Media button was only absent while paused.
|
||||
- Stubbed for S047/S048: picture in picture (toast), selftest `rclick`/`pagescroll`/`pagetype` via page JS, request policy `net::policy::decide` and ad-block request blocking not wired (cosmetic/page scripts only), cookie persistence (S051), `Shortcut` per-app window class, console messages.
|
||||
- Later: Wikipedia stays light with Nacre dark: prefers-color-scheme does follow Nacre (checked), Wikipedia's own Appearance shows "Light" (its default); system dark detection may still be polluted by Nacre's own prefer-dark. `navigation_action().frame_name()` is the target name, not "subframe" — check iframe navigations don't reach `on_navigation` as main-frame (S047/S048).
|
||||
|
||||
## Later
|
||||
- Turnstile widget paints as a black half-disc (Servo painting of its iframe/shadow DOM, S006 site doctor).
|
||||
|
|
|
|||
|
|
@ -1006,6 +1006,8 @@ impl App {
|
|||
win.ui.omnibox_edit = None;
|
||||
if win.tab().is_some_and(|t| t.page == Some(Page::NewTab)) {
|
||||
win.ui.focus_omnibox = true;
|
||||
} else if win.tab().is_some_and(|t| t.page.is_none()) {
|
||||
win.focus_page();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1049,6 +1051,12 @@ impl App {
|
|||
}
|
||||
}
|
||||
self.ensure_loaded(window);
|
||||
// A web page tab takes the keyboard back (the address field doesn't keep another tab's focus).
|
||||
if let Some(win) = self.windows.get_mut(&window)
|
||||
&& win.tab().is_some_and(|t| t.page.is_none() && t.draft.is_none())
|
||||
{
|
||||
win.focus_page();
|
||||
}
|
||||
if let Some(mut win) = self.windows.remove(&window) {
|
||||
// Theme follows the site colour when that is the colour source.
|
||||
self.style_window(&mut win);
|
||||
|
|
@ -1169,7 +1177,7 @@ impl App {
|
|||
tab.url = url;
|
||||
tab.load_status = Some(crate::engine::LoadState::Started);
|
||||
win.ui.omnibox_edit = None;
|
||||
win.page_focused = true;
|
||||
win.focus_page();
|
||||
}
|
||||
self.redraw(window);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -855,7 +855,7 @@ impl App {
|
|||
let index = (i + 1).min(win.tabs.len());
|
||||
win.tabs.insert(index, tab);
|
||||
win.active = index;
|
||||
win.page_focused = true;
|
||||
win.focus_page();
|
||||
win.redraw();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -743,6 +743,8 @@ impl App {
|
|||
"cookies": crate::store::cookies::keeping().map(|k| format!("{k:?}")),
|
||||
"active_index": self.windows.get(&window).map(|w| w.active),
|
||||
"fullscreen": self.windows.get(&window).map(|w| w.fullscreen),
|
||||
"ui_typing": self.windows.get(&window).map(|w| w.ctx().egui_wants_keyboard_input()),
|
||||
"page_focused": self.windows.get(&window).map(|w| w.page_focused && w.active_webview().is_some_and(|v| v.focused())),
|
||||
"frames": frames,
|
||||
"painters": self.windows.values().flat_map(|w| &w.tabs).filter(|t| t.web.is_some()).count(),
|
||||
"window_kinds": self.windows.values().map(|w| format!("{:?}", w.kind)).collect::<Vec<_>>(),
|
||||
|
|
|
|||
|
|
@ -181,9 +181,18 @@ impl BrowserWindow {
|
|||
/// Give the keyboard to the page.
|
||||
pub fn focus_page(&mut self) {
|
||||
self.page_focused = true;
|
||||
// The interface's text field (the address field after a new tab) lets go, as with Servo.
|
||||
self.area.ctx().memory_mut(|m| m.stop_text_input());
|
||||
// A new tab's view may not be in the window yet: put it there so it can take the focus.
|
||||
self.sync_webviews();
|
||||
if let Some(web) = self.active_webview() {
|
||||
web.focus();
|
||||
}
|
||||
// Not shown yet (no page rect): drop the interface's focus so `sync_webviews` focuses the page once placed.
|
||||
if self.area.has_focus() {
|
||||
GtkWindowExt::set_focus(&self.window, None::<>k::Widget>);
|
||||
}
|
||||
self.area.repaint();
|
||||
}
|
||||
|
||||
/// Give the keyboard to the interface.
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ wait 1
|
|||
shot newtab-dark
|
||||
newtab @PAGES@/hello.html
|
||||
waitload 30
|
||||
# the address field lets go when a new tab's page loads ("ui_typing": false, "page_focused": true)
|
||||
status focus
|
||||
newtab @PAGES@/color.html
|
||||
waitload 30
|
||||
cmd pin
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ wait 8
|
|||
shot yt-loaded
|
||||
save yt-before JSON.stringify((()=>{const v=document.querySelector('video');return v&&{t:v.currentTime,p:v.paused,rs:v.readyState}})())
|
||||
js window.__ev = []; for (const t of ['pointerdown', 'pointerup', 'click']) addEventListener(t, e => window.__ev.push(t + ':' + e.clientX + ',' + e.clientY + ':' + (e.target.className || e.target.tagName).toString().slice(0, 30)), true); true
|
||||
# YouTube keeps the page's main thread busy for several seconds after load (software GL, ~7 s here) and swaps its
|
||||
# skeleton for the real player meanwhile; a click in that window lands on <html>. Click once the player is hit.
|
||||
waitfor 60 (()=>{const e=document.elementFromPoint(402,354);return !!e && !!e.closest('#movie_player')})()
|
||||
log click-video
|
||||
wait 4
|
||||
waitfor 60 (()=>{const v=document.querySelector('video');return !!v && v.currentTime > 2})()
|
||||
|
|
|
|||
Loading…
Reference in a new issue