Skip to content

refactor(layout): lift page metadata into ResolvedPage#2810

Open
tupizz wants to merge 1 commit intomainfrom
tadeu/sd-2563-01-page-metadata
Open

refactor(layout): lift page metadata into ResolvedPage#2810
tupizz wants to merge 1 commit intomainfrom
tadeu/sd-2563-01-page-metadata

Conversation

@tupizz
Copy link
Copy Markdown
Contributor

@tupizz tupizz commented Apr 14, 2026

Summary

  • Add margins, footnoteReserved, numberText, vAlign, baseMargins, sectionIndex, sectionRefs, orientation to ResolvedPage
  • Add layoutEpoch to ResolvedLayout
  • Populate all fields in resolveLayout()
  • Painter reads from resolved page data with legacy fallbacks

PR Stack (SD-2563: Dumb Painter Refactor)

# PR Title Status
1 #2810 Lift page metadata into ResolvedPage 👈 this PR
2 #2811 Lift fragment metadata into resolved paint items
3 #2812 Pre-compute SDT container keys in resolved layout
4 #2813 Pre-compute paragraph border data in resolved layout
5 #2814 Move change detection into resolved layout stage

Test plan

  • 48/48 layout-resolved tests pass (11 new)
  • painter-dom types compile cleanly
  • No rendering behavior changes (all reads use resolvedPage?.x ?? page.x fallback)

@linear
Copy link
Copy Markdown

linear bot commented Apr 14, 2026

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 68ac032cf7

ℹ️ 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".

const className = kind === 'header' ? CLASS_NAMES.pageHeader : CLASS_NAMES.pageFooter;
const existing = pageEl.querySelector(`.${className}`);
// Provider still receives legacy page — its signature is not changed in this PR
const data = provider ? provider(page.number, page.margins, page) : null;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Pass resolved metadata into decoration provider

renderDecorationSection still calls the provider with source-page data (provider(page.number, page.margins, page)), but this refactor moved page metadata into ResolvedPage and the rest of this method now uses resolvedPage fallbacks for margin/anchor math. If sourceLayout.pages omits optional metadata while resolvedLayout.pages has it, the header/footer provider (e.g., HeaderFooterSessionManager.createDecorationProvider, which reads page.sectionRefs, sectionIndex, and margins) will resolve the wrong decoration variant or offsets, producing incorrect headers/footers even though the resolved data is present.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant