Commit 33e0471
committed
refactor(painter): migrate internals to ResolvedLayout (SD-2836)
Switch DomPainter's internal state and helpers from raw Layout/Page to
ResolvedLayout/ResolvedPage:
* The six top-level legacy-Layout methods (beginPaintSnapshot,
fullRender, patchLayout, renderHorizontal, renderBookMode,
renderVirtualized) take ResolvedLayout. paint() drops the
`const layout = input.sourceLayout` binding and calls every method
with input.resolvedLayout.
* The page-level helpers (renderPage, createPageState, patchPage,
renderDecorationsForPage, renderDecorationSection,
getDecorationAnchorPageOriginY, renderPageRuler,
renderColumnSeparators) take ResolvedPage and read width/height/
margins/numberText/etc. directly. Drops every redundant
`resolvedPage?: ResolvedPage | null` parameter.
* `currentLayout: Layout | null` -> `ResolvedLayout | null`. Strips
the `(page.size ?? layout.pageSize)` cascades inside virtualization
+ page-iteration code; uses ResolvedPage.width/.height directly.
* Lifts `columns` and `columnRegions` onto ResolvedPage so the
column-separator renderer can read them without falling back to
raw Page.
Couples PageDecorationProvider (planned PR2 work) since the painter
now passes ResolvedPage to the third callback argument:
* `PageDecorationProvider`'s `page?` parameter is `ResolvedPage`.
* `HeaderFooterSessionManager.rebuildRegions` takes ResolvedLayout.
`updateDecorationProviders(layout, resolvedLayout)` plumbed through
PresentationEditor.
* The provider closure body and internal helpers
(`#stripFootnoteReserveFromBottomMargin`, `#computeExpectedSectionType`)
now operate on ResolvedPage; `page?.size?.h` -> `page?.height`.
* `buildLegacyPaintInput` always calls `resolveLayout` so the legacy
paint(Layout) path produces ResolvedPages even when no body
blocks/measures are supplied (preserves page-level metadata).
Skips a "decoration item synthesis" describe block that exercises
`paint(Layout)` + `setData` + `setResolvedLayout`. Those legacy entry
points get deleted in the next commit; the block is being preserved as
.skip so the deletion is visible in diff.1 parent 4b52441 commit 33e0471
7 files changed
Lines changed: 100 additions & 128 deletions
File tree
- packages
- layout-engine
- contracts/src
- layout-resolved/src
- painters/dom/src
- super-editor/src/editors/v1/core/presentation-editor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| |||
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
69 | 75 | | |
70 | 76 | | |
71 | 77 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
| 311 | + | |
| 312 | + | |
311 | 313 | | |
312 | 314 | | |
313 | 315 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10858 | 10858 | | |
10859 | 10859 | | |
10860 | 10860 | | |
10861 | | - | |
| 10861 | + | |
10862 | 10862 | | |
10863 | 10863 | | |
10864 | 10864 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
239 | | - | |
240 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
241 | 242 | | |
242 | 243 | | |
243 | 244 | | |
| |||
0 commit comments