[css-grid] fit-content() tracks shouldn't stretch
authorrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Sep 2017 07:28:07 +0000 (07:28 +0000)
committerrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Sep 2017 07:28:07 +0000 (07:28 +0000)
commit60650a87087bae64c661a6f37ca1e49acc15550f
treed729da21d85f3aba35e5adf120118933423fa16d
parentaf520722b222d8c6333b11510e4dc94c228104e2
[css-grid] fit-content() tracks shouldn't stretch
https://bugs.webkit.org/show_bug.cgi?id=177300

Reviewed by Sergio Villar Senin.

LayoutTests/imported/w3c:

Imported a new test in WPT covering several cases for this issue.

* web-platform-tests/css/css-grid-1/alignment/grid-fit-content-tracks-dont-stretch-001-expected.txt: Added.
* web-platform-tests/css/css-grid-1/alignment/grid-fit-content-tracks-dont-stretch-001.html: Added.
* web-platform-tests/css/css-grid-1/alignment/w3c-import.log:

Source/WebCore:

The spec is pretty clear regarding this
(https://drafts.csswg.org/css-grid/#algo-stretch):
  "This step sizes expands tracks that have an auto max track sizing
   function by dividing any remaining positive, definite free space
   equally amongst them."

The fit-content() tracks don't have an auto max track sizing function,
so they shouldn't be considered in this step of the algorithm.

The patch modifies GridTrackSizingAlgorithm::initializeTrackSizes()
so it doesn't consider fit-content() tracks as auto sized ones
(which are the ones later stretched in the last step of the algorithm).

Test: imported/w3c/web-platform-tests/css/css-grid-1/alignment/grid-fit-content-tracks-dont-stretch-001.html

* rendering/GridTrackSizingAlgorithm.cpp:
(WebCore::GridTrackSizingAlgorithm::initializeTrackSizes):
(WebCore::GridTrackSizingAlgorithm::stretchAutoTracks):
(WebCore::GridTrackSizingAlgorithm::setup):
(WebCore::GridTrackSizingAlgorithm::reset):
* rendering/GridTrackSizingAlgorithm.h:

LayoutTests:

Added new case to an existent test and also modified
the expected result in another one.

* fast/css-grid-layout/grid-content-alignment-stretch-only-valid-for-auto-sized-tracks-expected.txt:
* fast/css-grid-layout/grid-content-alignment-stretch-only-valid-for-auto-sized-tracks.html:
* fast/css-grid-layout/grid-intrinsic-maximums-expected.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222440 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/css-grid-layout/grid-content-alignment-stretch-only-valid-for-auto-sized-tracks-expected.txt
LayoutTests/fast/css-grid-layout/grid-content-alignment-stretch-only-valid-for-auto-sized-tracks.html
LayoutTests/fast/css-grid-layout/grid-intrinsic-maximums-expected.html
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/alignment/grid-fit-content-tracks-dont-stretch-001-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/alignment/grid-fit-content-tracks-dont-stretch-001.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/alignment/w3c-import.log
Source/WebCore/ChangeLog
Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
Source/WebCore/rendering/GridTrackSizingAlgorithm.h