Title: [285487] trunk
Revision
285487
Author
n...@apple.com
Date
2021-11-09 01:31:01 -0800 (Tue, 09 Nov 2021)

Log Message

Use isValidCustomIdentifier in consumeWillChange
https://bugs.webkit.org/show_bug.cgi?id=232868

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

Edit existing WPT to be more exaustive: https://github.com/web-platform-tests/wpt/pull/31556

* web-platform-tests/css/css-will-change/parsing/will-change-invalid.html:
* web-platform-tests/css/css-will-change/parsing/will-change-invalid-expected.txt:

Source/WebCore:

This bit specifically implements <custom-ident>, see:
https://drafts.csswg.org/css-will-change/#will-change

* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeWillChange):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (285486 => 285487)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-11-09 09:29:43 UTC (rev 285486)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-11-09 09:31:01 UTC (rev 285487)
@@ -1,3 +1,15 @@
+2021-11-09  Tim Nguyen  <n...@apple.com>
+
+        Use isValidCustomIdentifier in consumeWillChange
+        https://bugs.webkit.org/show_bug.cgi?id=232868
+
+        Reviewed by Antti Koivisto.
+
+        Edit existing WPT to be more exaustive: https://github.com/web-platform-tests/wpt/pull/31556
+
+        * web-platform-tests/css/css-will-change/parsing/will-change-invalid.html:
+        * web-platform-tests/css/css-will-change/parsing/will-change-invalid-expected.txt:
+
 2021-11-09  Antti Koivisto  <an...@apple.com>
 
         [CSS Cascade Layers] Support 'revert-layer' value

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-will-change/parsing/will-change-invalid-expected.txt (285486 => 285487)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-will-change/parsing/will-change-invalid-expected.txt	2021-11-09 09:29:43 UTC (rev 285486)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-will-change/parsing/will-change-invalid-expected.txt	2021-11-09 09:31:01 UTC (rev 285487)
@@ -4,10 +4,104 @@
 PASS e.style['will-change'] = "contents auto" should not set the property value
 PASS e.style['will-change'] = "contents, auto" should not set the property value
 PASS e.style['will-change'] = "transform, initial" should not set the property value
+PASS e.style['will-change'] = "initial, transform" should not set the property value
+PASS e.style['will-change'] = "initial, initial" should not set the property value
+PASS e.style['will-change'] = "initial, inherit" should not set the property value
+PASS e.style['will-change'] = "initial, unset" should not set the property value
+PASS e.style['will-change'] = "initial, revert" should not set the property value
+PASS e.style['will-change'] = "initial, revert-layer" should not set the property value
+PASS e.style['will-change'] = "initial, default" should not set the property value
+PASS e.style['will-change'] = "initial, will-change" should not set the property value
+PASS e.style['will-change'] = "initial, none" should not set the property value
+PASS e.style['will-change'] = "initial, all" should not set the property value
 PASS e.style['will-change'] = "transform, inherit" should not set the property value
+PASS e.style['will-change'] = "inherit, transform" should not set the property value
+PASS e.style['will-change'] = "inherit, initial" should not set the property value
+PASS e.style['will-change'] = "inherit, inherit" should not set the property value
+PASS e.style['will-change'] = "inherit, unset" should not set the property value
+PASS e.style['will-change'] = "inherit, revert" should not set the property value
+PASS e.style['will-change'] = "inherit, revert-layer" should not set the property value
+PASS e.style['will-change'] = "inherit, default" should not set the property value
+PASS e.style['will-change'] = "inherit, will-change" should not set the property value
+PASS e.style['will-change'] = "inherit, none" should not set the property value
+PASS e.style['will-change'] = "inherit, all" should not set the property value
 PASS e.style['will-change'] = "transform, unset" should not set the property value
+PASS e.style['will-change'] = "unset, transform" should not set the property value
+PASS e.style['will-change'] = "unset, initial" should not set the property value
+PASS e.style['will-change'] = "unset, inherit" should not set the property value
+PASS e.style['will-change'] = "unset, unset" should not set the property value
+PASS e.style['will-change'] = "unset, revert" should not set the property value
+PASS e.style['will-change'] = "unset, revert-layer" should not set the property value
+PASS e.style['will-change'] = "unset, default" should not set the property value
+PASS e.style['will-change'] = "unset, will-change" should not set the property value
+PASS e.style['will-change'] = "unset, none" should not set the property value
+PASS e.style['will-change'] = "unset, all" should not set the property value
 PASS e.style['will-change'] = "transform, revert" should not set the property value
