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
2.2 KiB
2.2 KiB
Table Width Hints: HTML Attributes + CSS Width Support
Task Description
Add support for author-specified column widths from HTML width attributes and CSS width property on <table>, <col>, <td>, and <th> elements, using them as hints for column sizing in processTable().
Changes Made
1. CSS Layer (lib/Epub/Epub/css/CssStyle.h, lib/Epub/Epub/css/CssParser.cpp)
- Added
widthbit toCssPropertyFlags - Added
CssLength widthfield toCssStyle - Added
hasWidth()convenience method - Updated
applyOver(),reset(),clearAll(),anySet()to includewidth - Added
else if (propName == "width")case toCssParser::parseDeclarations()usinginterpretLength()
2. Table Data (lib/Epub/Epub/TableData.h)
- Added
CssLength widthHintandbool hasWidthHinttoTableCell - Added
std::vector<CssLength> colWidthHintstoTableData(from<col>tags) - Added
#include "css/CssStyle.h"forCssLength
3. Parser (lib/Epub/Epub/parsers/ChapterHtmlSlimParser.cpp)
- Removed
"col"fromTABLE_SKIP_TAGS(was being skipped entirely) - Added
parseHtmlWidthAttr()helper: parses HTMLwidth="200"(pixels) andwidth="50%"(percent) intoCssLength - Added
<col>handling instartElement: parseswidthHTML attribute andstyleCSS, pushes totableData->colWidthHints - Updated
<td>/<th>handling: now parseswidthHTML attribute,styleattribute, and stylesheet CSS width (viaresolveStyle). CSS takes priority over HTML attribute. Stored inTableCell::widthHint
4. Layout (processTable())
- Added step 3a: resolves width hints per column. Priority:
<col>hints > max cell hint (colspan=1 only). Percentages resolve relative to available content width. - Modified step 3b: hinted columns get their resolved pixel width (clamped to min col width). If all hinted widths exceed available space, they're scaled down proportionally. Unhinted columns use the existing two-pass fair-share algorithm on the remaining space.
Follow-up Items
- The
<colgroup>tag is still skipped entirely;<col>tags within<colgroup>won't be reached. Could un-skip<colgroup>(make it transparent like<thead>/<tbody>) if needed. rowspanis not yet supported.