Skip to content

fix(osr): re-assert last-known visibility after browser bind#15

Merged
wenkaifan0720 merged 1 commit into
mainfrom
fix/cef-visibility-reassert
Jul 1, 2026
Merged

fix(osr): re-assert last-known visibility after browser bind#15
wenkaifan0720 merged 1 commit into
mainfrom
fix/cef-visibility-reassert

Conversation

@wenkaifan0720

Copy link
Copy Markdown
Collaborator

Problem

Under a startup burst of many browser creates, one browser could end up established but permanently blank on-screen. cef_host gates every frame on slot->visible and never reconciles that flag against reality after establishment — so a setVisible edge that races the browser bind (recorded as intent only, browser==null) or is lost/mis-ordered can latch a slot hidden while the tile is on-screen. The native first-present watchdog (DoInvalidate) can't rescue it, because a WasHidden(true) browser's compositor is idled — no Invalidate/BeginFrame produces a frame. Which tile loses is timing-dependent, so a different tile goes blank each launch.

Fix

CefWebController now tracks the last requested visibility and re-asserts it once the browser binds (in _createSession, after channel re-registration) — replaying an edge that landed before bind or was lost under the burst. The false→true re-assert hits the native DoSetVisible edge and repaints the latched tile.

Gated on an explicit-set flag: a slot whose visibility was never set keeps CEF's default-shown, so a fresh/recovered off-screen slot isn't force-repainted (which would pump it at 60fps until its cull edge lands). A matching state is a no-op.

Pairs with a consumer-side change in work_canvas's agent_ui tile, which drives the session's visibility directly (its 5-hop InheritedNotifier path could drop the edge). The direct-drive ensures the correct value is what gets re-asserted; the re-assert here is the generic backstop for all consumers (before-bind window). Both are needed — one closes the before-bind window, the other the after-bind window.

Test

Adds create re-asserts last-known visibility only when explicitly set — pins that an explicit setVisible(false)/(true) is replayed after create(), and a never-set slot is not (the off-screen guard). Full suite green (+59).

Validation

Validated in a consuming app (work_canvas firebase-dev) across 8 relaunches with 16+ CEF tiles: the previously-blank agent_ui tile renders every launch, zero wedges (baseline was ~1 blank tile per launch).

🤖 Generated with Claude Code

Under a create burst, a setVisible edge issued before the browser binds
(recorded as intent only) or lost/mis-ordered could leave a slot latched
hidden while on-screen — a permanently blank tile — because cef_host gates
every frame on slot->visible and never reconciles it after establishment.

CefWebController now tracks the last requested visibility and re-asserts it
once the browser binds (in _createSession, after channel re-registration),
but ONLY when it was explicitly set: a never-set slot keeps CEF's
default-shown, so a fresh/recovered off-screen slot isn't force-repainted
(no 60fps off-screen pump). The hidden->visible edge repaints the latched
tile; a matching state is a no-op.

Pairs with a consumer-side direct visibility drive in work_canvas's agent_ui
tile (whose 5-hop InheritedNotifier visibility path could drop the edge).
Adds a unit test pinning re-assert-when-set / no-re-assert-when-unset.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@wenkaifan0720 wenkaifan0720 merged commit 3920866 into main Jul 1, 2026
1 check passed
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.

1 participant