Skip to content

feat(api): content bleed — sections fill to the trimmed page edge#228

Open
DemchaAV wants to merge 2 commits into
developfrom
feat/document-bleed
Open

feat(api): content bleed — sections fill to the trimmed page edge#228
DemchaAV wants to merge 2 commits into
developfrom
feat/document-bleed

Conversation

@DemchaAV

Copy link
Copy Markdown
Owner

Why

A section's background fill stops at the page content margin. Full-bleed chrome — a masthead band reaching the top and side edges, an edge-to-edge accent strip — was only reachable with a hand-computed negative-DocumentInsets trick that also drags the section's children off the page, and silently no-ops a negative bottom (the vertical flow swallows amount <= EPS in advanceSpace). There was no first-class way to say "this fill reaches the page edge."

What changed

  • New DocumentEdge enum + DocumentBleed record in document.style, mirroring the DocumentLineCap / DocumentInsets idioms (none() / all() / of(...)).
  • AbstractFlowBuilder.bleed(DocumentBleed) and bleedToEdge(DocumentEdge...) — section/flow builders declare which edges bleed.
  • Additive DocumentNode.bleed() default (none()), so every other node is unchanged; SectionNode carries the bleed (back-compat constructor preserved).
  • LayoutCompiler.compileComposite resolves the decoration box against the page canvas and relaxes the vertical content-area clamp on bled edges. Only the fill/border bleeds — the section's children stay inside the content margin, so a heading never runs off the page (an improvement over the negative-margin trick, which moved children too).

Lane: canonical public DSL + shared-engine (one compile method). The none() path is byte-identical — a static instance, no hot-path allocation.

Scope: section bleed. Line/leaf bleed (a line's geometry is fixed by node.startX()/endX(), not the placement width, so it belongs with LineBuilder.fill()) and migrating the existing MintEditorial / MintEditorialLetter masthead off the negative-margin idiom are deliberate follow-ups.

Verification

  • ./mvnw test -pl . — 1487 tests, 0 failures, 0 visual baselines changed (proves the non-bled path is byte-identical).
  • DocumentBleedTest: a bled section's fill reaches x=0 / width=pageWidth / top=pageHeight; a non-bled section stays inside every margin; DocumentBleed factory unit checks.
  • Runnable BleedExample (full-bleed masthead + edge-to-edge band) with a committed preview (assets/readme/examples/content-bleed.pdf) and an examples README row; CHANGELOG entry under v1.9.0.

@since 1.9.0 on all new public API.

DemchaAV added 2 commits June 24, 2026 10:30
Sections gain bleed(DocumentBleed) / bleedToEdge(DocumentEdge...): the
background fill extends to the physical page edge on the declared sides
while the section's children stay inside the content margin, so a
full-bleed masthead band's heading never runs off the page. The
content-side twin of pageBackground(...) and the intent-revealing
replacement for the hand-computed negative-margin idiom.

A DocumentEdge enum + DocumentBleed record join document.style; an
additive DocumentNode.bleed() default keeps every other node
byte-identical; SectionNode carries the bleed; LayoutCompiler resolves
the decoration box against the page canvas and relaxes the vertical
content-area clamp on bled edges.

Verified: ./mvnw test -pl . — 1487 tests, 0 baselines changed.
DocumentBleedTest asserts the bled fill reaches x=0 / width=pageWidth /
top=pageHeight; a runnable BleedExample ships with a committed preview.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant