Title: [124233] trunk
Revision
124233
Author
commit-qu...@webkit.org
Date
2012-07-31 12:04:04 -0700 (Tue, 31 Jul 2012)

Log Message

[CSS Shaders] CSS parser rejects parameter names that are also CSS keywords
https://bugs.webkit.org/show_bug.cgi?id=92537

Patch by Max Vujovic <mvujo...@adobe.com> on 2012-07-31
Reviewed by Dirk Schulze.

Source/WebCore:

Remove the CSS keyword check for CSS Shaders parameter names. Parameters are allowed to be
any valid CSS identifier, including CSS keywords. See the spec:
https://dvcs.w3.org/hg/FXTF/raw-file/tip/custom/index.html#feCustom

The CSS parser was rejecting input like the following because it uses a CSS keyword
"background" as a parameter name:
-webkit-filter: custom(none url(fragment.shader), background 0 1 0 1);

Test: css3/filters/custom/custom-filter-css-keyword-as-parameter-name.html

* css/CSSParser.cpp:
(WebCore::CSSParser::parseCustomFilter): Do not return early when the parameter name is a
CSS keyword (i.e. when the CSSParserValue has a non-zero id).

LayoutTests:

Add a pixel test that uses the CSS keyword "background" as a CSS Shaders parameter name.
Add a parsing test case that uses the CSS keyword "background".

* css3/filters/custom/custom-filter-css-keyword-as-parameter-name-expected.png: Added.
* css3/filters/custom/custom-filter-css-keyword-as-parameter-name-expected.txt: Added.
* css3/filters/custom/custom-filter-css-keyword-as-parameter-name.html: Added.
* css3/filters/custom/custom-filter-property-parsing-expected.txt:
* css3/filters/resources/css-keyword-as-parameter-name.fs: Added.
* css3/filters/script-tests/custom-filter-property-parsing.js:
* platform/chromium/TestExpectations:
* platform/chromium/css3/filters/custom/custom-filter-property-parsing-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (124232 => 124233)


--- trunk/LayoutTests/ChangeLog	2012-07-31 19:01:46 UTC (rev 124232)
+++ trunk/LayoutTests/ChangeLog	2012-07-31 19:04:04 UTC (rev 124233)
@@ -1,3 +1,22 @@
+2012-07-31  Max Vujovic  <mvujo...@adobe.com>
+
+        [CSS Shaders] CSS parser rejects parameter names that are also CSS keywords
+        https://bugs.webkit.org/show_bug.cgi?id=92537
+
+        Reviewed by Dirk Schulze.
+
+        Add a pixel test that uses the CSS keyword "background" as a CSS Shaders parameter name.
+        Add a parsing test case that uses the CSS keyword "background".
+
+        * css3/filters/custom/custom-filter-css-keyword-as-parameter-name-expected.png: Added.
+        * css3/filters/custom/custom-filter-css-keyword-as-parameter-name-expected.txt: Added.
+        * css3/filters/custom/custom-filter-css-keyword-as-parameter-name.html: Added.
+        * css3/filters/custom/custom-filter-property-parsing-expected.txt:
+        * css3/filters/resources/css-keyword-as-parameter-name.fs: Added.
+        * css3/filters/script-tests/custom-filter-property-parsing.js:
+        * platform/chromium/TestExpectations:
+        * platform/chromium/css3/filters/custom/custom-filter-property-parsing-expected.txt:
+
 2012-07-31  Pravin D  <pravind....@gmail.com>
 
         Caret position is wrong when a editable container has word-wrap:normal set

Added: trunk/LayoutTests/css3/filters/custom/custom-filter-css-keyword-as-parameter-name-expected.png (0 => 124233)


