Source/WebCore: parse CSS attribute -webkit-blend-mode
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Aug 2012 03:33:41 +0000 (03:33 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Aug 2012 03:33:41 +0000 (03:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=94024

Patch by Rik Cabanier <cabanier@adobe.com> on 2012-08-19
Reviewed by Dirk Schulze.

Added parsing and general CSS handling of -webkit-blend-mode per http://www.w3.org/TR/2012/WD-compositing-20120816/

Tests: css3/compositing/blend-mode-property-parsing-invalid.html
       css3/compositing/blend-mode-property-parsing.html
       css3/compositing/blend-mode-property.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* css/CSSParser.cpp:
(WebCore::isValidKeywordPropertyAndValue):
(WebCore::isKeywordPropertyID):
(WebCore::CSSParser::parseValue):
* css/CSSProperty.cpp:
(WebCore::CSSProperty::isInheritedProperty):
* css/CSSPropertyNames.in:
* css/CSSValueKeywords.in:
* css/StyleBuilder.cpp:
(WebCore::StyleBuilder::StyleBuilder):
* rendering/RenderLayer.h:
(RenderLayer):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
(WebCore):
(WebCore::RenderLayerBacking::updateLayerBlendMode):
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
(WebCore::RenderLayerBacking::setBlendMode):
* rendering/RenderLayerBacking.h:
(RenderLayerBacking):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::diff):
* rendering/style/RenderStyle.h:
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):
* rendering/style/StyleRareNonInheritedData.h:
(StyleRareNonInheritedData):

LayoutTests: parse CSS attribute -webkit-blend-mode
https://bugs.webkit.org/show_bug.cgi?id=94024

Patch by Rik Cabanier <cabanier@adobe.com> on 2012-08-19
Reviewed by Dirk Schulze.

Added parsing and general CSS handling of -webkit-blend-mode per http://www.w3.org/TR/2012/WD-compositing-20120816/

* css3/compositing: Added.
* css3/compositing/blend-mode-property-expected.txt: Added.
* css3/compositing/blend-mode-property-parsing-expected.txt: Added.
* css3/compositing/blend-mode-property-parsing-invalid-expected.txt: Added.
* css3/compositing/blend-mode-property-parsing-invalid.html: Added.
* css3/compositing/blend-mode-property-parsing.html: Added.
* css3/compositing/blend-mode-property.html: Added.
* css3/compositing/script-tests: Added.
* css3/compositing/script-tests/blend-mode-property-parsing-invalid.js: Added.
(testInvalidFilterRule):
* css3/compositing/script-tests/blend-mode-property-parsing.js: Added.
(jsWrapperClass):
(shouldBeType):
(testFilterRule):
* css3/compositing/script-tests/blend-mode-property.js: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@125989 268f45cc-cd09-0410-ab3c-d52691b4dbfc

24 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/compositing/blend-mode-property-expected.txt [new file with mode: 0644]
LayoutTests/css3/compositing/blend-mode-property-parsing-expected.txt [new file with mode: 0644]
LayoutTests/css3/compositing/blend-mode-property-parsing-invalid-expected.txt [new file with mode: 0644]
LayoutTests/css3/compositing/blend-mode-property-parsing-invalid.html [new file with mode: 0644]
LayoutTests/css3/compositing/blend-mode-property-parsing.html [new file with mode: 0644]
LayoutTests/css3/compositing/blend-mode-property.html [new file with mode: 0644]
LayoutTests/css3/compositing/script-tests/blend-mode-property-parsing-invalid.js [new file with mode: 0644]
LayoutTests/css3/compositing/script-tests/blend-mode-property-parsing.js [new file with mode: 0644]
LayoutTests/css3/compositing/script-tests/blend-mode-property.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSProperty.cpp
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/StyleBuilder.cpp
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerBacking.h
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
Source/WebCore/rendering/style/StyleRareNonInheritedData.h

