Skip to content

feat(layout): wire grid track definitions through to taffy #105

Description

@LeadcodeDev

Part of #102 — wave 1.

Mini-spec

Goal: make grid actually produce columns. grid-template-columns is declared in CssStyle, is made mandatory by the validator, and is never passed to taffy — the only grid reference in taffy_bridge.rs is the Display::Grid mapping at line 33.

Invariants

  • A grid with three 1fr tracks renders three side-by-side cells, matching the flex-direction: row control.
  • flex layout behaviour is unchanged.

Out of scope: removing the validator's mandatory-tracks check (L4 owns validate_schema.rs); grid areas / named lines.

Acceptance

  • grid-template-columns, grid-template-rows, grid-column, grid-row, grid-auto-flow are translated into the corresponding taffy::Style fields.
  • The three fixtures below each render three columns, not three stacked rows:
    • tracks as strings ["1fr","1fr","1fr"]
    • tracks as numbers [1,1,1]
    • with an explicit display: "grid"
  • gap applies on both axes.
  • A layout test asserts cell x-offsets differ (this is what the current code silently gets wrong).

Files: crates/rustmotion-core/src/css/taffy_bridge.rs, crates/rustmotion-core/src/css/style.rs

Note: crates/rustmotion-core/src/schema/style.rs is a different file owned by L4 — do not touch it.

Verify

rtk cargo test -p rustmotion-core
rtk cargo build --release

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions