Skip to content

refactor(engine): move row slot-width resolution into RowSlots#356

Merged
DemchaAV merged 1 commit into
2.0-devfrom
refactor/rowslots-resolve-layout
Jul 11, 2026
Merged

refactor(engine): move row slot-width resolution into RowSlots#356
DemchaAV merged 1 commit into
2.0-devfrom
refactor/rowslots-resolve-layout

Conversation

@DemchaAV

Copy link
Copy Markdown
Owner

Why

LayoutCompiler is the engine's largest class. Its compileHorizontalRow picked the
per-child slot widths inline through a three-way flex / explicit-columns / weights
branch, and the weight split lived in a private LayoutCompiler.distributeRowSlotWidths.
Both are pure row slot-width computation that belongs with the other primitives in
RowSlots (rowAvailableWidth, distributeFlex, distributeColumns,
intrinsicColumnWidths) — whose Javadoc already pointed at distributeRowSlotWidths.

What

  • Moved distributeRowSlotWidths from LayoutCompiler into RowSlots and repointed its
    {@link}.
  • Added RowSlots.resolveLayout(...), which returns the slot widths plus the flex leading
    offset and extra inter-child gap in a small package-private SlotLayout record — the
    same flex / columns / weights dispatch, lifted verbatim.
  • compileHorizontalRow now calls resolveLayout and reads the three values off the
    record; dropped two now-unused imports. LayoutCompiler loses ~64 lines.
  • RowSlotsTest gains four pure tests for distributeRowSlotWidths (even split, weighted
    split, inter-child gap subtraction, zero-total fallback).

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 row placement is
    byte-identical; resolveLayout reads no compiler state.
  • RowSlotsTest: 8 tests, 0 failures.

Byte-identical lift — the row slot-width dispatch is unchanged. Its branch selection is
exercised by the qa row corpus (as the sibling distributeFlex / distributeColumns
already are); the pure weight split now has direct unit coverage.

compileHorizontalRow chose its slot widths inline through a three-way
flex / explicit-columns / weights branch, and the weight split lived in a
private LayoutCompiler.distributeRowSlotWidths. Both belong with the other
row slot-width primitives.

Move distributeRowSlotWidths onto RowSlots (whose Javadoc already pointed at
it) and add RowSlots.resolveLayout, returning the slot widths plus the flex
leading / extra-gap in a small SlotLayout record. compileHorizontalRow now
calls resolveLayout and reads the three values off the record — byte-identical
placement, and LayoutCompiler drops ~64 lines and two now-unused imports.
RowSlotsTest gains direct coverage for the weight distribution.
@DemchaAV DemchaAV merged commit 16918bb into 2.0-dev Jul 11, 2026
12 checks passed
@DemchaAV DemchaAV deleted the refactor/rowslots-resolve-layout branch July 11, 2026 00:05
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