Remove all RDEPUBBackgroundTrace.log and bare print diagnostic calls

Keep only the evaluateFullPageMapTakeover: fullReplace diagnostic log
in RDEPUBPageMapReconciliationCoordinator.swift for future debugging.

Simplified RDEPUBBackgroundTrace to just the log method (removed measure
and debug gating). Removed all [EPUB][...], [ReadViewDemo], and
[EPUB][Pagination] print statements across the project.

Also includes earlier bug fixes:
- Fix stale currentPageNumber in extendPartial commit
- Fix pageCurl rebindVisiblePage during transition
- Fix keepCurrentWindow not removing pending update from queue
- Fix right-aligned text (巫鸿 bug) via avoidPageBreakInside,
  tail merger, and continuation paragraph normalization
- Add text-indent reset for aligned blocks in CSS compatibility layer

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-06-25 18:25:22 +08:00
co-authored by Claude
parent 8c5059e72f
commit 15b15d0e11
23 changed files with 95 additions and 492 deletions
@@ -28,14 +28,8 @@ final class RDEPUBReaderPaginationCoordinator {
controller.showLoading()
let token = UUID()
context.paginationToken = token
#if DEBUG
print("[EPUB][Pagination] profile=\(publication.readingProfile.rawValue) layout=\(publication.layout.rawValue) spine=\(publication.spine.count)")
#endif
if publication.readingProfile == .textReflowable {
#if DEBUG
print("[EPUB][Pagination] path=text-reflowable-on-demand")
#endif
paginateTextPublication(
parser: parser,
publication: publication,
@@ -47,9 +41,6 @@ final class RDEPUBReaderPaginationCoordinator {
}
if publication.layout == .fixed {
#if DEBUG
print("[EPUB][Pagination] path=fixed-layout")
#endif
let snapshot = readingSession.makePaginationSnapshot(
pageCounts: Array(repeating: 1, count: publication.spine.count),
preferences: controller.currentPreferences(),
@@ -60,9 +51,6 @@ final class RDEPUBReaderPaginationCoordinator {
}
let paginator = context.makePaginator()
#if DEBUG
print("[EPUB][Pagination] path=web-paginator")
#endif
context.paginator = paginator
paginator.calculate(
parser: parser,
@@ -143,31 +131,15 @@ final class RDEPUBReaderPaginationCoordinator {
func refreshVisibleContentPreservingLocation() {
guard let readerView = context.readerView else { return }
if readerView.isPageCurlTransitioning {
RDEPUBBackgroundTrace.log(
"LoadingPage",
"defer refreshVisibleContent currentPage=\(readerView.currentPage + 1) reason=pageCurlTransition"
)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { [weak self] in
self?.refreshVisibleContentPreservingLocation()
}
return
}
let restoreLocation = context.currentVisibleLocation() ?? context.persistenceLocation()
RDEPUBBackgroundTrace.log(
"LoadingPage",
"refreshVisibleContentPreservingLocation currentPage=\(readerView.currentPage + 1) restoreHref=\(restoreLocation?.href ?? "nil") restoreCFI=\(restoreLocation?.cfi ?? "nil")"
)
if readerView.currentDisplayType == .pageCurl, readerView.currentPage >= 0 {
RDEPUBBackgroundTrace.log(
"LoadingPage",
"refreshVisibleContent using transitionToPage currentPage=\(readerView.currentPage + 1)"
)
readerView.transitionToPage(pageNum: readerView.currentPage, animated: false)
} else {
RDEPUBBackgroundTrace.log(
"LoadingPage",
"refreshVisibleContent using reloadData currentPage=\(readerView.currentPage + 1)"
)
readerView.reloadData()
}
if let restoreLocation {
@@ -220,22 +192,9 @@ final class RDEPUBReaderPaginationCoordinator {
do {
guard context.controller != nil,
let runtime = context.runtime else { return }
RDEPUBBackgroundTrace.log(
"QuickOpen",
"begin token=\(token.uuidString) candidates=\(prioritizedCandidates.count) restoreSpine=\(readingSession.initialSpineIndex(for: restoreLocation))"
)
let runtimeChapter = try RDEPUBBackgroundTrace.measure(
"QuickOpen",
"loadFirstRenderableRuntimeChapter"
) {
try self.loadFirstRenderableRuntimeChapter(
prioritizedSpineIndices: prioritizedCandidates,
runtime: runtime
)
}
RDEPUBBackgroundTrace.log(
"QuickOpen",
"ready anchorSpine=\(runtimeChapter.spineIndex) pages=\(runtimeChapter.pages.count)"
let runtimeChapter = try self.loadFirstRenderableRuntimeChapter(
prioritizedSpineIndices: prioritizedCandidates,
runtime: runtime
)
let initialChapters = self.loadInitialInteractiveRuntimeChapters(
anchorChapter: runtimeChapter,
@@ -290,7 +249,6 @@ final class RDEPUBReaderPaginationCoordinator {
)
} catch {
lastError = error
RDEPUBBackgroundTrace.log("QuickOpen", "skip spine=\(spineIndex) reason=\(error)")
}
}
throw lastError ?? RDEPUBParserError.emptySpine
@@ -329,10 +287,6 @@ final class RDEPUBReaderPaginationCoordinator {
)
selectedChapters.append(chapter)
} catch {
RDEPUBBackgroundTrace.log(
"QuickOpen",
"lookahead skip spine=\(spineIndex) reason=\(error)"
)
}
}