Skip to content

fix(html): probe the text size adjustment in a document of its own - #1252

Merged
andiwand merged 2 commits into
mainfrom
fix/viewport-zoom-probe
Oct 24, 2026
Merged

andiwand merged 2 commits into
mainfrom
fix/viewport-zoom-probe

Conversation

@andiwand

@andiwand andiwand commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

Refs #764.

Summary

At load, viewport.js finds whether the browser adjusts the text size (textAdjustHolds). It set the zoom of body to 1 and then to 0.5, and text-size-adjust on the root. Both are inherited properties, so each set made the browser compute the style and the layout of the whole page again. A CPU profile of the 500 K-cell sheet of efficiency-big-1.ods showed about 2 s in ratio and in the elementFromPoint call that follows.

The probe now runs the same steps in a hidden about:blank iframe that holds only the probe. Where the iframe has no document, the probe answers false, which leaves the text adjustment alone.

efficiency-big-1.ods, sheet 7 first frame layout style
before 4.0 s 1.3 s 1.3 s
after 2.2 s 0.47 s 0.44 s
the same page without scripts 2.0 s 0.55 s 0.37 s

Test

  • The old and the new probe give the same answer in headless Chrome: true on desktop and false with mobile emulation, which is the case the probe exists for.
  • test/browser/viewport: 17 checks, 0 failed. All 2,530 tests pass.
  • I could not run WebKit here, because Safari refuses WebDriver until "Allow remote automation" is turned on. Desktop Safari ignores text-size-adjust, so the case that counts is iOS: the iOS app should check that the text keeps its size under a zoom.

The reference output changes only in resources/viewport.js. Pins: public 1ae5868, private 32f5ee7.

Review fixes

  • Rebased onto main after the squash of feat(html): add a switch for lazy layout #1251.
  • The design doc said that "the 1.8 s between them" was viewport.js, after it named 2.2 s and 2.0 s. It now says that the page with chunks took 4.0 s before, and 1.8 s of that was viewport.js.
  • Checked again: test/browser/viewport gives 17 checks, 0 failed, in two runs. Both new pins descend from the pins on main.

@andiwand
andiwand force-pushed the feat/lazy-layout-switch branch from ad29921 to 769f539 Compare October 24, 2026 20:13
@andiwand
andiwand force-pushed the fix/viewport-zoom-probe branch from a98c698 to 80909a2 Compare October 24, 2026 20:13
Base automatically changed from feat/lazy-layout-switch to main October 24, 2026 20:15
andiwand and others added 2 commits October 24, 2026 22:16
`viewport.js` found at load whether the browser adjusts the text size.
It set the zoom of the body twice and `text-size-adjust` on the root.
Both are inherited, so each set made the browser compute the style and
the layout of the whole page again. On the sheet of 500 K cells in
`efficiency-big-1.ods`, that cost 1.8 s of a 4.0 s first frame.

The probe now runs the same steps in an `about:blank` iframe, which
holds only the probe. The sheet paints its first frame after 2.2 s. The
same page without its scripts takes 2.0 s.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017QtawyvLP2SCnoBtnVfFed
The doc said that "the 1.8 s between them" was `viewport.js`, after it
named 2.2 s and 2.0 s. The 1.8 s lies between 4.0 s, the page with chunks
before the fix, and 2.2 s.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YHNzLmVv1mFWfPitHASucN
@andiwand
andiwand force-pushed the fix/viewport-zoom-probe branch from 80909a2 to f98b383 Compare October 24, 2026 20:16
@andiwand
andiwand merged commit c6f086a into main Oct 24, 2026
25 checks passed
@andiwand
andiwand deleted the fix/viewport-zoom-probe branch October 24, 2026 20:26
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