Repository navigation
fix(web): keep the page index when reopening a book in scroll mode - #741
Merged
Merged
Conversation
Co-Authored-By: qin hector <hectorq.me@gmail.com>
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
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.
Summary
In the Android shell, reopening a book left on page 3/7 restored the right text but showed 2/7. The page counter was wrong; the text position was not.
Root cause: scroll-mode restore in
ReaderViewcomputesscrollTop = limit * sectionOffsetfrom ther1locator. The locator offset is rounded to 4 decimals, and Android WebView roundsscrollTopagain on top of that (1170.485→1170.182, then1169.818on a second restore). The result lands just before page 3's boundary, outside the 1px tolerance inscrollPage.Fix: when restoring, if the target is within
1px + limit * LOCATOR_OFFSET_ROUNDING_ERRORof a page boundary, snap to that boundary (via the newscreenBoundaryAt, whichscrollPagenow shares). Positions in the middle of a page and the locator format are unchanged.web/test/reader-paging.test.tscovers both the snap case and the middle-of-page case.Verified on an API 35 emulator: before the fix it went 3/7 → 2/7 on reopen; with the fix it stays 3/7. Desktop Chromium never reproduced it, and still shows 3/7 with the fix.
Implemented in session Test issue 735 on Android emulator
Review with Devin · Open in Devin Desktop