Files
crosspoint-reader-mod/chat-summaries/2026-02-15_14-30-summary.md
cottongin dfbc931c14 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
2026-03-07 15:10:00 -05:00

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 width bit to CssPropertyFlags
  • Added CssLength width field to CssStyle
  • Added hasWidth() convenience method
  • Updated applyOver(), reset(), clearAll(), anySet() to include width
  • Added else if (propName == "width") case to CssParser::parseDeclarations() using interpretLength()

2. Table Data (lib/Epub/Epub/TableData.h)

  • Added CssLength widthHint and bool hasWidthHint to TableCell
  • Added std::vector<CssLength> colWidthHints to TableData (from <col> tags)
  • Added #include "css/CssStyle.h" for CssLength

3. Parser (lib/Epub/Epub/parsers/ChapterHtmlSlimParser.cpp)

  • Removed "col" from TABLE_SKIP_TAGS (was being skipped entirely)
  • Added parseHtmlWidthAttr() helper: parses HTML width="200" (pixels) and width="50%" (percent) into CssLength
  • Added <col> handling in startElement: parses width HTML attribute and style CSS, pushes to tableData->colWidthHints
  • Updated <td>/<th> handling: now parses width HTML attribute, style attribute, and stylesheet CSS width (via resolveStyle). CSS takes priority over HTML attribute. Stored in TableCell::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.
  • rowspan is not yet supported.