[CSS Grid Layout] Implementation of the grid-template shorthand.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Apr 2014 12:06:53 +0000 (12:06 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Apr 2014 12:06:53 +0000 (12:06 +0000)
commit01fdccbf6f2df767fe38eddcbf5c7dc0537310b1
tree02e29f4895ffc77026a6201c84823ea9ca943389
parent52f3124b3ebd7b3f1ed5b6bc60156297aaa4d1b6
[CSS Grid Layout] Implementation of the grid-template shorthand.
https://bugs.webkit.org/show_bug.cgi?id=128980

Patch by Javier Fernandez <jfernandez@igalia.com> on 2014-04-25
Reviewed by Darin Adler.

Source/WebCore:
This shorthand sets the values for the grid-template-columns,
grid-template-rows and grid-template-areas, so the implementation
tries to reuse as much available parsing functions as possible.

The "parsingGridTrackList" was refactored to return a CSSValue and
let the "parseValue" function to assign the property value. The
"forwardSlash" operator is now valid when the track-list clause is
part of a shorthand. The "parseValue" function checkouts that only
additional clauses are allowed when processing shorthands; the
grid-columns-rows-get-set.html tests was modified to verify this.

The "parseGridTemplateAreas" was refactored too, in order to
process single areas's rows. This is very useful for the
gris-template secondary syntax, which mixes areas and rows values.

Finally, the "parseGirdLineNames" function was modified as well by
defining an new argument to concatenate head/tail custom-ident
elements and ensure the identList is at the heading index, since
it's now possible the parseList was rewound.

The implementation of the grid-template shorthand tries first to
match the <grid-template-columns> / <grid-template-rows> syntax,
failing back to the secondary syntax if needed.  This approach
requires to rewind the parseList but it produces a clearer code.

Test: fast/css-grid-layout/grid-template-shorthand-get-set.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseGridTemplateRowsAndAreas):
(WebCore::CSSParser::parseGridTemplateShorthand):
(WebCore::CSSParser::parseGridLineNames):
(WebCore::CSSParser::parseGridTrackList):
(WebCore::CSSParser::parseGridTemplateAreasRow):
(WebCore::CSSParser::parseGridTemplateAreas):
* css/CSSParser.h:
* css/CSSParserValues.h:
(WebCore::CSSParserValueList::setCurrentIndex):
* css/CSSPropertyNames.in:
* css/StylePropertyShorthand.cpp:
(WebCore::webkitGridTemplateShorthand):
* css/StylePropertyShorthand.h:

LayoutTests:
Layout Test for the basic functionality of the grid-template shorthand. It was
also added a new javascript file with some utility functions.

This shorthand sets the values for the grid-template-columns,
grid-template-rows and grid-template-areas, so the implementation
tries to reuse as much available parsing functions as possible.

* fast/css-grid-layout/grid-template-shorthand-get-set-expected.txt: Added.
* fast/css-grid-layout/grid-template-shorthand-get-set.html: Added.
* fast/css-grid-layout/resources/grid-template-shorthand-parsing-utils.js: Added.
(testGridDefinitionsValues):
(testGridDefinitionsSetJSValues):
(testNonGridDefinitionsSetJSValues):
(checkGridDefinitionsSetJSValues):
(testGridDefinitionsSetBadJSValues):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167799 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css-grid-layout/grid-template-shorthand-get-set-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-template-shorthand-get-set.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/resources/grid-template-shorthand-parsing-utils.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/CSSParserValues.h
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/StylePropertyShorthand.cpp
Source/WebCore/css/StylePropertyShorthand.h