refactor(engine): extract the layer-stack placement into its own compiler#361
Merged
Merged
Conversation
…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.
faf752f to
3849ce3
Compare
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
LayoutCompilerbreakdown.compileStackedLayer(~134 lines — admit thestack band, place each layer in z-order, emit fill/overlay decoration, record the node) is
the next-largest
compile*method. UnlikecompileSplittableLeaf(#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 astandalone unit — it trims
LayoutCompilerwithout fully decoupling the recursion.What
compileStackedLayerinto a package-privateStackedLayerCompiler.compile(host, …);LayoutCompilerdispatches to it and drops the private method (1196 → 1062 LOC).host.placeStackLayer(…)/host.admitAtomicBlock(…)(both nowpackage-private) —
placeStackLayerstays inLayoutCompilerbecause the STACK branch ofcompileNodeInFixedSlotalso uses it.CompileContextrecord bundling the five cursor/emission params(
state/prepareContext/fragmentContext/nodes/fragments) so the collaboratortakes one context argument; dropped the unused
availableWidthparam; repointed a{@link}and a comment.
Tests
./mvnw -f aggregator/pom.xml verify -pl :graph-compose-qa -am— full compile + javadoc gateper-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.
CompileContextis the first step towardshrinking the remaining fat
compile*signatures; retrofittingSplittableLeafCompilerto itis a follow-up.