feat(api): content bleed — sections fill to the trimmed page edge#228
Open
DemchaAV wants to merge 2 commits into
Open
feat(api): content bleed — sections fill to the trimmed page edge#228DemchaAV wants to merge 2 commits into
DemchaAV wants to merge 2 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-
DocumentInsetstrick that also drags the section's children off the page, and silently no-ops a negative bottom (the vertical flow swallowsamount <= EPSinadvanceSpace). There was no first-class way to say "this fill reaches the page edge."What changed
DocumentEdgeenum +DocumentBleedrecord indocument.style, mirroring theDocumentLineCap/DocumentInsetsidioms (none()/all()/of(...)).AbstractFlowBuilder.bleed(DocumentBleed)andbleedToEdge(DocumentEdge...)— section/flow builders declare which edges bleed.DocumentNode.bleed()default (none()), so every other node is unchanged;SectionNodecarries the bleed (back-compat constructor preserved).LayoutCompiler.compileCompositeresolves 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 withLineBuilder.fill()) and migrating the existingMintEditorial/MintEditorialLettermasthead 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 reachesx=0/width=pageWidth/top=pageHeight; a non-bled section stays inside every margin;DocumentBleedfactory unit checks.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 underv1.9.0.@since 1.9.0on all new public API.