Skip to content

CSS Grid: named lines and areas#840

Merged
nicoburns merged 71 commits intomainfrom
named-grid-lines-and-areas
Aug 1, 2025
Merged

CSS Grid: named lines and areas#840
nicoburns merged 71 commits intomainfrom
named-grid-lines-and-areas

Conversation

@nicoburns
Copy link
Copy Markdown
Collaborator

@nicoburns nicoburns commented May 24, 2025

Objective

Support named grid lines and named grid areas in CSS grid.

Changes made

  • Make Style generic over an abstract string type (so clients can use the formats their strings are already in (e.g. Atom for Servo/Blitz))
  • Add a CustomIdent type (same string trait)
  • Add grid_template_row_names and grid_template_column_names properties (Vec of lines names)
  • Add GridTemplateArea struct and grid_template_areas property
  • Add a new GridTemplateComponent type so that repetitions can specify line names
  • Add NamedLine and NamedSpan variants to GridPlacement (and make public GridPlacement no longer generic)
  • Add a whole bunch more associated types to the GridContainerStyle trait to allow zero-cost iteration over complex nested grid definitions.

Context

This is necessary to correctly layout websites such docs.rs, wikipedia.org and news.bbc.co.uk

@nicoburns nicoburns force-pushed the named-grid-lines-and-areas branch 3 times, most recently from a98db79 to 9a0aeba Compare May 24, 2025 23:58
@nicoburns nicoburns force-pushed the named-grid-lines-and-areas branch 4 times, most recently from e4f56fb to ba97f8f Compare July 29, 2025 19:22
@nicoburns nicoburns force-pushed the named-grid-lines-and-areas branch 5 times, most recently from c4325db to 9b10d09 Compare July 30, 2025 16:46
@nicoburns nicoburns changed the title WIP: Named grid lines and areas CSS Grid: named lines and areas Aug 1, 2025
We cannot assume that a named line placement is valid
Signed-off-by: Nico Burns <[email protected]>
…tion when computing auto-repeated tracks

Signed-off-by: Nico Burns <[email protected]>
If known_dimensions is set in the axis, then the container counts as
having a definite width and should not fallback to the min-width fitting
strategy.
Signed-off-by: Nico Burns <[email protected]>
@nicoburns nicoburns force-pushed the named-grid-lines-and-areas branch from 0114b52 to d6c5707 Compare August 1, 2025 17:26
@nicoburns nicoburns force-pushed the named-grid-lines-and-areas branch 3 times, most recently from f6c9527 to 5f1e7b0 Compare August 1, 2025 22:06
@nicoburns nicoburns added the enhancement New feature or request label Aug 1, 2025
@nicoburns nicoburns marked this pull request as ready for review August 1, 2025 22:17
@nicoburns nicoburns force-pushed the named-grid-lines-and-areas branch from 5f1e7b0 to 8352beb Compare August 1, 2025 22:18
Signed-off-by: Nico Burns <[email protected]>
@nicoburns nicoburns force-pushed the named-grid-lines-and-areas branch from 8352beb to 1822b95 Compare August 1, 2025 22:18
@nicoburns nicoburns merged commit c3e8000 into main Aug 1, 2025
34 checks passed
@nicoburns nicoburns deleted the named-grid-lines-and-areas branch August 1, 2025 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CSS Grid: Support named grid lines and grid areas

1 participant