2011-04-14 Renata Hodovan <reni@webkit.org>
authorreni@webkit.org <reni@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Apr 2011 07:14:57 +0000 (07:14 +0000)
committerreni@webkit.org <reni@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Apr 2011 07:14:57 +0000 (07:14 +0000)
        Reviewed by Nikolas Zimmermann.

        CSS related SVG*Element changes doesn't require relayout
        https://bugs.webkit.org/show_bug.cgi?id=56906

        Testing inherited CSS related SVG property changes by FEFlood, FESpecularLighting and FEDiffuseLighing filters.
        Adding a missing test to check the dynamic update of lighting-color property of FESpecularLighting.
        All the other modifications are covered by the existing dyanmic-update tests.

        * platform/mac/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.checksum: Added.
        * platform/mac/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.png: Added.
        * platform/mac/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.checksum: Added.
        * platform/mac/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.png: Added.
        * platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.checksum: Added.
        * platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.png: Added.
        * platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.checksum: Added.
        * platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.png: Added.
        * svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.txt: Added.
        * svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.html: Added.
        * svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.txt: Added.
        * svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color.html: Added.
        * svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.txt: Added.
        * svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.html: Added.
        * svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.txt: Added.
        * svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop.html: Added.
        * svg/dynamic-updates/script-tests/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.js: Added.
        (executeTest):
        * svg/dynamic-updates/script-tests/SVGFEFloodElement-inherit-flood-color-css-prop.js: Added.
        (executeTest):
        * svg/dynamic-updates/script-tests/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.js: Added.
        (executeTest):
        * svg/dynamic-updates/script-tests/SVGFESpecularLightingElement-lighting-color-css-prop.js: Added.
        (executeTest):
2011-04-14  Renata Hodovan  <reni@webkit.org>

        Reviewed by Nikolas Zimmermann.

        CSS related SVG*Element changes doesn't require relayout
        https://bugs.webkit.org/show_bug.cgi?id=56906

        The changes of some CSS related SVGFilter properties e.g. lighting_color, flood_color, flood_opacity
        need only repaint. To avoid the default invalidation of filters in SVGResourceCache::clientStyleChange()
        we need an early return. So RenderSVGResourceFilterPrimitive::styleDidChange() can handle these properties
        via RenderSVGResourceFilter::primitiveAttributeChanged() the same way like we do it for the other SVGAttributes.

        Tests: svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.html
               svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color.html
               svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.html
               svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop.html

        * platform/graphics/filters/FEFlood.cpp:
        (WebCore::FEFlood::setFloodColor):
        (WebCore::FEFlood::setFloodOpacity):
        * platform/graphics/filters/FEFlood.h:
        * platform/graphics/filters/FESpecularLighting.cpp:
        (WebCore::FESpecularLighting::setLightingColor):
        * platform/graphics/filters/FESpecularLighting.h:
        * rendering/svg/RenderSVGResourceFilterPrimitive.cpp:
        (WebCore::RenderSVGResourceFilterPrimitive::styleDidChange):
        * rendering/svg/RenderSVGResourceFilterPrimitive.h:
        * rendering/svg/SVGResourcesCache.cpp:
        (WebCore::SVGResourcesCache::clientStyleChanged):
        * svg/SVGFEDiffuseLightingElement.cpp:
        (WebCore::SVGFEDiffuseLightingElement::setFilterEffectAttribute):
        * svg/SVGFEFloodElement.cpp:
        (WebCore::SVGFEFloodElement::setFilterEffectAttribute):
        * svg/SVGFEFloodElement.h:
        * svg/SVGFESpecularLightingElement.cpp:
        (WebCore::SVGFESpecularLightingElement::setFilterEffectAttribute):

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

