refactor(painters/dom): drop list-item fragment renderer (SD-2851)#3269
refactor(painters/dom): drop list-item fragment renderer (SD-2851)#3269luccas-harbour wants to merge 1 commit into
Conversation
List rendering is now unified through the paragraph fragment path, so the list-item-specific renderer and its supporting helpers are no longer reachable. Removes: - `renderListItemFragment` and `applyResolvedListItemWrapperFrame` from `renderer.ts`, along with the `LIST_MARKER_GAP` constant and the `stripListIndent` helper. - list-item branches from `fragmentKey`, `deriveBlockVersion`, and the fragment-frame dispatch (now treats `list-item` as unsupported). - list-item handling in `computeBetweenBorderFlags` (border grouping now only pairs `para` fragments). - list-item fixtures and assertions from `between-borders.test.ts`, `renderer-dispatch.test.ts`, and `index.test.ts`. - the now-stale `renderer-known-divergences.test.ts`.
There was a problem hiding this comment.
💡 Codex Review
renderFragment now throws for any list-item fragment, but the list-item model is still produced elsewhere in the pipeline (layout-bridge/src/incrementalLayout.ts and layout-resolved/src/resolveLayout.ts still handle kind: 'list-item', and ListItemFragment remains in contracts). That means any remaining caller/flow that emits legacy list fragments will hard-fail painting at runtime instead of degrading gracefully, which is a behavior regression introduced by this commit.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
Removes the now-unreachable
list-itemfragment path from the DOM painter. List rendering already flows through the paragraph fragment path (the PM adapter no longer registersorderedList/bulletListhandlers — list paragraphs go throughparagraphToFlowBlocks()asParagraphBlockwith marker metadata), so the dedicatedlist-itemrenderer and its helpers were dead weight duplicating paragraph behavior.What changed
In
packages/layout-engine/painters/dom/src/renderer.ts:renderListItemFragmentandapplyResolvedListItemWrapperFrame.LIST_MARKER_GAPconstant and thestripListIndenthelper.list-itembranches fromfragmentKey,deriveBlockVersion, and the fragment-frame dispatch —list-itemis now treated as unsupported (throws infragmentKeyandrenderFragment).computeBetweenBorderFlagsinfeatures/paragraph-borders/group-analysis.tsto pairparafragments only.Tests:
renderer-known-divergences.test.ts(the file existed to track list-item parity bugs; obsolete now).between-borders.test.ts,renderer-dispatch.test.ts, andindex.test.ts.test-utils/normalize-line.tsto reflect the remaining contexts (body, table-cell).Body↔table-cell justify
wordSpacingparity that incidentally lived in the deleted divergence file is still covered byrenderer-parity-contracts.test.ts:310-387. Lists rendered through the paragraph path are exercised byrenderer-marker-suffix.test.ts,renderer-marker-textwidth.test.ts, and the multi-line list integration test atindex.test.ts:1266.What's intentionally NOT in this PR
The
ListBlock/ListItemFragmenttypes and their producers incontracts/,layout-bridge/,layout-resolved/, andpm-adapter/sdt/are still present. They're now dead feeds (the painter rejects what they produce), but unwinding them touches multiple packages and is better as a follow-up so this PR stays focused on the painter cleanup.Follow-ups
ListBlock,ListMeasure, andListItemFragmentfrompackages/layout-engine/contracts/src/index.tsand propagate the removal throughlayout-bridge(cache.ts,incrementalLayout.ts),layout-resolved(resolveLayout.ts,versionSignature.ts), andpm-adapter/sdt/.RENDERING_DUPLICATION_AUDIT.md: extracting a shared paragraph content renderer that body and table-cell paths both consume.