From 948b8dee181da1bd431f91229f05e73e3b423490 Mon Sep 17 00:00:00 2001 From: Javier Fernandez Date: Mon, 29 Jan 2018 11:56:58 +0000 Subject: [PATCH] [css-align] justify-content doesn't allow values The CSS WG has resolved that it doesn't make sense to define Baseline Content-Alignment in the inline/main axis. https://github.com/w3c/csswg-drafts/issues/1184 The spec has been updated so that is not valid for the 'justify-content' property's syntax. This CL updates our parsing logic to match the new spec, including the parsing logic of the place-content shorthand. Additionally, this CL updates the computed value of the values to match other browsers. We don't implement support for values in the Content Distribution properties (align-content and justify-content), so I don't expect this change to break content of sites using the CSS Box Alignment feature. Bug: 802248, 803275 Change-Id: I0d3b1b7e7dd28552ee7e131bfe09ef7198565283 Reviewed-on: https://chromium-review.googlesource.com/882362 Reviewed-by: Darren Shen Commit-Queue: Javier Fernandez Cr-Commit-Position: refs/heads/master@{#532400} --- .../WebKit/LayoutTests/TestExpectations | 12 ----- .../parse-align-content-001.html | 8 +-- .../parse-align-content-003.html | 9 ++-- .../parse-justify-content-001.html | 7 +-- .../parse-justify-content-003.html | 8 ++- .../parse-justify-content-004.html | 2 +- .../place-content-shorthand-001.html | 4 +- .../place-content-shorthand-002.html | 4 +- .../place-content-shorthand-004.html | 9 +++- .../place-content-shorthand-006.html | 6 +-- .../parse-align-items-001.html | 8 +-- .../parse-align-items-003.html | 9 ++-- .../parse-justify-items-001.html | 8 +-- .../parse-justify-items-003.html | 9 ++-- .../place-items-shorthand-001.html | 2 +- .../place-items-shorthand-002.html | 2 +- .../place-items-shorthand-004.html | 2 +- .../place-items-shorthand-006.html | 4 +- .../resources/alignment-parsing-utils.js | 23 +++++---- .../self-alignment/parse-align-self-001.html | 8 +-- .../self-alignment/parse-align-self-003.html | 9 ++-- .../parse-justify-self-001.html | 9 ++-- .../parse-justify-self-003.html | 9 ++-- .../place-self-shorthand-001.html | 2 +- .../place-self-shorthand-002.html | 2 +- .../place-self-shorthand-004.html | 2 +- .../place-self-shorthand-006.html | 4 +- .../fast/alignment/parse-align-content.html | 8 +-- .../fast/alignment/parse-justify-content.html | 51 +++++++++---------- .../fast/alignment/parse-place-content.html | 39 ++++++++------ .../core/css/properties/CSSParsingUtils.cpp | 47 +++++++++-------- .../longhands/JustifyContentCustom.cpp | 5 ++ 32 files changed, 175 insertions(+), 156 deletions(-) diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index b69bfb7e428a9..fb8ab43393cd7 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations @@ -2358,18 +2358,6 @@ crbug.com/707359 [ Mac ] fast/css-grid-layout/grid-self-baseline-vertical-rl-05. # [css-align] crbug.com/726148 external/wpt/css/css-align/default-alignment/parse-justify-items-002.html [ Failure ] crbug.com/726147 external/wpt/css/css-align/default-alignment/parse-justify-items-004.html [ Failure ] -crbug.com/803275 external/wpt/css/css-align/default-alignment/parse-justify-items-001.html [ Failure ] -crbug.com/803275 external/wpt/css/css-align/default-alignment/parse-justify-items-003.html [ Failure ] -crbug.com/803275 external/wpt/css/css-align/default-alignment/parse-align-items-001.html [ Failure ] -crbug.com/803275 external/wpt/css/css-align/default-alignment/parse-align-items-003.html [ Failure ] -crbug.com/803275 external/wpt/css/css-align/self-alignment/parse-justify-self-001.html [ Failure ] -crbug.com/803275 external/wpt/css/css-align/self-alignment/parse-justify-self-003.html [ Failure ] -crbug.com/803275 external/wpt/css/css-align/self-alignment/parse-align-self-001.html [ Failure ] -crbug.com/803275 external/wpt/css/css-align/self-alignment/parse-align-self-003.html [ Failure ] -crbug.com/803275 external/wpt/css/css-align/content-distribution/parse-justify-content-001.html [ Failure ] -crbug.com/803275 external/wpt/css/css-align/content-distribution/parse-justify-content-003.html [ Failure ] -crbug.com/803275 external/wpt/css/css-align/content-distribution/parse-align-content-001.html [ Failure ] -crbug.com/803275 external/wpt/css/css-align/content-distribution/parse-align-content-003.html [ Failure ] # [selectors-4] crbug.com/706118 external/wpt/css/selectors/focus-within-004.html [ Failure ] diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-align-content-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-align-content-001.html index 15a5cda29f28e..c5cd4254f7078 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-align-content-001.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-align-content-001.html @@ -24,10 +24,10 @@ element.className = "alignContent" + key; document.body.appendChild(element); test(function() { - let computedValue = specifiedValue; - if (specifiedValue === "baseline") - computedValue = "first baseline"; - checkValues(element, "alignContent", "align-content", "", computedValue); + if (specifiedValue === "first baseline") + checkValues(element, "alignContent", "align-content", "", "baseline"); + else + checkValues(element, "alignContent", "align-content", "", specifiedValue); }, "Checking align-content: " + specifiedValue); } diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-align-content-003.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-align-content-003.html index 49978572146ee..b0da3588bf691 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-align-content-003.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-align-content-003.html @@ -23,11 +23,12 @@ for (var key in classes) { let specifiedValue = classes[key]; test(function() { + element.style.alignContent = ""; element.style.alignContent = specifiedValue; - let computedValue = specifiedValue; - if (specifiedValue === "baseline") - computedValue = "first baseline"; - checkValues(element, "alignContent", "align-content", specifiedValue, computedValue); + if (specifiedValue === "first baseline") + checkValues(element, "alignContent", "align-content", "baseline", "baseline"); + else + checkValues(element, "alignContent", "align-content", specifiedValue, specifiedValue); }, "Checking align-content: " + specifiedValue); } diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-justify-content-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-justify-content-001.html index f88c084cba627..df06ca920b1e6 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-justify-content-001.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-justify-content-001.html @@ -16,7 +16,7 @@
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-justify-content-003.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-justify-content-003.html index 03aa693a2d68e..0dea6e55f5c26 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-justify-content-003.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-justify-content-003.html @@ -18,16 +18,14 @@ document.body.appendChild(element); let classes = Object.assign({"Normal":"normal", "Left":"left", "Right":"right"}, contentPositionClasses, - distributionClasses, baselineClasses, overflowClasses); + distributionClasses, overflowClasses); for (var key in classes) { let specifiedValue = classes[key]; test(function() { + element.style.justifyContent = ""; element.style.justifyContent = specifiedValue; - let computedValue = specifiedValue; - if (specifiedValue === "baseline") - computedValue = "first baseline"; - checkValues(element, "justifyContent", "justify-content", specifiedValue, computedValue); + checkValues(element, "justifyContent", "justify-content", specifiedValue, specifiedValue); }, "Checking justify-content: " + specifiedValue); } diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-justify-content-004.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-justify-content-004.html index 6ba6f8b2383e4..22e78f84aed99 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-justify-content-004.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/parse-justify-content-004.html @@ -13,7 +13,7 @@ element = document.createElement("div"); document.body.appendChild(element); - let values = ["auto", "legacy", "self-start"].concat(invalidPositionValues, invalidDistributionValues); + let values = ["auto", "legacy", "self-start", "baseline", "first baseline", "last baseline"].concat(invalidPositionValues, invalidDistributionValues); values.forEach(function(value) { test(function() { diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/place-content-shorthand-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/place-content-shorthand-001.html index 6254e08a3bd63..153f6dd3d71ad 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/place-content-shorthand-001.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/content-distribution/place-content-shorthand-001.html @@ -5,10 +5,10 @@ - +
- +
- +
- +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/default-alignment/parse-align-items-003.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/default-alignment/parse-align-items-003.html index 03c49515df515..aa6b295dc2052 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/default-alignment/parse-align-items-003.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/default-alignment/parse-align-items-003.html @@ -22,11 +22,12 @@ for (var key in classes) { let specifiedValue = classes[key]; test(function() { + element.style.alignItems = ""; element.style.alignItems = specifiedValue; - let computedValue = specifiedValue; - if (specifiedValue === "baseline") - computedValue = "first baseline"; - checkValues(element, "alignItems", "align-items", specifiedValue, computedValue); + if (specifiedValue === "first baseline") + checkValues(element, "alignItems", "align-items", "baseline", "baseline"); + else + checkValues(element, "alignItems", "align-items", specifiedValue, specifiedValue); }, "Checking align-items: " + specifiedValue); } diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/default-alignment/parse-justify-items-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/default-alignment/parse-justify-items-001.html index e2ad078ca1bbd..aa4b147352eeb 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/default-alignment/parse-justify-items-001.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/default-alignment/parse-justify-items-001.html @@ -23,10 +23,10 @@ element.className = "justifyItems" + key; document.body.appendChild(element); test(function() { - let computedValue = specifiedValue; - if (specifiedValue === "baseline") - computedValue = "first baseline"; - checkValues(element, "justifyItems", "justify-items", "", computedValue); + if (specifiedValue === "first baseline") + checkValues(element, "justifyItems", "justify-items", "", "baseline"); + else + checkValues(element, "justifyItems", "justify-items", "", specifiedValue); }, "Checking justify-items: " + specifiedValue); } diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/default-alignment/parse-justify-items-003.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/default-alignment/parse-justify-items-003.html index fb8a067ce3998..9ab5ee3099a6f 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/default-alignment/parse-justify-items-003.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/default-alignment/parse-justify-items-003.html @@ -22,11 +22,12 @@ for (var key in classes) { let specifiedValue = classes[key]; test(function() { + element.style.justifyItems = ""; element.style.justifyItems = specifiedValue; - let computedValue = specifiedValue; - if (specifiedValue === "baseline") - computedValue = "first baseline"; - checkValues(element, "justifyItems", "justify-items", specifiedValue, computedValue); + if (specifiedValue === "first baseline") + checkValues(element, "justifyItems", "justify-items", "baseline", "baseline"); + else + checkValues(element, "justifyItems", "justify-items", specifiedValue, specifiedValue); }, "Checking justify-items: " + specifiedValue); } diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/default-alignment/place-items-shorthand-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/default-alignment/place-items-shorthand-001.html index 928149a0721a9..c67ca9cbaf2cf 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/default-alignment/place-items-shorthand-001.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/default-alignment/place-items-shorthand-001.html @@ -5,7 +5,7 @@ - +
- +
- +
- +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/self-alignment/parse-align-self-003.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/self-alignment/parse-align-self-003.html index 19c89266df2cd..a2f3351fe2a5d 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/self-alignment/parse-align-self-003.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/self-alignment/parse-align-self-003.html @@ -22,11 +22,12 @@ for (var key in classes) { let specifiedValue = classes[key]; test(function() { + element.style.alignSelf = ""; element.style.alignSelf = specifiedValue; - let computedValue = specifiedValue; - if (specifiedValue === "baseline") - computedValue = "first baseline"; - checkValues(element, "alignSelf", "align-self", specifiedValue, computedValue); + if (specifiedValue === "first baseline") + checkValues(element, "alignSelf", "align-self", "baseline", "baseline"); + else + checkValues(element, "alignSelf", "align-self", specifiedValue, specifiedValue); }, "Checking align-self: " + specifiedValue); } diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/self-alignment/parse-justify-self-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/self-alignment/parse-justify-self-001.html index da5f28f26b2a2..4b321d598582b 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/self-alignment/parse-justify-self-001.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/self-alignment/parse-justify-self-001.html @@ -23,10 +23,11 @@ element.className = "justifySelf" + key; document.body.appendChild(element); test(function() { - let computedValue = specifiedValue; - if (specifiedValue === "baseline") - computedValue = "first baseline"; - checkValues(element, "justifySelf", "justify-self", "", computedValue); + let value = specifiedValue; + if (specifiedValue === "first baseline") + checkValues(element, "justifySelf", "justify-self", "", "baseline"); + else + checkValues(element, "justifySelf", "justify-self", "", value); }, "Checking justify-self: " + specifiedValue); } diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/self-alignment/parse-justify-self-003.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/self-alignment/parse-justify-self-003.html index a7131ef57713e..96729166f15a7 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/self-alignment/parse-justify-self-003.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/self-alignment/parse-justify-self-003.html @@ -22,11 +22,12 @@ for (var key in classes) { let specifiedValue = classes[key]; test(function() { + element.style.justifySelf = ""; element.style.justifySelf = specifiedValue; - let computedValue = specifiedValue; - if (specifiedValue === "baseline") - computedValue = "first baseline"; - checkValues(element, "justifySelf", "justify-self", specifiedValue, computedValue); + if (specifiedValue === "first baseline") + checkValues(element, "justifySelf", "justify-self", "baseline", "baseline"); + else + checkValues(element, "justifySelf", "justify-self", specifiedValue, specifiedValue); }, "Checking justify-self: " + specifiedValue); } diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/self-alignment/place-self-shorthand-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/self-alignment/place-self-shorthand-001.html index 8cc3a336b43aa..d26df054d3585 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-align/self-alignment/place-self-shorthand-001.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-align/self-alignment/place-self-shorthand-001.html @@ -5,7 +5,7 @@ - +
- +
- +
- +
@@ -65,7 +68,6 @@
-
@@ -73,7 +75,7 @@
-
+
@@ -82,6 +84,8 @@
+
+