Rebuild core EPUB/PDF reading with responsive controls - #3
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 16611b646e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (_cachedViewport == null || | ||
| _viewportPreferences != snapshot.preferences) { | ||
| _cachedViewport = _controller.buildViewport(context); | ||
| _viewportPreferences = snapshot.preferences; |
There was a problem hiding this comment.
Rebuild viewport output from custom engines
When a custom ReaderEngine.buildViewport returns an immutable widget derived from its current locator or content, engine notifications rebuild the shell but this cache is reused whenever preferences are unchanged. Consequently navigation and other snapshot updates leave that custom viewport displaying stale content, whereas the previous implementation invoked buildViewport on every shell rebuild. Preserve the mounted element through normal Flutter reconciliation rather than caching the old widget instance.
AGENTS.md reference: AGENTS.md:L23-L24
Useful? React with 👍 / 👎.
| if (tag == 's' || tag == 'del') style['strike'] = true; | ||
| if (tag == 'code' || tag == 'pre') style['code'] = true; | ||
| if (tag == 'br') runs.add({'text': '\n', ...style}); | ||
| if (tag == 'li') text('• ', style); |
There was a problem hiding this comment.
Preserve numbering in ordered EPUB lists
For EPUB chapters containing <ol>, every <li> is unconditionally prefixed with a bullet, without considering its list ancestor, start, or per-item value. Numbered instructions, rankings, and references therefore lose meaningful ordering in both paginated and built-in scrolling reflow; generate ordered markers for ordered-list items while retaining bullets for unordered lists.
AGENTS.md reference: AGENTS.md:L20-L22
Useful? React with 👍 / 👎.
Opening EPUBs and changing layouts previously depended on main-thread processing and lossy chapter pagination. This rebuild adds resident native/browser EPUB workers, spine-ordered rich pagination, content-offset resume locations, and working PDF pagination/continuous scrolling with width fitting.
The reader shell now adapts to the available viewport, keeps keyboard navigation across chapters, applies reading appearance to Material popup routes while preserving host e-ink preferences, and offers distraction-free controls with an accessible restore button and Escape. Existing locators and custom engines/renderers/builders remain supported. Custom snapshot-based viewport widgets rebuild after navigation while Flutter preserves their mounted state. EPUB ordered lists retain numeric markers, start/item values and independent nested/reversed counters.
Validation:
The packaged worker asset and native example setup are included. CI covers the native build matrix; device tests, other browser engines, performance measurements on constrained devices, and a representative publisher corpus remain follow-up work. Supported-format limits and architecture are documented in
docs/.