[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)
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

index 9305f41..5def8b5 100644 (file)
@@ -1,3 +1,23 @@
+2015-05-04  Javier Fernandez  <jfernandez@igalia.com>
+
+        [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.
+
+        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.
+
 2015-05-04  Manuel Rego Casasnovas  <rego@igalia.com>
 
         [CSS Grid Layout] Wrong computed style for named grid lines in implicit tracks
index e219e2d..dd7292b 100644 (file)
@@ -51,6 +51,8 @@ flexitem.style.webkitOrder = '';
 shouldBeEqualToString('flexitem.style.webkitOrder', '');
 
 
+flexbox.style.display = '-webkit-flex';
+
 shouldBeEqualToString('flexbox.style.webkitJustifyContent', '');
 // The initial value is 'flex-start'.
 shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitJustifyContent', 'flex-start');
@@ -78,8 +80,6 @@ flexbox.style.webkitJustifyContent = '';
 shouldBeEqualToString('flexbox.style.webkitJustifyContent', '');
 shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitJustifyContent', 'flex-start');
 
-flexbox.style.display = '-webkit-flex';
-
 shouldBeEqualToString('flexbox.style.webkitAlignSelf', '');
 // The initial value is 'auto', which will be resolved depending on parent's style (except for the 'document' element).
 shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitAlignSelf', 'start');
diff --git a/LayoutTests/css3/parse-justify-content-expected.txt b/LayoutTests/css3/parse-justify-content-expected.txt
new file mode 100644 (file)
index 0000000..791eaf5
--- /dev/null
@@ -0,0 +1,142 @@
+Test that setting and getting justify-content works as expected
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Test getting justify-content set through CSS
+PASS getComputedStyle(justifyContentAuto, '').getPropertyValue('justify-content') is "start"
+PASS getComputedStyle(justifyContentBaseline, '').getPropertyValue('justify-content') is "baseline"
+PASS getComputedStyle(justifyContentLastBaseline, '').getPropertyValue('justify-content') is "last-baseline"
+PASS getComputedStyle(justifyContentSpaceBetween, '').getPropertyValue('justify-content') is "space-between"
+PASS getComputedStyle(justifyContentSpaceAround, '').getPropertyValue('justify-content') is "space-around"
+PASS getComputedStyle(justifyContentSpaceEvenly, '').getPropertyValue('justify-content') is "space-evenly"
+PASS getComputedStyle(justifyContentStretch, '').getPropertyValue('justify-content') is "stretch"
+PASS getComputedStyle(justifyContentStart, '').getPropertyValue('justify-content') is "start"
+PASS getComputedStyle(justifyContentEnd, '').getPropertyValue('justify-content') is "end"
+PASS getComputedStyle(justifyContentCenter, '').getPropertyValue('justify-content') is "center"
+PASS getComputedStyle(justifyContentLeft, '').getPropertyValue('justify-content') is "left"
+PASS getComputedStyle(justifyContentRight, '').getPropertyValue('justify-content') is "right"
+PASS getComputedStyle(justifyContentFlexStart, '').getPropertyValue('justify-content') is "flex-start"
+PASS getComputedStyle(justifyContentFlexEnd, '').getPropertyValue('justify-content') is "flex-end"
+PASS getComputedStyle(justifyContentEndTrue, '').getPropertyValue('justify-content') is "end true"
+PASS getComputedStyle(justifyContentCenterTrue, '').getPropertyValue('justify-content') is "center true"
+PASS getComputedStyle(justifyContentRightSafe, '').getPropertyValue('justify-content') is "right safe"
+PASS getComputedStyle(justifyContentLeftTrue, '').getPropertyValue('justify-content') is "left true"
+PASS getComputedStyle(justifyContentFlexStartTrue, '').getPropertyValue('justify-content') is "flex-start true"
+PASS getComputedStyle(justifyContentFlexEndSafe, '').getPropertyValue('justify-content') is "flex-end safe"
+PASS getComputedStyle(justifyContentSpaceBetweenLeft, '').getPropertyValue('justify-content') is "space-between left"
+PASS getComputedStyle(justifyContentSpaceAroundCenter, '').getPropertyValue('justify-content') is "space-around center"
+PASS getComputedStyle(justifyContentSpaceEvenlyRight, '').getPropertyValue('justify-content') is "space-evenly right"
+PASS getComputedStyle(justifyContentStretchStartSafe, '').getPropertyValue('justify-content') is "stretch start safe"
+PASS getComputedStyle(justifyContentSpaceAroundEndTrue, '').getPropertyValue('justify-content') is "space-around end true"
+PASS getComputedStyle(justifyContentSpaceEvenlyFlexStartSafe, '').getPropertyValue('justify-content') is "space-evenly flex-start safe"
+PASS getComputedStyle(justifyContentSpaceBetweenSafe, '').getPropertyValue('justify-content') is "start"
+PASS getComputedStyle(justifyContentSpaceBetweenStretch, '').getPropertyValue('justify-content') is "start"
+PASS getComputedStyle(justifyContentSafe, '').getPropertyValue('justify-content') is "start"
+PASS getComputedStyle(justifyContentRightSafeTrue, '').getPropertyValue('justify-content') is "start"
+PASS getComputedStyle(justifyContentCenterLeft, '').getPropertyValue('justify-content') is "start"
+
+Test initial value of justify-content through JS
+PASS getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+
+Test getting and setting justify-content through JS
+PASS element.style.justifyContent is "center"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "center"
+PASS element.style.justifyContent is "start true"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start true"
+PASS element.style.justifyContent is "flex-end safe"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "flex-end safe"
+PASS element.style.justifyContent is "space-between right safe"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "space-between right safe"
+PASS element.style.justifyContent is "stretch center"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "stretch center"
+PASS element.style.justifyContent is "right true"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "right true"
+PASS element.style.justifyContent is "auto"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is "auto"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "flex-start"
+PASS element.style.justifyContent is "auto"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is "flex-end"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "flex-end"
+
+Test bad combinations of justify-content
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+PASS element.style.justifyContent is ""
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+
+Test the value 'initial'
+PASS element.style.justifyContent is "stretch center"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "stretch center"
+PASS element.style.justifyContent is "initial"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+
+Test the value 'initial' for grid containers
+PASS element.style.justifyContent is "space-between left"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "space-between left"
+PASS element.style.justifyContent is "initial"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "start"
+
+Test the value 'initial' for flex containers
+PASS element.style.justifyContent is "right true"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "right true"
+PASS element.style.justifyContent is "initial"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "flex-start"
+
+Test the value 'inherit'
+PASS element.style.justifyContent is "end"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "end"
+PASS element.style.justifyContent is "inherit"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "end"
+PASS element.style.justifyContent is "left safe"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "left safe"
+PASS element.style.justifyContent is "inherit"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "left safe"
+PASS element.style.justifyContent is "stretch center"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "stretch center"
+PASS element.style.justifyContent is "inherit"
+PASS window.getComputedStyle(element, '').getPropertyValue('justify-content') is "stretch center"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/css3/parse-justify-content.html b/LayoutTests/css3/parse-justify-content.html
new file mode 100644 (file)
index 0000000..6341cb1
--- /dev/null
@@ -0,0 +1,356 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+#justifyContentAuto {
+    justify-content: auto;
+}
+
+#justifyContentBaseline {
+    justify-content: baseline;
+}
+
+#justifyContentLastBaseline {
+    justify-content: last-baseline;
+}
+
+#justifyContentSpaceBetween {
+    justify-content: space-between;
+}
+
+#justifyContentSpaceAround {
+    justify-content: space-around;
+}
+
+#justifyContentSpaceEvenly {
+    justify-content: space-evenly;
+}
+
+#justifyContentStretch {
+    justify-content: stretch;
+}
+
+#justifyContentStart {
+    justify-content: start;
+}
+
+#justifyContentEnd {
+    justify-content: end;
+}
+
+#justifyContentCenter {
+    justify-content: center;
+}
+
+#justifyContentLeft {
+    justify-content: left;
+}
+
+#justifyContentRight {
+    justify-content: right;
+}
+
+#justifyContentFlexStart {
+    justify-content: flex-start;
+}
+
+#justifyContentFlexEnd {
+    justify-content: flex-end;
+}
+
+#justifyContentEndTrue {
+    justify-content: end true;
+}
+
+#justifyContentCenterTrue {
+    justify-content: center true;
+}
+
+#justifyContentRightSafe {
+    justify-content: right safe;
+}
+
+#justifyContentLeftTrue {
+    justify-content: left true;
+}
+
+#justifyContentFlexStartTrue {
+    justify-content: flex-start true;
+}
+
+#justifyContentFlexEndSafe {
+    justify-content: flex-end safe;
+}
+
+#justifyContentSpaceBetweenLeft {
+    justify-content: space-between left;
+}
+
+#justifyContentSpaceAroundCenter {
+    justify-content: space-around center;
+}
+
+#justifyContentSpaceEvenlyRight {
+    justify-content: space-evenly right;
+}
+
+#justifyContentStretchStartSafe {
+    justify-content: stretch start safe;
+}
+
+#justifyContentSpaceAroundEndTrue {
+    justify-content: space-around end true;
+}
+
+#justifyContentSpaceEvenlyFlexStartSafe {
+    justify-content: space-evenly flex-start safe;
+}
+
+<!-- Invalid CSS cases -->
+#justifyContentSpaceBetweenSafe {
+    justify-content: space-between safe;
+}
+
+#justifyContentSpaceBetweenStretch {
+    justify-content: space-between stretch;
+}
+
+#justifyContentSafe {
+    justify-content: safe;
+}
+
+#justifyContentRightSafeTrue {
+    justify-content: right safe true;
+}
+
+#justifyContentCenterLeft {
+    justify-content: center left;
+}
+</style>
+<script src="../resources/js-test.js"></script>
+</head>
+<body>
+<div id="justifyContentAuto"></div>
+<div id="justifyContentBaseline"></div>
+<div id="justifyContentLastBaseline"></div>
+<div id="justifyContentSpaceBetween"></div>
+<div id="justifyContentSpaceAround"></div>
+<div id="justifyContentSpaceEvenly"></div>
+<div id="justifyContentStretch"></div>
+<div id="justifyContentStart"></div>
+<div id="justifyContentEnd"></div>
+<div id="justifyContentCenter"></div>
+<div id="justifyContentLeft"></div>
+<div id="justifyContentRight"></div>
+<div id="justifyContentFlexStart"></div>
+<div id="justifyContentFlexEnd"></div>
+<div id="justifyContentEndTrue"></div>
+<div id="justifyContentCenterTrue"></div>
+<div id="justifyContentRightSafe"></div>
+<div id="justifyContentLeftTrue"></div>
+<div id="justifyContentFlexStartTrue"></div>
+<div id="justifyContentFlexEndSafe"></div>
+<div id="justifyContentSpaceBetweenLeft"></div>
+<div id="justifyContentSpaceAroundCenter"></div>
+<div id="justifyContentSpaceEvenlyRight"></div>
+<div id="justifyContentStretchStartSafe"></div>
+<div id="justifyContentSpaceAroundEndTrue"></div>
+<div id="justifyContentSpaceEvenlyFlexStartSafe"></div>
+
+<div id="justifyContentSpaceBetweenSafe"></div>
+<div id="justifyContentSpaceBetweenStretch"></div>
+<div id="justifyContentSafe"></div>
+<div id="justifyContentRightSafeTrue"></div>
+<div id="justifyContentCenterLeft"></div>
+
+<script src="resources/alignment-parsing-utils.js"></script>
+<script>
+description('Test that setting and getting justify-content works as expected');
+
+debug("Test getting justify-content set through CSS");
+var justifyContentAuto = document.getElementById("justifyContentAuto");
+shouldBeEqualToString("getComputedStyle(justifyContentAuto, '').getPropertyValue('justify-content')", "start");
+
+var justifyContentBaseline = document.getElementById("justifyContentBaseline");
+shouldBeEqualToString("getComputedStyle(justifyContentBaseline, '').getPropertyValue('justify-content')", "baseline");
+
+var justifyContentLastBaseline = document.getElementById("justifyContentLastBaseline");
+shouldBeEqualToString("getComputedStyle(justifyContentLastBaseline, '').getPropertyValue('justify-content')", "last-baseline");
+
+var justifyContentSpaceBetween = document.getElementById("justifyContentSpaceBetween");
+shouldBeEqualToString("getComputedStyle(justifyContentSpaceBetween, '').getPropertyValue('justify-content')", "space-between");
+
+var justifyContentSpaceAround = document.getElementById("justifyContentSpaceAround");
+shouldBeEqualToString("getComputedStyle(justifyContentSpaceAround, '').getPropertyValue('justify-content')", "space-around");
+
+var justifyContentSpaceEvenly = document.getElementById("justifyContentSpaceEvenly");
+shouldBeEqualToString("getComputedStyle(justifyContentSpaceEvenly, '').getPropertyValue('justify-content')", "space-evenly");
+
+var justifyContentStretch = document.getElementById("justifyContentStretch");
+shouldBeEqualToString("getComputedStyle(justifyContentStretch, '').getPropertyValue('justify-content')", "stretch");
+
+var justifyContentStart = document.getElementById("justifyContentStart");
+shouldBeEqualToString("getComputedStyle(justifyContentStart, '').getPropertyValue('justify-content')", "start");
+
+var justifyContentEnd = document.getElementById("justifyContentEnd");
+shouldBeEqualToString("getComputedStyle(justifyContentEnd, '').getPropertyValue('justify-content')", "end");
+
+var justifyContentCenter = document.getElementById("justifyContentCenter");
+shouldBeEqualToString("getComputedStyle(justifyContentCenter, '').getPropertyValue('justify-content')", "center");
+
+var justifyContentLeft = document.getElementById("justifyContentLeft");
+shouldBeEqualToString("getComputedStyle(justifyContentLeft, '').getPropertyValue('justify-content')", "left");
+
+var justifyContentRight = document.getElementById("justifyContentRight");
+shouldBeEqualToString("getComputedStyle(justifyContentRight, '').getPropertyValue('justify-content')", "right");
+
+var justifyContentFlexStart = document.getElementById("justifyContentFlexStart");
+shouldBeEqualToString("getComputedStyle(justifyContentFlexStart, '').getPropertyValue('justify-content')", "flex-start");
+
+var justifyContentFlexEnd = document.getElementById("justifyContentFlexEnd");
+shouldBeEqualToString("getComputedStyle(justifyContentFlexEnd, '').getPropertyValue('justify-content')", "flex-end");
+
+var justifyContentEndTrue = document.getElementById("justifyContentEndTrue");
+shouldBeEqualToString("getComputedStyle(justifyContentEndTrue, '').getPropertyValue('justify-content')", "end true");
+
+var justifyContentCenterTrue = document.getElementById("justifyContentCenterTrue");
+shouldBeEqualToString("getComputedStyle(justifyContentCenterTrue, '').getPropertyValue('justify-content')", "center true");
+
+var justifyContentRightSafe = document.getElementById("justifyContentRightSafe");
+shouldBeEqualToString("getComputedStyle(justifyContentRightSafe, '').getPropertyValue('justify-content')", "right safe");
+
+var justifyContentLeftTrue = document.getElementById("justifyContentLeftTrue");
+shouldBeEqualToString("getComputedStyle(justifyContentLeftTrue, '').getPropertyValue('justify-content')", "left true");
+
+var justifyContentFlexStartTrue = document.getElementById("justifyContentFlexStartTrue");
+shouldBeEqualToString("getComputedStyle(justifyContentFlexStartTrue, '').getPropertyValue('justify-content')", "flex-start true");
+
+var justifyContentFlexEndSafe = document.getElementById("justifyContentFlexEndSafe");
+shouldBeEqualToString("getComputedStyle(justifyContentFlexEndSafe, '').getPropertyValue('justify-content')", "flex-end safe");
+
+var justifyContentSpaceBetweenLeft = document.getElementById("justifyContentSpaceBetweenLeft");
+shouldBeEqualToString("getComputedStyle(justifyContentSpaceBetweenLeft, '').getPropertyValue('justify-content')", "space-between left");
+
+var justifyContentSpaceAroundCenter = document.getElementById("justifyContentSpaceAroundCenter");
+shouldBeEqualToString("getComputedStyle(justifyContentSpaceAroundCenter, '').getPropertyValue('justify-content')", "space-around center");
+
+var justifyContentSpaceEvenlyRight = document.getElementById("justifyContentSpaceEvenlyRight");
+shouldBeEqualToString("getComputedStyle(justifyContentSpaceEvenlyRight, '').getPropertyValue('justify-content')", "space-evenly right");
+
+var justifyContentStretchStartSafe = document.getElementById("justifyContentStretchStartSafe");
+shouldBeEqualToString("getComputedStyle(justifyContentStretchStartSafe, '').getPropertyValue('justify-content')", "stretch start safe");
+
+var justifyContentSpaceAroundEndTrue = document.getElementById("justifyContentSpaceAroundEndTrue");
+shouldBeEqualToString("getComputedStyle(justifyContentSpaceAroundEndTrue, '').getPropertyValue('justify-content')", "space-around end true");
+
+var justifyContentSpaceEvenlyFlexStartSafe = document.getElementById("justifyContentSpaceEvenlyFlexStartSafe");
+shouldBeEqualToString("getComputedStyle(justifyContentSpaceEvenlyFlexStartSafe, '').getPropertyValue('justify-content')", "space-evenly flex-start safe");
+
+var justifyContentSpaceBetweenSafe = document.getElementById("justifyContentSpaceBetweenSafe");
+shouldBeEqualToString("getComputedStyle(justifyContentSpaceBetweenSafe, '').getPropertyValue('justify-content')", "start");
+
+var justifyContentSpaceAroundTrue = document.getElementById("justifyContentSpaceBetweenStretch");
+shouldBeEqualToString("getComputedStyle(justifyContentSpaceBetweenStretch, '').getPropertyValue('justify-content')", "start");
+
+var justifyContentSpaceAroundTrue = document.getElementById("justifyContentSafe");
+shouldBeEqualToString("getComputedStyle(justifyContentSafe, '').getPropertyValue('justify-content')", "start");
+
+var justifyContentSpaceAroundTrue = document.getElementById("justifyContentRightSafeTrue");
+shouldBeEqualToString("getComputedStyle(justifyContentRightSafeTrue, '').getPropertyValue('justify-content')", "start");
+
+var justifyContentSpaceAroundTrue = document.getElementById("justifyContentCenterLeft");
+shouldBeEqualToString("getComputedStyle(justifyContentCenterLeft, '').getPropertyValue('justify-content')", "start");
+
+debug("");
+debug("Test initial value of justify-content through JS");
+element = document.createElement("div");
+document.body.appendChild(element);
+shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('justify-content')", "start");
+
+debug("");
+debug("Test getting and setting justify-content through JS");
+element = document.createElement("div");
+document.body.appendChild(element);
+element.style.justifyContent = "center";
+checkValues(element, "justifyContent", "justify-content",  "center", "center");
+
+element.style.justifyContent = "true start";
+checkValues(element, "justifyContent", "justify-content",  "start true", "start true");
+
+element.style.justifyContent = "flex-end safe";
+checkValues(element, "justifyContent", "justify-content",  "flex-end safe", "flex-end safe");
+
+element.style.justifyContent = "space-between right safe";
+checkValues(element, "justifyContent", "justify-content",  "space-between right safe", "space-between right safe");
+
+element.style.justifyContent = "center stretch";
+checkValues(element, "justifyContent", "justify-content",  "stretch center", "stretch center");
+
+element.style.justifyContent = "right true";
+checkValues(element, "justifyContent", "justify-content",  "right true", "right true");
+
+element.style.justifyContent = "auto";
+checkValues(element, "justifyContent", "justify-content",  "auto", "start");
+
+element.style.display = "-webkit-flex";
+element.style.justifyContent = "auto";
+checkValues(element, "justifyContent", "justify-content",  "auto", "flex-start");
+
+element.style.display = "-webkit-grid";
+element.style.justifyContent = "auto";
+checkValues(element, "justifyContent", "justify-content",  "auto", "start");
+
+element.style.justifyContent = "flex-end";
+checkValues(element, "justifyContent", "justify-content",  "flex-end", "flex-end");
+
+debug("");
+debug("Test bad combinations of justify-content");
+element = document.createElement("div");
+document.body.appendChild(element);
+
+checkBadValues(element, "justifyContent", "justify-content",  "");
+checkBadValues(element, "justifyContent", "justify-content",  "true auto");
+checkBadValues(element, "justifyContent", "justify-content",  "auto safe");
+checkBadValues(element, "justifyContent", "justify-content",  "auto left");
+checkBadValues(element, "justifyContent", "justify-content",  "baseline safe");
+checkBadValues(element, "justifyContent", "justify-content",  "last baseline center");
+checkBadValues(element, "justifyContent", "justify-content",  "true true");
+checkBadValues(element, "justifyContent", "justify-content",  "true safe");
+checkBadValues(element, "justifyContent", "justify-content",  "center start");
+checkBadValues(element, "justifyContent", "justify-content",  "baseline safe");
+checkBadValues(element, "justifyContent", "justify-content",  "true baseline");
+checkBadValues(element, "justifyContent", "justify-content",  "true safe left");
+checkBadValues(element, "justifyContent", "justify-content",  "true left safe");
+checkBadValues(element, "justifyContent", "justify-content",  "left safe true safe");
+checkBadValues(element, "justifyContent", "justify-content",  "start right space-between");
+checkBadValues(element, "justifyContent", "justify-content",  "safe stretch");
+checkBadValues(element, "justifyContent", "justify-content",  "space-around stretch");
+checkBadValues(element, "justifyContent", "justify-content",  "end space-between start");
+checkBadValues(element, "justifyContent", "justify-content",  "right safe left");
+checkBadValues(element, "justifyContent", "justify-content",  "true");
+checkBadValues(element, "justifyContent", "justify-content",  "safe");
+
+debug("");
+debug("Test the value 'initial'");
+element.style.display = "";
+checkInitialValues(element, "justifyContent", "justify-content", "stretch center", "start");
+
+debug("");
+debug("Test the value 'initial' for grid containers");
+element.style.display = "-webkit-grid";
+checkInitialValues(element, "justifyContent", "justify-content", "space-between left", "start");
+
+debug("");
+debug("Test the value 'initial' for flex containers");
+element.style.display = "-webkit-flex";
+checkInitialValues(element, "justifyContent", "justify-content", "right true", "flex-start");
+
+debug("");
+debug("Test the value 'inherit'");
+checkInheritValues("justifyContent", "justify-content", "end");
+checkInheritValues("justifyContent", "justify-content", "left safe");
+checkInheritValues("justifyContent", "justify-content", "stretch center");
+
+</script>
+</body>
+</html>
index 80ee66e..1848b5e 100644 (file)
@@ -151,7 +151,7 @@ align-items: start;
 align-self: start;
 flex-direction: row;
 flex-wrap: nowrap;
-justify-content: flex-start;
+justify-content: start;
 justify-self: start;
 justify-items: start;
 -webkit-font-kerning: auto;
index f0333ec..32e5413 100644 (file)
@@ -150,7 +150,7 @@ align-items: auto
 align-self: auto
 flex-direction: row
 flex-wrap: nowrap
-justify-content: flex-start
+justify-content: auto
 justify-self: auto
 justify-items: auto
 -webkit-font-kerning: auto
index 25f1c89..432d507 100644 (file)
@@ -300,8 +300,8 @@ rect: style.getPropertyValue(flex-direction) : row
 rect: style.getPropertyCSSValue(flex-direction) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(flex-wrap) : nowrap
 rect: style.getPropertyCSSValue(flex-wrap) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(justify-content) : flex-start
-rect: style.getPropertyCSSValue(justify-content) : [object CSSPrimitiveValue]
+rect: style.getPropertyValue(justify-content) : start
+rect: style.getPropertyCSSValue(justify-content) : [object CSSValueList]
 rect: style.getPropertyValue(justify-self) : start
 rect: style.getPropertyCSSValue(justify-self) : [object CSSValueList]
 rect: style.getPropertyValue(justify-items) : start
@@ -818,8 +818,8 @@ g: style.getPropertyValue(flex-direction) : row
 g: style.getPropertyCSSValue(flex-direction) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(flex-wrap) : nowrap
 g: style.getPropertyCSSValue(flex-wrap) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(justify-content) : flex-start
