Diff
Modified: trunk/LayoutTests/ChangeLog (214851 => 214852)
--- trunk/LayoutTests/ChangeLog 2017-04-03 23:06:25 UTC (rev 214851)
+++ trunk/LayoutTests/ChangeLog 2017-04-03 23:08:42 UTC (rev 214852)
@@ -1,3 +1,15 @@
+2017-04-03 Javier Fernandez <jfernan...@igalia.com>
+
+ [css-align] Adapt place-content alignment shorthand to the new baseline syntax
+ https://bugs.webkit.org/show_bug.cgi?id=170340
+
+ Reviewed by David Hyatt.
+
+ Added additional test cases to evaluate the new baseline-alignment syntax.
+
+ * css3/parse-place-content-expected.txt:
+ * css3/parse-place-content.html:
+
2017-04-03 Nan Wang <n_w...@apple.com>
AX: Expose link children when doing search predication on iOS
Modified: trunk/LayoutTests/css3/parse-place-content-expected.txt (214851 => 214852)
--- trunk/LayoutTests/css3/parse-place-content-expected.txt 2017-04-03 23:06:25 UTC (rev 214851)
+++ trunk/LayoutTests/css3/parse-place-content-expected.txt 2017-04-03 23:08:42 UTC (rev 214852)
@@ -3,6 +3,8 @@
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 'first baseline' value through CSS.
+PASS Test getting the Computed Value of place-content's longhand properties when setting 'last 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.
@@ -18,7 +20,7 @@
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 values through JS.
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
Modified: trunk/LayoutTests/css3/parse-place-content.html (214851 => 214852)
--- trunk/LayoutTests/css3/parse-place-content.html 2017-04-03 23:06:25 UTC (rev 214851)
+++ trunk/LayoutTests/css3/parse-place-content.html 2017-04-03 23:08:42 UTC (rev 214852)
@@ -8,6 +8,12 @@
#placeContentBaseline {
place-content: baseline;
}
+#placeContentFirstBaseline {
+ place-content: first baseline;
+}
+#placeContentLastBaseline {
+ place-content: last baseline;
+}
#placeContentStart {
place-content: start;
}
@@ -63,6 +69,8 @@
<div id="placeContentNormal"></div>
<div id="placeContentBaseline"></div>
+ <div id="placeContentFirstBaseline"></div>
+ <div id="placeContentLastBaseline"></div>
<div id="placeContentStart"></div>
<div id="placeContentFlexStart"></div>
<div id="placeContentEnd"></div>
@@ -82,20 +90,30 @@
<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);
+ var res = value.split(" ");
+ var alignContentSpecified = res[0];
+ var justifyContentSpecified = "";
+ if (res[0] === "first" || res[0] === "last") {
+ alignContentSpecified = res[0] + " " + res[1];
+ if (res.length > 2)
+ justifyContentSpecified = res.slice(2).join(" ");
+ } else {
+ justifyContentSpecified = res.slice(1).join(" ");
+ }
+
+ if (justifyContentSpecified === "")
+ justifyContentSpecified = alignContentSpecified;
+ checkValues(element, "alignContent", "align-content", alignContentSpecified, alignValue);
+ checkValues(element, "justifyContent", "justify-content", justifyContentSpecified, 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)
+ 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)
@@ -139,6 +157,16 @@
}, "Test getting the Computed Value of place-content's longhand properties when setting 'baseline' value through CSS.");
test(function() {
+ checkValues(placeContentFirstBaseline, "placeContent", "place-content", "", "baseline baseline");
+ checkPlaceContentValues(placeContentFirstBaseline, "", "baseline", "baseline");
+}, "Test getting the Computed Value of place-content's longhand properties when setting 'first baseline' value through CSS.");
+
+test(function() {
+ checkValues(placeContentLastBaseline, "placeContent", "place-content", "", "last baseline last baseline");
+ checkPlaceContentValues(placeContentLastBaseline, "", "last baseline", "last baseline");
+}, "Test getting the Computed Value of place-content's longhand properties when setting 'last 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.");
@@ -214,10 +242,7 @@
}, "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");
@@ -231,6 +256,7 @@
checkPlaceContentValuesBadJS("10px", "normal", "normal");
checkPlaceContentValuesBadJS("stretch safe", "normal", "normal");
checkPlaceContentValuesBadJS("space-between start end", "normal", "normal");
+ checkPlaceContentValuesBadJS("", "normal", "normal");
}, "Test setting incorrect values through JS.");
test(function() {
Modified: trunk/Source/WebCore/ChangeLog (214851 => 214852)
--- trunk/Source/WebCore/ChangeLog 2017-04-03 23:06:25 UTC (rev 214851)
+++ trunk/Source/WebCore/ChangeLog 2017-04-03 23:08:42 UTC (rev 214852)
@@ -1,3 +1,28 @@
+2017-04-03 Javier Fernandez <jfernan...@igalia.com>
+
+ [css-align] Adapt place-content alignment shorthand to the new baseline syntax
+ https://bugs.webkit.org/show_bug.cgi?id=170340
+
+ Reviewed by David Hyatt.
+
+ Now that the align-content and justify-content CSS properties are
+ adapted to the new baseline-position CSS values syntax we can adapt the
+ shorthand that controls such properties to the new syntax as well.
+
+ No new tests, just adding some additional cases to the tests we already have.
+
+ * css/StyleProperties.cpp:
+ (WebCore::StyleProperties::getPropertyValue):
+ (WebCore::StyleProperties::placeContentPropertyValue):
+ * css/StyleProperties.h:
+ * css/parser/CSSPropertyParser.cpp:
+ (WebCore::isContentDistributionKeyword):
+ (WebCore::isContentPositionKeyword):
+ (WebCore::isOverflowKeyword):
+ (WebCore::getBaselineKeyword):
+ (WebCore::consumeContentDistributionOverflowPosition):
+ (WebCore::consumeSimplifiedContentPosition):
+
2017-04-03 Nan Wang <n_w...@apple.com>
AX: Expose link children when doing search predication on iOS
Modified: trunk/Source/WebCore/css/StyleProperties.cpp (214851 => 214852)
--- trunk/Source/WebCore/css/StyleProperties.cpp 2017-04-03 23:06:25 UTC (rev 214851)
+++ trunk/Source/WebCore/css/StyleProperties.cpp 2017-04-03 23:08:42 UTC (rev 214852)
@@ -186,7 +186,7 @@
case CSSPropertyGridRow:
return getShorthandValue(gridRowShorthand());
case CSSPropertyPlaceContent:
- return getShorthandValue(placeContentShorthand());
+ return placeContentPropertyValue();
case CSSPropertyFont:
return fontValue();
case CSSPropertyMargin:
@@ -583,6 +583,14 @@
return res;
}
+String StyleProperties::placeContentPropertyValue() const
+{
+ String value = getCommonValue(placeContentShorthand());
+ if (value.isNull() || value.isEmpty())
+ return getShorthandValue(placeContentShorthand());
+ return value;
+}
+
String StyleProperties::borderPropertyValue(CommonValueMode valueMode) const
{
const StylePropertyShorthand properties[3] = { borderWidthShorthand(), borderStyleShorthand(), borderColorShorthand() };
Modified: trunk/Source/WebCore/css/StyleProperties.h (214851 => 214852)
--- trunk/Source/WebCore/css/StyleProperties.h 2017-04-03 23:06:25 UTC (rev 214851)
+++ trunk/Source/WebCore/css/StyleProperties.h 2017-04-03 23:08:42 UTC (rev 214852)
@@ -157,6 +157,7 @@
private:
String getShorthandValue(const StylePropertyShorthand&) const;
String getCommonValue(const StylePropertyShorthand&) const;
+ String placeContentPropertyValue() const;
enum CommonValueMode { OmitUncommonValues, ReturnNullOnUncommonValues };
String borderPropertyValue(CommonValueMode) const;
String getLayeredShorthandValue(const StylePropertyShorthand&) const;
Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (214851 => 214852)
--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2017-04-03 23:06:25 UTC (rev 214851)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2017-04-03 23:08:42 UTC (rev 214852)
@@ -2619,11 +2619,39 @@
return list;
}
+static bool isContentDistributionKeyword(CSSValueID id)
+{
+ return identMatches<CSSValueSpaceBetween, CSSValueSpaceAround, CSSValueSpaceEvenly, CSSValueStretch>(id);
+}
+
+static bool isContentPositionKeyword(CSSValueID id)
+{
+ return identMatches<CSSValueStart, CSSValueEnd, CSSValueCenter, CSSValueFlexStart, CSSValueFlexEnd, CSSValueLeft, CSSValueRight>(id);
+}
+
+static bool isOverflowKeyword(CSSValueID id)
+{
+ return CSSPropertyParserHelpers::identMatches<CSSValueUnsafe, CSSValueSafe>(id);
+}
+
static bool isBaselineKeyword(CSSValueID id)
{
return identMatches<CSSValueFirst, CSSValueLast, CSSValueBaseline>(id);
}
+static CSSValueID getBaselineKeyword(RefPtr<CSSValue> value)
+{
+ auto& primitiveValue = downcast<CSSPrimitiveValue>(*value);
+ if (auto* pairValue = primitiveValue.pairValue()) {
+ ASSERT(pairValue->second()->valueID() == CSSValueBaseline);
+ if (pairValue->first()->valueID() == CSSValueLast)
+ return CSSValueLastBaseline;
+ return CSSValueFirstBaseline;
+ }
+ ASSERT(primitiveValue.valueID() == CSSValueBaseline);
+ return CSSValueBaseline;
+}
+
static RefPtr<CSSValue> consumeBaselineKeyword(CSSParserTokenRange& range)
{
CSSValueID id = range.peek().id();
@@ -2648,15 +2676,7 @@
RefPtr<CSSValue> baseline = consumeBaselineKeyword(range);
if (!baseline)
return nullptr;
- CSSValueID baselineID = CSSValueBaseline;
- auto& primitiveValue = downcast<CSSPrimitiveValue>(*baseline);
- if (auto* pairValue = primitiveValue.pairValue()) {
- if (pairValue->first()->valueID() == CSSValueLast)
- baselineID = CSSValueLastBaseline;
- else
- baselineID = CSSValueFirstBaseline;
- }
- return CSSContentDistributionValue::create(CSSValueInvalid, baselineID, CSSValueInvalid);
+ return CSSContentDistributionValue::create(CSSValueInvalid, getBaselineKeyword(baseline), CSSValueInvalid);
}
CSSValueID distribution = CSSValueInvalid;
@@ -2664,15 +2684,15 @@
CSSValueID overflow = CSSValueInvalid;
do {
CSSValueID id = range.peek().id();
- if (identMatches<CSSValueSpaceBetween, CSSValueSpaceAround, CSSValueSpaceEvenly, CSSValueStretch>(id)) {
+ if (isContentDistributionKeyword(id)) {
if (distribution != CSSValueInvalid)
return nullptr;
distribution = id;
- } else if (identMatches<CSSValueStart, CSSValueEnd, CSSValueCenter, CSSValueFlexStart, CSSValueFlexEnd, CSSValueLeft, CSSValueRight>(id)) {
+ } else if (isContentPositionKeyword(id)) {
if (position != CSSValueInvalid)
return nullptr;
position = id;
- } else if (identMatches<CSSValueUnsafe, CSSValueSafe>(id)) {
+ } else if (isOverflowKeyword(id)) {
if (overflow != CSSValueInvalid)
return nullptr;
overflow = id;
@@ -5451,12 +5471,16 @@
static RefPtr<CSSValue> consumeSimplifiedContentPosition(CSSParserTokenRange& range)
{
CSSValueID id = range.peek().id();
- if (identMatches<CSSValueNormal, CSSValueBaseline, CSSValueLastBaseline>(id))
+ if (identMatches<CSSValueNormal>(id) || isContentPositionKeyword(id))
return CSSContentDistributionValue::create(CSSValueInvalid, range.consumeIncludingWhitespace().id(), CSSValueInvalid);
- if (identMatches<CSSValueSpaceBetween, CSSValueSpaceAround, CSSValueSpaceEvenly, CSSValueStretch>(id))
+ if (isBaselineKeyword(id)) {
+ RefPtr<CSSValue> baseline = consumeBaselineKeyword(range);
+ if (!baseline)
+ return nullptr;
+ return CSSContentDistributionValue::create(CSSValueInvalid, getBaselineKeyword(baseline.releaseNonNull()), CSSValueInvalid);
+ }
+ if (isContentDistributionKeyword(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;
}