index ec3c3b7..92e933c 100644 (file)
@@ -1,3 +1,28 @@
+2012-08-19  Rik Cabanier  <cabanier@adobe.com>
+
+        parse CSS attribute -webkit-blend-mode
+        https://bugs.webkit.org/show_bug.cgi?id=94024
+
+        Reviewed by Dirk Schulze.
+
+        Added parsing and general CSS handling of -webkit-blend-mode per http://www.w3.org/TR/2012/WD-compositing-20120816/
+
+        * css3/compositing: Added.
+        * css3/compositing/blend-mode-property-expected.txt: Added.
+        * css3/compositing/blend-mode-property-parsing-expected.txt: Added.
+        * css3/compositing/blend-mode-property-parsing-invalid-expected.txt: Added.
+        * css3/compositing/blend-mode-property-parsing-invalid.html: Added.
+        * css3/compositing/blend-mode-property-parsing.html: Added.
+        * css3/compositing/blend-mode-property.html: Added.
+        * css3/compositing/script-tests: Added.
+        * css3/compositing/script-tests/blend-mode-property-parsing-invalid.js: Added.
+        (testInvalidFilterRule):
+        * css3/compositing/script-tests/blend-mode-property-parsing.js: Added.
+        (jsWrapperClass):
+        (shouldBeType):
+        (testFilterRule):
+        * css3/compositing/script-tests/blend-mode-property.js: Added.
+
 2012-08-19  MORITA Hajime  <morrita@google.com>
 
         DOM mutation against including <link> shouldn't trigger pending HTML parser.
diff --git a/LayoutTests/css3/compositing/blend-mode-property-expected.txt b/LayoutTests/css3/compositing/blend-mode-property-expected.txt
new file mode 100644 (file)
index 0000000..cef69ef
--- /dev/null
@@ -0,0 +1,57 @@
+Test the parsing of the -webkit-blend-mode property.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+FAIL cssRule.type should be 1. Threw exception ReferenceError: cssRule is not defined
+FAIL declaration.length should be 1. Threw exception ReferenceError: declaration is not defined
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be normal. Threw exception ReferenceError: declaration is not defined
+FAIL cssRule.type should be 1. Threw exception ReferenceError: cssRule is not defined
+FAIL declaration.length should be 1. Threw exception ReferenceError: declaration is not defined
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be multiply. Threw exception ReferenceError: declaration is not defined
+FAIL cssRule.type should be 1. Threw exception ReferenceError: cssRule is not defined
+FAIL declaration.length should be 1. Threw exception ReferenceError: declaration is not defined
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be screen. Threw exception ReferenceError: declaration is not defined
+FAIL cssRule.type should be 1. Threw exception ReferenceError: cssRule is not defined
+FAIL declaration.length should be 1. Threw exception ReferenceError: declaration is not defined
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be overlay. Threw exception ReferenceError: declaration is not defined
+FAIL cssRule.type should be 1. Threw exception ReferenceError: cssRule is not defined
+FAIL declaration.length should be 1. Threw exception ReferenceError: declaration is not defined
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be darken. Threw exception ReferenceError: declaration is not defined
+FAIL cssRule.type should be 1. Threw exception ReferenceError: cssRule is not defined
+FAIL declaration.length should be 1. Threw exception ReferenceError: declaration is not defined
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be lighten. Threw exception ReferenceError: declaration is not defined
+FAIL cssRule.type should be 1. Threw exception ReferenceError: cssRule is not defined
+FAIL declaration.length should be 1. Threw exception ReferenceError: declaration is not defined
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be color-dodge. Threw exception ReferenceError: declaration is not defined
+FAIL cssRule.type should be 1. Threw exception ReferenceError: cssRule is not defined
+FAIL declaration.length should be 1. Threw exception ReferenceError: declaration is not defined
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be color-burn. Threw exception ReferenceError: declaration is not defined
+FAIL cssRule.type should be 1. Threw exception ReferenceError: cssRule is not defined
+FAIL declaration.length should be 1. Threw exception ReferenceError: declaration is not defined
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be hard-light. Threw exception ReferenceError: declaration is not defined
+FAIL cssRule.type should be 1. Threw exception ReferenceError: cssRule is not defined
+FAIL declaration.length should be 1. Threw exception ReferenceError: declaration is not defined
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be soft-light. Threw exception ReferenceError: declaration is not defined
+FAIL cssRule.type should be 1. Threw exception ReferenceError: cssRule is not defined
+FAIL declaration.length should be 1. Threw exception ReferenceError: declaration is not defined
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be difference. Threw exception ReferenceError: declaration is not defined
+FAIL cssRule.type should be 1. Threw exception ReferenceError: cssRule is not defined
+FAIL declaration.length should be 1. Threw exception ReferenceError: declaration is not defined
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be exclusion. Threw exception ReferenceError: declaration is not defined
+FAIL cssRule.type should be 1. Threw exception ReferenceError: cssRule is not defined
+FAIL declaration.length should be 1. Threw exception ReferenceError: declaration is not defined
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be hue. Threw exception ReferenceError: declaration is not defined
+FAIL cssRule.type should be 1. Threw exception ReferenceError: cssRule is not defined
+FAIL declaration.length should be 1. Threw exception ReferenceError: declaration is not defined
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be saturation. Threw exception ReferenceError: declaration is not defined
+FAIL cssRule.type should be 1. Threw exception ReferenceError: cssRule is not defined
+FAIL declaration.length should be 1. Threw exception ReferenceError: declaration is not defined
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be color. Threw exception ReferenceError: declaration is not defined
+FAIL cssRule.type should be 1. Threw exception ReferenceError: cssRule is not defined
+FAIL declaration.length should be 1. Threw exception ReferenceError: declaration is not defined
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be luminosity. Threw exception ReferenceError: declaration is not defined
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/css3/compositing/blend-mode-property-parsing-expected.txt b/LayoutTests/css3/compositing/blend-mode-property-parsing-expected.txt
new file mode 100644 (file)
index 0000000..a37bfdc
--- /dev/null
@@ -0,0 +1,137 @@
+Test the parsing of the -webkit-blend-mode property.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Basic reference : normal
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be normal (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSPrimitiveValue. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSPrimitiveValuePrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSPrimitiveValueConstructor. Threw exception TypeError: Cannot read property 'constructor' of null
+
+Basic reference : multiply
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be multiply (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSPrimitiveValue. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSPrimitiveValuePrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSPrimitiveValueConstructor. Threw exception TypeError: Cannot read property 'constructor' of null
+
+Basic reference : screen
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be screen (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSPrimitiveValue. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSPrimitiveValuePrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSPrimitiveValueConstructor. Threw exception TypeError: Cannot read property 'constructor' of null
+
+Basic reference : overlay
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be overlay (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSPrimitiveValue. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSPrimitiveValuePrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSPrimitiveValueConstructor. Threw exception TypeError: Cannot read property 'constructor' of null
+
+Basic reference : darken
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be darken (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSPrimitiveValue. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSPrimitiveValuePrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSPrimitiveValueConstructor. Threw exception TypeError: Cannot read property 'constructor' of null
+
+Basic reference : lighten
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be lighten (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSPrimitiveValue. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSPrimitiveValuePrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSPrimitiveValueConstructor. Threw exception TypeError: Cannot read property 'constructor' of null
+
+Basic reference : color-dodge
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be color-dodge (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSPrimitiveValue. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSPrimitiveValuePrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSPrimitiveValueConstructor. Threw exception TypeError: Cannot read property 'constructor' of null
+
+Basic reference : color-burn
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be color-burn (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSPrimitiveValue. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSPrimitiveValuePrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSPrimitiveValueConstructor. Threw exception TypeError: Cannot read property 'constructor' of null
+
+Basic reference : hard-light
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be hard-light (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSPrimitiveValue. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSPrimitiveValuePrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSPrimitiveValueConstructor. Threw exception TypeError: Cannot read property 'constructor' of null
+
+Basic reference : soft-light
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be soft-light (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSPrimitiveValue. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSPrimitiveValuePrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSPrimitiveValueConstructor. Threw exception TypeError: Cannot read property 'constructor' of null
+
+Basic reference : difference
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be difference (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSPrimitiveValue. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSPrimitiveValuePrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSPrimitiveValueConstructor. Threw exception TypeError: Cannot read property 'constructor' of null
+
+Basic reference : exclusion
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be exclusion (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSPrimitiveValue. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSPrimitiveValuePrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSPrimitiveValueConstructor. Threw exception TypeError: Cannot read property 'constructor' of null
+
+Basic reference : hue
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be hue (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSPrimitiveValue. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSPrimitiveValuePrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSPrimitiveValueConstructor. Threw exception TypeError: Cannot read property 'constructor' of null
+
+Basic reference : saturation
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be saturation (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSPrimitiveValue. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSPrimitiveValuePrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSPrimitiveValueConstructor. Threw exception TypeError: Cannot read property 'constructor' of null
+
+Basic reference : color
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be color (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSPrimitiveValue. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSPrimitiveValuePrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSPrimitiveValueConstructor. Threw exception TypeError: Cannot read property 'constructor' of null
+
+Basic reference : luminosity
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-blend-mode') should be luminosity (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSPrimitiveValue. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSPrimitiveValuePrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSPrimitiveValueConstructor. Threw exception TypeError: Cannot read property 'constructor' of null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/css3/compositing/blend-mode-property-parsing-invalid-expected.txt b/LayoutTests/css3/compositing/blend-mode-property-parsing-invalid-expected.txt
new file mode 100644 (file)
index 0000000..0a1f509
--- /dev/null
@@ -0,0 +1,24 @@
+Test the parsing of the -webkit-blend-mode property.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Too many parameters : overlay overlay
+PASS cssRule.type is 1
+PASS declaration.length is 0
+PASS declaration.getPropertyValue('-webkit-blend-mode') is null
+
+Wrong type : "5px"
+PASS cssRule.type is 1
+PASS declaration.length is 0
+PASS declaration.getPropertyValue('-webkit-blend-mode') is null
+
+Trailing comma : overlay,
+PASS cssRule.type is 1
+PASS declaration.length is 0
+PASS declaration.getPropertyValue('-webkit-blend-mode') is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/css3/compositing/blend-mode-property-parsing-invalid.html b/LayoutTests/css3/compositing/blend-mode-property-parsing-invalid.html
new file mode 100644 (file)
index 0000000..ad3fcf2
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/blend-mode-property-parsing-invalid.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/css3/compositing/blend-mode-property-parsing.html b/LayoutTests/css3/compositing/blend-mode-property-parsing.html
new file mode 100644 (file)
index 0000000..bd0ba8e
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/blend-mode-property-parsing.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/css3/compositing/blend-mode-property.html b/LayoutTests/css3/compositing/blend-mode-property.html
new file mode 100644 (file)
index 0000000..5d5052f
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/blend-mode-property.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/css3/compositing/script-tests/blend-mode-property-parsing-invalid.js b/LayoutTests/css3/compositing/script-tests/blend-mode-property-parsing-invalid.js
new file mode 100644 (file)
index 0000000..3d7d8ca
--- /dev/null
@@ -0,0 +1,30 @@
+description("Test the parsing of the -webkit-blend-mode property.");
+
+// These have to be global for the test helpers to see them.
+var stylesheet, cssRule, declaration;
+var styleElement = document.createElement("style");
+document.head.appendChild(styleElement);
+stylesheet = styleElement.sheet;
+stylesheet.insertRule("body { -webkit-blend-mode: multiply; }", 0);
+
+function testInvalidFilterRule(description, rule)
+{
+    debug("");
+    debug(description + " : " + rule);
+
+    stylesheet.insertRule("body { -webkit-blend-mode: " + rule + "; }", 0);
+    cssRule = stylesheet.cssRules.item(0);
+  
+    shouldBe("cssRule.type", "1");
+
+    declaration = cssRule.style;
+    shouldBe("declaration.length", "0");
+    shouldBe("declaration.getPropertyValue('-webkit-blend-mode')", "null");
+}
+
+testInvalidFilterRule("Too many parameters", "overlay overlay");
+testInvalidFilterRule("Wrong type", "\"5px\"");
+testInvalidFilterRule("Trailing comma", "overlay,");
+
+
+successfullyParsed = true;
diff --git a/LayoutTests/css3/compositing/script-tests/blend-mode-property-parsing.js b/LayoutTests/css3/compositing/script-tests/blend-mode-property-parsing.js
new file mode 100644 (file)
index 0000000..f2d00de
--- /dev/null
@@ -0,0 +1,52 @@
+description("Test the parsing of the -webkit-blend-mode property.");
+
+function jsWrapperClass(node)
+{
+    if (!node)
+        return "[null]";
+    var string = Object.prototype.toString.apply(node);
+    return string.substr(8, string.length - 9);
+}
+
+function shouldBeType(expression, className, prototypeName, constructorName)
+{
+    if (!prototypeName)
+        prototypeName = className + "Prototype";
+    if (!constructorName)
+        constructorName = className + "Constructor";
+    shouldBe("jsWrapperClass(" + expression + ")", "'" + className + "'");
+    shouldBe("jsWrapperClass(" + expression + ".__proto__)", "'" + prototypeName + "'");
+    shouldBe("jsWrapperClass(" + expression + ".constructor)", "'" + constructorName + "'");
+}
+
+// These have to be global for the test helpers to see them.
+var stylesheet, cssRule, declaration, blendModeRule, subRule;
+var styleElement = document.createElement("style");
+document.head.appendChild(styleElement);
+stylesheet = styleElement.sheet;
+
+function testBlendModeRule(description, rule, expectedLength, expectedValue, expectedTypes, expectedTexts)
+{
+    debug("");
+    debug(description + " : " + rule);
+
+    stylesheet.insertRule("body { -webkit-blend-mode: " + rule + "; }", 0);
+    cssRule = stylesheet.cssRules.item(0);
+  
+    shouldBe("cssRule.type", "1");
+
+    declaration = cssRule.style;
+    shouldBe("declaration.length", "1");
+    shouldBe("declaration.getPropertyValue('-webkit-blend-mode')", "'" + expectedValue + "'");
+
+    blendModeRule = declaration.getPropertyCSSValue('-webkit-blend-mode');
+    shouldBeType("blendModeRule", "CSSPrimitiveValue");
+}
+
+var blendmodes = ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"];
+
+for(x in blendmodes)
+   testBlendModeRule("Basic reference", blendmodes[x], 1, blendmodes[x]);
+
+
+successfullyParsed = true;
diff --git a/LayoutTests/css3/compositing/script-tests/blend-mode-property.js b/LayoutTests/css3/compositing/script-tests/blend-mode-property.js
new file mode 100644 (file)
index 0000000..a089ea0
--- /dev/null
@@ -0,0 +1,26 @@
+description("Test the parsing of the -webkit-blend-mode property.");
+
+var styleElement = document.createElement("style");
+document.head.appendChild(styleElement);
+var stylesheet = styleElement.sheet;
+
+function testblendmode(blendmode)
+{
+// add a -webkit-filter property to the start of the stylesheet
+stylesheet.addRule("body", "-webkit-blend-mode: " + blendmode, 0);
+
+var cssRule = stylesheet.cssRules.item(0);
+
+shouldBe("cssRule.type", "1");
+
+var declaration = cssRule.style;
+shouldBe("declaration.length", "1");
+shouldBe("declaration.getPropertyValue('-webkit-blend-mode')", "\'" + blendmode + "\'");
+}
+
+var blendmodes = ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"];
+
+for(x in blendmodes)
+   testblendmode(blendmodes[x]);
+
+successfullyParsed = true;
index 66fdcd1..60658c5 100644 (file)
@@ -1,3 +1,48 @@
+2012-08-19  Rik Cabanier  <cabanier@adobe.com>
+
+        parse CSS attribute -webkit-blend-mode
+        https://bugs.webkit.org/show_bug.cgi?id=94024
+        Reviewed by Dirk Schulze.
+
+        Added parsing and general CSS handling of -webkit-blend-mode per http://www.w3.org/TR/2012/WD-compositing-20120816/
+
+        Tests: css3/compositing/blend-mode-property-parsing-invalid.html
+               css3/compositing/blend-mode-property-parsing.html
+               css3/compositing/blend-mode-property.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore):
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+        * css/CSSParser.cpp:
+        (WebCore::isValidKeywordPropertyAndValue):
+        (WebCore::isKeywordPropertyID):
+        (WebCore::CSSParser::parseValue):
+        * css/CSSProperty.cpp:
+        (WebCore::CSSProperty::isInheritedProperty):
+        * css/CSSPropertyNames.in:
+        * css/CSSValueKeywords.in:
+        * css/StyleBuilder.cpp:
+        (WebCore::StyleBuilder::StyleBuilder):
+        * rendering/RenderLayer.h:
+        (RenderLayer):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
+        (WebCore):
+        (WebCore::RenderLayerBacking::updateLayerBlendMode):
+        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
+        (WebCore::RenderLayerBacking::setBlendMode):
+        * rendering/RenderLayerBacking.h:
+        (RenderLayerBacking):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::diff):
+        * rendering/style/RenderStyle.h:
+        * rendering/style/StyleRareNonInheritedData.cpp:
+        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
+        (WebCore::StyleRareNonInheritedData::operator==):
+        * rendering/style/StyleRareNonInheritedData.h:
+        (StyleRareNonInheritedData):
+
 2012-08-19  MORITA Hajime  <morrita@google.com>
 
         DOM mutation against including <link> shouldn't trigger pending HTML parser.
index 0b5f2df..e20d152 100644 (file)
@@ -212,6 +212,9 @@ static const CSSPropertyID computedProperties[] = {
     CSSPropertyWebkitBackgroundComposite,
     CSSPropertyWebkitBackgroundOrigin,
     CSSPropertyWebkitBackgroundSize,
+#if ENABLE(CSS_COMPOSITING)
+    CSSPropertyWebkitBlendMode,
+#endif
     CSSPropertyWebkitBorderFit,
     CSSPropertyWebkitBorderHorizontalSpacing,
     CSSPropertyWebkitBorderImage,
@@ -2424,6 +2427,10 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
         case CSSPropertyWebkitFilter:
             return valueForFilter(style.get());
 #endif
+#if ENABLE(CSS_COMPOSITING)
+        case CSSPropertyWebkitBlendMode:
+            return cssValuePool().createValue(style->blendMode());
+#endif
         case CSSPropertyBackground:
             return getBackgroundShorthandValue();
         case CSSPropertyBorder: {
index f0bfa17..f350117 100644 (file)
@@ -674,6 +674,15 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int
         if (valueID == CSSValueVisible || valueID == CSSValueHidden)
             return true;
         break;
+#if ENABLE(CSS_COMPOSITING)
+    case CSSPropertyWebkitBlendMode:
+        if (valueID == CSSValueNormal || valueID == CSSValueMultiply || valueID == CSSValueScreen || valueID == CSSValueOverlay 
+            || valueID == CSSValueDarken || valueID == CSSValueLighten ||  valueID == CSSValueColorDodge || valueID == CSSValueColorBurn 
+            || valueID == CSSValueHardLight || valueID == CSSValueSoftLight || valueID == CSSValueDifference || valueID == CSSValueExclusion 
+            || valueID == CSSValueHue || valueID == CSSValueSaturation || valueID == CSSValueColor || valueID == CSSValueLuminosity)
+            return true;
+        break;
+#endif
     case CSSPropertyWebkitBorderFit:
         if (valueID == CSSValueBorder || valueID == CSSValueLines)
             return true;
@@ -918,6 +927,9 @@ static inline bool isKeywordPropertyID(CSSPropertyID propertyId)
     case CSSPropertyTextUnderlineStyle:
     case CSSPropertyVisibility:
     case CSSPropertyWebkitAppearance:
+#if ENABLE(CSS_COMPOSITING)
+    case CSSPropertyWebkitBlendMode:
+#endif
     case CSSPropertyWebkitBackfaceVisibility:
     case CSSPropertyWebkitBorderAfterStyle:
     case CSSPropertyWebkitBorderBeforeStyle:
@@ -2257,6 +2269,11 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
         }
         break;
 #endif
+#if ENABLE(CSS_COMPOSITING)
+    case CSSPropertyWebkitBlendMode:
+            validPrimitive = true;
+        break;
+#endif
 #if ENABLE(CSS3_FLEXBOX)
     case CSSPropertyWebkitFlex: {
         ShorthandScope scope(this, propId);
index 47fa670..ae10bc7 100644 (file)
@@ -569,6 +569,9 @@ bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID)
 #if ENABLE(CSS_FILTERS)
     case CSSPropertyWebkitFilter:
 #endif
+#if ENABLE(CSS_COMPOSITING)
+    case CSSPropertyWebkitBlendMode:
+#endif
 #if ENABLE(CSS3_FLEXBOX)
     case CSSPropertyWebkitAlignContent:
     case CSSPropertyWebkitAlignItems:
index ba4bcce..ec77267 100644 (file)
@@ -266,6 +266,9 @@ z-index
 #if defined(ENABLE_CSS_FILTERS) && ENABLE_CSS_FILTERS
 -webkit-filter
 #endif
+#if defined(ENABLE_CSS_COMPOSITING) && ENABLE_CSS_COMPOSITING
+-webkit-blend-mode
+#endif
 #if defined(ENABLE_CSS3_FLEXBOX) && ENABLE_CSS3_FLEXBOX
 -webkit-align-content
 -webkit-align-items
index 4af25f8..fa6d005 100644 (file)
@@ -926,7 +926,7 @@ edges
 coarse
 fine
 
-#if defined(ENABLE_CSS_FILTERS) && ENABLE_CSS_FILTERS
+#if (defined(ENABLE_CSS_FILTERS) && ENABLE_CSS_FILTERS) || (defined(ENABLE_CSS_COMPOSITING) && ENABLE_CSS_COMPOSITING)
 // -webkit-filter
 #if defined(ENABLE_CSS_SHADERS) && ENABLE_CSS_SHADERS
 // values for the custom() function
index ea17324..e91f4ee 100644 (file)
@@ -2093,6 +2093,9 @@ StyleBuilder::StyleBuilder()
     setPropertyHandler(CSSPropertyWordWrap, ApplyPropertyDefault<EWordWrap, &RenderStyle::wordWrap, EWordWrap, &RenderStyle::setWordWrap, EWordWrap, &RenderStyle::initialWordWrap>::createHandler());
     setPropertyHandler(CSSPropertyZIndex, ApplyPropertyAuto<int, &RenderStyle::zIndex, &RenderStyle::setZIndex, &RenderStyle::hasAutoZIndex, &RenderStyle::setHasAutoZIndex>::createHandler());
     setPropertyHandler(CSSPropertyZoom, ApplyPropertyZoom::createHandler());
+#if ENABLE(CSS_COMPOSITING)
+    setPropertyHandler(CSSPropertyWebkitBlendMode, ApplyPropertyDefault<BlendMode, &RenderStyle::blendMode, BlendMode, &RenderStyle::setBlendMode, BlendMode, &RenderStyle::initialBlendMode>::createHandler());
+#endif
 }
 
 
index 6c1229f..a5f744e 100644 (file)
@@ -397,6 +397,10 @@ public:
     bool isPaginated() const { return m_isPaginated; }
 
     void updateTransform();
+    
+#if ENABLE(CSS_COMPOSITING)
+    void updateBlendMode();
+#endif
 
     const LayoutSize& relativePositionOffset() const { return m_relativeOffset; }
 
@@ -931,6 +935,10 @@ protected:
     bool m_hasFilterInfo : 1;
 #endif
 
+#if ENABLE(CSS_COMPOSITING)
+    BlendMode m_blendMode;
+#endif
+
     RenderBoxModelObject* m_renderer;
 
     RenderLayer* m_parent;
index d256a69..6641bbc 100644 (file)
@@ -204,6 +204,9 @@ void RenderLayerBacking::createPrimaryGraphicsLayer()
 #if ENABLE(CSS_FILTERS)
     updateLayerFilters(renderer()->style());
 #endif
+#if ENABLE(CSS_COMPOSITING)
+    updateLayerBlendMode(renderer()->style());
+#endif
 }
 
 void RenderLayerBacking::destroyGraphicsLayers()
@@ -242,6 +245,12 @@ void RenderLayerBacking::updateLayerFilters(const RenderStyle* style)
 }
 #endif
 
+#if ENABLE(CSS_COMPOSITING)
+void RenderLayerBacking::updateLayerBlendMode(const RenderStyle*)
+{
+}
+#endif
+
 static bool hasNonZeroTransformOrigin(const RenderObject* renderer)
 {
     RenderStyle* style = renderer->style();
@@ -452,6 +461,10 @@ void RenderLayerBacking::updateGraphicsLayerGeometry()
 #if ENABLE(CSS_FILTERS)
     updateLayerFilters(renderer()->style());
 #endif
+
+#if ENABLE(CSS_COMPOSITING)
+    updateLayerBlendMode(renderer()->style());
+#endif
     
     m_owningLayer->updateDescendantDependentFlags();
 
@@ -1183,6 +1196,12 @@ void RenderLayerBacking::setRequiresOwnBackingStore(bool requiresOwnBacking)
     compositor()->repaintInCompositedAncestor(m_owningLayer, compositedBounds());
 }
 
+#if ENABLE(CSS_COMPOSITING)
+void RenderLayerBacking::setBlendMode(BlendMode)
+{
+}
+#endif
+
 void RenderLayerBacking::setContentsNeedDisplay()
 {
     ASSERT(!paintsIntoCompositedAncestor());
index 0f42d3f..f107dc2 100644 (file)
@@ -165,6 +165,10 @@ public:
 
     String nameForLayer() const;
     
+#if ENABLE(CSS_COMPOSITING)
+    void setBlendMode(BlendMode);
+#endif
+
 private:
     void createPrimaryGraphicsLayer();
     void destroyGraphicsLayers();
@@ -196,7 +200,9 @@ private:
 #if ENABLE(CSS_FILTERS)
     void updateLayerFilters(const RenderStyle*);
 #endif
-
+#if ENABLE(CSS_COMPOSITING)
+    void updateLayerBlendMode(const RenderStyle*);
+#endif
     // Return the opacity value that this layer should use for compositing.
     float compositingOpacity(float rendererOpacity) const;
     
index 5b4c3b9..2b5517a 100644 (file)
@@ -612,6 +612,11 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon
                  || visual->clip != other->visual->clip || visual->hasClip != other->visual->hasClip)
             return StyleDifferenceRepaintLayer;
     }
+    
+#if ENABLE(CSS_COMPOSITING)
+    if (rareNonInheritedData->m_effectiveBlendMode != other->rareNonInheritedData->m_effectiveBlendMode)
+        return StyleDifferenceRepaintLayer;
+#endif
 
     if (rareNonInheritedData->opacity != other->rareNonInheritedData->opacity) {
 #if USE(ACCELERATED_COMPOSITING)
index 808f2ef..0ec4f01 100644 (file)
@@ -978,6 +978,14 @@ public:
     bool hasFilter() const { return false; }
 #endif
 
+#if ENABLE(CSS_COMPOSITING)
+    BlendMode blendMode() const { return static_cast<BlendMode>(rareNonInheritedData->m_effectiveBlendMode); }
+    void setBlendMode(BlendMode v) { rareNonInheritedData.access()->m_effectiveBlendMode = v; }
+    bool hasBlendMode() const { return static_cast<BlendMode>(rareNonInheritedData->m_effectiveBlendMode) == BlendModeNormal; }
+#else
+    bool hasBlendMode() const { return false; }
+#endif
 #if USE(RTL_SCROLLBAR)
     bool shouldPlaceBlockDirectionScrollbarOnLogicalLeft() const { return !isLeftToRightDirection() && isHorizontalWritingMode(); }
 #else
@@ -1704,6 +1712,9 @@ public:
 #if ENABLE(CSS_FILTERS)
     static const FilterOperations& initialFilter() { DEFINE_STATIC_LOCAL(FilterOperations, ops, ()); return ops; }
 #endif
+#if ENABLE(CSS_COMPOSITING)
+    static BlendMode initialBlendMode() { return BlendModeNormal; }
+#endif
 private:
     void setVisitedLinkColor(const Color&);
     void setVisitedLinkBackgroundColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBackgroundColor, v) }
index 8d57922..80a3fbd 100644 (file)
@@ -78,6 +78,9 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
     , m_runningAcceleratedAnimation(false)
 #endif
     , m_hasAspectRatio(false)
+#if ENABLE(CSS_COMPOSITING)
+    , m_effectiveBlendMode(RenderStyle::initialBlendMode())
+#endif
 {
     m_maskBoxImage.setMaskDefaults();
 }
@@ -149,6 +152,9 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited
     , m_runningAcceleratedAnimation(o.m_runningAcceleratedAnimation)
 #endif
     , m_hasAspectRatio(o.m_hasAspectRatio)
+#if ENABLE(CSS_COMPOSITING)
+    , m_effectiveBlendMode(RenderStyle::initialBlendMode())
+#endif
 {
 }
 
@@ -225,6 +231,9 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
 #if USE(ACCELERATED_COMPOSITING)
         && !m_runningAcceleratedAnimation && !o.m_runningAcceleratedAnimation
 #endif
+#if ENABLE(CSS_COMPOSITING)
+        && m_effectiveBlendMode == o.m_effectiveBlendMode
+#endif
         && m_hasAspectRatio == o.m_hasAspectRatio;
 }
 
index a206015..e452759 100644 (file)
@@ -182,8 +182,13 @@ public:
 #if USE(ACCELERATED_COMPOSITING)
     unsigned m_runningAcceleratedAnimation : 1;
 #endif
+
     unsigned m_hasAspectRatio : 1; // Whether or not an aspect ratio has been specified.
 
+#if ENABLE(CSS_COMPOSITING)
+    unsigned m_effectiveBlendMode: 5; // EBlendMode
+#endif
+
 private:
     StyleRareNonInheritedData();
     StyleRareNonInheritedData(const StyleRareNonInheritedData&);