33 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.png [new file with mode: 0644]
LayoutTests/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.txt [new file with mode: 0644]
LayoutTests/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.html [new file with mode: 0644]
LayoutTests/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.txt [new file with mode: 0644]
LayoutTests/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color.html [new file with mode: 0644]
LayoutTests/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.txt [new file with mode: 0644]
LayoutTests/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.html [new file with mode: 0644]
LayoutTests/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.txt [new file with mode: 0644]
LayoutTests/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop.html [new file with mode: 0644]
LayoutTests/svg/dynamic-updates/script-tests/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.js [new file with mode: 0644]
LayoutTests/svg/dynamic-updates/script-tests/SVGFEFloodElement-inherit-flood-color-css-prop.js [new file with mode: 0644]
LayoutTests/svg/dynamic-updates/script-tests/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.js [new file with mode: 0644]
LayoutTests/svg/dynamic-updates/script-tests/SVGFESpecularLightingElement-lighting-color-css-prop.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/filters/FEFlood.cpp
Source/WebCore/platform/graphics/filters/FEFlood.h
Source/WebCore/platform/graphics/filters/FESpecularLighting.cpp
Source/WebCore/platform/graphics/filters/FESpecularLighting.h
Source/WebCore/rendering/svg/RenderSVGResourceFilterPrimitive.cpp
Source/WebCore/rendering/svg/RenderSVGResourceFilterPrimitive.h
Source/WebCore/rendering/svg/SVGResourcesCache.cpp
Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp
Source/WebCore/svg/SVGFEFloodElement.cpp
Source/WebCore/svg/SVGFEFloodElement.h
Source/WebCore/svg/SVGFESpecularLightingElement.cpp

index dd6384d..3794fdb 100644 (file)
@@ -1,3 +1,39 @@
+2011-04-14  Renata Hodovan  <reni@webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        CSS related SVG*Element changes doesn't require relayout
+        https://bugs.webkit.org/show_bug.cgi?id=56906
+
+        Testing inherited CSS related SVG property changes by FEFlood, FESpecularLighting and FEDiffuseLighing filters.
+        Adding a missing test to check the dynamic update of lighting-color property of FESpecularLighting.
+        All the other modifications are covered by the existing dyanmic-update tests.
+
+        * platform/mac/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.checksum: Added.
+        * platform/mac/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.png: Added.
+        * platform/mac/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.checksum: Added.
+        * platform/mac/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.png: Added.
+        * platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.checksum: Added.
+        * platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.png: Added.
+        * platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.checksum: Added.
+        * platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.png: Added.
+        * svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.txt: Added.
+        * svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.html: Added.
+        * svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.txt: Added.
+        * svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color.html: Added.
+        * svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.txt: Added.
+        * svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.html: Added.
+        * svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.txt: Added.
+        * svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop.html: Added.
+        * svg/dynamic-updates/script-tests/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.js: Added.
+        (executeTest):
+        * svg/dynamic-updates/script-tests/SVGFEFloodElement-inherit-flood-color-css-prop.js: Added.
+        (executeTest):
+        * svg/dynamic-updates/script-tests/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.js: Added.
+        (executeTest):
+        * svg/dynamic-updates/script-tests/SVGFESpecularLightingElement-lighting-color-css-prop.js: Added.
+        (executeTest):
+
 2011-04-13  James Robinson  <jamesr@chromium.org>
 
         Reviewed by Simon Fraser.
