refactor(engine): extract composite bleed-box geometry into CompositeDecoration#357
Merged
Conversation
…Decoration compileComposite resolved the decoration (fill / border) box inline: four coordinates, each adjusted per bled edge against the page dimensions. That is pure geometry and belongs with the decoration owner. Move it onto CompositeDecoration.resolveBleedBox, returning a BleedBox record; compileComposite now resolves the box in one call and passes it to fill, and drops the now-unused DocumentEdge import. Byte-identical placement, and the per-edge math gets direct unit coverage in CompositeDecorationTest.
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
Continues the
LayoutCompilergod-class breakdown.compileCompositecomputed thecomposite decoration box — the fill / border extent after content bleed — inline: four
coordinates, each snapped to the trimmed page edge per declared bleed edge. That pure
geometry belongs with the decoration owner (
CompositeDecoration), where it can beunit-tested in isolation instead of only through whole-document parity.
What
CompositeDecoration.resolveBleedBox(bleed, x, width, topY, bottomY, canvas)returning a package-private
BleedBox(x, width, topY, bottomY)record — the sameper-edge snap logic, lifted verbatim.
compileCompositeresolves the box in one call and passes it tofill(...)(signature unchanged); dropped the now-unused
DocumentEdgeimport.CompositeDecorationTest: five new cases — no-bleed pass-through, LEFT, RIGHT,TOP+BOTTOM, and full
all().Tests
./mvnw -f aggregator/pom.xml verify -pl :graph-compose-qa -am— full compile +javadoc gate + the qa visual/parity byte-identity suite (643): green. The decoration
geometry is byte-identical;
resolveBleedBoxreads no compiler state.CompositeDecorationTest: 13 tests, 0 failures.Byte-identical lift — the bleed math is unchanged, now behind a named, tested helper.