Skip to content

refactor(engine): extract composite bleed-box geometry into CompositeDecoration#357

Merged
DemchaAV merged 1 commit into
2.0-devfrom
refactor/extract-bleed-box
Jul 11, 2026
Merged

refactor(engine): extract composite bleed-box geometry into CompositeDecoration#357
DemchaAV merged 1 commit into
2.0-devfrom
refactor/extract-bleed-box

Conversation

@DemchaAV

Copy link
Copy Markdown
Owner

Why

Continues the LayoutCompiler god-class breakdown. compileComposite computed the
composite 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 be
unit-tested in isolation instead of only through whole-document parity.

What

  • Added CompositeDecoration.resolveBleedBox(bleed, x, width, topY, bottomY, canvas)
    returning a package-private BleedBox(x, width, topY, bottomY) record — the same
    per-edge snap logic, lifted verbatim.
  • compileComposite resolves the box in one call and passes it to fill(...)
    (signature unchanged); dropped the now-unused DocumentEdge import.
  • 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; resolveBleedBox reads no compiler state.
  • CompositeDecorationTest: 13 tests, 0 failures.

Byte-identical lift — the bleed math is unchanged, now behind a named, tested helper.

…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.
@DemchaAV DemchaAV merged commit 2d2b33c into 2.0-dev Jul 11, 2026
12 checks passed
@DemchaAV DemchaAV deleted the refactor/extract-bleed-box branch July 11, 2026 00:19
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