[CSS Grid Layout] Update grid-auto-flow to the new syntax
authorrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Jul 2014 10:42:32 +0000 (10:42 +0000)
committerrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Jul 2014 10:42:32 +0000 (10:42 +0000)
commit3d7bb4600b352eded3a2b0df866701e8beedf3b5
treed60a71ad2a1aeb992d7c353179a35df55ccfc4f9
parent742880e2ac7d5290fcc7dac3c91acc4db8b3db4c
[CSS Grid Layout] Update grid-auto-flow to the new syntax
https://bugs.webkit.org/show_bug.cgi?id=134057

Reviewed by Sergio Villar Senin.

Source/WebCore:
In last versions of the spec grid-auto-flow syntax has changed. New
syntax is:
[ row | column ] && dense? | stack && [ row | column ]?

Implemented parsing for new syntax and added/modified test cases in
current layout tests.

For the moment, the implementation keeps working in the same way, but
using "stack" value for grid-auto-flow property instead of "none". This
should be fixed in a follow-up patch once "stack" is properly
implemented.

Also "dense" needs to be reviewed. Right now auto-placement algorithm is
always "dense" and never "sparse".

No new tests, update current tests to add new cases.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue): Adapt to new syntax.
* css/CSSParser.cpp:
(WebCore::isValidKeywordPropertyAndValue): Removed grid-auto-flow as it
is not a keyword anymore.
(WebCore::isKeywordPropertyID): Ditto.
(WebCore::CSSParser::parseValue): Add specific method for parsing
grid-auto-flow.
(WebCore::CSSParser::parseGridShorthand): Adapt parsing for
grid-auto-flow property inside the shorthand.
(WebCore::isValidGridAutoFlowId): Helper method to check if the CSSValue
id is a valid keyword for grid-auto-flow property.
(WebCore::CSSParser::parseGridAutoFlow): Implement new parsing for
grid-auto-flow.
* css/CSSParser.h: Method header for grid-auto-flow parsing.
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::operator GridAutoFlow): Deleted.
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Deleted.
* css/CSSValueKeywords.in: Add new keywords required by grid-auto-flow:
"dense" and "stack".
* css/DeprecatedStyleBuilder.cpp:
(WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder): Remove
default handler as grid-auto-flow is not a keyword now.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty): Implement particular handler
for new grid-auto-flow syntax.
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::placeItemsOnGrid): Keep old "none" behavior as
"stack" behavior for the moment.
(WebCore::RenderGrid::autoPlacementMajorAxisDirection): Use the new
helper methods in RenderStyle.
(WebCore::RenderGrid::autoPlacementMinorAxisDirection): Ditto.
* rendering/style/GridResolvedPosition.cpp:
(WebCore::GridResolvedPosition::resolveGridPositionsFromStyle): Again
keep old "none" behavior for "stack".
* rendering/style/RenderStyle.h: Add new helper methods to know the
direction and algorithm of grid-auto-flow property.
* rendering/style/RenderStyleConstants.h: Redefine GridAutoFlow enum
using flags for algorithm and direction.
* rendering/style/StyleGridData.h: Change m_gridAutoFlow type to
unsigned.

LayoutTests:
Adapted current tests to the new syntax. Keeping old "none" behavior
using "stack".

Add new use cases to cover the new syntax to grid-auto-flow-get-set.html
and grid-shorthand-get-set.html.

* fast/css-grid-layout/grid-auto-flow-get-set-expected.txt:
* fast/css-grid-layout/grid-auto-flow-get-set.html:
* fast/css-grid-layout/grid-auto-flow-resolution.html:
* fast/css-grid-layout/grid-auto-flow-update-expected.txt:
* fast/css-grid-layout/grid-auto-flow-update.html:
* fast/css-grid-layout/grid-item-named-grid-area-resolution.html:
* fast/css-grid-layout/grid-item-z-index-change-repaint.html:
* fast/css-grid-layout/grid-item-z-index-stacking-context.html:
* fast/css-grid-layout/grid-shorthand-get-set-expected.txt:
* fast/css-grid-layout/grid-shorthand-get-set.html:
* fast/css-grid-layout/named-grid-lines-with-named-grid-areas-dynamic-get-set.html:
* fast/css-grid-layout/named-grid-lines-with-named-grid-areas-resolution.html:
* fast/css-grid-layout/resources/grid.css:
(.gridAutoFlowStack):
(.gridAutoFlowNone): Deleted.
* fast/css/getComputedStyle/computed-style-expected.txt:
* fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* ietestcenter/css3/grid/grid-column-001.htm:
* ietestcenter/css3/grid/grid-column-002.htm:
* ietestcenter/css3/grid/grid-column-003.htm:
* svg/css/getComputedStyle-basic-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170996 268f45cc-cd09-0410-ab3c-d52691b4dbfc
33 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css-grid-layout/grid-auto-flow-get-set-expected.txt
LayoutTests/fast/css-grid-layout/grid-auto-flow-get-set.html
LayoutTests/fast/css-grid-layout/grid-auto-flow-resolution.html
LayoutTests/fast/css-grid-layout/grid-auto-flow-update-expected.txt
LayoutTests/fast/css-grid-layout/grid-auto-flow-update.html
LayoutTests/fast/css-grid-layout/grid-item-named-grid-area-resolution.html
LayoutTests/fast/css-grid-layout/grid-item-z-index-change-repaint.html
LayoutTests/fast/css-grid-layout/grid-item-z-index-stacking-context.html
LayoutTests/fast/css-grid-layout/grid-shorthand-get-set-expected.txt
LayoutTests/fast/css-grid-layout/grid-shorthand-get-set.html
LayoutTests/fast/css-grid-layout/named-grid-lines-with-named-grid-areas-dynamic-get-set.html
LayoutTests/fast/css-grid-layout/named-grid-lines-with-named-grid-areas-resolution.html
LayoutTests/fast/css-grid-layout/resources/grid.css
LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt
LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
LayoutTests/ietestcenter/css3/grid/grid-column-001.htm
LayoutTests/ietestcenter/css3/grid/grid-column-002.htm
LayoutTests/ietestcenter/css3/grid/grid-column-003.htm
LayoutTests/svg/css/getComputedStyle-basic-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/DeprecatedStyleBuilder.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/rendering/RenderGrid.cpp
Source/WebCore/rendering/style/GridResolvedPosition.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/RenderStyleConstants.h
Source/WebCore/rendering/style/StyleGridData.h