Add support for parsing of -webkit-background-blend-mode
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2013 21:13:31 +0000 (21:13 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2013 21:13:31 +0000 (21:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=108547

Patch by Rik Cabanier <cabanier@adobe.com> on 2013-02-07
Reviewed by David Hyatt.

Source/WebCore:

Added parsing and general CSS handling of -webkit-background-blend-mode per
https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#background-blend-mode

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

* css/CSSComputedStyleDeclaration.cpp: Built value for getComputedStyle.
(WebCore):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* css/CSSParser.cpp: Parsed and stored value of -webkit-background-blend-mode.
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseFillProperty):
* css/CSSProperty.cpp: Listed -webkit-background-blend-mode as a non-inherited property.
(WebCore::CSSProperty::isInheritedProperty):
* css/CSSPropertyNames.in: Added -webkit-background-blend-mode as a CSS property.
* css/CSSToStyleMap.cpp: Mapped background blend mode from CSS value to enum.
(WebCore::CSSToStyleMap::mapFillBlendMode):
(WebCore):
* css/CSSToStyleMap.h: Added function declaration 'mapFillBlendMode'.
(CSSToStyleMap):
* css/StyleBuilder.cpp: Set up propery handler for -webkit-background-blend-mode.
(WebCore::StyleBuilder::StyleBuilder):
* rendering/style/FillLayer.cpp: Added code to store and retrieve the blend mode from a layer.
(WebCore::FillLayer::FillLayer):
(WebCore::FillLayer::operator=):
(WebCore::FillLayer::operator==):
(WebCore::FillLayer::fillUnsetProperties):
* rendering/style/FillLayer.h: Added function definitions to manage blend mode in a layer.
(WebCore::FillLayer::blendMode):
(WebCore::FillLayer::isBlendModeSet):
(WebCore::FillLayer::setBlendMode):
(WebCore::FillLayer::clearBlendMode):
(WebCore::FillLayer::initialFillBlendMode):
(FillLayer):

LayoutTests:

Added parsing and general CSS handling of -webkit-background-blend-mode per
https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#background-blend-mode

* css3/compositing/background-blend-mode-property-expected.txt: Added.
* css3/compositing/background-blend-mode-property-parsing-expected.txt: Added.
* css3/compositing/background-blend-mode-property-parsing.html: Added.
* css3/compositing/background-blend-mode-property.html: Added.
* css3/compositing/script-tests/background-blend-mode-property-parsing.js: Added.
(jsWrapperClass):
(shouldBeType):
(testBlendModeRule):
* css3/compositing/script-tests/background-blend-mode-property.js: Added.
(testblendmode):

* css3/compositing/background-blend-mode-property-expected.txt: Added.
* css3/compositing/background-blend-mode-property-parsing-expected.txt: Added.
* css3/compositing/background-blend-mode-property-parsing.html: Added.
* css3/compositing/background-blend-mode-property.html: Added.
* css3/compositing/script-tests/background-blend-mode-property-parsing.js: Added.
(jsWrapperClass):
(shouldBeType):
(testBlendModeRule):
* css3/compositing/script-tests/background-blend-mode-property.js: Added.
(testblendmode):
* platform/chromium/css3/compositing/background-blend-mode-property-expected.txt: Added.
* platform/chromium/css3/compositing/background-blend-mode-property-parsing-expected.txt: Added.

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

19 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/compositing/background-blend-mode-property-expected.txt [new file with mode: 0644]
LayoutTests/css3/compositing/background-blend-mode-property-parsing-expected.txt [new file with mode: 0644]
LayoutTests/css3/compositing/background-blend-mode-property-parsing.html [new file with mode: 0644]
LayoutTests/css3/compositing/background-blend-mode-property.html [new file with mode: 0644]
LayoutTests/css3/compositing/script-tests/background-blend-mode-property-parsing.js [new file with mode: 0644]
LayoutTests/css3/compositing/script-tests/background-blend-mode-property.js [new file with mode: 0644]
LayoutTests/platform/chromium/css3/compositing/background-blend-mode-property-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/css3/compositing/background-blend-mode-property-parsing-expected.txt [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/CSSToStyleMap.cpp
Source/WebCore/css/CSSToStyleMap.h
Source/WebCore/css/StyleBuilder.cpp
Source/WebCore/rendering/style/FillLayer.cpp
Source/WebCore/rendering/style/FillLayer.h

index d7b77f926c351928ca584e79046ec230768ea6f9..0e5845ff96b018d59614735a4c2d1a08b3cbb4f2 100644 (file)
@@ -1,3 +1,37 @@
+2013-02-07  Rik Cabanier  <cabanier@adobe.com>
+
+        Add support for parsing of -webkit-background-blend-mode
+        https://bugs.webkit.org/show_bug.cgi?id=108547
+
+        Reviewed by David Hyatt.
+
+        Added parsing and general CSS handling of -webkit-background-blend-mode per
+        https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#background-blend-mode
+
+        * css3/compositing/background-blend-mode-property-expected.txt: Added.
+        * css3/compositing/background-blend-mode-property-parsing-expected.txt: Added.
+        * css3/compositing/background-blend-mode-property-parsing.html: Added.
+        * css3/compositing/background-blend-mode-property.html: Added.
+        * css3/compositing/script-tests/background-blend-mode-property-parsing.js: Added.
+        (jsWrapperClass):
+        (shouldBeType):
+        (testBlendModeRule):
+        * css3/compositing/script-tests/background-blend-mode-property.js: Added.
+        (testblendmode):
+
+        * css3/compositing/background-blend-mode-property-expected.txt: Added.
+        * css3/compositing/background-blend-mode-property-parsing-expected.txt: Added.
+        * css3/compositing/background-blend-mode-property-parsing.html: Added.
+        * css3/compositing/background-blend-mode-property.html: Added.
+        * css3/compositing/script-tests/background-blend-mode-property-parsing.js: Added.
+        (jsWrapperClass):
+        (shouldBeType):
+        (testBlendModeRule):
+        * css3/compositing/script-tests/background-blend-mode-property.js: Added.
+        (testblendmode):
+        * platform/chromium/css3/compositing/background-blend-mode-property-expected.txt: Added.
+        * platform/chromium/css3/compositing/background-blend-mode-property-parsing-expected.txt: Added.
+
 2013-02-07  Gavin Peters  <gavinp@chromium.org>
 
         Unreviewed, rolling out r142142.
diff --git a/LayoutTests/css3/compositing/background-blend-mode-property-expected.txt b/LayoutTests/css3/compositing/background-blend-mode-property-expected.txt
new file mode 100644 (file)
index 0000000..d2e6c22
--- /dev/null
@@ -0,0 +1,57 @@
+Test the parsing of the -webkit-background-blend-mode property.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'normal, normal'
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'multiply, multiply'
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'screen, screen'
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'overlay, overlay'
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'darken, darken'
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'lighten, lighten'
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'color-dodge, color-dodge'
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'color-burn, color-burn'
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'hard-light, hard-light'
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'soft-light, soft-light'
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'difference, difference'
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'exclusion, exclusion'
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'hue, hue'
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'saturation, saturation'
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'color, color'
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'luminosity, luminosity'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/css3/compositing/background-blend-mode-property-parsing-expected.txt b/LayoutTests/css3/compositing/background-blend-mode-property-parsing-expected.txt
new file mode 100644 (file)
index 0000000..7019c4c
--- /dev/null
@@ -0,0 +1,137 @@
+Test the parsing of the -webkit-background-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
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'normal'
+PASS jsWrapperClass(blendModeRule) is 'CSSPrimitiveValue'
+PASS jsWrapperClass(blendModeRule.__proto__) is 'CSSPrimitiveValuePrototype'
+PASS jsWrapperClass(blendModeRule.constructor) is 'CSSPrimitiveValueConstructor'
+
+Basic reference : multiply, screen
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'multiply, screen'
+PASS jsWrapperClass(blendModeRule) is 'CSSValueList'
+PASS jsWrapperClass(blendModeRule.__proto__) is 'CSSValueListPrototype'
+PASS jsWrapperClass(blendModeRule.constructor) is 'CSSValueListConstructor'
+
+Basic reference : screen, hue
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'screen, hue'
+PASS jsWrapperClass(blendModeRule) is 'CSSValueList'
+PASS jsWrapperClass(blendModeRule.__proto__) is 'CSSValueListPrototype'
+PASS jsWrapperClass(blendModeRule.constructor) is 'CSSValueListConstructor'
+
+Basic reference : overlay, normal
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'overlay, normal'
+PASS jsWrapperClass(blendModeRule) is 'CSSValueList'
+PASS jsWrapperClass(blendModeRule.__proto__) is 'CSSValueListPrototype'
+PASS jsWrapperClass(blendModeRule.constructor) is 'CSSValueListConstructor'
+
+Basic reference : darken, lighten, normal, luminosity
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'darken, lighten, normal, luminosity'
+PASS jsWrapperClass(blendModeRule) is 'CSSValueList'
+PASS jsWrapperClass(blendModeRule.__proto__) is 'CSSValueListPrototype'
+PASS jsWrapperClass(blendModeRule.constructor) is 'CSSValueListConstructor'
+
+Basic reference : lighten
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'lighten'
+PASS jsWrapperClass(blendModeRule) is 'CSSPrimitiveValue'
+PASS jsWrapperClass(blendModeRule.__proto__) is 'CSSPrimitiveValuePrototype'
+PASS jsWrapperClass(blendModeRule.constructor) is 'CSSPrimitiveValueConstructor'
+
+Basic reference : color-dodge
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'color-dodge'
+PASS jsWrapperClass(blendModeRule) is 'CSSPrimitiveValue'
+PASS jsWrapperClass(blendModeRule.__proto__) is 'CSSPrimitiveValuePrototype'
+PASS jsWrapperClass(blendModeRule.constructor) is 'CSSPrimitiveValueConstructor'
+
+Basic reference : color-burn
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'color-burn'
+PASS jsWrapperClass(blendModeRule) is 'CSSPrimitiveValue'
+PASS jsWrapperClass(blendModeRule.__proto__) is 'CSSPrimitiveValuePrototype'
+PASS jsWrapperClass(blendModeRule.constructor) is 'CSSPrimitiveValueConstructor'
+
+Basic reference : hard-light
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'hard-light'
+PASS jsWrapperClass(blendModeRule) is 'CSSPrimitiveValue'
+PASS jsWrapperClass(blendModeRule.__proto__) is 'CSSPrimitiveValuePrototype'
+PASS jsWrapperClass(blendModeRule.constructor) is 'CSSPrimitiveValueConstructor'
+
+Basic reference : soft-light
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'soft-light'
+PASS jsWrapperClass(blendModeRule) is 'CSSPrimitiveValue'
+PASS jsWrapperClass(blendModeRule.__proto__) is 'CSSPrimitiveValuePrototype'
+PASS jsWrapperClass(blendModeRule.constructor) is 'CSSPrimitiveValueConstructor'
+
+Basic reference : difference
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'difference'
+PASS jsWrapperClass(blendModeRule) is 'CSSPrimitiveValue'
+PASS jsWrapperClass(blendModeRule.__proto__) is 'CSSPrimitiveValuePrototype'
+PASS jsWrapperClass(blendModeRule.constructor) is 'CSSPrimitiveValueConstructor'
+
+Basic reference : exclusion
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'exclusion'
+PASS jsWrapperClass(blendModeRule) is 'CSSPrimitiveValue'
+PASS jsWrapperClass(blendModeRule.__proto__) is 'CSSPrimitiveValuePrototype'
+PASS jsWrapperClass(blendModeRule.constructor) is 'CSSPrimitiveValueConstructor'
+
+Basic reference : hue
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'hue'
+PASS jsWrapperClass(blendModeRule) is 'CSSPrimitiveValue'
+PASS jsWrapperClass(blendModeRule.__proto__) is 'CSSPrimitiveValuePrototype'
+PASS jsWrapperClass(blendModeRule.constructor) is 'CSSPrimitiveValueConstructor'
+
+Basic reference : saturation
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'saturation'
+PASS jsWrapperClass(blendModeRule) is 'CSSPrimitiveValue'
+PASS jsWrapperClass(blendModeRule.__proto__) is 'CSSPrimitiveValuePrototype'
+PASS jsWrapperClass(blendModeRule.constructor) is 'CSSPrimitiveValueConstructor'
+
+Basic reference : color
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'color'
+PASS jsWrapperClass(blendModeRule) is 'CSSPrimitiveValue'
+PASS jsWrapperClass(blendModeRule.__proto__) is 'CSSPrimitiveValuePrototype'
+PASS jsWrapperClass(blendModeRule.constructor) is 'CSSPrimitiveValueConstructor'
+
+Basic reference : luminosity
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-background-blend-mode') is 'luminosity'
+PASS jsWrapperClass(blendModeRule) is 'CSSPrimitiveValue'
+PASS jsWrapperClass(blendModeRule.__proto__) is 'CSSPrimitiveValuePrototype'
+PASS jsWrapperClass(blendModeRule.constructor) is 'CSSPrimitiveValueConstructor'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/css3/compositing/background-blend-mode-property-parsing.html b/LayoutTests/css3/compositing/background-blend-mode-property-parsing.html
new file mode 100644 (file)
index 0000000..2df8513
--- /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/background-blend-mode-property-parsing.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/css3/compositing/background-blend-mode-property.html b/LayoutTests/css3/compositing/background-blend-mode-property.html
new file mode 100644 (file)
index 0000000..20822ff
--- /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/background-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/background-blend-mode-property-parsing.js b/LayoutTests/css3/compositing/script-tests/background-blend-mode-property-parsing.js
new file mode 100644 (file)
index 0000000..8c29e86
--- /dev/null
@@ -0,0 +1,55 @@
+description("Test the parsing of the -webkit-background-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-background-blend-mode: " + rule + "; }", 0);
+    cssRule = stylesheet.cssRules.item(0);
+  
+    shouldBe("cssRule.type", "1");
+
+    declaration = cssRule.style;
+    shouldBe("declaration.length", "1");
+    shouldBe("declaration.getPropertyValue('-webkit-background-blend-mode')", "'" + expectedValue + "'");
+
+    blendModeRule = declaration.getPropertyCSSValue('-webkit-background-blend-mode');
+       if(rule.indexOf(',') == -1)
+       shouldBeType("blendModeRule", "CSSPrimitiveValue");
+       else
+           shouldBeType("blendModeRule", "CSSValueList");
+}
+
+var blendmodes = ["normal", "multiply, screen", "screen, hue", "overlay, normal", "darken, lighten, normal, luminosity", "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/background-blend-mode-property.js b/LayoutTests/css3/compositing/script-tests/background-blend-mode-property.js
new file mode 100644 (file)
index 0000000..2405789
--- /dev/null
@@ -0,0 +1,28 @@
+description("Test the parsing of the -webkit-background-blend-mode property.");
+
+var styleElement = document.createElement("style");
+document.head.appendChild(styleElement);
+var stylesheet = styleElement.sheet;
+var cssRule;
+var declaration;
+
+function testblendmode(blendmode)
+{
+// add a -webkit-filter property to the start of the stylesheet
+stylesheet.addRule("body", "-webkit-background-blend-mode: " + blendmode + ", " + blendmode, 0);
+
+cssRule = stylesheet.cssRules.item(0);
+
+shouldBe("cssRule.type", "1");
+
+declaration = cssRule.style;
+shouldBe("declaration.length", "1");
+shouldBe("declaration.getPropertyValue('-webkit-background-blend-mode')", "\'" + blendmode + ", " + 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;
diff --git a/LayoutTests/platform/chromium/css3/compositing/background-blend-mode-property-expected.txt b/LayoutTests/platform/chromium/css3/compositing/background-blend-mode-property-expected.txt
new file mode 100644 (file)
index 0000000..8c69649
--- /dev/null
@@ -0,0 +1,57 @@
+Test the parsing of the -webkit-background-blend-mode property.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be normal, normal (of type string). Was null (of type object).
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be multiply, multiply (of type string). Was null (of type object).
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be screen, screen (of type string). Was null (of type object).
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be overlay, overlay (of type string). Was null (of type object).
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be darken, darken (of type string). Was null (of type object).
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be lighten, lighten (of type string). Was null (of type object).
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be color-dodge, color-dodge (of type string). Was null (of type object).
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be color-burn, color-burn (of type string). Was null (of type object).
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be hard-light, hard-light (of type string). Was null (of type object).
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be soft-light, soft-light (of type string). Was null (of type object).
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be difference, difference (of type string). Was null (of type object).
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be exclusion, exclusion (of type string). Was null (of type object).
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be hue, hue (of type string). Was null (of type object).
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be saturation, saturation (of type string). Was null (of type object).
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be color, color (of type string). Was null (of type object).
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be luminosity, luminosity (of type string). Was null (of type object).
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/chromium/css3/compositing/background-blend-mode-property-parsing-expected.txt b/LayoutTests/platform/chromium/css3/compositing/background-blend-mode-property-parsing-expected.txt
new file mode 100644 (file)
index 0000000..f75eb95
--- /dev/null
@@ -0,0 +1,137 @@
+Test the parsing of the -webkit-background-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-background-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, screen
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be multiply, screen (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSValueList. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSValueListPrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSValueListConstructor. Threw exception TypeError: Cannot read property 'constructor' of null
+
+Basic reference : screen, hue
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be screen, hue (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSValueList. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSValueListPrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSValueListConstructor. Threw exception TypeError: Cannot read property 'constructor' of null
+
+Basic reference : overlay, normal
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be overlay, normal (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSValueList. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSValueListPrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSValueListConstructor. Threw exception TypeError: Cannot read property 'constructor' of null
+
+Basic reference : darken, lighten, normal, luminosity
+PASS cssRule.type is 1
+FAIL declaration.length should be 1. Was 0.
+FAIL declaration.getPropertyValue('-webkit-background-blend-mode') should be darken, lighten, normal, luminosity (of type string). Was null (of type object).
+FAIL jsWrapperClass(blendModeRule) should be CSSValueList. Was [null].
+FAIL jsWrapperClass(blendModeRule.__proto__) should be CSSValueListPrototype. Threw exception TypeError: Cannot read property '__proto__' of null
+FAIL jsWrapperClass(blendModeRule.constructor) should be CSSValueListConstructor. 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-background-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-background-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-background-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-background-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-background-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-background-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-background-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-background-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-background-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-background-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-background-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
+
index e626d0d5ff658b04f59847bd959893cb211a147c..3e3e6935f9e1caec699b21e773c9e154090ff38a 100644 (file)
@@ -1,3 +1,45 @@
+2013-02-07  Rik Cabanier  <cabanier@adobe.com>
+
+        Add support for parsing of -webkit-background-blend-mode
+        https://bugs.webkit.org/show_bug.cgi?id=108547
+
+        Reviewed by David Hyatt.
+
+        Added parsing and general CSS handling of -webkit-background-blend-mode per 
+        https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#background-blend-mode
+
+        Tests: css3/compositing/background-blend-mode-property-parsing.html
+               css3/compositing/background-blend-mode-property.html
+
+        * css/CSSComputedStyleDeclaration.cpp: Built value for getComputedStyle.
+        (WebCore):
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+        * css/CSSParser.cpp: Parsed and stored value of -webkit-background-blend-mode.
+        (WebCore::CSSParser::parseValue):
+        (WebCore::CSSParser::parseFillProperty):
+        * css/CSSProperty.cpp: Listed -webkit-background-blend-mode as a non-inherited property.
+        (WebCore::CSSProperty::isInheritedProperty):
+        * css/CSSPropertyNames.in: Added -webkit-background-blend-mode as a CSS property.
+        * css/CSSToStyleMap.cpp: Mapped background blend mode from CSS value to enum.
+        (WebCore::CSSToStyleMap::mapFillBlendMode):
+        (WebCore):
+        * css/CSSToStyleMap.h: Added function declaration 'mapFillBlendMode'.
+        (CSSToStyleMap):
+        * css/StyleBuilder.cpp: Set up propery handler for -webkit-background-blend-mode.
+        (WebCore::StyleBuilder::StyleBuilder):
+        * rendering/style/FillLayer.cpp: Added code to store and retrieve the blend mode from a layer.
+        (WebCore::FillLayer::FillLayer):
+        (WebCore::FillLayer::operator=):
+        (WebCore::FillLayer::operator==):
+        (WebCore::FillLayer::fillUnsetProperties):
+        * rendering/style/FillLayer.h: Added function definitions to manage blend mode in a layer.
+        (WebCore::FillLayer::blendMode):
+        (WebCore::FillLayer::isBlendModeSet):
+        (WebCore::FillLayer::setBlendMode):
+        (WebCore::FillLayer::clearBlendMode):
+        (WebCore::FillLayer::initialFillBlendMode):
+        (FillLayer):
+
 2013-02-07  Gavin Peters  <gavinp@chromium.org>
 
         Unreviewed, rolling out r142142.
index a83e6c5f35768482d123133f3acb9424c10bb5ca..d8357d74fa9c02f97a4e87ba16bc29cbf2733250 100644 (file)
@@ -225,6 +225,7 @@ static const CSSPropertyID computedProperties[] = {
     CSSPropertyWebkitBackgroundSize,
 #if ENABLE(CSS_COMPOSITING)
     CSSPropertyWebkitBlendMode,
+    CSSPropertyWebkitBackgroundBlendMode,
 #endif
     CSSPropertyWebkitBorderFit,
     CSSPropertyWebkitBorderHorizontalSpacing,
@@ -2613,6 +2614,18 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
 #if ENABLE(CSS_COMPOSITING)
         case CSSPropertyWebkitBlendMode:
             return cssValuePool().createValue(style->blendMode());
+            
+        case CSSPropertyWebkitBackgroundBlendMode: {
+            const FillLayer* layers = style->backgroundLayers();
+            if (!layers->next())
+                return cssValuePool().createValue(layers->blendMode());
+
+            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+            for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+                list->append(cssValuePool().createValue(currLayer->blendMode()));
+
+            return list.release();
+        }
 #endif
         case CSSPropertyBackground:
             return getBackgroundShorthandValue();
index 8763990fda7e269cefc81c5a31193c71f0c2b924..2098b1e3157f72011a72565c3bcfe24727022a2e 100644 (file)
@@ -2025,7 +2025,11 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
     case CSSPropertyWebkitMaskSize:
     case CSSPropertyWebkitMaskRepeat:
     case CSSPropertyWebkitMaskRepeatX:
-    case CSSPropertyWebkitMaskRepeatY: {
+    case CSSPropertyWebkitMaskRepeatY:
+#if ENABLE(CSS_COMPOSITING)
+    case CSSPropertyWebkitBackgroundBlendMode:
+#endif
+    {
         RefPtr<CSSValue> val1;
         RefPtr<CSSValue> val2;
         CSSPropertyID propId1, propId2;
@@ -4200,6 +4204,18 @@ bool CSSParser::parseFillProperty(CSSPropertyID propId, CSSPropertyID& propId1,
                         m_valueList->next();
                     }
                     break;
+#if ENABLE(CSS_COMPOSITING)
+                case CSSPropertyWebkitBackgroundBlendMode:
+                    if (val->id == CSSValueNormal || val->id == CSSValueMultiply || val->id == CSSValueScreen || val->id == CSSValueOverlay 
+                        || val->id == CSSValueDarken || val->id == CSSValueLighten ||  val->id == CSSValueColorDodge
+                        || val->id == CSSValueColorBurn || val->id == CSSValueHardLight || val->id == CSSValueSoftLight
+                        || val->id == CSSValueDifference || val->id == CSSValueExclusion || val->id == CSSValueHue
+                        || val->id == CSSValueSaturation || val->id == CSSValueColor || val->id == CSSValueLuminosity) {
+                        currValue = cssValuePool().createIdentifierValue(val->id);
+                        m_valueList->next();
+                    }
+                    break;
+#endif
                 case CSSPropertyBackgroundRepeat:
                 case CSSPropertyWebkitMaskRepeat:
                     parseFillRepeat(currValue, currValue2);
index a7aa991e04bb918f1e34c35b7602aca3aa5ce37c..3a402cff75dfe35ce25bd50c8717a5e1e465d06a 100644 (file)
@@ -560,6 +560,7 @@ bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID)
 #endif
 #if ENABLE(CSS_COMPOSITING)
     case CSSPropertyWebkitBlendMode:
+    case CSSPropertyWebkitBackgroundBlendMode:
 #endif
     case CSSPropertyWebkitAlignContent:
     case CSSPropertyWebkitAlignItems:
index aa1f9ded9c0d1e096be3c13f98c07cbe4667b356..ac3fde5615b5b139c8fad14499896d4ad7b666da 100644 (file)
@@ -273,6 +273,7 @@ z-index
 #endif
 #if defined(ENABLE_CSS_COMPOSITING) && ENABLE_CSS_COMPOSITING
 -webkit-blend-mode
+-webkit-background-blend-mode
 #endif
 #if defined(ENABLE_CSS_FILTERS) && ENABLE_CSS_FILTERS
 -webkit-filter
index 0244d8a3ad578f6e13f6cd1dbe6a8d243ed807b0..721fd8e901b5ebbf1cf6cd749fa8f53f1cfba49b 100644 (file)
@@ -115,6 +115,20 @@ void CSSToStyleMap::mapFillComposite(CSSPropertyID, FillLayer* layer, CSSValue*
     layer->setComposite(*primitiveValue);
 }
 
+void CSSToStyleMap::mapFillBlendMode(CSSPropertyID, FillLayer* layer, CSSValue* value)
+{
+    if (value->isInitialValue()) {
+        layer->setBlendMode(FillLayer::initialFillBlendMode(layer->type()));
+        return;
+    }
+
+    if (!value->isPrimitiveValue())
+        return;
+
+    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    layer->setBlendMode(*primitiveValue);
+}
+
 void CSSToStyleMap::mapFillOrigin(CSSPropertyID, FillLayer* layer, CSSValue* value)
 {
     if (value->isInitialValue()) {
index 6bab40bfcd77e125ab08f008f10e7a3e6827914e..3cb12150a843e8a48e39a5b54135759294c41673 100644 (file)
@@ -45,6 +45,7 @@ public:
     void mapFillAttachment(CSSPropertyID, FillLayer*, CSSValue*);
     void mapFillClip(CSSPropertyID, FillLayer*, CSSValue*);
     void mapFillComposite(CSSPropertyID, FillLayer*, CSSValue*);
+    void mapFillBlendMode(CSSPropertyID, FillLayer*, CSSValue*);
     void mapFillOrigin(CSSPropertyID, FillLayer*, CSSValue*);
     void mapFillImage(CSSPropertyID, FillLayer*, CSSValue*);
     void mapFillRepeatX(CSSPropertyID, FillLayer*, CSSValue*);
index 72c7ea230d6c8e20ca3ded8396c8fef7a8d79da9..4d878b2e9b325e25ee36ad8cbf2b200f2f38210a 100644 (file)
@@ -1949,6 +1949,7 @@ StyleBuilder::StyleBuilder()
     setPropertyHandler(CSSPropertyWebkitBackgroundSize, CSSPropertyBackgroundSize);
 #if ENABLE(CSS_COMPOSITING)
     setPropertyHandler(CSSPropertyWebkitBlendMode, ApplyPropertyDefault<BlendMode, &RenderStyle::blendMode, BlendMode, &RenderStyle::setBlendMode, BlendMode, &RenderStyle::initialBlendMode>::createHandler());
+    setPropertyHandler(CSSPropertyWebkitBackgroundBlendMode, ApplyPropertyFillLayer<BlendMode, CSSPropertyWebkitBackgroundBlendMode, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isBlendModeSet, &FillLayer::blendMode, &FillLayer::setBlendMode, &FillLayer::clearBlendMode, &FillLayer::initialFillBlendMode, &CSSToStyleMap::mapFillBlendMode>::createHandler());
 #endif
     setPropertyHandler(CSSPropertyWebkitBorderFit, ApplyPropertyDefault<EBorderFit, &RenderStyle::borderFit, EBorderFit, &RenderStyle::setBorderFit, EBorderFit, &RenderStyle::initialBorderFit>::createHandler());
     setPropertyHandler(CSSPropertyWebkitBorderHorizontalSpacing, ApplyPropertyComputeLength<short, &RenderStyle::horizontalBorderSpacing, &RenderStyle::setHorizontalBorderSpacing, &RenderStyle::initialHorizontalBorderSpacing>::createHandler());
index 035f48e6fcfbc6c7d9292ca88681f8e410d1345a..0b5708834463e71db3005eafe0405eee291b4890 100644 (file)
@@ -53,6 +53,7 @@ FillLayer::FillLayer(EFillLayerType type)
     , m_repeatY(FillLayer::initialFillRepeatY(type))
     , m_composite(FillLayer::initialFillComposite(type))
     , m_sizeType(SizeNone)
+    , m_blendMode(FillLayer::initialFillBlendMode(type))
     , m_imageSet(false)
     , m_attachmentSet(false)
     , m_clipSet(false)
@@ -65,6 +66,7 @@ FillLayer::FillLayer(EFillLayerType type)
     , m_backgroundXOrigin(LeftEdge)
     , m_backgroundYOrigin(TopEdge)
     , m_compositeSet(type == MaskFillLayer)
+    , m_blendModeSet(false)
     , m_type(type)
 {
 }
@@ -82,6 +84,7 @@ FillLayer::FillLayer(const FillLayer& o)
     , m_repeatY(o.m_repeatY)
     , m_composite(o.m_composite)
     , m_sizeType(o.m_sizeType)
+    , m_blendMode(o.m_blendMode)
     , m_imageSet(o.m_imageSet)
     , m_attachmentSet(o.m_attachmentSet)
     , m_clipSet(o.m_clipSet)
@@ -94,6 +97,7 @@ FillLayer::FillLayer(const FillLayer& o)
     , m_backgroundXOrigin(o.m_backgroundXOrigin)
     , m_backgroundYOrigin(o.m_backgroundYOrigin)
     , m_compositeSet(o.m_compositeSet)
+    , m_blendModeSet(o.m_blendModeSet)
     , m_type(o.m_type)
 {
 }
@@ -120,6 +124,7 @@ FillLayer& FillLayer::operator=(const FillLayer& o)
     m_attachment = o.m_attachment;
     m_clip = o.m_clip;
     m_composite = o.m_composite;
+    m_blendMode = o.m_blendMode;
     m_origin = o.m_origin;
     m_repeatX = o.m_repeatX;
     m_repeatY = o.m_repeatY;
@@ -129,6 +134,7 @@ FillLayer& FillLayer::operator=(const FillLayer& o)
     m_attachmentSet = o.m_attachmentSet;
     m_clipSet = o.m_clipSet;
     m_compositeSet = o.m_compositeSet;
+    m_blendModeSet = o.m_blendModeSet;
     m_originSet = o.m_originSet;
     m_repeatXSet = o.m_repeatXSet;
     m_repeatYSet = o.m_repeatYSet;
@@ -146,8 +152,8 @@ bool FillLayer::operator==(const FillLayer& o) const
     // to propagate patterns into layers.  All layer comparisons happen after values have all been filled in anyway.
     return StyleImage::imagesEquivalent(m_image.get(), o.m_image.get()) && m_xPosition == o.m_xPosition && m_yPosition == o.m_yPosition
             && m_backgroundXOrigin == o.m_backgroundXOrigin && m_backgroundYOrigin == o.m_backgroundYOrigin
-            && m_attachment == o.m_attachment && m_clip == o.m_clip
-            && m_composite == o.m_composite && m_origin == o.m_origin && m_repeatX == o.m_repeatX
+            && m_attachment == o.m_attachment && m_clip == o.m_clip && m_composite == o.m_composite
+            && m_blendModeSet == o.m_blendModeSet && m_origin == o.m_origin && m_repeatX == o.m_repeatX
             && m_repeatY == o.m_repeatY && m_sizeType == o.m_sizeType && m_sizeLength == o.m_sizeLength
             && m_type == o.m_type && ((m_next && o.m_next) ? *m_next == *o.m_next : m_next == o.m_next);
 }
@@ -218,6 +224,17 @@ void FillLayer::fillUnsetProperties()
         }
     }
 
+    for (curr = this; curr && curr->isBlendModeSet(); curr = curr->next()) { }
+    if (curr && curr != this) {
+        // We need to fill in the remaining values with the pattern specified.
+        for (FillLayer* pattern = this; curr; curr = curr->next()) {
+            curr->m_blendMode = pattern->m_blendMode;
+            pattern = pattern->next();
+            if (pattern == curr || !pattern)
+                pattern = this;
+        }
+    }
+
     for (curr = this; curr && curr->isOriginSet(); curr = curr->next()) { }
     if (curr && curr != this) {
         // We need to fill in the remaining values with the pattern specified.
index 20d7d3a92a0370578edca49ecb9bf87c46142095..692cf37c860fa6f8ee53ea082fb2ce2bb25ba836 100644 (file)
@@ -76,6 +76,7 @@ public:
     EFillRepeat repeatX() const { return static_cast<EFillRepeat>(m_repeatX); }
     EFillRepeat repeatY() const { return static_cast<EFillRepeat>(m_repeatY); }
     CompositeOperator composite() const { return static_cast<CompositeOperator>(m_composite); }
+    BlendMode blendMode() const { return static_cast<BlendMode>(m_blendMode); }
     LengthSize sizeLength() const { return m_sizeLength; }
     EFillSizeType sizeType() const { return static_cast<EFillSizeType>(m_sizeType); }
     FillSize size() const { return FillSize(static_cast<EFillSizeType>(m_sizeType), m_sizeLength); }
@@ -93,6 +94,7 @@ public:
     bool isRepeatXSet() const { return m_repeatXSet; }
     bool isRepeatYSet() const { return m_repeatYSet; }
     bool isCompositeSet() const { return m_compositeSet; }
+    bool isBlendModeSet() const { return m_blendModeSet; }
     bool isSizeSet() const { return m_sizeType != SizeNone; }
     
     void setImage(PassRefPtr<StyleImage> i) { m_image = i; m_imageSet = true; }
@@ -106,6 +108,7 @@ public:
     void setRepeatX(EFillRepeat r) { m_repeatX = r; m_repeatXSet = true; }
     void setRepeatY(EFillRepeat r) { m_repeatY = r; m_repeatYSet = true; }
     void setComposite(CompositeOperator c) { m_composite = c; m_compositeSet = true; }
+    void setBlendMode(BlendMode b) { m_blendMode = b; m_blendModeSet = true; }
     void setSizeType(EFillSizeType b) { m_sizeType = b; }
     void setSizeLength(LengthSize l) { m_sizeLength = l; }
     void setSize(FillSize f) { m_sizeType = f.type; m_sizeLength = f.size; }
@@ -128,6 +131,7 @@ public:
     void clearRepeatX() { m_repeatXSet = false; }
     void clearRepeatY() { m_repeatYSet = false; }
     void clearComposite() { m_compositeSet = false; }
+    void clearBlendMode() { m_blendModeSet = false; }
     void clearSize() { m_sizeType = SizeNone; }
 
     void setNext(FillLayer* n) { if (m_next != n) { delete m_next; m_next = n; } }
@@ -173,6 +177,7 @@ public:
     static EFillRepeat initialFillRepeatX(EFillLayerType) { return RepeatFill; }
     static EFillRepeat initialFillRepeatY(EFillLayerType) { return RepeatFill; }
     static CompositeOperator initialFillComposite(EFillLayerType) { return CompositeSourceOver; }
+    static BlendMode initialFillBlendMode(EFillLayerType) { return BlendModeNormal; }
     static EFillSizeType initialFillSizeType(EFillLayerType) { return SizeLength; }
     static LengthSize initialFillSizeLength(EFillLayerType) { return LengthSize(); }
     static FillSize initialFillSize(EFillLayerType) { return FillSize(); }
@@ -203,6 +208,7 @@ private:
     unsigned m_repeatY : 3; // EFillRepeat
     unsigned m_composite : 4; // CompositeOperator
     unsigned m_sizeType : 2; // EFillSizeType
+    unsigned m_blendMode : 5; // BlendMode
     
     unsigned m_imageSet : 1;
     unsigned m_attachmentSet : 1;
@@ -216,6 +222,7 @@ private:
     unsigned m_backgroundXOrigin : 2; // BackgroundEdgeOrigin
     unsigned m_backgroundYOrigin : 2; // BackgroundEdgeOrigin
     unsigned m_compositeSet : 1;
+    unsigned m_blendModeSet : 1;
     
     unsigned m_type : 1; // EFillLayerType