Open Bug 2084413 Opened 1 month ago Updated 1 month ago

Grid shorthand doesn't round-trip for `grid: repeat(3, 80px) / auto-flow;`

Categories

(Core :: CSS Parsing and Computation, defect, P3)

defect

Tracking

()

People

(Reporter: emilio, Unassigned, Mentored)

Details

(Keywords: good-first-bug)

Attachments

(1 file)

Attached file Test-case —

See test-case. We should not error out. The code for serializing the grid shorthand is in here, we're probably bailing out incorrectly (return Ok(())) in some cases that can actually be represented.

This causes /css/css-typed-om/the-stylepropertymap/properties/grid.html to fail (because set() throws)

Hi :emilio, I'd like to work on this.

Looking at grid's to_css in servo/components/style/properties/shorthands.rs, both auto-flow branches bail out when the template track list isn't explicit (!list.is_explicit()), and is_explicit() is false for any repeat(). But the grid grammar takes a full <'grid-template-rows'> / <'grid-template-columns'> there, and the parser already accepts repeat(3, 80px) / auto-flow, so the value parses but serializes to the empty string.

My plan is to drop that check from both branches, so any track list the parser accepts is serialized. I'd add cases for repeat(3, 80px) / auto-flow and auto-flow / repeat(3, 80px) to the WPT shorthand serialization test, and check that css-typed-om/the-stylepropertymap/properties/grid.html passes. Does that sound right, or are there track lists (e.g. auto-repeat or subgrid) that should still bail out here?

That sounds about right!

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: