Repository navigation
feat(html): add a switch for lazy layout - #1251
Merged
Merged
Conversation
`HtmlConfig::lazy_layout` is on by default. Off, no view writes a chunk or the style that hides one, so the browser lays out everything. Its own find and a screen reader then reach every line, row and page. A host can take that where a file is small. - The text and sheet views write all their lines or rows as one block. The pdf pages get no chunk class. - `chunk_classes` gives the classes of a chunk, empty where the switch is off, and `write_chunk_style` writes nothing then. - The text styles move from `.odr-chunk` to `.odr-text-lines`, so a text page without chunks keeps its line numbers. - The apple, jni and python bindings carry the switch. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017QtawyvLP2SCnoBtnVfFed
The design names the switch, and the pins move to the reference output of the renamed text class and the reordered pdf page classes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017QtawyvLP2SCnoBtnVfFed
andiwand
force-pushed
the
feat/lazy-layout-switch
branch
from
October 24, 2026 20:13
ad29921 to
769f539
Compare
The views lay out only the parts near the viewport since #1247, #1248 and #1250, and this PR adds `HtmlConfig::lazy_layout`. A consumer notices both, but the changelog had no entry. Also check the round trip of the jni test with `assertFalse`. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YHNzLmVv1mFWfPitHASucN
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.
🤖 Generated with Claude Code
Refs #764.
Summary
HtmlConfig::lazy_layout(default on) turns level 1 ofdocs/design/lazy-loading.mdoff. Then no view writes a chunk or the style that hides one. The browser lays out everything, and its own find and a screen reader reach every line, row and page. A host can choose that for small files.chunk_classes(config, near)gives a chunk's classes, empty when the switch is off, andwrite_chunk_stylewrites nothing then..odr-chunkto.odr-text-lines, so a text page without chunks keeps its line numbers.lazyLayout), jni (lazyLayout) and python (lazy_layout) bindings carry it. wasm does not mirrorHtmlConfig.The reference output changes:
text.cssandtext.js, where main'stext.jshad changed in the merge of feat(html): lay out only the lines of a text file near the viewport #1247After the class change is reverted and the class order is ignored, every changed page is identical to the reference. Pins: public 1ff0147, private 07c9ef2.
Test
html.lazy_layout_off_writes_no_chunk: a text file, a sheet and a pdf with the switch off have no chunk class and no hiding style. All 2,530 tests pass.test_html.py(12) pass with the round trip of the field. Apple is left to CI.test/browser/plaintext: 54 checks, 0 failed.Review fixes
CHANGELOG.mdhad no entry for the lazy layout of feat(html): lay out only the lines of a text file near the viewport #1247, feat(html): lay out only the pdf pages near the viewport #1248 and feat(html): lay out only the chunks of a sheet near the viewport #1250, or for this switch. A consumer notices both: the find of the browser does not reach a far part, andHtmlConfighas a new field. Two entries under HTML output now state them.assertFalse(readBack.lazyLayout), notassertTrue(!…).test/browser/plaintext: 54 checks, 0 failed. I did not run the jni test after the change of its assert.