Skip to content

fix(webview): preserve zoom hotkeys across reloads (fix #16432) - #16433

Open
TimeToBuildBob wants to merge 1 commit into
tauri-apps:devfrom
TimeToBuildBob:fix/zoom-reload-state-a7c2
Open

TimeToBuildBob wants to merge 1 commit into
tauri-apps:devfrom
TimeToBuildBob:fix/zoom-reload-state-a7c2

Conversation

@TimeToBuildBob

Copy link
Copy Markdown

Summary

Fixes #16432. The Linux/macOS shortcut script keeps its counter in the document, while native zoom survives reload. After 140% → reload, zoom-in incorrectly requests 120%.

  • Track zoom per Webview, shared across cloned handles and document recreation. Absolute Rust/JS setters and relative shortcuts use the same state; shortcut limits remain 0.2–10 and absolute setters remain unclamped.
  • Send relative changes through the existing set_webview_zoom command/ACL; existing numeric payloads are unchanged. Handle the command synchronously so rapid reset/shortcut operations keep arrival order.
  • Apply zoom state mutations on the main thread, where Wry applies native setters. Locking around enqueueing alone lets queued worker setters diverge from newer main-thread setters.
  • Resolve main-thread Wry zoom by stable webview ID, avoiding the parent-ID mutex that worker-thread reparenting can hold while waiting for the event loop.
  • Add four Rust state/order regressions, four dependency-free Node script tests (Linux/macOS × keyboard/wheel), a CI step, and a changeset.

Verification

  • cargo test -p tauri --lib --no-default-features --features test --offline: 84 passed on Linux.
  • node --test crates/tauri/src/webview/scripts/zoom-hotkey.test.cjs: 4 passed. All four fail with the original script.
  • cargo clippy -p tauri -p tauri-runtime-wry --lib --no-default-features --features tauri/test --offline: passes with one pre-existing redundant-clone warning in manager/webview.rs:272.
  • Scoped rustfmt, Prettier and git diff --check pass.
  • Standalone native Linux/WebKitGTK fixture built against this checkout: 800 → 666 → 571 CSS pixels; real document reload retains 571; next zoom-in reaches 500 (160%); reset returns 800. Existing released Tauri 2.12.5 reverses to 666 at that step.
  • Native fixture also passes absolute numeric JS setter → shortcut, Rust set_zoom → shortcut, five-event burst, reset, and a queued-worker/main-thread interleaving. The wheel-handler test uses a synthetic DOM wheel event in the native webview, not physical wheel input.
  • Restoring the pre-main-thread shadow update makes the new execution-order Rust regression fail (3.0 versus expected 2.0). Restoring Wry's parent-ID-locking setter makes the native concurrent reparent/zoom fixture fail its return marker; the repaired version returns without deadlock.

Boundaries

Native evidence is Linux only. macOS is script-test coverage; Windows/macOS native and mobile cross-compilation remain CI/maintainer verification. This does not persist zoom across process restarts or track direct platform mutations via with_webview, outside Tauri's setters. No ActivityWatch-specific polyfill or reload reset is added.

The commit is signed. I read the contribution policy and will not generate replies to review comments; any requested review discussion needs a human handoff.

Git-Session-Id: 44d60a8d-a5a8-4168-9e33-4417c5f832a6

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Zoom-in after document reload reduces retained native zoom

1 participant