Skip to content

Rebuild core EPUB/PDF reading with responsive controls - #3

Merged
Eoic merged 4 commits into
masterfrom
feat/reader-core
Oct 3, 2026
Merged

Eoic merged 4 commits into
masterfrom
feat/reader-core

Conversation

@Eoic

@Eoic Eoic commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

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:

  • 144 reader unit/widget tests and two example tests passed with the pinned Flutter 3.41.2 SDK; formatting and analysis passed.
  • Example web release build passed. Chrome checks cover the packaged worker, local files and cleanup, EPUB chapter navigation, PDF resume/layout changes, responsive settings, opposite host/reader themes, and hiding/restoring controls.
  • Client integration: 23 focused tests, formatting/analysis, four bootstrap tests, locked Git dependency resolution, and client web release build passed.

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/.

Copilot AI balanced review requested due to automatic review settings October 3, 2026 19:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-03T19:07:00.076509Z 16611b6 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +696 to +699
if (_cachedViewport == null ||
_viewportPreferences != snapshot.preferences) {
_cachedViewport = _controller.buildViewport(context);
_viewportPreferences = snapshot.preferences;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@Eoic
Eoic merged commit dd7aa1f into master Oct 3, 2026
8 checks passed
@Eoic
Eoic deleted the feat/reader-core branch October 3, 2026 20:09
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.

2 participants