fix(reader): anchor progress restore to saved page - #369
Merged
deepin-bot[bot] merged 1 commit intoSep 8, 2026
Merged
Conversation
Reviewer's GuideReworks reading-progress restoration to wait for 400 ms of layout stability, keep the saved page as an anchor while fit-width/layout changes are occurring, and validate ratio-based restoration before allowing page state to be updated and persisted. Sequence diagram for anchored reading-progress restorationsequenceDiagram
participant DocSheet
participant RestoreTimer as RestoreSettleTimer
participant SheetBrowser
participant PageState as PageStateAndPersistence
DocSheet->>DocSheet: beginRestoreGuard()
DocSheet->>RestoreTimer: start(400ms)
SheetBrowser-->>DocSheet: sigPageChanged(page)
DocSheet-->>PageState: Ignore page update while guard active
SheetBrowser-->>DocSheet: sigDeformed()
DocSheet->>RestoreTimer: start(400ms)
RestoreTimer-->>DocSheet: timeout
DocSheet->>SheetBrowser: restoreScrollPosition(scrollPosition)
SheetBrowser-->>DocSheet: currentPage()
alt restored page differs from anchor page
DocSheet->>SheetBrowser: setCurrentPage(anchorPage)
end
DocSheet-->>PageState: Allow final page state and restoration signals
State diagram for reading-progress restoration guardstateDiagram-v2
[*] --> RestoreGuard
RestoreGuard: Saved page is the anchor
RestoreGuard: Ignore sigPageChanged updates
RestoreGuard --> RestoreGuard: sigDeformed / restart 400ms timer
RestoreGuard --> LayoutSettled: 400ms without sigDeformed
LayoutSettled: restoreScrollPosition(scrollPosition)
LayoutSettled --> RestoreComplete: currentPage matches anchor
LayoutSettled --> RestoreComplete: currentPage differs / setCurrentPage(anchorPage)
RestoreComplete: Enable page updates and persistence
RestoreComplete --> [*]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Restore of reading progress could regress one page because the saved whole-document ratio was converted with a mid-startup layout while fit-width scale was still changing; the drifted page was then written back and pinned by later deform runs. Guard the restore with the saved page as anchor: page updates are ignored until layout stays unchanged for 400ms, then the fine-grained ratio is re-applied and falls back to the saved page when it drifts. 阅读进度恢复可能回退一页:fit-width 缩放启动期仍在变化,整篇比例 按中间态布局换算的绝对位置跨页,页码被污染后又被后续 deform 固化 并落盘。 恢复期以保存页码为锚:布局连续 400ms 无变化前忽略页码回写,稳定 后执行精细恢复,跨页时回退锚点页。 Log: 修复重开文档时阅读进度回退到上一页的问题 PMS: BUG-376081 Influence: 文档查看器阅读进度恢复逻辑,恢复不再受启动布局变化影响。
add-uos
force-pushed
the
fix-376081-anchor-restore-to-saved-page
branch
from
September 8, 2026 01:15
eb51605 to
dcb3cad
Compare
lzwind
approved these changes
Sep 8, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos, lzwind The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Contributor
Author
|
/merge |
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.
Restore of reading progress could regress one page because the saved whole-document ratio was converted with a mid-startup layout while fit-width scale was still changing; the drifted page was then written back and pinned by later deform runs.
Guard the restore with the saved page as anchor: page updates are ignored until layout stays unchanged for 400ms, then the fine-grained ratio is re-applied and falls back to the saved page when it drifts.
阅读进度恢复可能回退一页:fit-width 缩放启动期仍在变化,整篇比例
按中间态布局换算的绝对位置跨页,页码被污染后又被后续 deform 固化
并落盘。
恢复期以保存页码为锚:布局连续 400ms 无变化前忽略页码回写,稳定
后执行精细恢复,跨页时回退锚点页。
Log: 修复重开文档时阅读进度回退到上一页的问题
PMS: BUG-376081
Influence: 文档查看器阅读进度恢复逻辑,恢复不再受启动布局变化影响。
Summary by Sourcery
Anchor reading-progress restoration to the saved page until the document layout stabilizes, then validate the final position to prevent page regressions.
Bug Fixes:
Enhancements: