Title: [148205] trunk
Revision
148205
Author
[email protected]
Date
2013-04-11 08:55:25 -0700 (Thu, 11 Apr 2013)

Log Message

[CSS Shaders] Parse mix descriptor
https://bugs.webkit.org/show_bug.cgi?id=114414

Reviewed by Antti Koivisto.

Source/WebCore:

Add support for the 'mix' descriptor in the filter at-rule to support blend modes
and composite operators in CSS Shaders.
Each pixel in the fragment shader will be blended and composited with the
backdrop by taking these values into account.

https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#custom-filter-mix

Tests: css3/filters/custom-with-at-rule-syntax/parsing-mix-property-invalid.html
       css3/filters/custom-with-at-rule-syntax/parsing-mix-property-valid.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* css/CSSParser.cpp: Added 'mix' property and fail parsing if not inside
    of an @filter rule.
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseFilterRuleMix): New helper function to verify
    values.
(WebCore):
* css/CSSParser.h:
* css/CSSProperty.cpp:
(WebCore::CSSProperty::isInheritedProperty):
* css/CSSPropertyNames.in: Added new property name 'mix'.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty):

LayoutTests:

Tests for the 'mix' descriptor on @filter rule.

* css3/filters/custom-with-at-rule-syntax/parsing-mix-property-invalid-expected.txt: Added.
* css3/filters/custom-with-at-rule-syntax/parsing-mix-property-invalid.html: Added.
* css3/filters/custom-with-at-rule-syntax/parsing-mix-property-valid-expected.txt: Added.
* css3/filters/custom-with-at-rule-syntax/parsing-mix-property-valid.html: Added.
* css3/filters/custom-with-at-rule-syntax/script-tests/parsing-mix-property-invalid.js: Added.
(testInvalidMixProperty):
* css3/filters/custom-with-at-rule-syntax/script-tests/parsing-mix-property-valid.js: Added.
(testMixProperty):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (148204 => 148205)


--- trunk/LayoutTests/ChangeLog	2013-04-11 15:09:53 UTC (rev 148204)
+++ trunk/LayoutTests/ChangeLog	2013-04-11 15:55:25 UTC (rev 148205)
@@ -1,3 +1,21 @@
+2013-04-11  Dirk Schulze  <[email protected]>
+
+        [CSS Shaders] Parse mix descriptor
+        https://bugs.webkit.org/show_bug.cgi?id=114414
+
+        Reviewed by Antti Koivisto.
+
+        Tests for the 'mix' descriptor on @filter rule.
+
+        * css3/filters/custom-with-at-rule-syntax/parsing-mix-property-invalid-expected.txt: Added.
+        * css3/filters/custom-with-at-rule-syntax/parsing-mix-property-invalid.html: Added.
+        * css3/filters/custom-with-at-rule-syntax/parsing-mix-property-valid-expected.txt: Added.
+        * css3/filters/custom-with-at-rule-syntax/parsing-mix-property-valid.html: Added.
+        * css3/filters/custom-with-at-rule-syntax/script-tests/parsing-mix-property-invalid.js: Added.
+        (testInvalidMixProperty):
+        * css3/filters/custom-with-at-rule-syntax/script-tests/parsing-mix-property-valid.js: Added.
+        (testMixProperty):
+
 2013-04-11  Zalan Bujtas  <[email protected]>
 
         Parent box with background-size auto and gradient image does not get properly repainted when child box is resized. 

Added: trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/parsing-mix-property-invalid-expected.txt (0 => 148205)


--- trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/parsing-mix-property-invalid-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/parsing-mix-property-invalid-expected.txt	2013-04-11 15:55:25 UTC (rev 148205)
@@ -0,0 +1,55 @@
+Test mix property parsing in the @-webkit-filter at-rule.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+========================================
+Value test.
+========================================
+
+No property value.
+mix: ;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 0
+PASS styleDeclaration.getPropertyValue('mix') is null
+
+Three values.
+mix: screen source-over screen;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 0
+PASS styleDeclaration.getPropertyValue('mix') is null
+
+Three values.
+mix: screen source-over source-over;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 0
+PASS styleDeclaration.getPropertyValue('mix') is null
+
+Two blend modes.
+mix: screen screen;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 0
+PASS styleDeclaration.getPropertyValue('mix') is null
+
+Two composite operators.
+mix: source-over source-over;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 0
+PASS styleDeclaration.getPropertyValue('mix') is null
+
+Two blend modes.
+mix: screen screen;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 0
+PASS styleDeclaration.getPropertyValue('mix') is null
+
+Comma between values.
+mix: screen, source-over;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 0
+PASS styleDeclaration.getPropertyValue('mix') is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/parsing-mix-property-invalid.html (0 => 148205)


--- trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/parsing-mix-property-invalid.html	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/parsing-mix-property-invalid.html	2013-04-11 15:55:25 UTC (rev 148205)
@@ -0,0 +1,14 @@
+<!doctype html>
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+<script src=""
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/parsing-mix-property-valid-expected.txt (0 => 148205)


--- trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/parsing-mix-property-valid-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/parsing-mix-property-valid-expected.txt	2013-04-11 15:55:25 UTC (rev 148205)
@@ -0,0 +1,393 @@
+Test mix property parsing in the @-webkit-filter at-rule.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+========================================
+Test blend mode keywords.
+========================================
+
+Test multiply.
+mix: multiply;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "multiply"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "multiply"
+
+Test screen.
+mix: screen;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "screen"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "screen"
+
+Test overlay.
+mix: overlay;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "overlay"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "overlay"
+
+Test darken.
+mix: darken;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "darken"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "darken"
+
+Test lighten.
+mix: lighten;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "lighten"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "lighten"
+
+Test color-dodge.
+mix: color-dodge;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "color-dodge"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "color-dodge"
+
+Test color-burn.
+mix: color-burn;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "color-burn"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "color-burn"
+
+Test hard-light.
+mix: hard-light;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "hard-light"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "hard-light"
+
+Test soft-light.
+mix: soft-light;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "soft-light"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "soft-light"
+
+Test difference.
+mix: difference;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "difference"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "difference"
+
+Test exclusion.
+mix: exclusion;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "exclusion"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "exclusion"
+
+Test hue.
+mix: hue;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "hue"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "hue"
+
+Test saturation.
+mix: saturation;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "saturation"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "saturation"
+
+Test color.
+mix: color;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "color"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "color"
+
+Test luminosity.
+mix: luminosity;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "luminosity"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "luminosity"
+
+========================================
+Test composite keywords.
+========================================
+
+Test clear.
+mix: clear;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "clear"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "clear"
+
+Test copy.
+mix: copy;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "copy"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "copy"
+
+Test source-over.
+mix: source-over;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "source-over"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "source-over"
+
+Test source-in.
+mix: source-in;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "source-in"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "source-in"
+
+Test source-out.
+mix: source-out;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "source-out"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "source-out"
+
+Test source-atop.
+mix: source-atop;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "source-atop"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "source-atop"
+
+Test destination-over.
+mix: destination-over;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "destination-over"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "destination-over"
+
+Test destination-in.
+mix: destination-in;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "destination-in"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "destination-in"
+
+Test destination-out.
+mix: destination-out;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "destination-out"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "destination-out"
+
+Test destination-atop.
+mix: destination-atop;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "destination-atop"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "destination-atop"
+
+Test xor.
+mix: xor;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "xor"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 1
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "xor"
+
+Blend mode and composite together.
+mix: screen source-over;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "screen source-over"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 2
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "screen"
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "source-over"
+
+Composite and blend mode together.
+mix: source-over screen;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "source-over screen"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 2
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "source-over"
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "screen"
+
+========================================
+Capitalization tests.
+========================================
+
+All tokens capitalized.
+mix: SCREEN SOURCE-OVER;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "screen source-over"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 2
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "screen"
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "source-over"
+
+========================================
+Whitespace tests.
+========================================
+
+Extra leading, middle, and trailing whitespace. 
+mix:    screen   source-over   ;
+PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE
+PASS styleDeclaration.length is 1
+PASS removeBaseURL(styleDeclaration.getPropertyValue('mix')) is "screen source-over"
+PASS mixPropertyValue instanceof CSSValueList is true
+PASS mixPropertyValue.constructor === CSSValueList is true
+PASS mixPropertyValue.__proto__ === CSSValueList.prototype is true
+PASS mixPropertyValue.length is 2
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "screen"
+PASS subValue.cssValueType is CSSValue.CSS_PRIMITIVE_VALUE
+PASS removeBaseURL(subValue.cssText) is "source-over"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/parsing-mix-property-valid.html (0 => 148205)


--- trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/parsing-mix-property-valid.html	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/parsing-mix-property-valid.html	2013-04-11 15:55:25 UTC (rev 148205)
@@ -0,0 +1,14 @@
+<!doctype html>
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+<script src=""
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/script-tests/parsing-mix-property-invalid.js (0 => 148205)


--- trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/script-tests/parsing-mix-property-invalid.js	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/script-tests/parsing-mix-property-invalid.js	2013-04-11 15:55:25 UTC (rev 148205)
@@ -0,0 +1,30 @@
+// Requires custom-filter-parsing-common.js.
+
+description("Test mix property parsing in the @-webkit-filter at-rule.");
+
+// These have to be global for the test helpers to see them.
+var filterAtRule, styleDeclaration;
+
+function testInvalidMixProperty(description, propertyValue)
+{
+    var mixProperty = "mix: " + propertyValue + ";";
+    debug("\n" + description + "\n" + mixProperty);
+
+    stylesheet.insertRule("@-webkit-filter my-filter { " + mixProperty + " }", 0);
+
+    filterAtRule = stylesheet.cssRules.item(0);
+    shouldBe("filterAtRule.type", "CSSRule.WEBKIT_FILTER_RULE");
+
+    styleDeclaration = filterAtRule.style;
+    shouldBe("styleDeclaration.length", "0");
+    shouldBe("styleDeclaration.getPropertyValue('mix')", "null");
+}
+
+heading("Value test.");
+testInvalidMixProperty("No property value.", "");
+testInvalidMixProperty("Three values.", "screen source-over screen");
+testInvalidMixProperty("Three values.", "screen source-over source-over");
+testInvalidMixProperty("Two blend modes.", "screen screen");
+testInvalidMixProperty("Two composite operators.", "source-over source-over");
+testInvalidMixProperty("Two blend modes.", "screen screen");
+testInvalidMixProperty("Comma between values.", "screen, source-over");

Added: trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/script-tests/parsing-mix-property-valid.js (0 => 148205)


--- trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/script-tests/parsing-mix-property-valid.js	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/script-tests/parsing-mix-property-valid.js	2013-04-11 15:55:25 UTC (rev 148205)
@@ -0,0 +1,85 @@
+// Requires custom-filter-parsing-common.js.
+
+description("Test mix property parsing in the @-webkit-filter at-rule.");
+
+// These have to be global for the test helpers to see them.
+var filterAtRule, styleDeclaration, mixPropertyValue, subValue;
+
+function testMixProperty(description, propertyValue, expectedValue, expectedTexts)
+{
+    var mixProperty = "mix: " + propertyValue + ";"
+    debug("\n" + description + "\n" + mixProperty);
+
+    stylesheet.insertRule("@-webkit-filter my-filter { " + mixProperty + " }", 0);
+    filterAtRule = stylesheet.cssRules.item(0);
+    shouldBe("filterAtRule.type", "CSSRule.WEBKIT_FILTER_RULE");
+
+    styleDeclaration = filterAtRule.style;
+    shouldBe("styleDeclaration.length", "1");
+    shouldBe("removeBaseURL(styleDeclaration.getPropertyValue('mix'))", "\"" + expectedValue + "\"");
+
+    mixPropertyValue = styleDeclaration.getPropertyCSSValue('mix');
+    shouldHaveConstructor("mixPropertyValue", "CSSValueList");
+
+    shouldBe("mixPropertyValue.length", expectedTexts.length.toString()); // shouldBe expects string arguments
+  
+    if (mixPropertyValue) {
+        for (var i = 0; i < expectedTexts.length; i++) {
+            subValue = mixPropertyValue[i];
+            shouldBe("subValue.cssValueType", "CSSValue.CSS_PRIMITIVE_VALUE");
+            shouldBe("removeBaseURL(subValue.cssText)", "\"" + expectedTexts[i] + "\"");
+        }
+    }
+}
+
+heading("Test blend mode keywords.");
+testMixProperty("Test multiply.", "multiply", "multiply", ["multiply"]);
+testMixProperty("Test screen.", "screen", "screen", ["screen"]);
+testMixProperty("Test overlay.", "overlay", "overlay", ["overlay"]);
+testMixProperty("Test darken.", "darken", "darken", ["darken"]);
+testMixProperty("Test lighten.", "lighten", "lighten", ["lighten"]);
+testMixProperty("Test color-dodge.", "color-dodge", "color-dodge", ["color-dodge"]);
+testMixProperty("Test color-burn.", "color-burn", "color-burn", ["color-burn"]);
+testMixProperty("Test hard-light.", "hard-light", "hard-light", ["hard-light"]);
+testMixProperty("Test soft-light.", "soft-light", "soft-light", ["soft-light"]);
+testMixProperty("Test difference.", "difference", "difference", ["difference"]);
+testMixProperty("Test exclusion.", "exclusion", "exclusion", ["exclusion"]);
+testMixProperty("Test hue.", "hue", "hue", ["hue"]);
+testMixProperty("Test saturation.", "saturation", "saturation", ["saturation"]);
+testMixProperty("Test color.", "color", "color", ["color"]);
+testMixProperty("Test luminosity.", "luminosity", "luminosity", ["luminosity"]);
+
+heading("Test composite keywords.");
+testMixProperty("Test clear.", "clear", "clear", ["clear"]);
+testMixProperty("Test copy.", "copy", "copy", ["copy"]);
+testMixProperty("Test source-over.", "source-over", "source-over", ["source-over"]);
+testMixProperty("Test source-in.", "source-in", "source-in", ["source-in"]);
+testMixProperty("Test source-out.", "source-out", "source-out", ["source-out"]);
+testMixProperty("Test source-atop.", "source-atop", "source-atop", ["source-atop"]);
+testMixProperty("Test destination-over.", "destination-over", "destination-over", ["destination-over"]);
+testMixProperty("Test destination-in.", "destination-in", "destination-in", ["destination-in"]);
+testMixProperty("Test destination-out.", "destination-out", "destination-out", ["destination-out"]);
+testMixProperty("Test destination-atop.", "destination-atop", "destination-atop", ["destination-atop"]);
+testMixProperty("Test xor.", "xor", "xor", ["xor"]);
+
+testMixProperty("Blend mode and composite together.",
+    "screen source-over",
+    "screen source-over",
+    ["screen", "source-over"]);
+
+testMixProperty("Composite and blend mode together.",
+    "source-over screen",
+    "source-over screen",
+    ["source-over", "screen"]);
+
+heading("Capitalization tests.");
+testMixProperty("All tokens capitalized.",
+    "SCREEN SOURCE-OVER",
+    "screen source-over",
+    ["screen", "source-over"]);
+
+heading("Whitespace tests.");
+testMixProperty("Extra leading, middle, and trailing whitespace. ",
+    "   screen   source-over   ",
+    "screen source-over",
+    ["screen", "source-over"]);

