[CSS Box Alignment] Upgrade justify-content parsing to CSS3 Box Alignment spec.
authorjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 May 2015 17:25:21 +0000 (17:25 +0000)
committerjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 May 2015 17:25:21 +0000 (17:25 +0000)
commit37fb84a3eec18cf879fc7f07d173a624414b7abd
tree84f11b146b8a82da00c2e594f4842d4870c5d795
parent59db675007893d93d0983b388abd7d3022df2444
[CSS Box Alignment] Upgrade justify-content parsing to CSS3 Box Alignment spec.
https://bugs.webkit.org/show_bug.cgi?id=144442

Reviewed by David Hyatt.

Upgrade the justify-content property to the last CSS3 Box
Alignment specification. It defines a different enumeration for
Positional and Distribution alignment, which requires changes in
the FlexibleBox implementation.

Source/WebCore:

A new parsing function has been implemented to replace the basic
keyword IDs validation. Because of the complexity of the new
values, a new CSSPrimitiveValue derived class has been defined
which simplifies considerably the parsing logic.

We will follow the same approach than for Self Alignment, defining
a single class to hold all the related alignment data. This makes
possible to use a StyleBuilderConverter function instead of custom
builder functions for these properties.

Test: css3/parse-justify-content.html

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::resolveContentAlignmentAuto):
(WebCore::valueForContentPositionAndDistributionWithOverflowAlignment):
(WebCore::ComputedStyleExtractor::propertyValue):
(WebCore::valueForItemPositionWithOverflowAlignment): Deleted.
* css/CSSContentDistributionValue.cpp: Added.
(WebCore::CSSContentDistributionValue::CSSContentDistributionValue):
(WebCore::CSSContentDistributionValue::~CSSContentDistributionValue):
(WebCore::CSSContentDistributionValue::customCSSText):
(WebCore::CSSContentDistributionValue::equals):
* css/CSSContentDistributionValue.h: Added.
(WebCore::CSSContentDistributionValue::create):
(WebCore::CSSContentDistributionValue::distribution):
(WebCore::CSSContentDistributionValue::position):
(WebCore::CSSContentDistributionValue::overflow):
* css/CSSParser.cpp:
(WebCore::isValidKeywordPropertyAndValue):
(WebCore::isKeywordPropertyID):
(WebCore::CSSParser::parseValue):
(WebCore::isContentDistributionKeyword):
(WebCore::isContentPositionKeyword):
(WebCore::isAlignmentOverflowKeyword):
(WebCore::CSSParser::parseContentDistributionOverflowPosition):
(WebCore::CSSParser::parseItemPositionOverflowPosition):
(WebCore::CSSParser::parseLegacyPosition): Deleted.
* css/CSSParser.h:
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator ContentPosition):
(WebCore::CSSPrimitiveValue::operator ContentDistributionType):
(WebCore::CSSPrimitiveValue::operator EFlexDirection): Deleted.
* css/CSSPropertyNames.in:
* css/CSSValue.cpp:
(WebCore::CSSValue::equals):
(WebCore::CSSValue::cssText):
(WebCore::CSSValue::destroy):
* css/CSSValue.h:
(WebCore::CSSValue::isContentDistributionValue):
(WebCore::CSSValue::isWebKitCSSFilterValue): Deleted.
* css/CSSValueKeywords.in:
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertContentAlignmentData):
(WebCore::StyleBuilderConverter::convertSelfOrDefaultAlignmentData): Deleted.
* rendering/RenderFlexibleBox.cpp:
(WebCore::initialJustifyContentOffset):
(WebCore::justifyContentSpaceBetweenChildren):
(WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
(WebCore::RenderFlexibleBox::layoutColumnReverse):
* rendering/RenderFullScreen.cpp:
(WebCore::createFullScreenStyle):
* rendering/mathml/RenderMathMLScripts.cpp:
(WebCore::RenderMathMLScripts::fixAnonymousStyleForSubSupPair):
(WebCore::RenderMathMLScripts::fixAnonymousStyles):
* rendering/style/RenderStyle.h:
* rendering/style/RenderStyleConstants.h:
* rendering/style/StyleContentAlignmentData.h: Added.
(WebCore::StyleContentAlignmentData::StyleContentAlignmentData):
(WebCore::StyleContentAlignmentData::setPosition):
(WebCore::StyleContentAlignmentData::setDistribution):
(WebCore::StyleContentAlignmentData::setOverflow):
(WebCore::StyleContentAlignmentData::position):
(WebCore::StyleContentAlignmentData::distribution):
(WebCore::StyleContentAlignmentData::overflow):
(WebCore::StyleContentAlignmentData::operator==):
(WebCore::StyleContentAlignmentData::operator!=):
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):
* rendering/style/StyleRareNonInheritedData.h:

LayoutTests:

Some minor changes in some Flexbox related test cases for adapting
them to the new parsing logic. New layout tests, not Flexbox
specific, to verify the parsing of the new values.

* css3/flexbox/css-properties.html:
* css3/parse-justify-content-expected.txt: Added.
* css3/parse-justify-content.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183748 268f45cc-cd09-0410-ab3c-d52691b4dbfc
30 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/flexbox/css-properties.html
LayoutTests/css3/parse-justify-content-expected.txt [new file with mode: 0644]
LayoutTests/css3/parse-justify-content.html [new file with mode: 0644]
LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt
LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
LayoutTests/svg/css/getComputedStyle-basic-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSAllInOne.cpp
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSContentDistributionValue.cpp [new file with mode: 0644]
Source/WebCore/css/CSSContentDistributionValue.h [new file with mode: 0644]
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/CSSValue.cpp
Source/WebCore/css/CSSValue.h
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/rendering/RenderFlexibleBox.cpp
Source/WebCore/rendering/RenderFullScreen.cpp
Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/RenderStyleConstants.h
Source/WebCore/rendering/style/StyleContentAlignmentData.h [new file with mode: 0644]
Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
Source/WebCore/rendering/style/StyleRareNonInheritedData.h