1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use super::*;
thread_local! {
/// Persistent live WebAssembly showcase `(App, ShowcaseState)` receiving interactive DOM canvas events.
pub(crate) static WEB_SHOWCASE_RUNTIME: RefCell<Option<(App, ShowcaseState)>> = const { RefCell::new(None) };
/// Coalesced dirty flag set by high-frequency DOM input listeners and flushed once per `requestAnimationFrame`.
pub(crate) static WEB_NEEDS_FRAME: Cell<bool> = const { Cell::new(true) };
/// Hidden DOM `<input>` element bridging browser soft keyboards and CJK/IME composition.
pub(crate) static WEB_IME_ELEMENT: RefCell<Option<HtmlElement>> = const { RefCell::new(None) };
/// Tracks whether a browser IME composition session is currently in progress.
pub(crate) static WEB_IME_COMPOSING: Cell<bool> = const { Cell::new(false) };
/// Tracks whether the hidden browser IME proxy input is currently focused.
pub(crate) static WEB_IME_ACTIVE: Cell<bool> = const { Cell::new(false) };
/// Retained browser `requestAnimationFrame` callback cancelled on background and restarted on foreground.
pub(crate) static WEB_RAF_CALLBACK: RefCell<Option<Closure<dyn FnMut(f64)>>> = const { RefCell::new(None) };
/// Active browser `requestAnimationFrame` handle (`None` while idle or background-frozen so 0 frames fire).
pub(crate) static WEB_RAF_ID: Cell<Option<i32>> = const { Cell::new(None) };
/// Last browser rAF timestamp in milliseconds (`0.0` on boot or foreground resume to prevent dt spikes).
pub(crate) static WEB_RAF_LAST_TS: Cell<f64> = const { Cell::new(0.0) };
/// Accumulated seconds for host display refresh-rate detection in the browser rAF loop.
pub(crate) static WEB_RAF_ACCUM_SECS: Cell<f32> = const { Cell::new(0.0) };
/// Accumulated frame counter for host display refresh-rate detection in the browser rAF loop.
pub(crate) static WEB_RAF_ACCUM_FRAMES: Cell<u32> = const { Cell::new(0) };
/// Set once initial browser display refresh rate has been measured so idle pages can park rAF completely.
pub(crate) static WEB_RAF_CALIBRATED: Cell<bool> = const { Cell::new(false) };
/// Cached canvas geometry `(left, top, css_w, css_h, dpr)` maintained by `ResizeObserver` and DPR listeners to avoid per-rAF layout reflows.
pub(crate) static WEB_CACHED_VIEWPORT: Cell<(f64, f64, f64, f64, f32)> = const { Cell::new((0.0, 0.0, 1200.0, 800.0, 1.0)) };
/// Exact integer physical canvas size `(phys_w, phys_h)` reported by `ResizeObserver` `devicePixelContentBoxSize` (`(0, 0)` when unavailable).
pub(crate) static WEB_OBSERVED_PHYS_SIZE: Cell<(u32, u32)> = const { Cell::new((0, 0)) };
/// Dirty flag raised by `ResizeObserver`, `resize`, or DPR listeners when `WEB_CACHED_VIEWPORT` must be applied to `App`.
pub(crate) static WEB_VIEWPORT_DIRTY: Cell<bool> = const { Cell::new(false) };
/// Lock-free mirror of `App::should_pump_frames()` readable without borrowing `WEB_SHOWCASE_RUNTIME` during re-entrant wakeups.
pub(crate) static WEB_SHOULD_PUMP: Cell<bool> = const { Cell::new(true) };
/// Re-entrancy guard suppressing outbound `location.set_hash` writes while syncing route state from browser `popstate`/`hashchange`.
pub(crate) static WEB_SYNCING_FROM_HISTORY: Cell<bool> = const { Cell::new(false) };
/// Dual-canvas independent presentation coordinator tracking active/standby `<canvas>` handoffs and `SubmissionProxy` rAF telemetry.
pub(crate) static WEB_DUAL_CANVAS_COORDINATOR: RefCell<ShowcaseWebDualCanvasCoordinator> = RefCell::new(ShowcaseWebDualCanvasCoordinator::default());
}