[CSS Grid Layout] getComputedStyle() must return the specified value for positioning...
authorsvillar@igalia.com <svillar@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Mar 2014 16:45:21 +0000 (16:45 +0000)
committersvillar@igalia.com <svillar@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Mar 2014 16:45:21 +0000 (16:45 +0000)
commitdd39ec1e09b9c69701a808486a7a7b08102f8e20
tree8b3f222bf549d44dd1b0b80442a5c2629592a636
parent72d2ad87eb825de3dcb61f64aae9b827a1c7781a
[CSS Grid Layout] getComputedStyle() must return the specified value for positioning properties
https://bugs.webkit.org/show_bug.cgi?id=130010

Reviewed by Darin Adler.

Source/WebCore:

According to the specs
http://dev.w3.org/csswg/css-grid/#property-index and also to
http://lists.w3.org/Archives/Public/www-style/2014Mar/0162.html
the function getComputedStyle() must return the specified values
for positioning properties, i.e, grid-{columns|rows}-{start|end}.

We were in some cases, adjusting the style in the StyleResolver
(for example with two opposing spans) something that is now done
in the RenderGrid because we cannot alter the original style.

The code moved to the renderer became more self explanatory and it
now supports named grid areas with names ending in "-start" and
"-end".

Test: fast/css-grid-layout/named-grid-lines-with-named-grid-areas-get-set.html

* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle):
(WebCore::gridLineDefinedBeforeGridArea): Deleted.
(WebCore::StyleResolver::adjustNamedGridItemPosition): Deleted.
(WebCore::StyleResolver::adjustGridItemPosition): Deleted.
* css/StyleResolver.h:
* rendering/RenderGrid.cpp:
(WebCore::isColumnSide):
(WebCore::RenderGrid::explicitGridSizeForSide):
(WebCore::gridLineDefinedBeforeGridArea):
(WebCore::setNamedLinePositionIfDefinedBeforeArea):
(WebCore::RenderGrid::adjustNamedGridItemPosition):
(WebCore::RenderGrid::adjustGridPositionsFromStyle):
(WebCore::RenderGrid::resolveGridPositionsFromStyle):
(WebCore::RenderGrid::resolveNamedGridLinePositionFromStyle):
(WebCore::RenderGrid::resolveNamedGridLinePositionAgainstOppositePosition):
* rendering/RenderGrid.h:
* rendering/style/GridPosition.h:
(WebCore::GridPosition::setAutoPosition): New helper function.

LayoutTests:

Updated the return value of getComputedStyle(), it must be always
the specified value.

Added also a new test that verifies the resolution of names in
grid positioning properties, both grid area names and grid line
names (including any combination of the two).

* fast/css-grid-layout/grid-item-area-get-set-expected.txt:
* fast/css-grid-layout/grid-item-area-get-set.html:
* fast/css-grid-layout/grid-item-column-row-get-set-expected.txt:
* fast/css-grid-layout/grid-item-column-row-get-set.html:
* fast/css-grid-layout/grid-item-end-after-get-set-expected.txt:
* fast/css-grid-layout/grid-item-end-after-get-set.html:
* fast/css-grid-layout/grid-item-spanning-resolution-expected.txt:
* fast/css-grid-layout/grid-item-spanning-resolution.html:
* fast/css-grid-layout/grid-item-start-before-get-set-expected.txt:
* fast/css-grid-layout/grid-item-start-before-get-set.html:
* fast/css-grid-layout/named-grid-lines-with-named-grid-areas-get-set-expected.txt: Added.
* fast/css-grid-layout/named-grid-lines-with-named-grid-areas-get-set.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166299 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css-grid-layout/grid-item-area-get-set-expected.txt
LayoutTests/fast/css-grid-layout/grid-item-area-get-set.html
LayoutTests/fast/css-grid-layout/grid-item-column-row-get-set-expected.txt
LayoutTests/fast/css-grid-layout/grid-item-column-row-get-set.html [changed mode: 0755->0644]
LayoutTests/fast/css-grid-layout/grid-item-end-after-get-set-expected.txt
LayoutTests/fast/css-grid-layout/grid-item-end-after-get-set.html
LayoutTests/fast/css-grid-layout/grid-item-spanning-resolution-expected.txt
LayoutTests/fast/css-grid-layout/grid-item-spanning-resolution.html
LayoutTests/fast/css-grid-layout/grid-item-start-before-get-set-expected.txt
LayoutTests/fast/css-grid-layout/grid-item-start-before-get-set.html
LayoutTests/fast/css-grid-layout/named-grid-lines-with-named-grid-areas-get-set-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/named-grid-lines-with-named-grid-areas-get-set.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/named-grid-lines-with-named-grid-areas-resolution-expected.txt
LayoutTests/fast/css-grid-layout/named-grid-lines-with-named-grid-areas-resolution.html
Source/WebCore/ChangeLog
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h
Source/WebCore/rendering/RenderGrid.cpp
Source/WebCore/rendering/RenderGrid.h
Source/WebCore/rendering/style/GridPosition.h