Skip to content

Acquire a pane's WebGL renderer after its first settled fit - #1839

Merged
nedtwigg merged 2 commits into
mainfrom
webgl-blank
Nov 18, 2026
Merged

nedtwigg merged 2 commits into
mainfrom
webgl-blank

Conversation

@nedtwigg

Copy link
Copy Markdown
Member

Splitting a pane left every other terminal blank until an unrelated page change (a hover, say) forced a redraw. It reproduces on the production site.

Cause

The entering pane's WebGL canvas was created at mount, at xterm's default 80×24 grid, and the fit on the split animation's settle frame then resized that brand-new canvas. Chromium's TreesInViz compositor trips its damage checks on that frame (crbug.com/454680865: "Viz damage does not contain client damage", then "Has no damage while expects_to_draw is set" every frame) and skips draws, so the other canvases stay on their last presented frame while still rendering correctly into their drawing buffers.

TreesInViz is on by default in Chrome for Testing 150 (what agent-browser runs) and blanks every time; installed Chrome 157 does not blank unless it is launched with --enable-features=TreesInViz. The create-then-resize pattern predates the xterm bump in dc82a41c9.

Fix

  • mountElement now only reveals the element on the DOM renderer.
  • TerminalPane acquires the GPU renderer through the new mountRenderer after its settled-geometry gate and first fit, so the canvas is created at the settled grid. A stale container is a no-op.
  • A pane whose size a remote session holds mounts its renderer without fitting.
  • A newly split pane shows the DOM renderer during its fade-in (~440 ms).
  • docs/specs/layout.md → Renderer states the rule; the rationale entry carries the dated measurements.

Testing

  • New tests in TerminalPane.test.tsx and terminal-registry.alert.test.ts pin no renderer while entering and a renderer right after the first fit; they fail against the old code. jsdom has no WebGL, so the blanking itself is not testable there.
  • Verified live in agent-browser: every terminal stayed painted ~1 s and ~3 s after one split and after a second.
  • Not tested: Firefox, WebKit, the Tauri app, VS Code. Other triggers of the Chromium bug may remain.

🤖 Generated with Claude Code

Splitting a pane on the desktop playground left every other terminal
blank until an unrelated DOM change. The entering pane's WebGL canvas
was created at mount, at xterm's default 80x24 grid, and the
settle-frame fit then resized that brand-new canvas. Chromium's
TreesInViz compositor trips its damage checks on that frame
(crbug.com/454680865: "Viz damage does not contain client damage",
then "Has no damage while expects_to_draw is set" every frame) and
skips draws, so the other canvases stay blank while still rendering
correctly into their drawing buffers.

mountElement now only reveals the element on the DOM renderer, and
TerminalPane acquires the GPU renderer through mountRenderer after its
fit gate passes, so the canvas is created at the settled grid. A pane
whose size a remote session holds mounts its renderer without fitting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 07d440d
Status: ✅  Deploy successful!
Preview URL: https://fafdf4b9.mouseterm.pages.dev
Branch Preview URL: https://webgl-blank.mouseterm.pages.dev

View logs

@dormouse-bot dormouse-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One spec wording issue: the code matches the PR description, but the new Renderer rule appears to say the opposite for held panes.

Comment thread docs/specs/layout.md Resolved
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nedtwigg
nedtwigg merged commit 0c1c34a into main Nov 18, 2026
20 checks passed
@nedtwigg
nedtwigg deleted the webgl-blank branch November 18, 2026 04:49
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.

2 participants