wpt icon indicating copy to clipboard operation
wpt copied to clipboard

Don't serialize shorthand when not all subproperties have initial values

Open cdoublev opened this issue 2 years ago • 2 comments

This test case corresponds to a current round trip issue in Chrome/Firefox (at least): grid serializes to 'none' even if grid-template-areas is declared to a non-initial value.

cdoublev avatar Sep 03 '22 19:09 cdoublev

This test case corresponds to a current round trip issue in Chrome/Firefox

Firefox and WebKit seem fine for me. Just Blink is wrong

Loirooriol avatar Sep 05 '22 14:09 Loirooriol

Sure. I have already spent some time analyzing the conditions for which grid or grid-template should not be serialized, and to figure out how to formulate these conditions in the most simple terms. However it does not surprise me that I missed grid: auto-flow 1px/2px; grid-auto-columns: 3px as I had decided to come back later to it with a fresh look. Furthermore, I was quite confident for this simple test but ideally I should run new tests locally and I might struggle to do so as I am using a virtual machine to keep my host machine "clean". But I can still open the HTML test file directl and running wpt lint should be enough, of course.

TLDR: I will do it later but feel free to replace this PR if you do not want to wait.

cdoublev avatar Sep 06 '22 06:09 cdoublev

Superseded by #36217

Oriol (or anyone interested), I leave you my notes in case you want to review/complete tests about serializing grid/grid-template to empty string when it cannot represent all its sub-properties.

grid-template

It is assumed that grid-template-rows, grid-template-columns, grid-template-areas, have a declaration.

grid-template cannot represent all its sub-properties when grid-template-areas is not declared to its initial value (none) and some of these conditions is truthy:

  • grid-template-rows matches none
  • grid-template-rows defines less/more <track-size>s than <string> (rows) in grid-template-areas
  • grid-template-rows|columns matches <track-list> expanded with <track-repeat>
  • grid-template-rows|columns matches <auto-track-list>
  • grid-template-rows|columns matches subgrid <line-name-list>?

Alternatively, the last three conditions can be expressed as follows to guide implementation rather than tests:

  • grid-template-rows matches <track-list> expanded with <track-size>
  • grid-template-columns matches either none, <track-list> expanded with <track-size> (explicit track list), or <explicit-track-list>

grid

It is assumed that grid-template-rows, grid-template-columns, grid-template-areas, grid-auto-fow, grid-auto-rows, grid-auto-columns, have a declaration.

grid cannot represent all its sub-properties when some of these conditions is truthy:

  • grid-auto-* are declared to their initial value (auto) and the serialization of grid-template is empty string
  • both axis have declarations defining an implicit track list
  • some axis has declarations defining both an explicit and implicit track lists

cdoublev avatar Oct 14 '22 16:10 cdoublev