Bug 157834

Summary: [css-grid] Fix behavior of flexible track breadths
Product: WebKit Reporter: Manuel Rego Casasnovas <rego>
Component: Layout and RenderingAssignee: Manuel Rego Casasnovas <rego>
Severity: Normal CC: commit-queue, jfernandez, rego, simon.fraser, svillar
Priority: P2 Keywords: BlinkMergeCandidate
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.chromium.org/p/chromium/issues/detail?id=611407
Bug Depends on:    
Bug Blocks: 60731    
Description Flags
Patch none

Description Manuel Rego Casasnovas 2016-05-18 04:46:32 PDT
There have been some changes on the spec so we need to update the implementation.
This bug is about 2 changes that are interrelated.

1) First change [1] is from January 2015 [2]:
  "When appearing outside a minmax() notation,
   implies an automatic minimum (i.e. ''minmax(auto, <flex>)'')."

  Right now, we're considering that "1fr" is equivalent to "minmax(1fr, 1fr)".
  But it should be "minmax(auto, 1fr)".

2) Another change [3] from the spec  that we should implement.
  "fr" should be invalid if it's used in the min slot of minmax().

  The new syntax on the spec is [4]:
    <track-size> =
      <track-breadth> |
      minmax( <inflexible-breadth> , <track-breadth> )

    <inflexible-breadth> =
      <length> |
      <percentage> |
      min-content |
      max-content |

  This means that a declaration like "grid-column: minmax(1fr, 100px);"
  should be considered invalid.

As you can see both changes are very related. It would be strange that
we're rejecting "fr" explicitly on the min slot (e.g. "minmax(1fr, 100px)"),
but accepting it implicitly as "1fr" would behave like "minmax(1fr, 1fr)"
instead of "minmax(auto, 1fr)".

BTW, this has been already fixed in Blink:

[1] https://drafts.csswg.org/css-grid/#valdef-grid-template-columns-flex
[2] https://github.com/w3c/csswg-drafts/commit/129f2c1ad684e47ef85900f8e156efe07a3f13d6
[3] https://github.com/w3c/csswg-drafts/commit/4040ba7fa068905f7fe1c1bf35d665a2062acafa
[4] https://drafts.csswg.org/css-grid/#typedef-track-size
Comment 1 Manuel Rego Casasnovas 2016-05-20 02:18:24 PDT
Created attachment 279473 [details]
Comment 2 Sergio Villar Senin 2016-05-24 01:05:35 PDT
Comment on attachment 279473 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=279473&action=review

Awesome. Just some minor nits here and there.

> Source/WebCore/ChangeLog:10
> +        1) Flex sizes are invalid on the min slot of minmax().

Nit: "min track sizing function"

> Source/WebCore/ChangeLog:18
> +          adding a new type of restriction "InflexibleSizeOnly".

I prefer this to be inlined bellow in the changed files list.

> Source/WebCore/ChangeLog:28
> +          RenderGrid::gridTrackSize();


> Source/WebCore/rendering/RenderGrid.cpp:751
> +    // if the track had a flex size directly (e.g. "1fr"), the spec says that in this case it implies an automatic minimum.

" if the track had a flex size directly" sounds weird to me, could you rephrase it?

> LayoutTests/ChangeLog:8
> +        The patch includes new test cases checking specifically these 2 issues.

"checking specifically these 2 issues" note that you have not mentioned any issue in this ChangeLog, it only makes sense when reading the WebCore one, so perhaps it's better to add a description or completely wipe out that sentence (and adapting the following ones)
Comment 3 Manuel Rego Casasnovas 2016-05-24 01:24:21 PDT
Created attachment 279636 [details]
Comment 4 Manuel Rego Casasnovas 2016-05-24 01:25:10 PDT
Comment on attachment 279636 [details]

Thanks for the review. Applied suggested changes.
Comment 5 WebKit Commit Bot 2016-05-24 01:54:06 PDT
Comment on attachment 279636 [details]

Clearing flags on attachment: 279636

Committed r201325: <http://trac.webkit.org/changeset/201325>
Comment 6 WebKit Commit Bot 2016-05-24 01:54:10 PDT
All reviewed patches have been landed.  Closing bug.