[css-align] Initial values are parsed as invalid for some Alignment properties
authorjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Sep 2016 11:46:57 +0000 (11:46 +0000)
committerjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Sep 2016 11:46:57 +0000 (11:46 +0000)
commitf0bd7acb980ba585f92ee32e4e4a76c2e82ca9a8
tree7a667c899ef2204eb4c7fc735539365f2711be78
parentc9744f961d3ecf5522804ddc842772fe5d3c913d
[css-align] Initial values are parsed as invalid for some Alignment properties
https://bugs.webkit.org/show_bug.cgi?id=161303

Reviewed by Darin Adler.

Source/WebCore:

Due to the implementation of the new CSS Box Alignment specification,
some properties have now new values allowed, which are not valid
according to the Flexible Box Layout specification.

In r205102 we have get back the keywordID parsing, originally implemented for
the Flexbible Box Layout specification. Even though the new valued would be
parsed as invalid when they are set, the 'initial' values will be assigned
in any case.

This patch verifies that the 'initial' values depend on whether the Grid
Layout is enabled or not and verifying such values are parsed as valid.

Additionally, it gets back as well they keywordID parsing for the Content
Alignment properties (align-content and justify-content). This required to
touch a bit the StyleBuilderConverter logic, since we will have to deal with
either the complex CSSContentDistributionValue complex or the  simpler
CSSPrimitiveValue.

Test: fast/css/ensure-flexbox-compatibility-with-initial-values.html

* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertContentAlignmentData): Handling a primitive value if Grid Layout is not enabled.
* css/parser/CSSParser.cpp:
(WebCore::isValidKeywordPropertyAndValue): Simpler parsing of alignment properties if Grid Layout is not enabled.
(WebCore::isKeywordPropertyID): Alignment properties are defined as keyword if Grid Layout is no enabled.
(WebCore::CSSParser::parseValue): Assert Grid Layout is enabled when using the complex parsing.
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::isCSSGridLayoutEnabled): Checking out the Grid Layout runtime flags.
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::initialDefaultAlignment): Initial value will depend on whether Grid Layout is enabled or not.
(WebCore::RenderStyle::initialContentAlignment): Initial value will depend on whether Grid Layout is enabled or not.

LayoutTests:

Test to verify the "initial" values of the CSS Box Alignment properties
are parsed as valid independently of whether Grid Layout is enabled or not.

* fast/css/ensure-flexbox-compatibility-with-initial-values-expected.txt: Added.
* fast/css/ensure-flexbox-compatibility-with-initial-values.html: Added.
* fast/css/resources/alignment-parsing-utils.js:
(checkSupportedValues):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205807 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/css/ensure-flexbox-compatibility-with-initial-values-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/ensure-flexbox-compatibility-with-initial-values.html [new file with mode: 0644]
LayoutTests/fast/css/resources/alignment-parsing-utils.js
Source/WebCore/ChangeLog
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/css/parser/CSSParser.cpp
Source/WebCore/rendering/RenderFlexibleBox.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h