+PASS e.style['will-change'] = "revert, transform" should not set the property value
+PASS e.style['will-change'] = "revert, initial" should not set the property value
+PASS e.style['will-change'] = "revert, inherit" should not set the property value
+PASS e.style['will-change'] = "revert, unset" should not set the property value
+PASS e.style['will-change'] = "revert, revert" should not set the property value
+PASS e.style['will-change'] = "revert, revert-layer" should not set the property value
+PASS e.style['will-change'] = "revert, default" should not set the property value
+PASS e.style['will-change'] = "revert, will-change" should not set the property value
+PASS e.style['will-change'] = "revert, none" should not set the property value
+PASS e.style['will-change'] = "revert, all" should not set the property value
+FAIL e.style['will-change'] = "transform, revert-layer" should not set the property value assert_equals: expected "" but got "transform, revert-layer"
+FAIL e.style['will-change'] = "revert-layer, transform" should not set the property value assert_equals: expected "" but got "revert-layer, transform"
+PASS e.style['will-change'] = "revert-layer, initial" should not set the property value
+PASS e.style['will-change'] = "revert-layer, inherit" should not set the property value
+PASS e.style['will-change'] = "revert-layer, unset" should not set the property value
+PASS e.style['will-change'] = "revert-layer, revert" should not set the property value
+FAIL e.style['will-change'] = "revert-layer, revert-layer" should not set the property value assert_equals: expected "" but got "revert-layer, revert-layer"
+PASS e.style['will-change'] = "revert-layer, default" should not set the property value
+PASS e.style['will-change'] = "revert-layer, will-change" should not set the property value
+PASS e.style['will-change'] = "revert-layer, none" should not set the property value
+PASS e.style['will-change'] = "revert-layer, all" should not set the property value
 PASS e.style['will-change'] = "transform, default" should not set the property value
+PASS e.style['will-change'] = "default, transform" should not set the property value
+PASS e.style['will-change'] = "default, initial" should not set the property value
+PASS e.style['will-change'] = "default, inherit" should not set the property value
+PASS e.style['will-change'] = "default, unset" should not set the property value
+PASS e.style['will-change'] = "default, revert" should not set the property value
+PASS e.style['will-change'] = "default, revert-layer" should not set the property value
+PASS e.style['will-change'] = "default, default" should not set the property value
+PASS e.style['will-change'] = "default, will-change" should not set the property value
+PASS e.style['will-change'] = "default, none" should not set the property value
+PASS e.style['will-change'] = "default, all" should not set the property value
+PASS e.style['will-change'] = "transform, will-change" should not set the property value
+PASS e.style['will-change'] = "will-change, transform" should not set the property value
+PASS e.style['will-change'] = "will-change, initial" should not set the property value
+PASS e.style['will-change'] = "will-change, inherit" should not set the property value
+PASS e.style['will-change'] = "will-change, unset" should not set the property value
+PASS e.style['will-change'] = "will-change, revert" should not set the property value
+PASS e.style['will-change'] = "will-change, revert-layer" should not set the property value
+PASS e.style['will-change'] = "will-change, default" should not set the property value
+PASS e.style['will-change'] = "will-change, will-change" should not set the property value
+PASS e.style['will-change'] = "will-change, none" should not set the property value
+PASS e.style['will-change'] = "will-change, all" should not set the property value
+PASS e.style['will-change'] = "transform, none" should not set the property value
+PASS e.style['will-change'] = "none, transform" should not set the property value
+PASS e.style['will-change'] = "none, initial" should not set the property value
+PASS e.style['will-change'] = "none, inherit" should not set the property value
+PASS e.style['will-change'] = "none, unset" should not set the property value
+PASS e.style['will-change'] = "none, revert" should not set the property value
+PASS e.style['will-change'] = "none, revert-layer" should not set the property value
+PASS e.style['will-change'] = "none, default" should not set the property value
+PASS e.style['will-change'] = "none, will-change" should not set the property value
+PASS e.style['will-change'] = "none, none" should not set the property value
+PASS e.style['will-change'] = "none, all" should not set the property value
+PASS e.style['will-change'] = "transform, all" should not set the property value
+PASS e.style['will-change'] = "all, transform" should not set the property value
+PASS e.style['will-change'] = "all, initial" should not set the property value
+PASS e.style['will-change'] = "all, inherit" should not set the property value
+PASS e.style['will-change'] = "all, unset" should not set the property value
+PASS e.style['will-change'] = "all, revert" should not set the property value
+PASS e.style['will-change'] = "all, revert-layer" should not set the property value
+PASS e.style['will-change'] = "all, default" should not set the property value
+PASS e.style['will-change'] = "all, will-change" should not set the property value
+PASS e.style['will-change'] = "all, none" should not set the property value
+PASS e.style['will-change'] = "all, all" should not set the property value
 PASS e.style['will-change'] = "will-change" should not set the property value
 PASS e.style['will-change'] = "none" should not set the property value
 PASS e.style['will-change'] = "all" should not set the property value

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-will-change/parsing/will-change-invalid.html (285486 => 285487)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-will-change/parsing/will-change-invalid.html	2021-11-09 09:29:43 UTC (rev 285486)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-will-change/parsing/will-change-invalid.html	2021-11-09 09:31:01 UTC (rev 285487)
@@ -17,15 +17,30 @@
 test_invalid_value("will-change", "contents auto");
 test_invalid_value("will-change", "contents, auto");
 