diff --git a/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.checksum b/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.checksum
new file mode 100644 (file)
index 0000000..13e65bf
--- /dev/null
@@ -0,0 +1 @@
+ed98f0b5d307c65048203716a24db886
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.png b/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.png
new file mode 100644 (file)
index 0000000..884631a
Binary files /dev/null and b/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.checksum b/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.checksum
new file mode 100644 (file)
index 0000000..a7b59a4
--- /dev/null
@@ -0,0 +1 @@
+6e83f3ce6218c0436c8b7c7aad7059f8
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.png b/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.png
new file mode 100644 (file)
index 0000000..598762a
Binary files /dev/null and b/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.checksum b/LayoutTests/platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.checksum
new file mode 100644 (file)
index 0000000..1edc418
--- /dev/null
@@ -0,0 +1 @@
+8233e8dc288e42bc15e9978485778530
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.png b/LayoutTests/platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.png
new file mode 100644 (file)
index 0000000..9220ec3
Binary files /dev/null and b/LayoutTests/platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.checksum b/LayoutTests/platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.checksum
new file mode 100644 (file)
index 0000000..1805a43
--- /dev/null
@@ -0,0 +1 @@
+45022fd0b20a79da03e0642fb88e910f
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.png b/LayoutTests/platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.png
new file mode 100644 (file)
index 0000000..c53f4a2
Binary files /dev/null and b/LayoutTests/platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.png differ
diff --git a/LayoutTests/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.txt b/LayoutTests/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.txt
new file mode 100644 (file)
index 0000000..5831f35
--- /dev/null
@@ -0,0 +1,13 @@
+SVG 1.1 dynamic update tests
+
+Tests dynamic updates of the inherited 'lighting-color' css property of the SVGFEDiffuseLightingElement object
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.defaultView.getComputedStyle(gradientElement).getPropertyValue('lighting-color') is "rgb(255, 0, 0)"
+PASS document.defaultView.getComputedStyle(gradientElement).getPropertyValue('lighting-color') is "rgb(255, 255, 0)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.html b/LayoutTests/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.html
new file mode 100644 (file)
index 0000000..c3b5b6e
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="resources/SVGTestCase.js"></script>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<h1>SVG 1.1 dynamic update tests</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.txt b/LayoutTests/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.txt
new file mode 100644 (file)
index 0000000..d472051
--- /dev/null
@@ -0,0 +1,13 @@
+SVG 1.1 dynamic update tests
+
+Tests dynamic updates of the inherited 'flood-color' attribute of the SVGFEFloodElement object
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.defaultView.getComputedStyle(floodElement).getPropertyValue('flood-color') is "rgb(145, 32, 103)"
+PASS document.defaultView.getComputedStyle(floodElement).getPropertyValue('flood-color') is "rgb(64, 128, 103)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color.html b/LayoutTests/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color.html
new file mode 100644 (file)
index 0000000..63441ff
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="resources/SVGTestCase.js"></script>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<h1>SVG 1.1 dynamic update tests</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/SVGFEFloodElement-inherit-flood-color-css-prop.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.txt b/LayoutTests/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.txt
new file mode 100644 (file)
index 0000000..6cf6e30
--- /dev/null
@@ -0,0 +1,13 @@
+SVG 1.1 dynamic update tests
+
+Tests dynamic updates of the inherited 'lighting-color' attribute of the SVGFESpecularLightingElement object
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.defaultView.getComputedStyle(specularElement).getPropertyValue('lighting-color') is "rgb(255, 0, 0)"
+PASS document.defaultView.getComputedStyle(specularElement).getPropertyValue('lighting-color') is "rgb(173, 255, 47)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.html b/LayoutTests/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.html
new file mode 100644 (file)
index 0000000..43cf56f
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="resources/SVGTestCase.js"></script>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<h1>SVG 1.1 dynamic update tests</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.txt b/LayoutTests/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.txt
new file mode 100644 (file)
index 0000000..4611494
--- /dev/null
@@ -0,0 +1,13 @@
+SVG 1.1 dynamic update tests
+
+Tests dynamic updates of the 'lighting-color' attribute of the SVGFESpecularLightingElement object
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.defaultView.getComputedStyle(specularElement).getPropertyValue('lighting-color') is "rgb(255, 255, 0)"
+PASS document.defaultView.getComputedStyle(specularElement).getPropertyValue('lighting-color') is "rgb(173, 255, 47)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop.html b/LayoutTests/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop.html
new file mode 100644 (file)
index 0000000..9e2e8ad
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="resources/SVGTestCase.js"></script>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<h1>SVG 1.1 dynamic update tests</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/SVGFESpecularLightingElement-lighting-color-css-prop.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/svg/dynamic-updates/script-tests/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.js b/LayoutTests/svg/dynamic-updates/script-tests/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.js
new file mode 100644 (file)
index 0000000..9abcb2e
--- /dev/null
@@ -0,0 +1,60 @@
+// [Name] SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.js
+// [Expected rendering result] A shining circle (performed by diffuse lighting) - and a series of PASS messages
+
+description("Tests dynamic updates of the inherited 'lighting-color' css property of the SVGFEDiffuseLightingElement object");
+createSVGTestCase();
+
+var pointLight = createSVGElement("fePointLight");
+pointLight.setAttribute("x", "100");
+pointLight.setAttribute("y", "180");
+pointLight.setAttribute("z", "30");
+
+var blurElement = createSVGElement("feGaussianBlur");
+blurElement.setAttribute("in", "SourceGraphic");
+blurElement.setAttribute("stdDeviation", "2");
+blurElement.setAttribute("result", "blur");
+
+var gradientElement = createSVGElement("feDiffuseLighting");
+gradientElement.setAttribute("in", "blur");
+gradientElement.setAttribute("surfaceScale", "1");
+gradientElement.setAttribute("diffuseConstant", "1");
+gradientElement.setAttribute("lighting-color", "inherit");
+gradientElement.appendChild(pointLight);
+
+var filterElement = createSVGElement("filter");
+filterElement.setAttribute("id", "myFilter");
+filterElement.setAttribute("filterUnits", "userSpaceOnUse");
+filterElement.setAttribute("x", "0");
+filterElement.setAttribute("y", "0");
+filterElement.setAttribute("width", "200");
+filterElement.setAttribute("height", "200");
+filterElement.setAttribute("style", "lighting-color:red");
+filterElement.appendChild(blurElement);
+filterElement.appendChild(gradientElement);
+
+var defsElement = createSVGElement("defs");
+defsElement.appendChild(filterElement);
+
+rootSVGElement.appendChild(defsElement);
+
+var rectElement = createSVGElement("circle");
+rectElement.setAttribute("width", 200);
+rectElement.setAttribute("height", 200);
+rectElement.setAttribute("cx", "100");
+rectElement.setAttribute("cy", "60");
+rectElement.setAttribute("r", "50");
+rectElement.setAttribute("filter", "url(#myFilter)");
+rootSVGElement.appendChild(rectElement);
+
+shouldBeEqualToString("document.defaultView.getComputedStyle(gradientElement).getPropertyValue('lighting-color')", "rgb(255, 0, 0)");
+
+function executeTest() {
+    gradientElement.style.setProperty("lighting-color", "yellow", "");
+    shouldBeEqualToString("document.defaultView.getComputedStyle(gradientElement).getPropertyValue('lighting-color')", "rgb(255, 255, 0)");
+
+    completeTest();
+}
+
+startTest(rectElement, 100, 100);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/svg/dynamic-updates/script-tests/SVGFEFloodElement-inherit-flood-color-css-prop.js b/LayoutTests/svg/dynamic-updates/script-tests/SVGFEFloodElement-inherit-flood-color-css-prop.js
new file mode 100644 (file)
index 0000000..8f12b9d
--- /dev/null
@@ -0,0 +1,49 @@
+// [Name] SVGFEFLoodElement-inherit-flood-color-attr.js
+// [Expected rendering result] A simple rect with feFlood filter - and a series of PASS messages
+
+description("Tests dynamic updates of the inherited 'flood-color' attribute of the SVGFEFloodElement object")
+createSVGTestCase();
+
+var floodElement = createSVGElement("feFlood");
+floodElement.setAttribute("flood-color", "inherit");
+floodElement.setAttribute("flood-opacity", ".8");
+
+var filterElement = createSVGElement("filter");
+filterElement.setAttribute("id", "myFilter");
+filterElement.setAttribute("filterUnits", "userSpaceOnUse");
+filterElement.setAttribute("x", "0");
+filterElement.setAttribute("y", "0");
+filterElement.setAttribute("width", "200");
+filterElement.setAttribute("height", "200");
+filterElement.setAttribute("style", "flood-color:rgb(145, 32, 103)");
+filterElement.appendChild(floodElement);
+
+var defsElement = createSVGElement("defs");
+defsElement.appendChild(filterElement);
+
+rootSVGElement.appendChild(defsElement);
+rootSVGElement.setAttribute("width", "700");
+rootSVGElement.setAttribute("height", "200");
+
+var rectElement = createSVGElement("rect");
+rectElement.setAttribute("x", 60);
+rectElement.setAttribute("y", 100);
+rectElement.setAttribute("width", 100);
+rectElement.setAttribute("height", 100);
+rectElement.setAttribute("stroke", "#AF1E9D");
+rectElement.setAttribute("stroke-width", "8");
+rectElement.setAttribute("filter", "url(#myFilter)");
+rootSVGElement.appendChild(rectElement);
+
+shouldBeEqualToString("document.defaultView.getComputedStyle(floodElement).getPropertyValue('flood-color')", "rgb(145, 32, 103)");
+
+function executeTest() {
+    filterElement.setAttribute("style", "flood-color:rgb(64, 128, 103)");
+    shouldBeEqualToString("document.defaultView.getComputedStyle(floodElement).getPropertyValue('flood-color')", "rgb(64, 128, 103)");
+
+    completeTest();
+}
+
+startTest(rootSVGElement, 100, 100);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/svg/dynamic-updates/script-tests/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.js b/LayoutTests/svg/dynamic-updates/script-tests/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.js
new file mode 100644 (file)
index 0000000..c9a2a69
--- /dev/null
@@ -0,0 +1,68 @@
+// [Name] SVGFESpecularLightingElement-inhertit-lighting-color-css-prop.js
+// [Expected rendering result] A shining circle - and a series of PASS messages
+
+description("Tests dynamic updates of the inherited 'lighting-color' attribute of the SVGFESpecularLightingElement object")
+createSVGTestCase();
+
+var distantElement = createSVGElement("feDistantLight");
+distantElement.setAttribute("azimuth", "45");
+distantElement.setAttribute("elevation", "45");
+
+var specularElement = createSVGElement("feSpecularLighting");
+specularElement.setAttribute("in", "SourceGraphic");
+specularElement.setAttribute("specularConstant", "1");
+specularElement.setAttribute("specularExponent", "1");
+specularElement.setAttribute("surfaceScale", "1");
+specularElement.setAttribute("lighting-color", "inherit");
+specularElement.appendChild(distantElement);
+
+var filterElement = createSVGElement("filter");
+filterElement.setAttribute("id", "myFilter");
+filterElement.setAttribute("filterUnits", "objectBoundingBox");
+filterElement.setAttribute("x", "0%");
+filterElement.setAttribute("y", "0%");
+filterElement.setAttribute("width", "100%");
+filterElement.setAttribute("height", "100%");
+filterElement.setAttribute("style", "lighting-color:red");
+filterElement.appendChild(specularElement);
+
+var defsElement = createSVGElement("defs");
+defsElement.appendChild(filterElement);
+
+rootSVGElement.appendChild(defsElement);
+rootSVGElement.setAttribute("width", "200");
+rootSVGElement.setAttribute("height", "200");
+
+var gElement = createSVGElement("g");
+gElement.setAttribute("fill", "black");
+
+var backgroundElement = createSVGElement("rect");
+backgroundElement.setAttribute("x", 60);
+backgroundElement.setAttribute("y", 20);
+backgroundElement.setAttribute("width", 100);
+backgroundElement.setAttribute("height", 60);
+gElement.appendChild(backgroundElement);
+rootSVGElement.appendChild(gElement);
+
+var rectElement = createSVGElement("image");
+rectElement.setAttribute("x", 60);
+rectElement.setAttribute("y", 20);
+rectElement.setAttribute("width", 100);
+rectElement.setAttribute("height", 60);
+rectElement.setAttributeNS(xlinkNS, "xlink:href", "../W3C-SVG-1.1/resources/bumpMap2.png");
+rectElement.setAttribute("filter", "url(#myFilter)");
+rootSVGElement.appendChild(rectElement);
+
+shouldBeEqualToString("document.defaultView.getComputedStyle(specularElement).getPropertyValue('lighting-color')", "rgb(255, 0, 0)");
+
+function executeTest() {
+    filterElement.setAttribute("style", "lighting-color:rgb(173, 255, 47)");
+//    specularElement.style.setProperty("lighting-color", "greenyellow", "");
+    shouldBeEqualToString("document.defaultView.getComputedStyle(specularElement).getPropertyValue('lighting-color')", "rgb(173, 255, 47)");
+
+    completeTest();
+}
+
+startTest(rootSVGElement, 100, 100);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/svg/dynamic-updates/script-tests/SVGFESpecularLightingElement-lighting-color-css-prop.js b/LayoutTests/svg/dynamic-updates/script-tests/SVGFESpecularLightingElement-lighting-color-css-prop.js
new file mode 100644 (file)
index 0000000..ec6f171
--- /dev/null
@@ -0,0 +1,66 @@
+// [Name] SVGFESpecularLightingElement-lighting-color-css-prop.js
+// [Expected rendering result] A shining circle - and a series of PASS messages
+
+description("Tests dynamic updates of the 'lighting-color' attribute of the SVGFESpecularLightingElement object")
+createSVGTestCase();
+
+var distantElement = createSVGElement("feDistantLight");
+distantElement.setAttribute("azimuth", "45");
+distantElement.setAttribute("elevation", "45");
+
+var specularElement = createSVGElement("feSpecularLighting");
+specularElement.setAttribute("in", "SourceGraphic");
+specularElement.setAttribute("specularConstant", "1");
+specularElement.setAttribute("specularExponent", "1");
+specularElement.setAttribute("surfaceScale", "1");
+specularElement.setAttribute("lighting-color", "rgb(255, 255, 0)");
+specularElement.appendChild(distantElement);
+
+var filterElement = createSVGElement("filter");
+filterElement.setAttribute("id", "myFilter");
+filterElement.setAttribute("filterUnits", "objectBoundingBox");
+filterElement.setAttribute("x", "0%");
+filterElement.setAttribute("y", "0%");
+filterElement.setAttribute("width", "100%");
+filterElement.setAttribute("height", "100%");
+filterElement.appendChild(specularElement);
+
+var defsElement = createSVGElement("defs");
+defsElement.appendChild(filterElement);
+
+rootSVGElement.appendChild(defsElement);
+rootSVGElement.setAttribute("width", "200");
+rootSVGElement.setAttribute("height", "200");
+
+var gElement = createSVGElement("g");
+gElement.setAttribute("fill", "black");
+
+var backgroundElement = createSVGElement("rect");
+backgroundElement.setAttribute("x", 60);
+backgroundElement.setAttribute("y", 20);
+backgroundElement.setAttribute("width", 100);
+backgroundElement.setAttribute("height", 60);
+gElement.appendChild(backgroundElement);
+rootSVGElement.appendChild(gElement);
+
+var rectElement = createSVGElement("image");
+rectElement.setAttribute("x", 60);
+rectElement.setAttribute("y", 20);
+rectElement.setAttribute("width", 100);
+rectElement.setAttribute("height", 60);
+rectElement.setAttributeNS(xlinkNS, "xlink:href", "../W3C-SVG-1.1/resources/bumpMap2.png");
+rectElement.setAttribute("filter", "url(#myFilter)");
+rootSVGElement.appendChild(rectElement);
+
+shouldBeEqualToString("document.defaultView.getComputedStyle(specularElement).getPropertyValue('lighting-color')", "rgb(255, 255, 0)");
+
+function executeTest() {
+    specularElement.style.setProperty("lighting-color", "greenyellow", "");
+    shouldBeEqualToString("document.defaultView.getComputedStyle(specularElement).getPropertyValue('lighting-color')", "rgb(173, 255, 47)");
+
+    completeTest();
+}
+
+startTest(rootSVGElement, 100, 100);
+
+var successfullyParsed = true;
index 57c33c3..5191cd9 100644 (file)
@@ -1,3 +1,40 @@
+2011-04-14  Renata Hodovan  <reni@webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        CSS related SVG*Element changes doesn't require relayout
+        https://bugs.webkit.org/show_bug.cgi?id=56906
+
+        The changes of some CSS related SVGFilter properties e.g. lighting_color, flood_color, flood_opacity
+        need only repaint. To avoid the default invalidation of filters in SVGResourceCache::clientStyleChange()
+        we need an early return. So RenderSVGResourceFilterPrimitive::styleDidChange() can handle these properties
+        via RenderSVGResourceFilter::primitiveAttributeChanged() the same way like we do it for the other SVGAttributes.
+
+        Tests: svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.html
+               svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color.html
+               svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.html
+               svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop.html
+
+        * platform/graphics/filters/FEFlood.cpp:
+        (WebCore::FEFlood::setFloodColor):
+        (WebCore::FEFlood::setFloodOpacity):
+        * platform/graphics/filters/FEFlood.h:
+        * platform/graphics/filters/FESpecularLighting.cpp:
+        (WebCore::FESpecularLighting::setLightingColor):
+        * platform/graphics/filters/FESpecularLighting.h:
+        * rendering/svg/RenderSVGResourceFilterPrimitive.cpp:
+        (WebCore::RenderSVGResourceFilterPrimitive::styleDidChange):
+        * rendering/svg/RenderSVGResourceFilterPrimitive.h:
+        * rendering/svg/SVGResourcesCache.cpp:
+        (WebCore::SVGResourcesCache::clientStyleChanged):
+        * svg/SVGFEDiffuseLightingElement.cpp:
+        (WebCore::SVGFEDiffuseLightingElement::setFilterEffectAttribute):
+        * svg/SVGFEFloodElement.cpp:
+        (WebCore::SVGFEFloodElement::setFilterEffectAttribute):
+        * svg/SVGFEFloodElement.h:
+        * svg/SVGFESpecularLightingElement.cpp:
+        (WebCore::SVGFESpecularLightingElement::setFilterEffectAttribute):
+
 2011-04-13  James Robinson  <jamesr@chromium.org>
 
         Reviewed by Simon Fraser.
