From 0c7ffa97994e315149c883b959a8ab9a66a266a2 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Thu, 25 Jun 2026 10:46:16 +0800 Subject: [PATCH] fix(reader): stop iOS page-turn animation stutter (#4768) (#4772) * fix(reader): stop iOS page-turn animation stutter (#4768) iOS users saw occasional page-turn animation stutter that was not present on earlier 0.11.x builds. It traces to foliate-js commit c1c7315 (first shipped in 0.11.4): the large-section rafAnimateScroll fallback and the removal of persistent compositor-layer hints, both added to fix a ~1s Blink freeze on Android Chromium at high DPR. Apple WebKit composites those layers fine, so on iOS (notably 120Hz ProMotion devices) the changes only cost smoothness: large-section turns animate scroll on the main thread, and every turn promotes a layer on-demand instead of using a persistent one. Opt the iOS renderer into foliate-js's new gpu-composite path, which restores persistent compositor layers and skips the main-thread rafAnimateScroll fallback. Other platforms keep the Android freeze fix. Bumps the foliate-js submodule. Co-Authored-By: Claude Opus 4.8 (1M context) * chore(deps): repin foliate-js to merged gpu-composite commit (#4768) readest/foliate-js#39 squash-merged to a new commit on main. Move the submodule pin off the now-orphaned PR branch commit to the merged main commit. No content change. Co-Authored-By: Claude Opus 4.8 (1M context) --------- Co-authored-by: Claude Opus 4.8 (1M context) --- .../src/app/reader/components/FoliateViewer.tsx | 8 ++++++++ packages/foliate-js | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/readest-app/src/app/reader/components/FoliateViewer.tsx b/apps/readest-app/src/app/reader/components/FoliateViewer.tsx index a70582b5..cb5a435b 100644 --- a/apps/readest-app/src/app/reader/components/FoliateViewer.tsx +++ b/apps/readest-app/src/app/reader/components/FoliateViewer.tsx @@ -687,6 +687,14 @@ const FoliateViewer: React.FC<{ } else { view.renderer.removeAttribute('animated'); } + // iOS WebKit composites large/persistent page layers without the Android + // high-DPR Blink freeze, so opt this renderer into the GPU-accelerated + // page-turn path (persistent compositor layers + no main-thread + // rafAnimateScroll fallback) to keep 120Hz ProMotion turns smooth + // (readest#4768). + if (appService?.isIOSApp) { + view.renderer.setAttribute('gpu-composite', ''); + } if (viewSettings.disableSwipe) { view.renderer.setAttribute('no-swipe', ''); } else { diff --git a/packages/foliate-js b/packages/foliate-js index 982f168c..23ec1c79 160000 --- a/packages/foliate-js +++ b/packages/foliate-js @@ -1 +1 @@ -Subproject commit 982f168c668dedcf38b2304bec788337712d60aa +Subproject commit 23ec1c7957af6a5dcbd7d340314fe5238ef4e665