mod: Phase 1 - bring forward mod-exclusive files with ActivityManager migration

Brings ~55 mod-exclusive files to the upstream-based mod/master-resync branch:

Activities (migrated to new ActivityManager pattern):
- Clock/Time: SetTimeActivity, SetTimezoneOffsetActivity, NtpSyncActivity
- Dictionary: DictionaryDefinitionActivity, DictionarySuggestionsActivity,
  DictionaryWordSelectActivity, LookedUpWordsActivity
- Bookmark: EpubReaderBookmarkSelectionActivity
- Book management: BookManageMenuActivity, EndOfBookMenuActivity
- OPDS: OpdsServerListActivity, OpdsSettingsActivity
- Utility: DirectoryPickerActivity, NumericStepperActivity

Utilities (unchanged):
- BookManager, BookSettings, BookmarkStore, BootNtpSync
- Dictionary, LookupHistory, TimeSync, OpdsServerStore

Libraries: PlaceholderCover, TableData, ChapterXPathIndexer
Scripts: inject_mod_version, generate_book_icon, preview_placeholder_cover
Docs: KOReader sync XPath mapping

Migration changes:
- ActivityWithSubactivity -> Activity base class
- Callback constructors -> finish()/setResult() pattern
- enterNewActivity() -> startActivityForResult()
- Activity::RenderLock&& -> RenderLock&&

These files won't compile yet - they reference mod settings and I18n
strings that will be added in subsequent phases.

Made-with: Cursor
This commit is contained in:
cottongin
2026-03-07 15:10:00 -05:00
parent 170cc25774
commit dfbc931c14
147 changed files with 112771 additions and 1 deletions

View File

@@ -0,0 +1,51 @@
# Port Upstream 1.1.0 RC Commits to mod/master
## Task Description
Audited all 11 commits from upstream PR #992 (1.1.0 Release Candidate) and ported the remaining unported/partially-ported ones to `mod/master`.
## Commit Audit Results
### Already Fully Ported (no changes needed)
- **402e887** - Bump version to 1.1.0 (skip, not relevant)
- **3e2c518** (#997) - Glyph null-safety (ported in c1b8e53)
- **b8e743e** (#995) - PNGdec buffer size (ported in c1b8e53)
- **588984e** (#1010) - Dangling pointer (ported in 18be265)
- **87d9d1d** (#978) - Font drawing performance (ported in 3a06418)
- **2cc497c** (#957) - Double FAST_REFRESH (ported in ad282ca)
### Already Effectively Present
- **8db3542** (#1017) - Cover outlines for Lyra themes (mod's LyraTheme.cpp already draws outlines unconditionally; Lyra3CoversTheme.cpp doesn't exist in mod)
### Ported in This Session
#### 1. Aligned #1002 + Ported #1018 (CSS cache invalidation)
**Files:** `CssParser.h`, `CssParser.cpp`, `Epub.cpp`, `ChapterHtmlSlimParser.cpp`
- Added `tryInterpretLength()` (bool return + out-param) to properly skip non-length CSS values like `auto`, `inherit`
- Added `deleteCache()` method to CssParser
- Moved `CSS_CACHE_VERSION` to static class member
- Added stale cache file removal in `loadFromCache()` on version mismatch
- Added "both CSS width and height set" branch in image sizing logic
- Refactored `parseCssFiles()` to early-return when cache exists
- Refactored `load()` to call `loadFromCache()` and invalidate sections on stale cache
#### 2. Ported #1014 (Strip unused CSS rules)
**File:** `CssParser.cpp`
- Added selector filtering in `processRuleBlockWithStyle` to skip `+`, `>`, `[`, `:`, `#`, `~`, `*`, and whitespace selectors
- Fixed `normalized()` trailing whitespace to use `while` loop and also strip `\n`
- Added TODO comments for multi-class selector support
#### 3. Ported #990 (Continue reading card classic theme)
**Files:** `BaseTheme.h`, `BaseTheme.cpp`
- Changed `homeTopPadding` from 20 to 40
- Computed `bookWidth` from cover BMP aspect ratio (clamped to 90% screen width, fallback to half-width)
- Fixed centering: added `rect.x` offset to `bookX`, `boxX`, and `continueBoxX`
- Simplified cover drawing (removed scaling/centering math since bookWidth now matches aspect ratio)
## Build Status
All changes compile successfully (0 errors, 0 warnings in modified files).
## Follow-up Items
- Test on device to verify CSS cache invalidation works correctly (books with stale caches should auto-rebuild)
- Test classic theme continue reading card with various cover aspect ratios
- Test image sizing with EPUBs that specify both CSS width and height on images