-g: style.getPropertyCSSValue(justify-content) : [object CSSPrimitiveValue]
+g: style.getPropertyValue(justify-content) : start
+g: style.getPropertyCSSValue(justify-content) : [object CSSValueList]
 g: style.getPropertyValue(justify-self) : start
 g: style.getPropertyCSSValue(justify-self) : [object CSSValueList]
 g: style.getPropertyValue(justify-items) : start
index 3952674..fc9df1b 100644 (file)
@@ -1241,6 +1241,7 @@ set(WebCore_SOURCES
     css/CSSCanvasValue.cpp
     css/CSSCharsetRule.cpp
     css/CSSComputedStyleDeclaration.cpp
+    css/CSSContentDistributionValue.cpp
     css/CSSCrossfadeValue.cpp
     css/CSSCursorImageValue.cpp
     css/CSSDefaultStyleSheets.cpp
index d4b407b..fca49ad 100644 (file)
@@ -1,3 +1,99 @@
+2015-05-04  Javier Fernandez  <jfernandez@igalia.com>
+
+        [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.
+
+        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:
+
 2015-05-04  Per Arne Vollan  <peavo@outlook.com>
 
         [WinCairo] Compile error in sharedEGLDisplay() method.
index 6cf9d96..acdc998 100644 (file)
                9BF9A8801648DD2F001C6B23 /* JSHTMLFormControlsCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BF9A87E1648DD2F001C6B23 /* JSHTMLFormControlsCollection.cpp */; };
                9BF9A8811648DD2F001C6B23 /* JSHTMLFormControlsCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BF9A87F1648DD2F001C6B23 /* JSHTMLFormControlsCollection.h */; };
                9D6380101AF173220031A15C /* StyleSelfAlignmentData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D63800F1AF16E160031A15C /* StyleSelfAlignmentData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               9DAC7C541AF2CAA100437C44 /* CSSContentDistributionValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9DAC7C521AF2CAA100437C44 /* CSSContentDistributionValue.cpp */; };
+               9DAC7C551AF2CAA200437C44 /* CSSContentDistributionValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DAC7C531AF2CAA100437C44 /* CSSContentDistributionValue.h */; };
+               9DAC7C571AF2CB6400437C44 /* StyleContentAlignmentData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DAC7C561AF2CB6400437C44 /* StyleContentAlignmentData.h */; settings = {ATTRIBUTES = (Private, ); }; };
                9F72304F11184B4100AD0126 /* ScriptProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F72304C11184B4100AD0126 /* ScriptProfile.h */; settings = {ATTRIBUTES = (Private, ); }; };
                9FA37EE41172FC8000C4CD55 /* ScriptProfileNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 9FA37EE31172FC8000C4CD55 /* ScriptProfileNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
                9FA37EFA1172FDA600C4CD55 /* JSScriptProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9FA37EF61172FD9300C4CD55 /* JSScriptProfile.cpp */; };
                9BF9A87E1648DD2F001C6B23 /* JSHTMLFormControlsCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLFormControlsCollection.cpp; sourceTree = "<group>"; };
                9BF9A87F1648DD2F001C6B23 /* JSHTMLFormControlsCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLFormControlsCollection.h; sourceTree = "<group>"; };
                9D63800F1AF16E160031A15C /* StyleSelfAlignmentData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StyleSelfAlignmentData.h; path = style/StyleSelfAlignmentData.h; sourceTree = "<group>"; };
+               9DAC7C521AF2CAA100437C44 /* CSSContentDistributionValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSContentDistributionValue.cpp; sourceTree = "<group>"; };
+               9DAC7C531AF2CAA100437C44 /* CSSContentDistributionValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSContentDistributionValue.h; sourceTree = "<group>"; };
+               9DAC7C561AF2CB6400437C44 /* StyleContentAlignmentData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StyleContentAlignmentData.h; path = style/StyleContentAlignmentData.h; sourceTree = "<group>"; };
                9F72304C11184B4100AD0126 /* ScriptProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptProfile.h; sourceTree = "<group>"; };
                9FA37EE31172FC8000C4CD55 /* ScriptProfileNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptProfileNode.h; sourceTree = "<group>"; };
                9FA37EEF1172FD4100C4CD55 /* ScriptProfile.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ScriptProfile.idl; sourceTree = "<group>"; };
                BC8C8FAA0DDCD2F200B592F4 /* style */ = {
                        isa = PBXGroup;
                        children = (
+                               9DAC7C561AF2CB6400437C44 /* StyleContentAlignmentData.h */,
                                9D63800F1AF16E160031A15C /* StyleSelfAlignmentData.h */,
                                FBD6AF8215EF21A3008B7110 /* BasicShapes.cpp */,
                                FBD6AF8315EF21A3008B7110 /* BasicShapes.h */,
                        children = (
                                31BC742B1AAFF45C006B4340 /* CSSAnimationTriggerScrollValue.cpp */,
                                31BC742C1AAFF45C006B4340 /* CSSAnimationTriggerScrollValue.h */,
+                               9DAC7C521AF2CAA100437C44 /* CSSContentDistributionValue.cpp */,
+                               9DAC7C531AF2CAA100437C44 /* CSSContentDistributionValue.h */,
                                83520C7D1A71BFCC006BD2AA /* CSSFontFamily.h */,
                                FBD6AF8415EF21D4008B7110 /* BasicShapeFunctions.cpp */,
                                FBD6AF8515EF21D4008B7110 /* BasicShapeFunctions.h */,
                                CE1252371A15BDBE00864480 /* CoreGraphicsSPI.h in Headers */,
                                443818001A91B2F8006E04F2 /* CoreMediaSoftLink.h in Headers */,
                                7C9DBFEE1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h in Headers */,
-                               9D6380101AF173220031A15C /* StyleSelfAlignmentData.h in Headers */,
                                4449A4051A964B0000B64AD5 /* CoreMediaSPI.h in Headers */,
                                1C6466251A12C38E0094603C /* CoreTextSPI.h in Headers */,
                                862F129E18C1576F005C54AF /* CountedUserActivity.h in Headers */,
                                BC6049CC0DB560C200204739 /* CSSCanvasValue.h in Headers */,
                                A80E6CF90A1989CA007FB8C5 /* CSSCharsetRule.h in Headers */,
                                BCEA4790097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h in Headers */,
+                               9DAC7C551AF2CAA200437C44 /* CSSContentDistributionValue.h in Headers */,
                                2D8FEBDD143E3EF70072502B /* CSSCrossfadeValue.h in Headers */,
                                AA21ECCD0ABF0FC6002B834C /* CSSCursorImageValue.h in Headers */,
                                4A9CC81816BB9AC600EC645A /* CSSDefaultStyleSheets.h in Headers */,
                                835D363719FF6193004C93AB /* StyleBuilderCustom.h in Headers */,
                                BCEF444D0E674628001C1287 /* StyleCachedImage.h in Headers */,
                                9393E605151A9A1800066F06 /* StyleCachedImageSet.h in Headers */,
+                               9DAC7C571AF2CB6400437C44 /* StyleContentAlignmentData.h in Headers */,
                                BC5EB67F0E81D4A700B25965 /* StyleDashboardRegion.h in Headers */,
                                A8C4A7FD09D563270003AC8D /* StyledElement.h in Headers */,
                                BC5EB8B90E8201BD00B25965 /* StyleDeprecatedFlexibleBoxData.h in Headers */,
                                E4BBED4D14FCDBA1003F0B98 /* StyleRule.h in Headers */,
                                E4946EAF156E64DD00D3297F /* StyleRuleImport.h in Headers */,
                                F47A5E3E195B8C8A00483100 /* StyleScrollSnapPoints.h in Headers */,
+                               9D6380101AF173220031A15C /* StyleSelfAlignmentData.h in Headers */,
                                A8EA800C0A19516E00A8EF5F /* StyleSheet.h in Headers */,
                                E4F9EEF3156DA00700D23E7E /* StyleSheetContents.h in Headers */,
                                A8EA800A0A19516E00A8EF5F /* StyleSheetList.h in Headers */,
                                BC604A430DB5634E00204739 /* CSSCanvasValue.cpp in Sources */,
                                E1EBBBD40AAC9B87001FE8E2 /* CSSCharsetRule.cpp in Sources */,
                                BCEA478F097CAAC80094C9E4 /* CSSComputedStyleDeclaration.cpp in Sources */,
+                               9DAC7C541AF2CAA100437C44 /* CSSContentDistributionValue.cpp in Sources */,
                                2D8FEBDC143E3EF70072502B /* CSSCrossfadeValue.cpp in Sources */,
                                AA21ECCA0ABF0FBA002B834C /* CSSCursorImageValue.cpp in Sources */,
                                4A9CC81716BB9AC600EC645A /* CSSDefaultStyleSheets.cpp in Sources */,
index e86b71f..3f5ddbd 100644 (file)
@@ -32,6 +32,7 @@
 #include "CSSCanvasValue.cpp"
 #include "CSSCharsetRule.cpp"
 #include "CSSComputedStyleDeclaration.cpp"
+#include "CSSContentDistributionValue.cpp"
 #include "CSSCrossfadeValue.cpp"
 #include "CSSCursorImageValue.cpp"
 #include "CSSDefaultStyleSheets.cpp"
index 2f8b1aa..87d4bf5 100644 (file)
@@ -1717,8 +1717,7 @@ static ItemPosition resolveContainerAlignmentAuto(ItemPosition position, RenderO
     if (position != ItemPositionAuto || !element)
         return position;
 
-    bool isFlexOrGrid = element->style().isDisplayFlexibleOrGridBox();
-    return isFlexOrGrid ? ItemPositionStretch : ItemPositionStart;
+    return element->style().isDisplayFlexibleOrGridBox() ? ItemPositionStretch : ItemPositionStart;
 }
 
 static ItemPosition resolveSelfAlignmentAuto(ItemPosition position, OverflowAlignment& overflow, RenderObject* element)
@@ -1734,6 +1733,14 @@ static ItemPosition resolveSelfAlignmentAuto(ItemPosition position, OverflowAlig
     return resolveContainerAlignmentAuto(parent->style().alignItemsPosition(), parent);
 }
 
+static ContentPosition resolveContentAlignmentAuto(ContentPosition position, ContentDistributionType distribution, RenderObject* element)
+{
+    if (position != ContentPositionAuto || distribution != ContentDistributionDefault || !element)
+        return position;
+
+    return element->style().isDisplayFlexibleBox() ? ContentPositionFlexStart : ContentPositionStart;
+}
+
 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
 {
     return ComputedStyleExtractor(m_node, m_allowVisitedStyle, m_pseudoElementSpecifier).propertyValue(propertyID, updateLayout);
@@ -1826,6 +1833,20 @@ static PassRefPtr<CSSValueList> valueForItemPositionWithOverflowAlignment(ItemPo
     return result.release();
 }
 
+static PassRefPtr<CSSValueList> valueForContentPositionAndDistributionWithOverflowAlignment(ContentPosition position, ContentDistributionType distribution, OverflowAlignment overflowAlignment)
+{
+    RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated();
+    if (distribution != ContentDistributionDefault)
+        result->append(CSSPrimitiveValue::create(distribution));
+    if (distribution == ContentDistributionDefault || position != ContentPositionAuto)
+        result->append(CSSPrimitiveValue::create(position));
+    if ((position >= ContentPositionCenter || distribution != ContentDistributionDefault) && overflowAlignment != OverflowAlignmentDefault)
+        result->append(CSSPrimitiveValue::create(overflowAlignment));
+    ASSERT(result->length() > 0);
+    ASSERT(result->length() <= 3);
+    return result.release();
+}
+
 PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
 {
     Node* styledNode = this->styledNode();
@@ -2210,7 +2231,7 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
         case CSSPropertyFlexWrap:
             return cssValuePool().createValue(style->flexWrap());
         case CSSPropertyJustifyContent:
-            return cssValuePool().createValue(style->justifyContent());
+            return valueForContentPositionAndDistributionWithOverflowAlignment(resolveContentAlignmentAuto(style->justifyContentPosition(), style->justifyContentDistribution(), renderer), style->justifyContentDistribution(), style->justifyContentOverflowAlignment());
         case CSSPropertyJustifyItems:
             return valueForItemPositionWithOverflowAlignment(resolveContainerAlignmentAuto(style->justifyItemsPosition(), renderer), style->justifyItemsOverflowAlignment(), style->justifyItemsPositionType());
         case CSSPropertyJustifySelf: {
diff --git a/Source/WebCore/css/CSSContentDistributionValue.cpp b/Source/WebCore/css/CSSContentDistributionValue.cpp
new file mode 100644 (file)
index 0000000..7b2d14a
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2015 Igalia S.L. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CSSContentDistributionValue.h"
+
+#include "CSSValueList.h"
+#include <wtf/text/StringBuilder.h>
+
+namespace WebCore {
+
+CSSContentDistributionValue::CSSContentDistributionValue(CSSValueID distribution, CSSValueID position, CSSValueID overflow)
+    : CSSValue(CSSContentDistributionClass)
+    , m_distribution(distribution)
+    , m_position(position)
+    , m_overflow(overflow)
+{
+}
+
+CSSContentDistributionValue::~CSSContentDistributionValue()
+{
+}
+
+String CSSContentDistributionValue::customCSSText() const
+{
+    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+    if (m_distribution != CSSValueInvalid)
+        list->append(distribution());
+    if (m_position != CSSValueInvalid)
+        list->append(position());
+    if (m_overflow != CSSValueInvalid)
+        list->append(overflow());
+    return list.release()->customCSSText();
+}
+
+bool CSSContentDistributionValue::equals(const CSSContentDistributionValue& other) const
+{
+    return m_distribution == other.m_distribution && m_position == other.m_position && m_overflow == other.m_overflow;
+}
+
+}
diff --git a/Source/WebCore/css/CSSContentDistributionValue.h b/Source/WebCore/css/CSSContentDistributionValue.h
new file mode 100644 (file)
index 0000000..1e43130
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2015 Igalia S.L. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSContentDistributionValue_h
+#define CSSContentDistributionValue_h
+
+#include "CSSValue.h"
+#include "CSSValuePool.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class CSSContentDistributionValue : public CSSValue {
+public:
+    static Ref<CSSContentDistributionValue> create(CSSValueID distribution, CSSValueID position, CSSValueID overflow)
+    {
+        return adoptRef(*new CSSContentDistributionValue(distribution, position, overflow));
+    }
+    ~CSSContentDistributionValue();
+
+    Ref<CSSPrimitiveValue> distribution() const { return cssValuePool().createIdentifierValue(m_distribution); }
+    Ref<CSSPrimitiveValue> position() const { return cssValuePool().createIdentifierValue(m_position); }
+    Ref<CSSPrimitiveValue> overflow() const { return cssValuePool().createIdentifierValue(m_overflow); }
+
+    String customCSSText() const;
+
+    bool equals(const CSSContentDistributionValue&) const;
+
+private:
+    CSSContentDistributionValue(CSSValueID distribution, CSSValueID position, CSSValueID overflow);
+
+    CSSValueID m_distribution;
+    CSSValueID m_position;
+    CSSValueID m_overflow;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSContentDistributionValue, isContentDistributionValue())
+
+#endif // CSSContentDistributionValue_h
index 7efdd01..373b603 100644 (file)
@@ -33,6 +33,7 @@
 #include "CSSBasicShapes.h"
 #include "CSSBorderImage.h"
 #include "CSSCanvasValue.h"
+#include "CSSContentDistributionValue.h"
 #include "CSSCrossfadeValue.h"
 #include "CSSCursorImageValue.h"
 #include "CSSFilterImageValue.h"
@@ -892,11 +893,6 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int
         if (valueID == CSSValueNowrap || valueID == CSSValueWrap || valueID == CSSValueWrapReverse)
              return true;
         break;
-    case CSSPropertyJustifyContent:
-        // FIXME: Per CSS alignment, this property should accept an optional <overflow-position>. We should share this parsing code with 'justify-self'.
-        if (valueID == CSSValueFlexStart || valueID == CSSValueFlexEnd || valueID == CSSValueCenter || valueID == CSSValueSpaceBetween || valueID == CSSValueSpaceAround)
-            return true;
-        break;
     case CSSPropertyWebkitFontKerning:
         if (valueID == CSSValueAuto || valueID == CSSValueNormal || valueID == CSSValueNone)
             return true;
@@ -1128,7 +1124,6 @@ static inline bool isKeywordPropertyID(CSSPropertyID propertyId)
     case CSSPropertyAlignContent:
     case CSSPropertyFlexDirection:
     case CSSPropertyFlexWrap:
-    case CSSPropertyJustifyContent:
     case CSSPropertyWebkitFontKerning:
     case CSSPropertyWebkitFontSmoothing:
     case CSSPropertyWebkitHyphens:
@@ -2713,6 +2708,9 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
         }
         return false;
     }
+    case CSSPropertyJustifyContent:
+        parsedValue = parseContentDistributionOverflowPosition();
+        break;
     case CSSPropertyJustifySelf:
         return parseItemPositionOverflowPosition(propId, important);
     case CSSPropertyJustifyItems:
@@ -3119,7 +3117,6 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
     case CSSPropertyAlignContent:
     case CSSPropertyFlexDirection:
     case CSSPropertyFlexWrap:
-    case CSSPropertyJustifyContent:
     case CSSPropertyWebkitFontKerning:
     case CSSPropertyWebkitFontSmoothing:
     case CSSPropertyWebkitHyphens:
@@ -3232,11 +3229,29 @@ void CSSParser::addFillValue(RefPtr<CSSValue>& lval, Ref<CSSValue>&& rval)
     lval = WTF::move(list);
 }
 
+static bool isContentDistributionKeyword(CSSValueID id)
+{
+    return id == CSSValueSpaceBetween || id == CSSValueSpaceAround
+        || id == CSSValueSpaceEvenly || id == CSSValueStretch;
+}
+
+static bool isContentPositionKeyword(CSSValueID id)
+{
+    return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter
+        || id == CSSValueFlexStart || id == CSSValueFlexEnd
+        || id == CSSValueLeft || id == CSSValueRight;
+}
+
 static inline bool isBaselinePositionKeyword(CSSValueID id)
 {
     return id == CSSValueBaseline || id == CSSValueLastBaseline;
 }
 
+static bool isAlignmentOverflowKeyword(CSSValueID id)
+{
+    return id == CSSValueTrue || id == CSSValueSafe;
+}
+
 static bool isItemPositionKeyword(CSSValueID id)
 {
     return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter
@@ -3268,6 +3283,57 @@ bool CSSParser::parseLegacyPosition(CSSPropertyID propId, bool important)
     return !m_valueList->next();
 }
 
+PassRefPtr<CSSValue> CSSParser::parseContentDistributionOverflowPosition()
+{
+    // auto | <baseline-position> | <content-distribution> || [ <overflow-position>? && <content-position> ]
+    // <baseline-position> = baseline | last-baseline;
+    // <content-distribution> = space-between | space-around | space-evenly | stretch;
+    // <content-position> = center | start | end | flex-start | flex-end | left | right;
+    // <overflow-position> = true | safe
+
+    CSSParserValue* value = m_valueList->current();
+    if (!value)
+        return nullptr;
+
+    // auto | <baseline-position>
+    if (value->id == CSSValueAuto || isBaselinePositionKeyword(value->id)) {
+        m_valueList->next();
+        return CSSContentDistributionValue::create(CSSValueInvalid, value->id, CSSValueInvalid);
+    }
+
+    CSSValueID distribution = CSSValueInvalid;
+    CSSValueID position = CSSValueInvalid;
+    CSSValueID overflow = CSSValueInvalid;
+    while (value) {
+        if (isContentDistributionKeyword(value->id)) {
+            if (distribution != CSSValueInvalid)
+                return nullptr;
+            distribution = value->id;
+        } else if (isContentPositionKeyword(value->id)) {
+            if (position != CSSValueInvalid)
+                return nullptr;
+            position = value->id;
+        } else if (isAlignmentOverflowKeyword(value->id)) {
+            if (overflow != CSSValueInvalid)
+                return nullptr;
+            overflow = value->id;
+        } else
+            return nullptr;
+        value = m_valueList->next();
+    }
+
+    // The grammar states that we should have at least <content-distribution> or
+    // <content-position> ( <content-distribution> || <content-position> ).
+    if (position == CSSValueInvalid && distribution == CSSValueInvalid)
+        return nullptr;
+
+    // The grammar states that <overflow-position> must be associated to <content-position>.
+    if (overflow != CSSValueInvalid && position == CSSValueInvalid)
+        return nullptr;
+
+    return CSSContentDistributionValue::create(distribution, position, overflow);
+}
+
 bool CSSParser::parseItemPositionOverflowPosition(CSSPropertyID propId, bool important)
 {
     // auto | stretch | <baseline-position> | [<item-position> && <overflow-position>? ]
@@ -3297,16 +3363,15 @@ bool CSSParser::parseItemPositionOverflowPosition(CSSPropertyID propId, bool imp
                 return false;
             overflowAlignmentKeyword = cssValuePool().createIdentifierValue(value->id);
         }
-    } else if (value->id != CSSValueTrue && value->id != CSSValueSafe)
-        return false;
-    else {
+    } else if (isAlignmentOverflowKeyword(value->id)) {
         overflowAlignmentKeyword = cssValuePool().createIdentifierValue(value->id);
         value = m_valueList->next();
         if (value && isItemPositionKeyword(value->id))
             position = cssValuePool().createIdentifierValue(value->id);
         else
             return false;
-    }
+    } else
+        return false;
 
     if (m_valueList->next())
         return false;
index 951dd81..fb126e5 100644 (file)
@@ -231,6 +231,7 @@ public:
 
     bool parseLegacyPosition(CSSPropertyID, bool important);
     bool parseItemPositionOverflowPosition(CSSPropertyID, bool important);
+    PassRefPtr<CSSValue> parseContentDistributionOverflowPosition();
 
 #if ENABLE(CSS_SHAPES)
     PassRefPtr<CSSValue> parseShapeProperty(CSSPropertyID);
index cea3172..3348aac 100644 (file)
@@ -1438,52 +1438,6 @@ template<> inline CSSPrimitiveValue::operator EEmptyCell() const
     return SHOW;
 }
 
-template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EJustifyContent e)
-    : CSSValue(PrimitiveClass)
-{
-    m_primitiveUnitType = CSS_VALUE_ID;
-    switch (e) {
-    case JustifyFlexStart:
-        m_value.valueID = CSSValueFlexStart;
-        break;
-    case JustifyFlexEnd:
-        m_value.valueID = CSSValueFlexEnd;
-        break;
-    case JustifyCenter:
-        m_value.valueID = CSSValueCenter;
-        break;
-    case JustifySpaceBetween:
-        m_value.valueID = CSSValueSpaceBetween;
-        break;
-    case JustifySpaceAround:
-        m_value.valueID = CSSValueSpaceAround;
-        break;
-    }
-}
-
-template<> inline CSSPrimitiveValue::operator EJustifyContent() const
-{
-    ASSERT(isValueID());
-
-    switch (m_value.valueID) {
-    case CSSValueFlexStart:
-        return JustifyFlexStart;
-    case CSSValueFlexEnd:
-        return JustifyFlexEnd;
-    case CSSValueCenter:
-        return JustifyCenter;
-    case CSSValueSpaceBetween:
-        return JustifySpaceBetween;
-    case CSSValueSpaceAround:
-        return JustifySpaceAround;
-    default:
-        break;
-    }
-
-    ASSERT_NOT_REACHED();
-    return JustifyFlexStart;
-}
-
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexDirection e)
     : CSSValue(PrimitiveClass)
 {
@@ -5186,6 +5140,114 @@ template<> inline CSSPrimitiveValue::operator OverflowAlignment() const
     return OverflowAlignmentTrue;
 }
 
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ContentPosition contentPosition)
+    : CSSValue(PrimitiveClass)
+{
+    m_primitiveUnitType = CSS_VALUE_ID;
+    switch (contentPosition) {
+    case ContentPositionAuto:
+        m_value.valueID = CSSValueAuto;
+        break;
+    case ContentPositionBaseline:
+        m_value.valueID = CSSValueBaseline;
+        break;
+    case ContentPositionLastBaseline:
+        m_value.valueID = CSSValueLastBaseline;
+        break;
+    case ContentPositionCenter:
+        m_value.valueID = CSSValueCenter;
+        break;
+    case ContentPositionStart:
+        m_value.valueID = CSSValueStart;
+        break;
+    case ContentPositionEnd:
+        m_value.valueID = CSSValueEnd;
+        break;
+    case ContentPositionFlexStart:
+        m_value.valueID = CSSValueFlexStart;
+        break;
+    case ContentPositionFlexEnd:
+        m_value.valueID = CSSValueFlexEnd;
+        break;
+    case ContentPositionLeft:
+        m_value.valueID = CSSValueLeft;
+        break;
+    case ContentPositionRight:
+        m_value.valueID = CSSValueRight;
+        break;
+    }
+}
+
+template<> inline CSSPrimitiveValue::operator ContentPosition() const
+{
+    switch (m_value.valueID) {
+    case CSSValueAuto:
+        return ContentPositionAuto;
+    case CSSValueBaseline:
+        return ContentPositionBaseline;
+    case CSSValueLastBaseline:
+        return ContentPositionLastBaseline;
+    case CSSValueCenter:
+        return ContentPositionCenter;
+    case CSSValueStart:
+        return ContentPositionStart;
+    case CSSValueEnd:
+        return ContentPositionEnd;
+    case CSSValueFlexStart:
+        return ContentPositionFlexStart;
+    case CSSValueFlexEnd:
+        return ContentPositionFlexEnd;
+    case CSSValueLeft:
+        return ContentPositionLeft;
+    case CSSValueRight:
+        return ContentPositionRight;
+    default:
+        break;
+    }
+    ASSERT_NOT_REACHED();
+    return ContentPositionAuto;
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ContentDistributionType contentDistribution)
+    : CSSValue(PrimitiveClass)
+{
+    m_primitiveUnitType = CSS_VALUE_ID;
+    switch (contentDistribution) {
+    case ContentDistributionDefault:
+        m_value.valueID = CSSValueDefault;
+        break;
+    case ContentDistributionSpaceBetween:
+        m_value.valueID = CSSValueSpaceBetween;
+        break;
+    case ContentDistributionSpaceAround:
+        m_value.valueID = CSSValueSpaceAround;
+        break;
+    case ContentDistributionSpaceEvenly:
+        m_value.valueID = CSSValueSpaceEvenly;
+        break;
+    case ContentDistributionStretch:
+        m_value.valueID = CSSValueStretch;
+        break;
+    }
+}
+
+template<> inline CSSPrimitiveValue::operator ContentDistributionType() const
+{
+    switch (m_value.valueID) {
+    case CSSValueSpaceBetween:
+        return ContentDistributionSpaceBetween;
+    case CSSValueSpaceAround:
+        return ContentDistributionSpaceAround;
+    case CSSValueSpaceEvenly:
+        return ContentDistributionSpaceEvenly;
+    case CSSValueStretch:
+        return ContentDistributionStretch;
+    default:
+        break;
+    }
+    ASSERT_NOT_REACHED();
+    return ContentDistributionStretch;
+}
 
 #if ENABLE(CSS_SCROLL_SNAP)
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ScrollSnapType e)
index 28b28a9..303b9e0 100644 (file)
@@ -473,7 +473,7 @@ flex-shrink
 -webkit-flex-shrink = flex-shrink
 flex-wrap
 -webkit-flex-wrap = flex-wrap
-justify-content
+justify-content [Initial=initialContentAlignment, Converter=ContentAlignmentData]
 -webkit-justify-content = justify-content
 #if defined(ENABLE_FILTERS_LEVEL_2) && ENABLE_FILTERS_LEVEL_2
 -webkit-backdrop-filter [ConditionalConverter=FilterOperations]
index 377f6ed..cd17eda 100644 (file)
@@ -33,6 +33,7 @@
 #include "CSSBorderImageSliceValue.h"
 #include "CSSCalculationValue.h"
 #include "CSSCanvasValue.h"
+#include "CSSContentDistributionValue.h"
 #include "CSSCrossfadeValue.h"
 #include "CSSCursorImageValue.h"
 #include "CSSFilterImageValue.h"
@@ -231,6 +232,8 @@ bool CSSValue::equals(const CSSValue& other) const
         case AnimationTriggerScrollClass:
             return compareCSSValues<CSSAnimationTriggerScrollValue>(*this, other);
 #endif
+        case CSSContentDistributionClass:
+            return compareCSSValues<CSSContentDistributionValue>(*this, other);
         default:
             ASSERT_NOT_REACHED();
             return false;
@@ -323,6 +326,8 @@ String CSSValue::cssText() const
 #endif
     case WebKitCSSResourceClass:
         return downcast<WebKitCSSResourceValue>(*this).customCSSText();
+    case CSSContentDistributionClass:
+        return downcast<CSSContentDistributionValue>(*this).customCSSText();
     }
     ASSERT_NOT_REACHED();
     return String();
@@ -443,6 +448,9 @@ void CSSValue::destroy()
     case WebKitCSSResourceClass:
         delete downcast<WebKitCSSResourceValue>(this);
         return;
+    case CSSContentDistributionClass:
+        delete downcast<CSSContentDistributionValue>(this);
+        return;
     }
     ASSERT_NOT_REACHED();
 }
index 9f19af9..13a652f 100644 (file)
@@ -96,6 +96,7 @@ public:
     bool isCalcValue() const {return m_classType == CalculationClass; }
     bool isFilterImageValue() const { return m_classType == FilterImageClass; }
     bool isWebKitCSSFilterValue() const { return m_classType == WebKitCSSFilterClass; }
+    bool isContentDistributionValue() const { return m_classType == CSSContentDistributionClass; }
 #if ENABLE(CSS_GRID_LAYOUT)
     bool isGridTemplateAreasValue() const { return m_classType == GridTemplateAreasClass; }
     bool isGridLineNamesValue() const { return m_classType == GridLineNamesClass; }
@@ -173,6 +174,8 @@ protected:
         AnimationTriggerScrollClass,
 #endif
 
+        CSSContentDistributionClass,
+
         // List class types must appear after ValueListClass.
         ValueListClass,
 #if ENABLE(CSS_IMAGE_SET)
index 786e69e..1beb134 100644 (file)
@@ -545,6 +545,7 @@ flex-end
 // center
 space-between
 space-around
+space-evenly
 // stretch
 
 // CSS_PROP_ALIGN_ITEMS / CSS_PROP_ALIGN_SELF
@@ -556,11 +557,15 @@ last-baseline
 // stretch
 
 // CSS_PROP_JUSTIFY_CONTENT
+// start
+// end
 // flex-start
 // flex-end
 // center
 // space-between
 // space-around
+// space-evenly
+// stretch
 
 // CSS_PROP_JUSTIFY_ITEMS / CSS_PROP_JUSTIFY_SELF
 // auto
index 1d034dc..417a401 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "BasicShapeFunctions.h"
 #include "CSSCalculationValue.h"
+#include "CSSContentDistributionValue.h"
 #include "CSSFontFeatureValue.h"
 #include "CSSFunctionValue.h"
 #include "CSSGridLineNamesValue.h"
@@ -122,6 +123,7 @@ public:
     static String convertSVGURIReference(StyleResolver&, CSSValue&);
     static Color convertSVGColor(StyleResolver&, CSSValue&);
     static StyleSelfAlignmentData convertSelfOrDefaultAlignmentData(StyleResolver&, CSSValue&);
+    static StyleContentAlignmentData convertContentAlignmentData(StyleResolver&, CSSValue&);
     static EGlyphOrientation convertGlyphOrientation(StyleResolver&, CSSValue&);
     static EGlyphOrientation convertGlyphOrientationOrAuto(StyleResolver&, CSSValue&);
     static Optional<Length> convertLineHeight(StyleResolver&, CSSValue&, float multiplier = 1.f);
@@ -1188,6 +1190,19 @@ inline StyleSelfAlignmentData StyleBuilderConverter::convertSelfOrDefaultAlignme
     return alignmentData;
 }
 
