Skip to content

feat(html): add a switch for lazy layout - #1251

Merged
andiwand merged 3 commits into
mainfrom
feat/lazy-layout-switch
Oct 24, 2026
Merged

andiwand merged 3 commits into
mainfrom
feat/lazy-layout-switch

Conversation

@andiwand

@andiwand andiwand commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

Refs #764.

Summary

HtmlConfig::lazy_layout (default on) turns level 1 of docs/design/lazy-loading.md off. 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.

  • Text and sheets write all their lines or rows as one block or table. pdf pages get no chunk class.
  • chunk_classes(config, near) gives a chunk's classes, empty when 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 (lazyLayout), jni (lazyLayout) and python (lazy_layout) bindings carry it. wasm does not mirror HtmlConfig.
  • The chunk size stays internal, because the measurements were flat around it. The design doc says so.

The reference output changes:

After 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.
  • The jni ctest and the python 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

Base automatically changed from feat/sheet-chunks to main October 24, 2026 20:12
andiwand and others added 2 commits October 24, 2026 22:13
`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
andiwand force-pushed the feat/lazy-layout-switch branch from ad29921 to 769f539 Compare October 24, 2026 20:13
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
@andiwand
andiwand merged commit 2bd865f into main Oct 24, 2026
17 checks passed
@andiwand
andiwand deleted the feat/lazy-layout-switch branch October 24, 2026 20:15
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