Commit 14615eb
committed
π Order-agnostic page-range cfi test for inverted epub.js spans
epub.js can report a page's start cfi *after* its end cfi for a
reflowable chapter wedged between fixed-layout image spreads (same
root cause as the TTS-start fix). Two range checks assumed
start <= end and silently broke on such pages:
- isSegmentOnCurrentPage: always false β during listen, TTS
needlessly re-navigated the reader on every segment.
- openPlayer staleness check: a still-on-page stored TTS index
could be misclassified as stale.
Extract one shared `isCFIWithinPageRange` (app/utils/epub.ts) that
tests membership without assuming bound order β two compares, no
allocation, no duplicated logic or cross-referencing comments.
No-op for normal pages where start <= end already.1 parent 43936df commit 14615eb
3 files changed
Lines changed: 24 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
| 81 | + | |
83 | 82 | | |
84 | 83 | | |
85 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
538 | 538 | | |
539 | 539 | | |
540 | 540 | | |
541 | | - | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
542 | 544 | | |
543 | | - | |
544 | | - | |
| 545 | + | |
545 | 546 | | |
546 | 547 | | |
547 | 548 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
3 | 22 | | |
4 | 23 | | |
5 | 24 | | |
| |||
0 commit comments