Skip to content

refactor(engine): extract the layer-stack placement into its own compiler#361

Merged
DemchaAV merged 1 commit into
2.0-devfrom
refactor/extract-stacked-layer-compiler
Jul 11, 2026
Merged

refactor(engine): extract the layer-stack placement into its own compiler#361
DemchaAV merged 1 commit into
2.0-devfrom
refactor/extract-stacked-layer-compiler

Conversation

@DemchaAV

Copy link
Copy Markdown
Owner

Why

Continues the LayoutCompiler breakdown. compileStackedLayer (~134 lines — admit the
stack band, place each layer in z-order, emit fill/overlay decoration, record the node) is
the next-largest compile* method. Unlike compileSplittableLeaf (#360, self-contained),
its per-layer placement recurses back through the compiler (placeStackLayer
compileNodeInFixedSlot), so this is a method object with a host callback, not a
standalone unit — it trims LayoutCompiler without fully decoupling the recursion.

What

  • Moved compileStackedLayer into a package-private StackedLayerCompiler.compile(host, …);
    LayoutCompiler dispatches to it and drops the private method (1196 → 1062 LOC).
  • The collaborator calls back host.placeStackLayer(…) / host.admitAtomicBlock(…) (both now
    package-private) — placeStackLayer stays in LayoutCompiler because the STACK branch of
    compileNodeInFixedSlot also uses it.
  • Introduced a CompileContext record bundling the five cursor/emission params
    (state / prepareContext / fragmentContext / nodes / fragments) so the collaborator
    takes one context argument; dropped the unused availableWidth param; repointed a {@link}
    and a comment.

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 layer-stack render (z-order,
      per-layer offsets, fill/overlay) is exercised by the qa LayerStack parity / demo suites.

Honest scope: a relocation with a host callback, not a decoupling — the collaborator is not
independently unit-testable (its per-layer step delegates back into the full compiler), so it
stays qa-covered like the pagination-cursor helpers. CompileContext is the first step toward
shrinking the remaining fat compile* signatures; retrofitting SplittableLeafCompiler to it
is a follow-up.

…iler

Move compileStackedLayer out of LayoutCompiler into a package-private
StackedLayerCompiler, trimming the compiler by ~134 lines. The stack places
each layer through the host's placeStackLayer recursion, so the collaborator
takes the LayoutCompiler as a host and calls back host.placeStackLayer and
host.admitAtomicBlock (both now package-private) — a method object, not a
standalone unit. The five always-threaded cursor / emission parameters are
bundled into a new CompileContext record, and the unused availableWidth
parameter is dropped. Byte-identical.
@DemchaAV DemchaAV force-pushed the refactor/extract-stacked-layer-compiler branch from faf752f to 3849ce3 Compare July 11, 2026 08:09
@DemchaAV DemchaAV merged commit 22e41f4 into 2.0-dev Jul 11, 2026
12 checks passed
@DemchaAV DemchaAV deleted the refactor/extract-stacked-layer-compiler branch July 11, 2026 08:14
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