perf(reader): create PDF page canvases on first render
vomebook
44759b1
Every PDF page shell created a default 300x150 canvas at mount. A 234-page
original PDF therefore held 234 blank backing stores (~16.7M pixels, ~67 MB)
before any page was visible, and the count scaled with the document.
Create the canvas in the renderer instead, matching the v3 path. Measured on a
production 234-page PDF: 234 canvases / 16.7M px at open -> 0 / 0, with the same
pages rendered as they scroll into view.
- PDF-pages/image-pages images stay transparent until decoded, then appear whole;
a blank visible page fades in (120 ms), offscreen pages and swaps switch at once.
- Before the primary PDF is ready, opening range reads yield to visible page images
(admitPdfRange: 1 / 4 / 6 in flight) and nearby pages' images start 1 s after the
first one shows; visible demand wakes pending hybrid polls.
- Read-aloud text discovery reads only pages the renderer has extracted or is
extracting. The previous probe extracted up to 12 unrendered pages, which for a
scanned PDF downloads their full page images ahead of the visible page.
- Tests: scroll-scheduling/range-transport cases, hybrid reveal/lookahead cases, a
read-aloud probe regression, the Pages full-search rule and a drawer-transition
race in the dark-theme handoff test.
fix(reader): PDF.js for large hybrid books, prioritized image fallback, stable page geometry, hybrid outline
- Range-transport PDFs up to 1 GiB (complete bodies keep 512 MiB) on client and proxy
- A failed primary leaves hybrid mode; image pages use a priority-ordered pool with preemption
- Visible-page image fallback waits for this book's measured PDF draw time
- Image and canvas geometry changes preserve the reading anchor; first geometry seeds shells
- PDF outline fills a missing manifest TOC after the first page
9 days ago
feat(reader): support v3 DjVu primary via image stream and text layer
The pipeline records math.ceil() of a vector preview's intrinsic size while
browsers round naturalWidth, so A4 (595.3pt) and 16:9 slide SVGs failed the
exact-size check with PDF_V3_PREVIEW_GEOMETRY_MISMATCH. The first page showed
"page load failed, retrying" until PDF.js replaced it. SVG previews now allow
a 1px rounding difference; raster previews and the aspect check are unchanged.
Visible pages whose speculative render was cancelled are requeued on slot
release and scroll, and PDF page reads enter the render queue before getPage.
Preview cancellation no longer writes a page failure state.
18 days ago
refactor: organize project layout and Reader responsibilities