index 3c48cf9..d832d2b 100644 (file)
@@ -49,9 +49,12 @@ Color FEFlood::floodColor() const
     return m_floodColor;
 }
 
-void FEFlood::setFloodColor(const Color& color)
+bool FEFlood::setFloodColor(const Color& color)
 {
+    if (m_floodColor == color)
+        return false;
     m_floodColor = color;
+    return true;
 }
 
 float FEFlood::floodOpacity() const
@@ -59,9 +62,12 @@ float FEFlood::floodOpacity() const
     return m_floodOpacity;
 }
 
-void FEFlood::setFloodOpacity(float floodOpacity)
+bool FEFlood::setFloodOpacity(float floodOpacity)
 {
+    if (m_floodOpacity == floodOpacity)
+        return false;
     m_floodOpacity = floodOpacity;
+    return true;
 }
 
 void FEFlood::apply()
index 2e8824f..cac4153 100644 (file)
@@ -34,10 +34,10 @@ public:
     static PassRefPtr<FEFlood> create(Filter* filter, const Color&, float);
 
     Color floodColor() const;
-    void setFloodColor(const Color &);
+    bool setFloodColor(const Color &);
 
     float floodOpacity() const;
-    void setFloodOpacity(float);
+    bool setFloodOpacity(float);
 
     virtual void apply();
     virtual void dump();