Modified: trunk/Source/WebCore/ChangeLog (148204 => 148205)


--- trunk/Source/WebCore/ChangeLog	2013-04-11 15:09:53 UTC (rev 148204)
+++ trunk/Source/WebCore/ChangeLog	2013-04-11 15:55:25 UTC (rev 148205)
@@ -1,3 +1,35 @@
+2013-04-11  Dirk Schulze  <[email protected]>
+
+        [CSS Shaders] Parse mix descriptor
+        https://bugs.webkit.org/show_bug.cgi?id=114414
+
+        Reviewed by Antti Koivisto.
+
+        Add support for the 'mix' descriptor in the filter at-rule to support blend modes
+        and composite operators in CSS Shaders.
+        Each pixel in the fragment shader will be blended and composited with the
+        backdrop by taking these values into account.
+
+        https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#custom-filter-mix
+
+        Tests: css3/filters/custom-with-at-rule-syntax/parsing-mix-property-invalid.html
+               css3/filters/custom-with-at-rule-syntax/parsing-mix-property-valid.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+        * css/CSSParser.cpp: Added 'mix' property and fail parsing if not inside
+            of an @filter rule.
+        (WebCore::CSSParser::parseValue):
+        (WebCore::CSSParser::parseFilterRuleMix): New helper function to verify
+            values.
+        (WebCore):
+        * css/CSSParser.h:
+        * css/CSSProperty.cpp:
+        (WebCore::CSSProperty::isInheritedProperty):
+        * css/CSSPropertyNames.in: Added new property name 'mix'.
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::applyProperty):
+
 2013-04-11  Zalan Bujtas  <[email protected]>
 
         Parent box with background-size auto and gradient image does not get properly repainted when child box is resized. 

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (148204 => 148205)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2013-04-11 15:09:53 UTC (rev 148204)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2013-04-11 15:55:25 UTC (rev 148205)
@@ -2814,6 +2814,9 @@
 #if ENABLE(CSS_EXCLUSIONS)
         case CSSPropertyWebkitWrap:
 #endif
+#if ENABLE(CSS_SHADERS)
+        case CSSPropertyMix:
+#endif
             break;
 
 #if ENABLE(CSS_DEVICE_ADAPTATION)

Modified: trunk/Source/WebCore/css/CSSParser.cpp (148204 => 148205)


--- trunk/Source/WebCore/css/CSSParser.cpp	2013-04-11 15:09:53 UTC (rev 148204)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2013-04-11 15:55:25 UTC (rev 148205)
@@ -2349,6 +2349,14 @@
 #endif
         return parseFontFaceSrc();
 
+#if ENABLE(CSS_SHADERS)
+    case CSSPropertyMix:
+        // The mix property is just supported inside of an @filter rule.
+        if (!m_inFilterRule)
+            return false;
+        return parseFilterRuleMix();
+#endif
+
     case CSSPropertyUnicodeRange:
         return parseFontFaceUnicodeRange();
 
@@ -8800,6 +8808,37 @@
     return true;
 }
 
+bool CSSParser::parseFilterRuleMix()
+{
+    if (m_valueList->size() > 2)
+        return false;
+
+    RefPtr<CSSValueList> mixList = CSSValueList::createSpaceSeparated();
+
+    bool hasBlendMode = false;
+    bool hasAlphaCompositing = false;
+    CSSParserValue* value = m_valueList->current();
+    while (value) {
+        RefPtr<CSSValue> mixValue;
+        if (!hasBlendMode && isBlendMode(value->id)) {
+            hasBlendMode = true;
+            mixValue = cssValuePool().createIdentifierValue(value->id);
+        } else if (!hasAlphaCompositing && isCompositeOperator(value->id)) {
+            hasAlphaCompositing = true;
+            mixValue = cssValuePool().createIdentifierValue(value->id);
+        }
+
+        if (!mixValue)
+            return false;
+
+        mixList->append(mixValue.release());
+        value = m_valueList->next();
+    }
+
+    addProperty(CSSPropertyMix, mixList.release(), m_important);
+    return true;
+}
+
 StyleRuleBase* CSSParser::createFilterRule(const CSSParserString& filterName)
 {
     RefPtr<StyleRuleFilter> rule = StyleRuleFilter::create(filterName);

Modified: trunk/Source/WebCore/css/CSSParser.h (148204 => 148205)


--- trunk/Source/WebCore/css/CSSParser.h	2013-04-11 15:09:53 UTC (rev 148204)
+++ trunk/Source/WebCore/css/CSSParser.h	2013-04-11 15:55:25 UTC (rev 148205)
@@ -253,6 +253,7 @@
     PassRefPtr<WebKitCSSFilterValue> parseCustomFilterFunctionWithInlineSyntax(CSSParserValue*);
     PassRefPtr<WebKitCSSFilterValue> parseCustomFilterFunction(CSSParserValue*);
     bool parseFilterRuleSrc();
+    bool parseFilterRuleMix();
     PassRefPtr<WebKitCSSShaderValue> parseFilterRuleSrcUriAndFormat(CSSParserValueList*);
 #endif
 #endif

Modified: trunk/Source/WebCore/css/CSSProperty.cpp (148204 => 148205)


--- trunk/Source/WebCore/css/CSSProperty.cpp	2013-04-11 15:09:53 UTC (rev 148204)
+++ trunk/Source/WebCore/css/CSSProperty.cpp	2013-04-11 15:55:25 UTC (rev 148205)
@@ -676,6 +676,9 @@
     case CSSPropertyWebkitShapeOutside:
     case CSSPropertyWebkitWrapThrough:
 #endif
+#if ENABLE(CSS_SHADERS)
+    case CSSPropertyMix:
+#endif
 #if ENABLE(SVG)
     case CSSPropertyClipPath:
     case CSSPropertyMask:

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (148204 => 148205)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2013-04-11 15:09:53 UTC (rev 148204)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2013-04-11 15:55:25 UTC (rev 148205)
@@ -128,6 +128,9 @@
 max-width
 min-height
 min-width
+#if defined(ENABLE_CSS_SHADERS) && ENABLE_CSS_SHADERS
+mix
+#endif
 opacity
 // Honor -webkit-opacity as a synonym for opacity. This was the only syntax that worked in Safari 1.1,
 // and may be in use on some websites and widgets.

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (148204 => 148205)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2013-04-11 15:09:53 UTC (rev 148204)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2013-04-11 15:55:25 UTC (rev 148205)
@@ -3147,6 +3147,9 @@
     case CSSPropertyWebkitShapeInside:
     case CSSPropertyWebkitShapeOutside:
 #endif
+#if ENABLE(CSS_SHADERS)
+    case CSSPropertyMix:
+#endif
     case CSSPropertyWhiteSpace:
     case CSSPropertyWidows:
     case CSSPropertyWidth:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to