+inline StyleContentAlignmentData StyleBuilderConverter::convertContentAlignmentData(StyleResolver&, CSSValue& value)
+{
+    StyleContentAlignmentData alignmentData = RenderStyle::initialContentAlignment();
+    auto& contentValue = downcast<CSSContentDistributionValue>(value);
+    if (contentValue.distribution()->getValueID() != CSSValueInvalid)
+        alignmentData.setDistribution(contentValue.distribution().get());
+    if (contentValue.position()->getValueID() != CSSValueInvalid)
+        alignmentData.setPosition(contentValue.position().get());
+    if (contentValue.overflow()->getValueID() != CSSValueInvalid)
+        alignmentData.setOverflow(contentValue.overflow().get());
+    return alignmentData;
+}
+
 inline EGlyphOrientation StyleBuilderConverter::convertGlyphOrientation(StyleResolver&, CSSValue& value)
 {
     float angle = fabsf(fmodf(downcast<CSSPrimitiveValue>(value).getFloatValue(), 360.0f));
index 849e6e2..b26ed9a 100644 (file)
@@ -958,13 +958,13 @@ bool RenderFlexibleBox::resolveFlexibleLengths(FlexSign flexSign, const OrderedF
     return !totalViolation;
 }
 
-static LayoutUnit initialJustifyContentOffset(LayoutUnit availableFreeSpace, EJustifyContent justifyContent, unsigned numberOfChildren)
+static LayoutUnit initialJustifyContentOffset(LayoutUnit availableFreeSpace, ContentPosition justifyContent, ContentDistributionType justifyContentDistribution, unsigned numberOfChildren)
 {
-    if (justifyContent == JustifyFlexEnd)
+    if (justifyContent == ContentPositionFlexEnd)
         return availableFreeSpace;
-    if (justifyContent == JustifyCenter)
+    if (justifyContent == ContentPositionCenter)
         return availableFreeSpace / 2;
-    if (justifyContent == JustifySpaceAround) {
+    if (justifyContentDistribution == ContentDistributionSpaceAround) {
         if (availableFreeSpace > 0 && numberOfChildren)
             return availableFreeSpace / (2 * numberOfChildren);
         else
@@ -973,12 +973,12 @@ static LayoutUnit initialJustifyContentOffset(LayoutUnit availableFreeSpace, EJu
     return 0;
 }
 
-static LayoutUnit justifyContentSpaceBetweenChildren(LayoutUnit availableFreeSpace, EJustifyContent justifyContent, unsigned numberOfChildren)
+static LayoutUnit justifyContentSpaceBetweenChildren(LayoutUnit availableFreeSpace, ContentDistributionType justifyContentDistribution, unsigned numberOfChildren)
 {
     if (availableFreeSpace > 0 && numberOfChildren > 1) {
-        if (justifyContent == JustifySpaceBetween)
+        if (justifyContentDistribution == ContentDistributionSpaceBetween)
             return availableFreeSpace / (numberOfChildren - 1);
-        if (justifyContent == JustifySpaceAround)
+        if (justifyContentDistribution == ContentDistributionSpaceAround)
             return availableFreeSpace / numberOfChildren;
     }
     return 0;
@@ -1060,7 +1060,7 @@ void RenderFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, cons
     size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren(children);
     LayoutUnit autoMarginOffset = autoMarginOffsetInMainAxis(children, availableFreeSpace);
     LayoutUnit mainAxisOffset = flowAwareBorderStart() + flowAwarePaddingStart();
-    mainAxisOffset += initialJustifyContentOffset(availableFreeSpace, style().justifyContent(), numberOfChildrenForJustifyContent);
+    mainAxisOffset += initialJustifyContentOffset(availableFreeSpace, style().justifyContentPosition(), style().justifyContentDistribution(), numberOfChildrenForJustifyContent);
     if (style().flexDirection() == FlowRowReverse)
         mainAxisOffset += isHorizontalFlow() ? verticalScrollbarWidth() : horizontalScrollbarHeight();
 
@@ -1117,7 +1117,7 @@ void RenderFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, cons
 
         ++seenInFlowPositionedChildren;
         if (seenInFlowPositionedChildren < numberOfChildrenForJustifyContent)
-            mainAxisOffset += justifyContentSpaceBetweenChildren(availableFreeSpace, style().justifyContent(), numberOfChildrenForJustifyContent);
+            mainAxisOffset += justifyContentSpaceBetweenChildren(availableFreeSpace, style().justifyContentDistribution(), numberOfChildrenForJustifyContent);
     }
 
     if (isColumnFlow())
@@ -1143,7 +1143,7 @@ void RenderFlexibleBox::layoutColumnReverse(const OrderedFlexItemList& children,
     // just moving the children to a new position.
     size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren(children);
     LayoutUnit mainAxisOffset = logicalHeight() - flowAwareBorderEnd() - flowAwarePaddingEnd();
-    mainAxisOffset -= initialJustifyContentOffset(availableFreeSpace, style().justifyContent(), numberOfChildrenForJustifyContent);
+    mainAxisOffset -= initialJustifyContentOffset(availableFreeSpace, style().justifyContentPosition(), style().justifyContentDistribution(), numberOfChildrenForJustifyContent);
     mainAxisOffset -= isHorizontalFlow() ? verticalScrollbarWidth() : horizontalScrollbarHeight();
 
     size_t seenInFlowPositionedChildren = 0;
@@ -1161,7 +1161,7 @@ void RenderFlexibleBox::layoutColumnReverse(const OrderedFlexItemList& children,
 
         ++seenInFlowPositionedChildren;
         if (seenInFlowPositionedChildren < numberOfChildrenForJustifyContent)
-            mainAxisOffset -= justifyContentSpaceBetweenChildren(availableFreeSpace, style().justifyContent(), numberOfChildrenForJustifyContent);
+            mainAxisOffset -= justifyContentSpaceBetweenChildren(availableFreeSpace, style().justifyContentDistribution(), numberOfChildrenForJustifyContent);
     }
 }
 
index 891087c..2cf9954 100644 (file)
@@ -89,7 +89,7 @@ static Ref<RenderStyle> createFullScreenStyle()
     fullscreenStyle.get().fontCascade().update(nullptr);
 
     fullscreenStyle.get().setDisplay(FLEX);
-    fullscreenStyle.get().setJustifyContent(JustifyCenter);
+    fullscreenStyle.get().setJustifyContentPosition(ContentPositionCenter);
     fullscreenStyle.get().setAlignItemsPosition(ItemPositionCenter);
     fullscreenStyle.get().setFlexDirection(FlowColumn);
     
index 4161e46..d17f9ad 100644 (file)
@@ -95,7 +95,12 @@ void RenderMathMLScripts::fixAnonymousStyleForSubSupPair(RenderObject* subSupPai
     // (respectively superscript) with the bottom (respectively top) edge of
     // the flex container. Note that for valid <msub> and <msup> elements, the
     // subSupPair should actually have only one script.
-    scriptsStyle.setJustifyContent(m_kind == Sub ? JustifyFlexStart : m_kind == Super ? JustifyFlexEnd : JustifySpaceBetween);
+    if (m_kind == Sub)
+        scriptsStyle.setJustifyContentPosition(ContentPositionFlexStart);
+    else if (m_kind == Super)
+        scriptsStyle.setJustifyContentPosition(ContentPositionFlexEnd);
+    else
+        scriptsStyle.setJustifyContentDistribution(ContentDistributionSpaceBetween);
 
     // The MathML specification does not specify vertical alignment of scripts.
     // Let's right align prescripts and left align postscripts.
@@ -133,7 +138,7 @@ void RenderMathMLScripts::fixAnonymousStyles()
             ASSERT(subSupPair && subSupPair->style().refCount() == 1);
             RenderStyle& scriptsStyle = subSupPair->style();
             scriptsStyle.setFlexDirection(FlowRow);
-            scriptsStyle.setJustifyContent(JustifyFlexStart);
+            scriptsStyle.setJustifyContentPosition(ContentPositionFlexStart);
             scriptsStyle.setAlignItemsPosition(ItemPositionCenter);
             scriptsStyle.setOrder(0);
             scriptsStyle.setFontSize(style().fontSize());
index 51d3cb1..23c7285 100644 (file)
@@ -922,7 +922,10 @@ public:
     bool isColumnFlexDirection() const { return flexDirection() == FlowColumn || flexDirection() == FlowColumnReverse; }
     bool isReverseFlexDirection() const { return flexDirection() == FlowRowReverse || flexDirection() == FlowColumnReverse; }
     EFlexWrap flexWrap() const { return static_cast<EFlexWrap>(rareNonInheritedData->m_flexibleBox->m_flexWrap); }
-    EJustifyContent justifyContent() const { return static_cast<EJustifyContent>(rareNonInheritedData->m_justifyContent); }
+    const StyleContentAlignmentData& justifyContent() const { return rareNonInheritedData->m_justifyContent; }
+    ContentPosition justifyContentPosition() const { return rareNonInheritedData->m_justifyContent.position(); }
+    ContentDistributionType justifyContentDistribution() const { return rareNonInheritedData->m_justifyContent.distribution(); }
+    OverflowAlignment justifyContentOverflowAlignment() const { return rareNonInheritedData->m_justifyContent.overflow(); }
     const StyleSelfAlignmentData& justifyItems() const { return rareNonInheritedData->m_justifyItems; }
     ItemPosition justifyItemsPosition() const { return rareNonInheritedData->m_justifyItems.position(); }
     OverflowAlignment justifyItemsOverflowAlignment() const { return rareNonInheritedData->m_justifyItems.overflow(); }
@@ -1510,7 +1513,10 @@ public:
     void setAlignSelfOverflow(OverflowAlignment overflow) { rareNonInheritedData.access()->m_alignSelf.setOverflow(overflow); }
     void setFlexDirection(EFlexDirection direction) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexDirection, direction); }
     void setFlexWrap(EFlexWrap w) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexWrap, w); }
-    void setJustifyContent(EJustifyContent p) { SET_VAR(rareNonInheritedData, m_justifyContent, p); }
+    void setJustifyContent(const StyleContentAlignmentData& data) { SET_VAR(rareNonInheritedData, m_justifyContent, data); }
+    void setJustifyContentPosition(ContentPosition position) { rareNonInheritedData.access()->m_justifyContent.setPosition(position); }
+    void setJustifyContentOverflow(OverflowAlignment overflow) { rareNonInheritedData.access()->m_justifyContent.setOverflow(overflow); }
+    void setJustifyContentDistribution(ContentDistributionType distribution) { rareNonInheritedData.access()->m_justifyContent.setDistribution(distribution); }
     void setJustifyItems(const StyleSelfAlignmentData& data) { SET_VAR(rareNonInheritedData, m_justifyItems, data); }
     void setJustifyItemsPosition(ItemPosition position) { rareNonInheritedData.access()->m_justifyItems.setPosition(position); }
     void setJustifyItemsOverflow(OverflowAlignment overflow) { rareNonInheritedData.access()->m_justifyItems.setOverflow(overflow); }
@@ -1804,6 +1810,7 @@ public:
     bool isDisplayInlineType() const { return isDisplayInlineType(display()); }
     bool isOriginalDisplayInlineType() const { return isDisplayInlineType(originalDisplay()); }
     bool isDisplayFlexibleOrGridBox() const { return isDisplayFlexibleOrGridBox(display()); }
+    bool isDisplayFlexibleBox() const { return isDisplayFlexibleBox(display()); }
     bool isDisplayRegionType() const
     {
         return display() == BLOCK || display() == INLINE_BLOCK
@@ -1928,9 +1935,9 @@ public:
     static int initialOrder() { return 0; }
     static EAlignContent initialAlignContent() { return AlignContentStretch; }
     static StyleSelfAlignmentData initialSelfAlignment() { return StyleSelfAlignmentData(ItemPositionAuto, OverflowAlignmentDefault); }
+    static StyleContentAlignmentData initialContentAlignment() { return StyleContentAlignmentData(ContentPositionAuto, ContentDistributionDefault, OverflowAlignmentDefault); }
     static EFlexDirection initialFlexDirection() { return FlowRow; }
     static EFlexWrap initialFlexWrap() { return FlexNoWrap; }
-    static EJustifyContent initialJustifyContent() { return JustifyFlexStart; }
     static int initialMarqueeLoopCount() { return -1; }
     static int initialMarqueeSpeed() { return 85; }
     static Length initialMarqueeIncrement() { return Length(6, Fixed); }
index f8b84b5..1adf583 100644 (file)
@@ -248,10 +248,11 @@ enum EBoxDirection { BNORMAL, BREVERSE };
 enum EAlignContent { AlignContentFlexStart, AlignContentFlexEnd, AlignContentCenter, AlignContentSpaceBetween, AlignContentSpaceAround, AlignContentStretch };
 enum EFlexDirection { FlowRow, FlowRowReverse, FlowColumn, FlowColumnReverse };
 enum EFlexWrap { FlexNoWrap, FlexWrap, FlexWrapReverse };
-enum EJustifyContent { JustifyFlexStart, JustifyFlexEnd, JustifyCenter, JustifySpaceBetween, JustifySpaceAround };
 enum ItemPosition {ItemPositionAuto, ItemPositionStretch, ItemPositionBaseline, ItemPositionLastBaseline, ItemPositionCenter, ItemPositionStart, ItemPositionEnd, ItemPositionSelfStart, ItemPositionSelfEnd, ItemPositionFlexStart, ItemPositionFlexEnd, ItemPositionLeft, ItemPositionRight};
 enum OverflowAlignment {OverflowAlignmentDefault, OverflowAlignmentTrue, OverflowAlignmentSafe};
 enum ItemPositionType {NonLegacyPosition, LegacyPosition};
+enum ContentPosition {ContentPositionAuto, ContentPositionBaseline, ContentPositionLastBaseline, ContentPositionCenter, ContentPositionStart, ContentPositionEnd, ContentPositionFlexStart, ContentPositionFlexEnd, ContentPositionLeft, ContentPositionRight};
+enum ContentDistributionType {ContentDistributionDefault, ContentDistributionSpaceBetween, ContentDistributionSpaceAround, ContentDistributionSpaceEvenly, ContentDistributionStretch};
 
 enum ETextSecurity {
     TSNONE, TSDISC, TSCIRCLE, TSSQUARE
diff --git a/Source/WebCore/rendering/style/StyleContentAlignmentData.h b/Source/WebCore/rendering/style/StyleContentAlignmentData.h
new file mode 100644 (file)
index 0000000..31b61b4
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2015 Igalia S.L. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef StyleContentAlignmentData_h
+#define StyleContentAlignmentData_h
+
+#include "RenderStyleConstants.h"
+
+namespace WebCore {
+
+class StyleContentAlignmentData {
+public:
+    // Style data for Content-Distribution properties: align-content, justify-content.
+    // <content-distribution> || [ <overflow-position>? && <content-position> ]
+    StyleContentAlignmentData(ContentPosition position, ContentDistributionType distribution, OverflowAlignment overflow = OverflowAlignmentDefault)
+        : m_position(position)
+        , m_distribution(distribution)
+        , m_overflow(overflow)
+    {
+    }
+
+    void setPosition(ContentPosition position) { m_position = position; }
+    void setDistribution(ContentDistributionType distribution) { m_distribution = distribution; }
+    void setOverflow(OverflowAlignment overflow) { m_overflow = overflow; }
+
+    ContentPosition position() const { return static_cast<ContentPosition>(m_position); }
+    ContentDistributionType distribution() const { return static_cast<ContentDistributionType>(m_distribution); }
+    OverflowAlignment overflow() const { return static_cast<OverflowAlignment>(m_overflow); }
+
+    bool operator==(const StyleContentAlignmentData& o) const
+    {
+        return m_position == o.m_position && m_distribution == o.m_distribution && m_overflow == o.m_overflow;
+    }
+
+    bool operator!=(const StyleContentAlignmentData& o) const
+    {
+        return !(*this == o);
+    }
+
+private:
+    unsigned m_position : 4; // ContentPosition
+    unsigned m_distribution : 3; // ContentDistributionType
+    unsigned m_overflow : 2; // OverflowAlignment
+};
+
+} // namespace WebCore
+
+#endif // StyleContentAlignmentData_h
index bf2e7aa..5f03e39 100644 (file)
@@ -73,6 +73,7 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
     , m_regionThread(RenderStyle::initialRegionThread())
     , m_alignItems(RenderStyle::initialSelfAlignment())
     , m_alignSelf(RenderStyle::initialSelfAlignment())
+    , m_justifyContent(RenderStyle::initialContentAlignment())
     , m_justifyItems(RenderStyle::initialSelfAlignment())
     , m_justifySelf(RenderStyle::initialSelfAlignment())
 #if ENABLE(CSS_SCROLL_SNAP)
@@ -86,7 +87,6 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
     , m_transformStyle3D(RenderStyle::initialTransformStyle3D())
     , m_backfaceVisibility(RenderStyle::initialBackfaceVisibility())
     , m_alignContent(RenderStyle::initialAlignContent())
-    , m_justifyContent(RenderStyle::initialJustifyContent())
     , userDrag(RenderStyle::initialUserDrag())
     , textOverflow(RenderStyle::initialTextOverflow())
     , marginBeforeCollapse(MCOLLAPSE)
@@ -161,6 +161,7 @@ inline StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonIn
     , m_regionThread(o.m_regionThread)
     , m_alignItems(o.m_alignItems)
     , m_alignSelf(o.m_alignSelf)
+    , m_justifyContent(o.m_justifyContent)
     , m_justifyItems(o.m_justifyItems)
     , m_justifySelf(o.m_justifySelf)
 #if ENABLE(CSS_SCROLL_SNAP)
@@ -174,7 +175,6 @@ inline StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonIn
     , m_transformStyle3D(o.m_transformStyle3D)
     , m_backfaceVisibility(o.m_backfaceVisibility)
     , m_alignContent(o.m_alignContent)
-    , m_justifyContent(o.m_justifyContent)
     , userDrag(o.userDrag)
     , textOverflow(o.textOverflow)
     , marginBeforeCollapse(o.marginBeforeCollapse)
@@ -258,6 +258,7 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
         && m_flowThread == o.m_flowThread
         && m_alignItems == o.m_alignItems
         && m_alignSelf == o.m_alignSelf
+        && m_justifyContent == o.m_justifyContent
         && m_justifyItems == o.m_justifyItems
         && m_justifySelf == o.m_justifySelf
         && m_regionThread == o.m_regionThread
@@ -269,7 +270,6 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
         && m_transformStyle3D == o.m_transformStyle3D
         && m_backfaceVisibility == o.m_backfaceVisibility
         && m_alignContent == o.m_alignContent
-        && m_justifyContent == o.m_justifyContent
         && userDrag == o.userDrag
         && textOverflow == o.textOverflow
         && marginBeforeCollapse == o.marginBeforeCollapse
index 0340930..1c7eef0 100644 (file)
@@ -34,6 +34,7 @@
 #include "LineClampValue.h"
 #include "NinePieceImage.h"
 #include "ShapeValue.h"
+#include "StyleContentAlignmentData.h"
 #include "StyleSelfAlignmentData.h"
 #include <memory>
 #include <wtf/PassRefPtr.h>
@@ -178,6 +179,7 @@ public:
 
     StyleSelfAlignmentData m_alignItems;
     StyleSelfAlignmentData m_alignSelf;
+    StyleContentAlignmentData m_justifyContent;
     StyleSelfAlignmentData m_justifyItems;
     StyleSelfAlignmentData m_justifySelf;
 
@@ -196,7 +198,6 @@ public:
     unsigned m_backfaceVisibility : 1; // EBackfaceVisibility
 
     unsigned m_alignContent : 3; // EAlignContent
-    unsigned m_justifyContent : 3; // EJustifyContent
 
     unsigned userDrag : 2; // EUserDrag
     unsigned textOverflow : 1; // Whether or not lines that spill out should be truncated with "..."