--- trunk/LayoutTests/css3/filters/custom/custom-filter-css-keyword-as-parameter-name-expected.png	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/custom/custom-filter-css-keyword-as-parameter-name-expected.png	2012-07-31 19:04:04 UTC (rev 124233)
@@ -0,0 +1,4 @@
+\x89PNG
+
+
+IHDR X\x9Av\x82p)tEXtchecksum621245da03ce748d59755f38be0acc75\x8C\x9E\x88IDATx\x9C\xEDٱ\xC2@\xC1\x85A\xE4y\xE0\x9DB\x851o\xA8\xDB>cݩ;ff@\xE0\xB1{p\xC8 #@\x80\x8C2\xC8 \xF3\xBC:x\xAFW\xB1\x83}\xD6w\xF7\xF8\x9B\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 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x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2Ȝ\xBD\x99\xA9\xB1\xD2\xF7\x9CIEND\xAEB`\x82
\ No newline at end of file

Added: trunk/LayoutTests/css3/filters/custom/custom-filter-css-keyword-as-parameter-name-expected.txt (0 => 124233)


--- trunk/LayoutTests/css3/filters/custom/custom-filter-css-keyword-as-parameter-name-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/custom/custom-filter-css-keyword-as-parameter-name-expected.txt	2012-07-31 19:04:04 UTC (rev 124233)
@@ -0,0 +1 @@
+

Added: trunk/LayoutTests/css3/filters/custom/custom-filter-css-keyword-as-parameter-name.html (0 => 124233)


--- trunk/LayoutTests/css3/filters/custom/custom-filter-css-keyword-as-parameter-name.html	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/custom/custom-filter-css-keyword-as-parameter-name.html	2012-07-31 19:04:04 UTC (rev 124233)
@@ -0,0 +1,26 @@
+<!doctype html>
+<html>
+<head>
+    <title>Tests that a CSS keyword can be a parameter name.</title>
+    <script>
+        if (window.testRunner) {
+            window.testRunner.overridePreference("WebKitCSSCustomFilterEnabled", "1");
+            window.testRunner.overridePreference("WebKitWebGLEnabled", "1");
+            window.testRunner.dumpAsText(true);
+        }
+    </script>
+    <style>
+    /* Tests that the CSS keyword "background" can be a parameter name. */
+    .shaded {
+        width: 100px;
+        height: 100px;
+        /* The shader should replace the div's red background with green. */
+        background-color: red;
+        -webkit-filter: custom(none url('../resources/css-keyword-as-parameter-name.fs'), background 0 1 0 1);
+    }
+    </style>
+</head>
+<body>
+    <div class="shaded"></div>
+</body>
+</html>

Modified: trunk/LayoutTests/css3/filters/custom/custom-filter-property-parsing-expected.txt (124232 => 124233)


--- trunk/LayoutTests/css3/filters/custom/custom-filter-property-parsing-expected.txt	2012-07-31 19:01:46 UTC (rev 124232)
+++ trunk/LayoutTests/css3/filters/custom/custom-filter-property-parsing-expected.txt	2012-07-31 19:04:04 UTC (rev 124233)
@@ -103,6 +103,17 @@
 PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM
 PASS removeBaseURL(subRule.cssText) is 'custom(none url(fragment.shader), p1 1.1, p2 2.2 3.3, p3 3.1 4.1 5.1, p4 4.1 5.2 6.3 7.4)'
 
+Custom with parameter name same as CSS value keyword : custom(none url(fragment.shader), background 0 1 0 1)
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS removeBaseURL(declaration.getPropertyValue('-webkit-filter')) is 'custom(none url(fragment.shader), background 0 1 0 1)'
+PASS jsWrapperClass(filterRule) is 'CSSValueList'
+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype'
+PASS jsWrapperClass(filterRule.constructor) is 'CSSValueListConstructor'
+PASS filterRule.length is 1
+PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM
+PASS removeBaseURL(subRule.cssText) is 'custom(none url(fragment.shader), background 0 1 0 1)'
+
 Custom with mesh size and number parameters : custom(none url(fragment.shader), 10 20, p1 1, p2 2 3, p3 3 4 5, p4 4 5 6 7)
 PASS cssRule.type is 1
 PASS declaration.length is 1

Added: trunk/LayoutTests/css3/filters/resources/css-keyword-as-parameter-name.fs (0 => 124233)


--- trunk/LayoutTests/css3/filters/resources/css-keyword-as-parameter-name.fs	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/resources/css-keyword-as-parameter-name.fs	2012-07-31 19:04:04 UTC (rev 124233)
@@ -0,0 +1,8 @@
+precision mediump float;
+
+uniform vec4 background;
+
+void main()
+{
+    gl_FragColor = background;
+}

Modified: trunk/LayoutTests/css3/filters/script-tests/custom-filter-property-parsing.js (124232 => 124233)


--- trunk/LayoutTests/css3/filters/script-tests/custom-filter-property-parsing.js	2012-07-31 19:01:46 UTC (rev 124232)
+++ trunk/LayoutTests/css3/filters/script-tests/custom-filter-property-parsing.js	2012-07-31 19:04:04 UTC (rev 124233)
@@ -101,6 +101,9 @@
             "custom(none url(fragment.shader), p1 1.1, p2 2.2 3.3, p3 3.1 4.1 5.1, p4 4.1 5.2 6.3 7.4)",
             "custom(none url(fragment.shader), p1 1.1, p2 2.2 3.3, p3 3.1 4.1 5.1, p4 4.1 5.2 6.3 7.4)");
 
