[CSS Grid Layout] Using automatic (instead of min-content) minimums for 'auto' tracks
authorsvillar@igalia.com <svillar@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Sep 2015 12:13:30 +0000 (12:13 +0000)
committersvillar@igalia.com <svillar@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Sep 2015 12:13:30 +0000 (12:13 +0000)
commit7c59cfdfec82d5a44c3efbbd9b4af9767899d5fe
treef0f6e3c0a514b5998d06a88aaa285f391ce5e01b
parent5fa6422b4a46782df4001fd25488ab63bb1be6da
[CSS Grid Layout]  Using automatic (instead of min-content) minimums for 'auto' tracks
https://bugs.webkit.org/show_bug.cgi?id=142329

Reviewed by Darin Adler.

Based on Blink's r198697 by <svillar@igalia.com> and r200478 by <jfernandez@igalia.com>

Source/WebCore:

More precisely (syntax-wise), this would allow 'auto' to be used within the
minmax() function (it's currently forbidden) and have the 'auto' keyword map
to minmax(auto, auto) instead of minmax(min-content, max-content).
- As a minimum, 'auto' would mean "use the specified minimum size, or if
that is auto, treat as 0 or min-content per Flexbox rules".
- As a maximum, 'auto' would mean "use the max-content size".

Regarding the implementation, a new phase is added to the track sizing
algorithm called ResolveIntrinsicMinimums (the former ResolveIntrinsicMinimums
is now called ResolveContentBasedMinimums which does not include 'auto'
resolution) which will be run before any other. This phase uses the minimum
size of grid items (as specified by min-width/height).

Tests: fast/css-grid-layout/grid-automatic-minimum-for-auto-columns.html
       fast/css-grid-layout/grid-automatic-minimum-for-auto-rows.html

* css/CSSParser.cpp:
(WebCore::CSSParser::parseGridBreadth):
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeUsedBreadthOfMinLength):
(WebCore::RenderGrid::computeUsedBreadthOfMaxLength):
(WebCore::RenderGrid::minSizeForChild):
(WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions):
(WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForNonSpanningItems):
(WebCore::RenderGrid::trackSizeForTrackSizeComputationPhase):
(WebCore::RenderGrid::shouldProcessTrackForTrackSizeComputationPhase):
(WebCore::RenderGrid::trackShouldGrowBeyondGrowthLimitsForTrackSizeComputationPhase):
(WebCore::RenderGrid::markAsInfinitelyGrowableForTrackSizeComputationPhase):
(WebCore::RenderGrid::updateTrackSizeForTrackSizeComputationPhase):
(WebCore::RenderGrid::currentItemSizeForTrackSizeComputationPhase):
* rendering/RenderGrid.h:
* rendering/style/GridTrackSize.h:
(WebCore::GridTrackSize::minTrackBreadth):
(WebCore::GridTrackSize::maxTrackBreadth):
(WebCore::GridTrackSize::cacheMinMaxTrackBreadthTypes):
(WebCore::GridTrackSize::hasIntrinsicMinTrackBreadth):
(WebCore::GridTrackSize::hasAutoMinTrackBreadth):
(WebCore::GridTrackSize::hasAutoMaxTrackBreadth):
(WebCore::GridTrackSize::hasMaxContentOrAutoMaxTrackBreadth):
(WebCore::GridTrackSize::hasAutoOrMinContentMinTrackBreadthAndIntrinsicMaxTrackBreadth):
(WebCore::GridTrackSize::hasMinContentMinTrackBreadthAndMinOrMaxContentMaxTrackBreadth): Deleted.

LayoutTests:

New tests to verify that auto is a valid keyword inside
minmax. Updated the expectations of existing tests to
reflect the new status of auto.

* fast/css-grid-layout/grid-auto-columns-rows-get-set-expected.txt:
* fast/css-grid-layout/grid-auto-columns-rows-get-set.html:
* fast/css-grid-layout/grid-automatic-minimum-for-auto-columns-expected.txt: Added.
* fast/css-grid-layout/grid-automatic-minimum-for-auto-columns.html: Added.
* fast/css-grid-layout/grid-automatic-minimum-for-auto-rows-expected.txt: Added.
* fast/css-grid-layout/grid-automatic-minimum-for-auto-rows.html: Added.
* 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/non-grid-columns-rows-get-set-expected.txt:
* fast/css-grid-layout/non-grid-columns-rows-get-set-multiple-expected.txt:
* fast/css-grid-layout/non-grid-columns-rows-get-set-multiple.html:
* fast/css-grid-layout/non-grid-columns-rows-get-set.html:
* fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js:
* fast/css-grid-layout/resources/grid-columns-rows-get-set.js:
* fast/css-grid-layout/resources/non-grid-columns-rows-get-set-multiple.js:
* fast/css-grid-layout/resources/non-grid-columns-rows-get-set.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189911 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css-grid-layout/grid-auto-columns-rows-get-set-expected.txt
LayoutTests/fast/css-grid-layout/grid-auto-columns-rows-get-set.html
LayoutTests/fast/css-grid-layout/grid-automatic-minimum-for-auto-columns-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-automatic-minimum-for-auto-columns.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-automatic-minimum-for-auto-rows-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-automatic-minimum-for-auto-rows.html [new file with mode: 0644]
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/non-grid-columns-rows-get-set-expected.txt
LayoutTests/fast/css-grid-layout/non-grid-columns-rows-get-set-multiple-expected.txt
LayoutTests/fast/css-grid-layout/non-grid-columns-rows-get-set-multiple.html
LayoutTests/fast/css-grid-layout/non-grid-columns-rows-get-set.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/fast/css-grid-layout/resources/non-grid-columns-rows-get-set-multiple.js
LayoutTests/fast/css-grid-layout/resources/non-grid-columns-rows-get-set.js
Source/WebCore/ChangeLog
Source/WebCore/css/CSSParser.cpp
Source/WebCore/rendering/RenderGrid.cpp
Source/WebCore/rendering/RenderGrid.h
Source/WebCore/rendering/style/GridTrackSize.h