fix(html): fitting the width states a floor a wide page can reach - #911
Merged
Merged
Conversation
A browser floors the page scale at 0.25, so `width=device-width` alone cannot fit content more than four screens wide: an A0 sheet on a phone opens at its own size, scrolls sideways, and the pinch stops before the page fits. Measured in a WebView at 3232 css px on a 412 px screen, the scale sat at 0.25 with less than half the page visible. Fitting the width now states the floor the content needs - what fits the widest page on a 320 px screen, the narrowest there is. Where the browser's own 0.25 already reaches, nothing is added and the meta is unchanged, so no existing output moves. `write_viewport_meta` takes the `content_pixels` that `write_zoom_style` beside it already takes. The call sites without one state no floor. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FJJdfqpnVCKBNHXjAVxSou
andiwand
force-pushed
the
fix/fit-width-states-a-floor
branch
from
September 20, 2026 09:46
97139a7 to
548f80d
Compare
`viewport_of` sat outside the anonymous namespace, so it had external linkage where `fit_of` beside it does not. The assertions now state the whole meta, which catches the order of the clauses and the separators. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0149gFxhkvKTBQidz6brU8Vt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A browser floors the page scale at 0.25.
width=device-widthalone leaves that floor in place, so content more than four screens wide cannot be zoomed out to: it opens at its own size, scrolls sideways, and the pinch stops before the page fits.Measured in OpenDocument Reader's WebView on an A0-sized pdf page - 3232 css px on a 412 px screen:
visualViewport.scalesat at 0.25 with less than half the page visible, and no gesture could go lower.Fitting the width now states the floor the content needs: what it takes to fit the widest page on a 320 px screen, the narrowest there is. Where 0.25 already reaches - every ordinary page - nothing is added and the meta is unchanged, so no existing output moves.
width=device-width,user-scalable=yes…,minimum-scale=0.099,……,initial-scale=1.0,…write_viewport_metatakes thecontent_pixelsthatwrite_zoom_stylebeside it already takes; the call sites without one state no floor, as before.Checked
odr_test --gtest_filter=html*: 98 tests, all passing, including a new one that the floor appears only when the page column is wider than four screens.cli/translate: the A0 page gainsminimum-scale=0.099; an A4 landscape menu, a normal pdf, five presentations, an odt and two spreadsheets are byte-identical.viewport_content) makes the A0 page open fitted, with both edges on screen.