-// CSS-wide keywords are excluded from <custom-ident>
-// https://drafts.csswg.org/css-values-4/#identifier-value
-test_invalid_value("will-change", "transform, initial");
-test_invalid_value("will-change", "transform, inherit");
-test_invalid_value("will-change", "transform, unset");
-test_invalid_value("will-change", "transform, revert");
-test_invalid_value("will-change", "transform, default");
+let excludedKeywords = [
+  // CSS-wide keywords are excluded from <custom-ident>
+  // https://drafts.csswg.org/css-values-4/#identifier-value
+  "initial",
+  "inherit",
+  "unset",
+  "revert",
+  "revert-layer",
+  "default",
 
-// will-change additionally excludes the following from <custom-ident>
+  // will-change additionally excludes the following from <custom-ident>
+  "will-change",
+  "none",
+  "all",
+];
+
+for (let keyword of excludedKeywords) {
+  test_invalid_value("will-change", `transform, ${keyword}`);
+  test_invalid_value("will-change", `${keyword}, transform`);
+  for (let k of excludedKeywords) {
+    test_invalid_value("will-change", `${keyword}, ${k}`);
+  }
+}
+
 test_invalid_value("will-change", "will-change");
 test_invalid_value("will-change", "none");
 test_invalid_value("will-change", "all");

Modified: trunk/Source/WebCore/ChangeLog (285486 => 285487)


--- trunk/Source/WebCore/ChangeLog	2021-11-09 09:29:43 UTC (rev 285486)
+++ trunk/Source/WebCore/ChangeLog	2021-11-09 09:31:01 UTC (rev 285487)
@@ -1,3 +1,16 @@
+2021-11-09  Tim Nguyen  <n...@apple.com>
+
+        Use isValidCustomIdentifier in consumeWillChange
+        https://bugs.webkit.org/show_bug.cgi?id=232868
+
+        Reviewed by Antti Koivisto.
+
+        This bit specifically implements <custom-ident>, see:
+        https://drafts.csswg.org/css-will-change/#will-change
+
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeWillChange):
+
 2021-11-09  Antti Koivisto  <an...@apple.com>
 
         [CSS Cascade Layers] Support 'revert-layer' value

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (285486 => 285487)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2021-11-09 09:29:43 UTC (rev 285486)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2021-11-09 09:31:01 UTC (rev 285487)
@@ -500,13 +500,11 @@
             values->append(CSSValuePool::singleton().createIdentifierValue(propertyID));
             range.consumeIncludingWhitespace();
         } else {
-            switch (range.peek().id()) {
+            auto id = range.peek().id();
+            switch (id) {
             case CSSValueNone:
             case CSSValueAll:
             case CSSValueAuto:
-            case CSSValueDefault:
-            case CSSValueInitial:
-            case CSSValueInherit:
                 return nullptr;
             case CSSValueContents:
             case CSSValueScrollPosition:
@@ -513,6 +511,8 @@
                 values->append(consumeIdent(range).releaseNonNull());
                 break;
             default:
+                if (!isValidCustomIdentifier(id))
+                    return nullptr;
                 // Append properties we don't recognize, but that are legal, as strings.
                 values->append(consumeCustomIdent(range).releaseNonNull());
                 break;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to