<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[213230] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/213230">213230</a></dd>
<dt>Author</dt> <dd>jfernandez@igalia.com</dd>
<dt>Date</dt> <dd>2017-03-01 10:47:49 -0800 (Wed, 01 Mar 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>[css-align] Implement the place-content shorthand
https://bugs.webkit.org/show_bug.cgi?id=168771
Reviewed by Manuel Rego Casasnovas.
Source/WebCore:
The CSS Box Alignment specification defines a new shorthand to set the
Content Alignment properties (align-content and justify-content) at the
same time.
This patch provides the implementation of the CSS parsing logic and the
required regression tests.
Test: css3/parse-place-content.html
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSProperties.json:
* css/StyleProperties.cpp:
(WebCore::StyleProperties::getPropertyValue):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeSimplifiedContentPosition):
(WebCore::CSSPropertyParser::consumePlaceContentShorthand):
(WebCore::CSSPropertyParser::parseShorthand):
* css/parser/CSSPropertyParser.h:
LayoutTests:
Regression tests for the new place-content alignment shorthand.
Added also a new parsing utility script which uses the testharness functions.
* css3/parse-place-content-expected.txt: Added.
* css3/parse-place-content.html: Added.
* css3/resources/alignment-parsing-utils-th.js: Added.
(checkValues):
(checkBadValues):
(checkInitialValues):
(checkInheritValues):
(checkLegacyValues):
(checkSupportedValues):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSComputedStyleDeclarationcpp">trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSPropertiesjson">trunk/Source/WebCore/css/CSSProperties.json</a></li>
<li><a href="#trunkSourceWebCorecssStylePropertiescpp">trunk/Source/WebCore/css/StyleProperties.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSPropertyParsercpp">trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSPropertyParserh">trunk/Source/WebCore/css/parser/CSSPropertyParser.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscss3parseplacecontentexpectedtxt">trunk/LayoutTests/css3/parse-place-content-expected.txt</a></li>
<li><a href="#trunkLayoutTestscss3parseplacecontenthtml">trunk/LayoutTests/css3/parse-place-content.html</a></li>
<li><a href="#trunkLayoutTestscss3resourcesalignmentparsingutilsthjs">trunk/LayoutTests/css3/resources/alignment-parsing-utils-th.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (213229 => 213230)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-03-01 18:18:04 UTC (rev 213229)
+++ trunk/LayoutTests/ChangeLog        2017-03-01 18:47:49 UTC (rev 213230)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2017-03-01 Javier Fernandez <jfernandez@igalia.com>
+
+ [css-align] Implement the place-content shorthand
+ https://bugs.webkit.org/show_bug.cgi?id=168771
+
+ Reviewed by Manuel Rego Casasnovas.
+
+ Regression tests for the new place-content alignment shorthand.
+ Added also a new parsing utility script which uses the testharness functions.
+
+ * css3/parse-place-content-expected.txt: Added.
+ * css3/parse-place-content.html: Added.
+ * css3/resources/alignment-parsing-utils-th.js: Added.
+ (checkValues):
+ (checkBadValues):
+ (checkInitialValues):
+ (checkInheritValues):
+ (checkLegacyValues):
+ (checkSupportedValues):
+
</ins><span class="cx"> 2017-03-01 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> [GTK] fast/canvas/canvas-createPattern-video-loading.html makes its subsequent test timeout
</span></span></pre></div>
<a id="trunkLayoutTestscss3parseplacecontentexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/parse-place-content-expected.txt (0 => 213230)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/parse-place-content-expected.txt         (rev 0)
+++ trunk/LayoutTests/css3/parse-place-content-expected.txt        2017-03-01 18:47:49 UTC (rev 213230)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+Test to verify that the new place-content alignment shorthand is parsed as expected and correctly sets the longhand values.
+
+
+PASS Test getting the Computed Value of place-content's longhand properties when setting 'normal' value through CSS.
+PASS Test getting the Computed Value of place-content's longhand properties when setting 'baseline' value through CSS.
+PASS Test getting the Computed Value of place-content's longhand properties when setting 'start' value through CSS.
+PASS Test getting the Computed Value of place-content's longhand properties when setting 'flex-start' value through CSS.
+PASS Test getting the Computed Value of place-content's longhand properties when setting 'end' value through CSS.
+PASS Test getting the Computed Value of place-content's longhand properties when setting 'space-between' value through CSS.
+PASS Test getting the Computed Value of place-content's longhand properties when setting 'stretch' value through CSS.
+PASS Test getting the Computed Value of place-content's longhand properties when setting 'start end' value through CSS.
+PASS Test getting the Computed Value of place-content's longhand properties when setting 'start space-evenly' value through CSS.
+PASS Test getting the Computed Value of place-content's longhand properties when setting 'start baseline' value through CSS.
+PASS Test setting '' as incorrect value through CSS.
+PASS Test setting 'auto' as incorrect value through CSS.
+PASS Test setting 'none' as incorrect value through CSS.
+PASS Test setting 'safe' as incorrect value through CSS.
+PASS Test setting 'start safe' as incorrect value through CSS.
+PASS Test setting 'baseline safe' as incorrect value through CSS.
+PASS Test setting 'start end left' as incorrect value through CSS.
+FAIL Test setting values through JS. assert_equals: placeContent specified value is not what it should. expected "center" but got "center center"
+PASS Test setting incorrect values through JS.
+PASS Test the 'initial' value of the place-content shorthand and its longhand properties' Computed value
+PASS Test the 'inherit' value of the place-content shorthand and its longhand properties' Computed value
+
</ins></span></pre></div>
<a id="trunkLayoutTestscss3parseplacecontenthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/parse-place-content.html (0 => 213230)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/parse-place-content.html         (rev 0)
+++ trunk/LayoutTests/css3/parse-place-content.html        2017-03-01 18:47:49 UTC (rev 213230)
</span><span class="lines">@@ -0,0 +1,247 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<style>
+#placeContentNormal {
+ place-content: normal;
+}
+#placeContentBaseline {
+ place-content: baseline;
+}
+#placeContentStart {
+ place-content: start;
+}
+#placeContentFlexStart {
+ place-content: flex-start;
+}
+#placeContentEnd {
+ place-content: end;
+}
+#placeContentSpaceBetween {
+ place-content: space-between;
+}
+#placeContentStretch {
+ place-content: stretch;
+}
+#placeContentStartEnd {
+ place-content: start end;
+}
+#placeContentStartSpaceEvenly {
+ place-content: start space-evenly;
+}
+#placeContentStartBaseline {
+ place-content: start baseline;
+}
+
+<!-- Invalid CSS cases -->
+#placeContentEmpty {
+ place-content:;
+}
+#placeContentAuto {
+ place-content: auto;
+}
+#placeContentNone {
+ place-content: none;
+}
+#placeContentSafe {
+ place-content: safe;
+}
+#placeContentStartSafe {
+ place-content: start safe;
+}
+#placeContentStartEndLeft {
+ place-content: start end left;
+}
+</style>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="resources/alignment-parsing-utils-th.js"></script>
+</head>
+<body>
+ <p>Test to verify that the new place-content alignment shorthand is parsed as expected and correctly sets the longhand values.</p>
+ <div id="log"></div>
+
+ <div id="placeContentNormal"></div>
+ <div id="placeContentBaseline"></div>
+ <div id="placeContentStart"></div>
+ <div id="placeContentFlexStart"></div>
+ <div id="placeContentEnd"></div>
+ <div id="placeContentSpaceBetween"></div>
+ <div id="placeContentStretch"></div>
+ <div id="placeContentStartEnd"></div>
+ <div id="placeContentStartSpaceEvenly"></div>
+ <div id="placeContentStartBaseline"></div>
+
+ <div id="placeContentEmpty"></div>
+ <div id="placeContentAuto"></div>
+ <div id="placeContentNone"></div>
+ <div id="placeContentSafe"></div>
+ <div id="placeContentStartSafe"></div>
+ <div id="placeContentBaselineSafe"></div>
+ <div id="placeContentStartEndLeft"></div>
+<script>
+function checkPlaceContentValues(element, value, alignValue, justifyValue)
+{
+ var res = value.split(" ");
+ if (res.length < 2)
+ res[1] = res[0];
+ checkValues(element, "alignContent", "align-content", res[0], alignValue);
+ checkValues(element, "justifyContent", "justify-content", res[1], justifyValue);
+}
+
+function checkPlaceContentValuesJS(value, alignValue, justifyValue)
+{
+ element = document.createElement("div");
+ document.body.appendChild(element);
+ element.style.placeContent = value;
+ checkValues(element, "placeContent", "place-content", value, alignValue + ' ' + justifyValue)
+ checkPlaceContentValues(element, value, alignValue, justifyValue)
+}
+
+function checkPlaceContentValuesBadJS(value)
+{
+ element.style.placeContent = "";
+ element.style.placeContent = value;
+ checkPlaceContentValues(element, "", "normal", "normal")
+}
+
+function checkPlaceContentInitialValue()
+{
+ element = document.createElement("div");
+ document.body.appendChild(element);
+ checkValues(element, "placeContent", "place-content", "", "normal normal");
+ element.style.placeContent = "center";
+ checkPlaceContentValues(element, "center", "center", "center");
+ element.style.placeContent = "initial";
+ checkValues(element, "placeContent", "place-content", "initial", "normal normal");
+ checkPlaceContentValues(element, "initial", "normal", "normal");
+}
+
+function checkPlaceContentInheritValue()
+{
+ document.body.style.placeContent = "start";
+ var anotherElement = document.createElement("div");
+ document.body.appendChild(anotherElement);
+ checkPlaceContentValues(anotherElement, "", "normal", "normal");
+ anotherElement.style.placeContent = "inherit";
+ checkPlaceContentValues(anotherElement, "inherit", "start", "start");
+}
+
+
+test(function() {
+ checkValues(placeContentNormal, "placeContent", "place-content", "", "normal normal");
+ checkPlaceContentValues(placeContentNormal, "", "normal", "normal");
+}, "Test getting the Computed Value of place-content's longhand properties when setting 'normal' value through CSS.");
+
+test(function() {
+ checkValues(placeContentBaseline, "placeContent", "place-content", "", "baseline baseline");
+ checkPlaceContentValues(placeContentBaseline, "", "baseline", "baseline");
+}, "Test getting the Computed Value of place-content's longhand properties when setting 'baseline' value through CSS.");
+
+test(function() {
+ checkValues(placeContentStart, "placeContent", "place-content", "", "start start");
+ checkPlaceContentValues(placeContentStart, "", "start", "start");
+}, "Test getting the Computed Value of place-content's longhand properties when setting 'start' value through CSS.");
+
+test(function() {
+ checkValues(placeContentFlexStart, "placeContent", "place-content", "", "flex-start flex-start");
+ checkPlaceContentValues(placeContentFlexStart, "", "flex-start", "flex-start");
+}, "Test getting the Computed Value of place-content's longhand properties when setting 'flex-start' value through CSS.");
+
+test(function() {
+ checkValues(placeContentEnd, "placeContent", "place-content", "", "end end");
+ checkPlaceContentValues(placeContentEnd, "", "end", "end");
+}, "Test getting the Computed Value of place-content's longhand properties when setting 'end' value through CSS.");
+
+test(function() {
+ checkValues(placeContentSpaceBetween, "placeContent", "place-content", "", "space-between space-between");
+ checkPlaceContentValues(placeContentSpaceBetween, "", "space-between", "space-between");
+}, "Test getting the Computed Value of place-content's longhand properties when setting 'space-between' value through CSS.");
+
+test(function() {
+ checkValues(placeContentStretch, "placeContent", "place-content", "", "stretch stretch");
+ checkPlaceContentValues(placeContentStretch, "", "stretch", "stretch");
+}, "Test getting the Computed Value of place-content's longhand properties when setting 'stretch' value through CSS.");
+
+test(function() {
+ checkValues(placeContentStartEnd, "placeContent", "place-content", "", "start end");
+ checkPlaceContentValues(placeContentStartEnd, "", "start", "end");
+}, "Test getting the Computed Value of place-content's longhand properties when setting 'start end' value through CSS.");
+
+test(function() {
+ checkValues(placeContentStartSpaceEvenly, "placeContent", "place-content", "", "start space-evenly");
+ checkPlaceContentValues(placeContentStartSpaceEvenly, "", "start", "space-evenly");
+}, "Test getting the Computed Value of place-content's longhand properties when setting 'start space-evenly' value through CSS.");
+
+test(function() {
+ checkValues(placeContentStartBaseline, "placeContent", "place-content", "", "start baseline");
+ checkPlaceContentValues(placeContentStartBaseline, "", "start", "baseline");
+}, "Test getting the Computed Value of place-content's longhand properties when setting 'start baseline' value through CSS.");
+
+test(function() {
+ checkValues(placeContentAuto, "placeContent", "place-content", "", "normal normal");
+ checkPlaceContentValues(placeContentAuto, "", "normal", "normal");
+}, "Test setting '' as incorrect value through CSS.");
+
+test(function() {
+ checkValues(placeContentAuto, "placeContent", "place-content", "", "normal normal");
+ checkPlaceContentValues(placeContentAuto, "", "normal", "normal");
+}, "Test setting 'auto' as incorrect value through CSS.");
+
+test(function() {
+ checkValues(placeContentNone, "placeContent", "place-content", "", "normal normal");
+ checkPlaceContentValues(placeContentNone, "", "normal", "normal");
+}, "Test setting 'none' as incorrect value through CSS.");
+
+test(function() {
+ checkValues(placeContentSafe, "placeContent", "place-content", "", "normal normal");
+ checkPlaceContentValues(placeContentSafe, "", "normal", "normal");
+}, "Test setting 'safe' as incorrect value through CSS.");
+
+test(function() {
+ checkValues(placeContentStartSafe, "placeContent", "place-content", "", "normal normal");
+ checkPlaceContentValues(placeContentStartSafe, "", "normal", "normal");
+}, "Test setting 'start safe' as incorrect value through CSS.");
+
+test(function() {
+ checkValues(placeContentStartSafe, "placeContent", "place-content", "", "normal normal");
+ checkPlaceContentValues(placeContentStartSafe, "", "normal", "normal");
+}, "Test setting 'baseline safe' as incorrect value through CSS.");
+
+test(function() {
+ checkValues(placeContentStartEndLeft, "placeContent", "place-content", "", "normal normal");
+ checkPlaceContentValues(placeContentStartEndLeft, "", "normal", "normal");
+}, "Test setting 'start end left' as incorrect value through CSS.");
+
+test(function() {
+ // FIXME: We will get FAIL for placeContent specified values tests because we still don't know how to serialize this shortand.
+ // https://github.com/w3c/csswg-drafts/issues/1041
+ checkPlaceContentValuesJS("center", "center", "center");
+ checkPlaceContentValuesJS("start start", "start", "start");
+ checkPlaceContentValuesJS("center start", "center", "start");
+ checkPlaceContentValuesJS("space-between end", "space-between", "end");
+ checkPlaceContentValuesJS("normal end", "normal", "end");
+}, "Test setting values through JS.");
+
+test(function() {
+ checkPlaceContentValuesBadJS("center safe", "normal", "normal");
+ checkPlaceContentValuesBadJS("center space-between center", "normal", "normal");
+ checkPlaceContentValuesBadJS("asrt", "normal", "normal");
+ checkPlaceContentValuesBadJS("auto", "normal", "normal");
+ checkPlaceContentValuesBadJS("10px", "normal", "normal");
+ checkPlaceContentValuesBadJS("stretch safe", "normal", "normal");
+ checkPlaceContentValuesBadJS("space-between start end", "normal", "normal");
+}, "Test setting incorrect values through JS.");
+
+test(function() {
+ checkPlaceContentInitialValue();
+}, "Test the 'initial' value of the place-content shorthand and its longhand properties' Computed value");
+
+test(function() {
+ checkPlaceContentInheritValue();
+}, "Test the 'inherit' value of the place-content shorthand and its longhand properties' Computed value");
+
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscss3resourcesalignmentparsingutilsthjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/resources/alignment-parsing-utils-th.js (0 => 213230)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/resources/alignment-parsing-utils-th.js         (rev 0)
+++ trunk/LayoutTests/css3/resources/alignment-parsing-utils-th.js        2017-03-01 18:47:49 UTC (rev 213230)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+function checkValues(element, property, propertyID, value, computedValue)
+{
+ window.element = element;
+ var elementID = element.id || "element";
+ assert_equals(eval('element.style.' + property), value, property + ' specified value is not what it should.');
+ assert_equals(eval("window.getComputedStyle(" + elementID + ", '').getPropertyValue('" + propertyID + "')"), computedValue, property + " is not what it should.");
+}
+
+function checkBadValues(element, property, propertyID, value)
+{
+ var elementID = element.id || "element";
+ var initialValue = eval("window.getComputedStyle(" + elementID + " , '').getPropertyValue('" + propertyID + "')");
+ element.style[property] = value;
+ checkValues(element, property, propertyID, "", initialValue);
+}
+
+function checkInitialValues(element, property, propertyID, value, initial)
+{
+ element.style[property] = value;
+ checkValues(element, property, propertyID, value, value);
+ element.style[property] = "initial";
+ checkValues(element, property, propertyID, "initial", initial);
+}
+
+function checkInheritValues(property, propertyID, value)
+{
+ var parentElement = document.createElement("div");
+ document.body.appendChild(parentElement);
+ parentElement.style[property] = value;
+ checkValues(parentElement, property, propertyID, value, value);
+
+ var element = document.createElement("div");
+ parentElement.appendChild(element);
+ element.style[property] = "inherit";
+ checkValues(element, property, propertyID, "inherit", value);
+}
+
+function checkLegacyValues(property, propertyID, value)
+{
+ var parentElement = document.createElement("div");
+ document.body.appendChild(parentElement);
+ parentElement.style[property] = value;
+ checkValues(parentElement, property, propertyID, value, value);
+
+ var element = document.createElement("div");
+ parentElement.appendChild(element);
+ checkValues(element, property, propertyID, "", value);
+}
+
+function checkSupportedValues(elementID, property)
+{
+ var value = eval("window.getComputedStyle(" + elementID + " , '').getPropertyValue('" + property + "')");
+ var value1 = eval("window.getComputedStyle(" + elementID + " , '')");
+ shouldBeTrue("CSS.supports('" + property + "', '" + value + "')");
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (213229 => 213230)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-01 18:18:04 UTC (rev 213229)
+++ trunk/Source/WebCore/ChangeLog        2017-03-01 18:47:49 UTC (rev 213230)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2017-03-01 Javier Fernandez <jfernandez@igalia.com>
+
+ [css-align] Implement the place-content shorthand
+ https://bugs.webkit.org/show_bug.cgi?id=168771
+
+ Reviewed by Manuel Rego Casasnovas.
+
+ The CSS Box Alignment specification defines a new shorthand to set the
+ Content Alignment properties (align-content and justify-content) at the
+ same time.
+
+ This patch provides the implementation of the CSS parsing logic and the
+ required regression tests.
+
+ Test: css3/parse-place-content.html
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::ComputedStyleExtractor::propertyValue):
+ * css/CSSProperties.json:
+ * css/StyleProperties.cpp:
+ (WebCore::StyleProperties::getPropertyValue):
+ * css/parser/CSSPropertyParser.cpp:
+ (WebCore::consumeSimplifiedContentPosition):
+ (WebCore::CSSPropertyParser::consumePlaceContentShorthand):
+ (WebCore::CSSPropertyParser::parseShorthand):
+ * css/parser/CSSPropertyParser.h:
+
</ins><span class="cx"> 2017-03-01 Simon Fraser <simon.fraser@apple.com>
</span><span class="cx">
</span><span class="cx"> Try to fix Windows build after r213191.
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSComputedStyleDeclarationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (213229 => 213230)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2017-03-01 18:18:04 UTC (rev 213229)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2017-03-01 18:47:49 UTC (rev 213230)
</span><span class="lines">@@ -320,6 +320,7 @@
</span><span class="cx"> CSSPropertyJustifyContent,
</span><span class="cx"> CSSPropertyJustifySelf,
</span><span class="cx"> CSSPropertyJustifyItems,
</span><ins>+ CSSPropertyPlaceContent,
</ins><span class="cx"> #if ENABLE(FILTERS_LEVEL_2)
</span><span class="cx"> CSSPropertyWebkitBackdropFilter,
</span><span class="cx"> #endif
</span><span class="lines">@@ -2871,6 +2872,8 @@
</span><span class="cx"> return valueForItemPositionWithOverflowAlignment(resolveJustifyItemsAuto(style->justifyItems(), styledElement->parentNode()));
</span><span class="cx"> case CSSPropertyJustifySelf:
</span><span class="cx"> return valueForItemPositionWithOverflowAlignment(resolveJustifySelfAuto(style->justifySelf(), styledElement->parentNode()));
</span><ins>+ case CSSPropertyPlaceContent:
+ return getCSSPropertyValuesForShorthandProperties(placeContentShorthand());
</ins><span class="cx"> case CSSPropertyOrder:
</span><span class="cx"> return cssValuePool.createValue(style->order(), CSSPrimitiveValue::CSS_NUMBER);
</span><span class="cx"> case CSSPropertyFloat:
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSPropertiesjson"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSProperties.json (213229 => 213230)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSProperties.json        2017-03-01 18:18:04 UTC (rev 213229)
+++ trunk/Source/WebCore/css/CSSProperties.json        2017-03-01 18:47:49 UTC (rev 213230)
</span><span class="lines">@@ -4625,6 +4625,14 @@
</span><span class="cx"> "url": "https://www.w3.org/TR/css-align-3/#propdef-justify-items"
</span><span class="cx"> }
</span><span class="cx"> },
</span><ins>+ "place-content": {
+ "codegen-properties": {
+ "longhands": [
+ "align-content",
+ "justify-content"
+ ]
+ }
+ },
</ins><span class="cx"> "grid": {
</span><span class="cx"> "codegen-properties": {
</span><span class="cx"> "longhands": [
</span></span></pre></div>
<a id="trunkSourceWebCorecssStylePropertiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleProperties.cpp (213229 => 213230)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleProperties.cpp        2017-03-01 18:18:04 UTC (rev 213229)
+++ trunk/Source/WebCore/css/StyleProperties.cpp        2017-03-01 18:47:49 UTC (rev 213230)
</span><span class="lines">@@ -187,6 +187,8 @@
</span><span class="cx"> return getShorthandValue(gridColumnShorthand());
</span><span class="cx"> case CSSPropertyGridRow:
</span><span class="cx"> return getShorthandValue(gridRowShorthand());
</span><ins>+ case CSSPropertyPlaceContent:
+ return getShorthandValue(placeContentShorthand());
</ins><span class="cx"> case CSSPropertyFont:
</span><span class="cx"> return fontValue();
</span><span class="cx"> case CSSPropertyMargin:
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSPropertyParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (213229 => 213230)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp        2017-03-01 18:18:04 UTC (rev 213229)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp        2017-03-01 18:47:49 UTC (rev 213230)
</span><span class="lines">@@ -5254,6 +5254,39 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static RefPtr<CSSValue> consumeSimplifiedContentPosition(CSSParserTokenRange& range)
+{
+ CSSValueID id = range.peek().id();
+ if (identMatches<CSSValueNormal, CSSValueBaseline, CSSValueLastBaseline>(id))
+ return CSSContentDistributionValue::create(CSSValueInvalid, range.consumeIncludingWhitespace().id(), CSSValueInvalid);
+ if (identMatches<CSSValueSpaceBetween, CSSValueSpaceAround, CSSValueSpaceEvenly, CSSValueStretch>(id))
+ return CSSContentDistributionValue::create(range.consumeIncludingWhitespace().id(), CSSValueInvalid, CSSValueInvalid);
+ if (identMatches<CSSValueStart, CSSValueEnd, CSSValueCenter, CSSValueFlexStart, CSSValueFlexEnd, CSSValueLeft, CSSValueRight>(id))
+ return CSSContentDistributionValue::create(CSSValueInvalid, range.consumeIncludingWhitespace().id(), CSSValueInvalid);
+ return nullptr;
+}
+
+bool CSSPropertyParser::consumePlaceContentShorthand(bool important)
+{
+ ASSERT(shorthandForProperty(CSSPropertyPlaceContent).length() == 2);
+
+ if (m_range.atEnd())
+ return false;
+
+ RefPtr<CSSValue> alignContentValue = consumeSimplifiedContentPosition(m_range);
+ if (!alignContentValue)
+ return false;
+ RefPtr<CSSValue> justifyContentValue = m_range.atEnd() ? alignContentValue : consumeSimplifiedContentPosition(m_range);
+ if (!justifyContentValue)
+ return false;
+ if (!m_range.atEnd())
+ return false;
+
+ addProperty(CSSPropertyAlignContent, CSSPropertyPlaceContent, alignContentValue.releaseNonNull(), important);
+ addProperty(CSSPropertyJustifyContent, CSSPropertyPlaceContent, justifyContentValue.releaseNonNull(), important);
+ return true;
+}
+
</ins><span class="cx"> bool CSSPropertyParser::parseShorthand(CSSPropertyID property, bool important)
</span><span class="cx"> {
</span><span class="cx"> switch (property) {
</span><span class="lines">@@ -5435,6 +5468,8 @@
</span><span class="cx"> return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important);
</span><span class="cx"> case CSSPropertyGrid:
</span><span class="cx"> return consumeGridShorthand(important);
</span><ins>+ case CSSPropertyPlaceContent:
+ return consumePlaceContentShorthand(important);
</ins><span class="cx"> case CSSPropertyWebkitMarquee:
</span><span class="cx"> return consumeShorthandGreedily(webkitMarqueeShorthand(), important);
</span><span class="cx"> default:
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSPropertyParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.h (213229 => 213230)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSPropertyParser.h        2017-03-01 18:18:04 UTC (rev 213229)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.h        2017-03-01 18:47:49 UTC (rev 213230)
</span><span class="lines">@@ -80,6 +80,8 @@
</span><span class="cx"> bool consumeGridShorthand(bool important);
</span><span class="cx"> bool consumeGridAreaShorthand(bool important);
</span><span class="cx">
</span><ins>+ bool consumePlaceContentShorthand(bool important);
+
</ins><span class="cx"> bool consumeFont(bool important);
</span><span class="cx"> bool consumeFontVariantShorthand(bool important);
</span><span class="cx"> bool consumeSystemFont(bool important);
</span></span></pre>
</div>
</div>
</body>
</html>