[CSS Grid Layout] getComputedStyle() is wrong for grid-definition-{columns|rows}
authorsvillar@igalia.com <svillar@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Feb 2014 18:13:30 +0000 (18:13 +0000)
committersvillar@igalia.com <svillar@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Feb 2014 18:13:30 +0000 (18:13 +0000)
commit74b47d39dd862d2723b0c5e2c78d38af837029a7
tree5e99ee6a4bad63bf4f9d75763472bdb7d8e65cce
parent34701f0597895cdbad56ad68efb214859947cfae
[CSS Grid Layout] getComputedStyle() is wrong for grid-definition-{columns|rows}
https://bugs.webkit.org/show_bug.cgi?id=127033

Reviewed by Andreas Kling.

Source/WebCore:

Tests: 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/non-grid-element-repeat-get-set.html
       fast/css-grid-layout/non-named-grid-line-get-set.html

According to the specs getComputedStyle() should return the used
values instead of the resolved values for compatibility with early
implementations. This means that grid-definition-{columns|rows}
are now layout dependent as we need to compute the used values for
grid track sizes.

Updated the outcome of existing tests and added a bunch of new
ones that check the behavior of the different properties outside
grid containers.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::specifiedValueForGridTrackSize):
(WebCore::valueForGridTrackList):
(WebCore::isLayoutDependent):
(WebCore::ComputedStyleExtractor::propertyValue):
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::GridIterator::GridIterator):
(WebCore::RenderGrid::computedUsedBreadthOfGridTracks):
(WebCore::RenderGrid::computeUsedBreadthOfMinLength):
(WebCore::RenderGrid::computeUsedBreadthOfMaxLength):
(WebCore::RenderGrid::computeUsedBreadthOfSpecifiedLength):
(WebCore::RenderGrid::computeNormalizedFractionBreadth):
(WebCore::RenderGrid::gridTrackSize):
(WebCore::RenderGrid::minContentForChild):
(WebCore::RenderGrid::maxContentForChild):
(WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions):
(WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForItems):
(WebCore::RenderGrid::tracksAreWiderThanMinTrackBreadth):
(WebCore::RenderGrid::growGrid):
(WebCore::RenderGrid::autoPlacementMajorAxisDirection):
(WebCore::RenderGrid::autoPlacementMinorAxisDirection):
(WebCore::RenderGrid::layoutGridItems):
(WebCore::RenderGrid::resolveGridPositionsFromAutoPlacementPosition):
(WebCore::RenderGrid::resolveGridPositionsFromStyle):
(WebCore::RenderGrid::gridAreaBreadthForChild):
(WebCore::RenderGrid::populateGridPositions):
(WebCore::RenderGrid::findChildLogicalPosition):
* rendering/RenderGrid.h:

LayoutTests:

Updated the expected results of many tests, as we should expect
the used values instead of the resolved ones when asking for
getComputedStyle().

* 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-element-repeat-get-set-expected.txt:
* fast/css-grid-layout/grid-element-repeat-get-set.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/non-grid-columns-rows-get-set-expected.txt: Copied from LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-expected.txt.
* fast/css-grid-layout/non-grid-columns-rows-get-set-multiple-expected.txt: Copied from LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-multiple-expected.txt.
* fast/css-grid-layout/non-grid-columns-rows-get-set-multiple.html: Copied from LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-multiple.html.
* fast/css-grid-layout/non-grid-columns-rows-get-set.html: Copied from LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set.html.
* fast/css-grid-layout/non-grid-element-repeat-get-set-expected.txt: Copied from LayoutTests/fast/css-grid-layout/grid-element-repeat-get-set-expected.txt.
* fast/css-grid-layout/non-grid-element-repeat-get-set.html: Copied from LayoutTests/fast/css-grid-layout/grid-element-repeat-get-set.html.
* fast/css-grid-layout/non-named-grid-line-get-set-expected.txt: Copied from LayoutTests/fast/css-grid-layout/named-grid-line-get-set-expected.txt.
* fast/css-grid-layout/non-named-grid-line-get-set.html: Added.
* fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js:
(testInherit):
(testInitial):
* fast/css-grid-layout/resources/grid-columns-rows-get-set.js:
(testInherit):
(testInitial):
* fast/css-grid-layout/resources/grid-definitions-parsing-utils.js:
(testGridDefinitionsValues):
(checkGridDefinitionsSetJSValues):
* fast/css-grid-layout/resources/non-grid-columns-rows-get-set-multiple.js: Copied from LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js.
(testInherit):
(testInitial):
* fast/css-grid-layout/resources/non-grid-columns-rows-get-set.js: Copied from LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set.js.
(testInherit):
(testInitial):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
26 files changed:
LayoutTests/ChangeLog
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-element-repeat-get-set-expected.txt
LayoutTests/fast/css-grid-layout/grid-element-repeat-get-set.html
LayoutTests/fast/css-grid-layout/named-grid-line-get-set-expected.txt
LayoutTests/fast/css-grid-layout/named-grid-line-get-set.html [changed mode: 0644->0755]
LayoutTests/fast/css-grid-layout/non-grid-columns-rows-get-set-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/non-grid-columns-rows-get-set-multiple-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/non-grid-columns-rows-get-set-multiple.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/non-grid-columns-rows-get-set.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/non-grid-element-repeat-get-set-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/non-grid-element-repeat-get-set.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/non-named-grid-line-get-set-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/non-named-grid-line-get-set.html [new file with mode: 0644]
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/grid-definitions-parsing-utils.js
LayoutTests/fast/css-grid-layout/resources/non-grid-columns-rows-get-set-multiple.js [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/resources/non-grid-columns-rows-get-set.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/rendering/RenderGrid.cpp
Source/WebCore/rendering/RenderGrid.h