index a20eb8c..2c7b1eb 100644 (file)
@@ -54,9 +54,12 @@ Color FESpecularLighting::lightingColor() const
     return m_lightingColor;
 }
 
-void FESpecularLighting::setLightingColor(const Color& lightingColor)
+bool FESpecularLighting::setLightingColor(const Color& lightingColor)
 {
+    if (m_lightingColor == lightingColor)
+        return false;
     m_lightingColor = lightingColor;
+    return true;
 }
 
 float FESpecularLighting::surfaceScale() const
index 9d3ea2d..9fa3add 100644 (file)
@@ -34,7 +34,7 @@ public:
     virtual ~FESpecularLighting();
 
     Color lightingColor() const;
-    void setLightingColor(const Color&);
+    bool setLightingColor(const Color&);
 
     float surfaceScale() const;
     bool setSurfaceScale(float);
index 64df700..f077bfd 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2010 University of Szeged
  * Copyright (C) 2010 Zoltan Herczeg
+ * Copyright (C) 2011 Renata Hodovan (reni@webkit.org)
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #include "RenderSVGResource.h"
 #include "SVGFEImage.h"
 #include "SVGFilter.h"
+#include "SVGNames.h"
 
 namespace WebCore {
 
+
+void RenderSVGResourceFilterPrimitive::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
+{
+    RenderSVGHiddenContainer::styleDidChange(diff, oldStyle);
+
+    RenderObject* filter = parent();
+    if (!filter)
+        return;
+    ASSERT(filter->isSVGResourceFilter());
+
+    if (diff == StyleDifferenceEqual || !oldStyle)
+        return;
+
+    const SVGRenderStyle* newStyle = this->style()->svgStyle();
+    if (node()->hasTagName(SVGNames::feFloodTag)) {
+        if (newStyle->floodColor() != oldStyle->svgStyle()->floodColor())
+            static_cast<RenderSVGResourceFilter*>(filter)->primitiveAttributeChanged(this, SVGNames::flood_colorAttr);
+        if (newStyle->floodOpacity() != oldStyle->svgStyle()->floodOpacity())
+            static_cast<RenderSVGResourceFilter*>(filter)->primitiveAttributeChanged(this, SVGNames::flood_opacityAttr);
+    } else if (node()->hasTagName(SVGNames::feDiffuseLightingTag) || node()->hasTagName(SVGNames::feSpecularLightingTag)) {
+        if (newStyle->lightingColor() != oldStyle->svgStyle()->lightingColor())
+            static_cast<RenderSVGResourceFilter*>(filter)->primitiveAttributeChanged(this, SVGNames::lighting_colorAttr);
+    }
+}
+
 FloatRect RenderSVGResourceFilterPrimitive::determineFilterPrimitiveSubregion(FilterEffect* effect)
 {
     FloatRect uniteRect;
index 8176d29..e8e4efc 100644 (file)
@@ -43,6 +43,8 @@ public:
     {
     }
 
+    virtual void styleDidChange(StyleDifference, const RenderStyle*);
+
     virtual const char* renderName() const { return "RenderSVGResourceFilterPrimitive"; }
     virtual bool isSVGResourceFilterPrimitive() const { return true; }
 
index 886f76a..74d2950 100644 (file)
@@ -126,6 +126,10 @@ void SVGResourcesCache::clientStyleChanged(RenderObject* renderer, StyleDifferen
     if (diff == StyleDifferenceEqual)
         return;
 
+    // In this case the proper SVGFE*Element will imply whether the modifided CSS properties implies a relayout or repaint.
+    if (renderer->isSVGResourceFilterPrimitive() && diff == StyleDifferenceRepaint)
+        return;
+
     clientUpdatedFromElement(renderer, newStyle);
     RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer, false);
 }
index a4c2a6b..f58be8f 100644 (file)
@@ -87,14 +87,17 @@ void SVGFEDiffuseLightingElement::parseMappedAttribute(Attribute* attr)
 bool SVGFEDiffuseLightingElement::setFilterEffectAttribute(FilterEffect* effect, const QualifiedName& attrName)
 {
     FEDiffuseLighting* diffuseLighting = static_cast<FEDiffuseLighting*>(effect);
+
+    if (attrName == SVGNames::lighting_colorAttr) {
+        RenderObject* renderer = this->renderer();
+        ASSERT(renderer);
+        ASSERT(renderer->style());
+        return diffuseLighting->setLightingColor(renderer->style()->svgStyle()->lightingColor());
+    }
     if (attrName == SVGNames::surfaceScaleAttr)
         return diffuseLighting->setSurfaceScale(surfaceScale());
     if (attrName == SVGNames::diffuseConstantAttr)
         return diffuseLighting->setDiffuseConstant(diffuseConstant());
-    if (attrName == SVGNames::lighting_colorAttr) {
-        RefPtr<RenderStyle> filterStyle = styleForRenderer();
-        return diffuseLighting->setLightingColor(filterStyle->svgStyle()->lightingColor());
-    }
 
     LightSource* lightSource = const_cast<LightSource*>(diffuseLighting->lightSource());
     const SVGFELightElement* lightElement = SVGFELightElement::findLightElement(this);
index eb20927..bb676a9 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "Attribute.h"
 #include "RenderStyle.h"
+#include "SVGNames.h"
 #include "SVGRenderStyle.h"
 
 namespace WebCore {
@@ -39,6 +40,24 @@ PassRefPtr<SVGFEFloodElement> SVGFEFloodElement::create(const QualifiedName& tag
     return adoptRef(new SVGFEFloodElement(tagName, document));
 }
 
+
+bool SVGFEFloodElement::setFilterEffectAttribute(FilterEffect* effect, const QualifiedName& attrName)
+{
+    RenderObject* renderer = this->renderer();
+    ASSERT(renderer);
+    RenderStyle* style = renderer->style();
+    ASSERT(style);
+    FEFlood* flood = static_cast<FEFlood*>(effect);
+
+    if (attrName == SVGNames::flood_colorAttr)
+        return flood->setFloodColor(style->svgStyle()->floodColor());
+    if (attrName == SVGNames::flood_opacityAttr)
+        return flood->setFloodOpacity(style->svgStyle()->floodOpacity());
+
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
 PassRefPtr<FilterEffect> SVGFEFloodElement::build(SVGFilterBuilder*, Filter* filter)
 {
     RefPtr<RenderStyle> filterStyle = styleForRenderer();
index f7c7987..e98e7b3 100644 (file)
@@ -36,6 +36,7 @@ private:
 
     virtual void fillAttributeToPropertyTypeMap();
     virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap();
+    virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName);
     virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
 };
 
index 60684ed..bdc75b1 100644 (file)
@@ -92,6 +92,13 @@ void SVGFESpecularLightingElement::parseMappedAttribute(Attribute* attr)
 bool SVGFESpecularLightingElement::setFilterEffectAttribute(FilterEffect* effect, const QualifiedName& attrName)
 {
     FESpecularLighting* specularLighting = static_cast<FESpecularLighting*>(effect);
+
+    if (attrName == SVGNames::lighting_colorAttr) {
+        RenderObject* renderer = this->renderer();
+        ASSERT(renderer);
+        ASSERT(renderer->style());
+        return specularLighting->setLightingColor(renderer->style()->svgStyle()->lightingColor());
+    }
     if (attrName == SVGNames::surfaceScaleAttr)
         return specularLighting->setSurfaceScale(surfaceScale());
     if (attrName == SVGNames::specularConstantAttr)