[css-grid] Update behavior of percentage row tracks and gutters
authorrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Aug 2018 09:14:35 +0000 (09:14 +0000)
committerrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Aug 2018 09:14:35 +0000 (09:14 +0000)
commita22e900a91ad9cd398358182e44fa56ff6b85334
tree5240b7dc648be7eed76996db8b83fcb9e17b90b4
parent44d2f4b1f1e5ea7f13fbb7a1e20afec9824f008e
[css-grid] Update behavior of percentage row tracks and gutters
https://bugs.webkit.org/show_bug.cgi?id=188403

Reviewed by Sergio Villar Senin.

LayoutTests/imported/w3c:

Import tests from WPT related to this issue.

* web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-001-expected.txt: Added.
* web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-001.html: Added.
* web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-002-expected.txt: Added.
* web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-002.html: Added.
* web-platform-tests/css/css-grid/alignment/w3c-import.log:
* web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001-expected.txt: Added.
* web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html: Added.
* web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002-expected.txt: Added.
* web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html: Added.
* web-platform-tests/css/css-grid/grid-definition/w3c-import.log:
* web-platform-tests/css/css-grid/grid-layout-properties.html: Update test to reflect the new behavior.

Source/WebCore:

The CSSWG decided to change how percentage row tracks and gutters
in a grid container with indefinite height are resolved.

The CSSWG issues are:
- https://github.com/w3c/csswg-drafts/issues/1921
- https://github.com/w3c/csswg-drafts/issues/509

So far they were resolved as "auto", like it happens with
percentage heights in regular blocks. But now they're going to behave
similar to what happens in the columns axis, they would be ignored
to compute the intrinsic height.
This causes that we need to repeat the track sizing algorithm
when we have a grid container with indefinite height
that has some percentage rows using the intrinsic height
calculated on the first pass. Then the percentages will be resolved
against the intrinsic height.

Tests: imported/w3c/web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-001.html
       imported/w3c/web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-002.html
       imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html
       imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html

* rendering/GridTrackSizingAlgorithm.cpp:
(WebCore::GridTrackSizingAlgorithm::gridTrackSize const):
(WebCore::GridTrackSizingAlgorithm::initializeTrackSizes):
(WebCore::GridTrackSizingAlgorithm::setup):
(WebCore::GridTrackSizingAlgorithm::reset):
* rendering/GridTrackSizingAlgorithm.h:
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::availableSpaceForGutters const):
(WebCore::RenderGrid::repeatTracksSizingIfNeeded):
(WebCore::RenderGrid::layoutBlock):

LayoutTests:

Update tests as needed according to the new behavior.

* TestExpectations: Two grid gutters tests from WPT css-align suite are passing now.
* fast/css-grid-layout/grid-columns-rows-get-set-expected.txt:
* fast/css-grid-layout/grid-columns-rows-get-set-multiple-expected.txt:
* fast/css-grid-layout/grid-columns-rows-get-set-multiple.html:
* fast/css-grid-layout/grid-columns-rows-get-set.html:
* fast/css-grid-layout/grid-gutters-as-percentage-expected.txt:
* fast/css-grid-layout/grid-gutters-as-percentage.html:
* fast/css-grid-layout/grid-track-sizing-with-percentages-and-orthogonal-flows-expected.txt:
* fast/css-grid-layout/grid-track-sizing-with-percentages-and-orthogonal-flows.html:
* fast/css-grid-layout/named-grid-line-get-set-expected.txt:
* fast/css-grid-layout/named-grid-line-get-set.html:
* fast/css-grid-layout/nested-grid-expected.html:
* fast/css-grid-layout/percent-track-breadths-regarding-container-size.html:
* fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js:
* fast/css-grid-layout/resources/grid-columns-rows-get-set.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234687 268f45cc-cd09-0410-ab3c-d52691b4dbfc
32 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-expected.txt
LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-multiple-expected.txt
LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-multiple.html
LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set.html
LayoutTests/fast/css-grid-layout/grid-gutters-as-percentage-expected.txt
LayoutTests/fast/css-grid-layout/grid-gutters-as-percentage.html
LayoutTests/fast/css-grid-layout/grid-track-sizing-with-percentages-and-orthogonal-flows-expected.txt
LayoutTests/fast/css-grid-layout/grid-track-sizing-with-percentages-and-orthogonal-flows.html
LayoutTests/fast/css-grid-layout/named-grid-line-get-set-expected.txt
LayoutTests/fast/css-grid-layout/named-grid-line-get-set.html
LayoutTests/fast/css-grid-layout/nested-grid-expected.html
LayoutTests/fast/css-grid-layout/percent-track-breadths-regarding-container-size.html
LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js
LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set.js
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-001-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-001.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-002-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-002.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-layout-properties.html
Source/WebCore/ChangeLog
Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
Source/WebCore/rendering/GridTrackSizingAlgorithm.h
Source/WebCore/rendering/RenderGrid.cpp