Skip to content

Grid Lanes: dense packing - #1274

Open
nicoburns wants to merge 2 commits into
devin/1791476519-grid-lanes-intrinsic-tracksfrom
devin/1791477864-grid-lanes-dense
Open

nicoburns wants to merge 2 commits into
devin/1791476519-grid-lanes-intrinsic-tracksfrom
devin/1791477864-grid-lanes-dense

Conversation

@nicoburns

@nicoburns nicoburns commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Objective

Third Grid Lanes PR: dense packing (css-grid-3 §4.3 and §4.4 step 4). Stacked on #1272.

After an item's normal placement and measurement, a dense container backfills it into the highest skipped space it fits into, provided the tracks of that space have the same total size as the tracks of its normal placement (so the measurement stays valid). Among spaces within the tie threshold of the highest one the start-most wins. A backfilled item leaves the auto-placement cursor and the running positions untouched; definitely placed items can backfill within their own tracks.

The dense keyword is read from grid_auto_flow().is_dense(): the spec has not settled which property carries it (csswg-drafts#12803), Chromium uses a provisional grid-lanes-pack property, and Blitz drives it from grid-auto-flow: dense on a display: grid-lanes container (DioxusLabs/blitz#1132). The fixtures set both properties so Chrome and Taffy agree.

Context

Implementation in src/compute/grid/lanes.rs, following Chromium's shape (GridLanesRunningPositions):

  • TrackOpenings per track (only allocated when dense): bounded skipped spaces plus the open end at the running position. Normal placement records a skipped space whenever a spanned track's running position is below the item's position; backfilling carves the item out of the opening (split, trim or remove).
  • find_dense_placement tries every start line with the same spanned track size and intersects the openings across the span (lowest_opening_in_span, recursive like Chromium's AccumulateTrackOpeningsToAccommodateItem); paths that end in the open end of every track are not skipped spaces. Two passes (highest, then first within the threshold that is above the normal placement) avoid a candidate allocation.
  • Items occupy outer size + stacking gap in the openings, matching the running-position bookkeeping.
  • set_item_grid_axis_lines is the previous inline line-setting code, now shared by normal and dense placement.

Tests: 9 new fixtures in test_fixtures/grid_lanes/grid_lanes_dense_*.html (36 generated tests) covering backfill, the same-track-size rule, spanning backfill across adjacent openings, definite items, the tie threshold, gaps, margins, row direction and the no-opening fallback; all pass against Chrome 151 and the existing suites regenerated byte-identical. cargo test --all-features: 6869 passed.

No shared grid code changes: everything is in the grid_lanes-gated lanes.rs, so default-feature grid layout is unaffected.

Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/93f06aa5dd4e4bc18d2482197dbb9191
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/93f06aa5dd4e4bc18d2482197dbb9191?variant=devin-insiders
Requested by: @nicoburns

@staging-devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access that start with 'Devin'.

  • Disable automatic comment, CI, and merge conflict monitoring

@staging-devin-ai-integration
staging-devin-ai-integration Bot added this pull request to stack #1273 October 8, 2026 16:54
@staging-devin-ai-integration
staging-devin-ai-integration Bot force-pushed the devin/1791477864-grid-lanes-dense branch from 96ce55c to 72dedff Compare October 8, 2026 17:34
@staging-devin-ai-integration
staging-devin-ai-integration Bot force-pushed the devin/1791477864-grid-lanes-dense branch from 72dedff to 6ee90e4 Compare October 8, 2026 17:56
@staging-devin-ai-integration
staging-devin-ai-integration Bot force-pushed the devin/1791477864-grid-lanes-dense branch from 6ee90e4 to fd428eb Compare October 8, 2026 18:40
@staging-devin-ai-integration
staging-devin-ai-integration Bot force-pushed the devin/1791477864-grid-lanes-dense branch from fd428eb to 6437323 Compare October 8, 2026 20:39
@staging-devin-ai-integration
staging-devin-ai-integration Bot force-pushed the devin/1791477864-grid-lanes-dense branch from 6437323 to 36455d0 Compare October 8, 2026 20:42
@staging-devin-ai-integration
staging-devin-ai-integration Bot force-pushed the devin/1791477864-grid-lanes-dense branch from 36455d0 to 1387644 Compare October 8, 2026 20:47
@staging-devin-ai-integration
staging-devin-ai-integration Bot force-pushed the devin/1791477864-grid-lanes-dense branch 2 times, most recently from cf00d40 to 6fd411b Compare October 8, 2026 21:59
@staging-devin-ai-integration
staging-devin-ai-integration Bot force-pushed the devin/1791477864-grid-lanes-dense branch 2 times, most recently from 5bc349e to 0f08b91 Compare October 8, 2026 22:56
@staging-devin-ai-integration
staging-devin-ai-integration Bot force-pushed the devin/1791477864-grid-lanes-dense branch from 0f08b91 to 4016385 Compare October 8, 2026 23:09
@staging-devin-ai-integration
staging-devin-ai-integration Bot force-pushed the devin/1791477864-grid-lanes-dense branch from 4016385 to be4907d Compare October 8, 2026 23:41
@staging-devin-ai-integration
staging-devin-ai-integration Bot force-pushed the devin/1791477864-grid-lanes-dense branch from be4907d to 912bc5d Compare October 9, 2026 00:01
@staging-devin-ai-integration
staging-devin-ai-integration Bot force-pushed the devin/1791477864-grid-lanes-dense branch from 912bc5d to 05b0bfa Compare October 9, 2026 01:04

This branch has not been deployed

No deployments
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