+testFilterRule("Custom with parameter name same as CSS value keyword",
+            "custom(none url(fragment.shader), background 0 1 0 1)",
+            "custom(none url(fragment.shader), background 0 1 0 1)");
 
 testFilterRule("Custom with mesh size and number parameters",
             "custom(none url(fragment.shader), 10 20, p1 1, p2 2 3, p3 3 4 5, p4 4 5 6 7)",

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (124232 => 124233)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-07-31 19:01:46 UTC (rev 124232)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-07-31 19:04:04 UTC (rev 124233)
@@ -2624,6 +2624,7 @@
 BUGWK84800 WIN LINUX : css3/filters/custom/filter-repaint-custom-rotated.html = PASS IMAGE IMAGE+TEXT TEXT MISSING
 BUGWK84800 WIN LINUX : css3/filters/custom/filter-repaint-custom.html = PASS IMAGE IMAGE+TEXT TEXT MISSING
 BUGWK84800 WIN LINUX : css3/filters/custom/effect-color-check.html = PASS IMAGE IMAGE+TEXT TEXT MISSING
+BUGWK92537 WIN LINUX : css3/filters/custom/custom-filter-css-keyword-as-parameter-name.html = PASS IMAGE IMAGE+TEXT TEXT MISSING
 
 // CSS Regions tests for region styling and scoped styles
 BUGWK49142 : fast/regions/style-scoped-in-flow-override-container-style.html = PASS IMAGE IMAGE+TEXT TEXT MISSING

Modified: trunk/LayoutTests/platform/chromium/css3/filters/custom/custom-filter-property-parsing-expected.txt (124232 => 124233)


--- trunk/LayoutTests/platform/chromium/css3/filters/custom/custom-filter-property-parsing-expected.txt	2012-07-31 19:01:46 UTC (rev 124232)
+++ trunk/LayoutTests/platform/chromium/css3/filters/custom/custom-filter-property-parsing-expected.txt	2012-07-31 19:04:04 UTC (rev 124233)
@@ -103,6 +103,17 @@
 PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM
 PASS removeBaseURL(subRule.cssText) is 'custom(none url(fragment.shader), p1 1.1, p2 2.2 3.3, p3 3.1 4.1 5.1, p4 4.1 5.2 6.3 7.4)'
 
+Custom with parameter name same as CSS value keyword : custom(none url(fragment.shader), background 0 1 0 1)
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS removeBaseURL(declaration.getPropertyValue('-webkit-filter')) is 'custom(none url(fragment.shader), background 0 1 0 1)'
+PASS jsWrapperClass(filterRule) is 'CSSValueList'
+FAIL jsWrapperClass(filterRule.__proto__) should be CSSValueListPrototype. Was Object.
+FAIL jsWrapperClass(filterRule.constructor) should be CSSValueListConstructor. Was Function.
+PASS filterRule.length is 1
+PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM
+PASS removeBaseURL(subRule.cssText) is 'custom(none url(fragment.shader), background 0 1 0 1)'
+
 Custom with mesh size and number parameters : custom(none url(fragment.shader), 10 20, p1 1, p2 2 3, p3 3 4 5, p4 4 5 6 7)
 PASS cssRule.type is 1
 PASS declaration.length is 1

Modified: trunk/Source/WebCore/ChangeLog (124232 => 124233)


--- trunk/Source/WebCore/ChangeLog	2012-07-31 19:01:46 UTC (rev 124232)
+++ trunk/Source/WebCore/ChangeLog	2012-07-31 19:04:04 UTC (rev 124233)
@@ -1,3 +1,24 @@
+2012-07-31  Max Vujovic  <mvujo...@adobe.com>
+
+        [CSS Shaders] CSS parser rejects parameter names that are also CSS keywords
+        https://bugs.webkit.org/show_bug.cgi?id=92537
+
+        Reviewed by Dirk Schulze.
+
+        Remove the CSS keyword check for CSS Shaders parameter names. Parameters are allowed to be
+        any valid CSS identifier, including CSS keywords. See the spec:
+        https://dvcs.w3.org/hg/FXTF/raw-file/tip/custom/index.html#feCustom
+
+        The CSS parser was rejecting input like the following because it uses a CSS keyword
+        "background" as a parameter name:
+        -webkit-filter: custom(none url(fragment.shader), background 0 1 0 1);
+
+        Test: css3/filters/custom/custom-filter-css-keyword-as-parameter-name.html
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseCustomFilter): Do not return early when the parameter name is a
+        CSS keyword (i.e. when the CSSParserValue has a non-zero id).
+
 2012-07-31  Pravin D  <pravind....@gmail.com>
 
         Caret position is wrong when a editable container has word-wrap:normal set

Modified: trunk/Source/WebCore/css/CSSParser.cpp (124232 => 124233)


--- trunk/Source/WebCore/css/CSSParser.cpp	2012-07-31 19:01:46 UTC (rev 124232)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2012-07-31 19:04:04 UTC (rev 124233)
@@ -7448,7 +7448,7 @@
     RefPtr<CSSValueList> paramList = CSSValueList::createCommaSeparated();
     
     while ((arg = argsList->current())) {
-        if (arg->id || arg->unit != CSSPrimitiveValue::CSS_IDENT)
+        if (arg->unit != CSSPrimitiveValue::CSS_IDENT)
             return 0;
 
         RefPtr<CSSValueList> parameter = CSSValueList::createSpaceSeparated();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to