WebCore: SVGFEImageElement doesn't support dynamic invalidation
authorreni@webkit.org <reni@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Nov 2010 16:10:35 +0000 (16:10 +0000)
committerreni@webkit.org <reni@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Nov 2010 16:10:35 +0000 (16:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=49536

Patch by Renata Hodovan <reni@webkit.org> on 2010-11-15
Reviewed by Andreas Kling.

The dynamic changes are captured by the svgAttributeChanged function. Invalidate the filter primitive if necessary.

Tests: svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr.html
       svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop.html

* svg/SVGFEImageElement.cpp:
(WebCore::SVGFEImageElement::svgAttributeChanged):
* svg/SVGFEImageElement.h:

LayoutTests: SVGFEImageElement doesn't support dynamic invalidation, when attributes change.
https://bugs.webkit.org/show_bug.cgi?id=49536

Patch by Renata Hodovan <reni@webkit.org> on 2010-11-15
Reviewed by Andreas Kling.

Adding layout tests for feImage dynamic changes.

* platform/mac/svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr-expected.checksum: Added.
* platform/mac/svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr-expected.png: Added.
* platform/mac/svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop-expected.checksum: Added.
* platform/mac/svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop-expected.png: Added.
* svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr-expected.txt: Added.
* svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr.html: Added.
* svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop-expected.txt: Added.
* svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop.html: Added.
* svg/dynamic-updates/script-tests/SVGFEImageElement-dom-preserveAspectRatio-attr.js: Added.
(executeTest):
* svg/dynamic-updates/script-tests/SVGFEImageElement-svgdom-preserveAspectRatio-prop.js: Added.
(executeTest):

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

14 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop-expected.png [new file with mode: 0644]
LayoutTests/svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr-expected.txt [new file with mode: 0644]
LayoutTests/svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr.html [new file with mode: 0644]
LayoutTests/svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop-expected.txt [new file with mode: 0644]
LayoutTests/svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop.html [new file with mode: 0644]
LayoutTests/svg/dynamic-updates/script-tests/SVGFEImageElement-dom-preserveAspectRatio-attr.js [new file with mode: 0644]
LayoutTests/svg/dynamic-updates/script-tests/SVGFEImageElement-svgdom-preserveAspectRatio-prop.js [new file with mode: 0644]
WebCore/ChangeLog
WebCore/svg/SVGFEImageElement.cpp
WebCore/svg/SVGFEImageElement.h

index 99d9fa2..0abcfef 100644 (file)
@@ -1,3 +1,25 @@
+2010-11-15  Renata Hodovan  <reni@webkit.org>
+
+        Reviewed by Andreas Kling.
+
+        SVGFEImageElement doesn't support dynamic invalidation, when attributes change.
+        https://bugs.webkit.org/show_bug.cgi?id=49536
+
+        Adding layout tests for feImage dynamic changes.
+
+        * platform/mac/svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr-expected.checksum: Added.
+        * platform/mac/svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr-expected.png: Added.
+        * platform/mac/svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop-expected.checksum: Added.
+        * platform/mac/svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop-expected.png: Added.
+        * svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr-expected.txt: Added.
+        * svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr.html: Added.
+        * svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop-expected.txt: Added.
+        * svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop.html: Added.
+        * svg/dynamic-updates/script-tests/SVGFEImageElement-dom-preserveAspectRatio-attr.js: Added.
+        (executeTest):
+        * svg/dynamic-updates/script-tests/SVGFEImageElement-svgdom-preserveAspectRatio-prop.js: Added.
+        (executeTest):
+
 2010-11-15  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         Unreviewed. Add Qt specific expected results after r72003.
diff --git a/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr-expected.checksum b/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr-expected.checksum
new file mode 100644 (file)
index 0000000..6625982
--- /dev/null
@@ -0,0 +1 @@
+ae824aafc27b9ce49b1dab3de3beac67
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr-expected.png b/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr-expected.png
new file mode 100644 (file)
index 0000000..736db95
Binary files /dev/null and b/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop-expected.checksum b/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop-expected.checksum
new file mode 100644 (file)
index 0000000..87d27fd
--- /dev/null
@@ -0,0 +1 @@
+f3f293c6785a92711e69bc1f47c2a527
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop-expected.png b/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop-expected.png
new file mode 100644 (file)
index 0000000..c46224a
Binary files /dev/null and b/LayoutTests/platform/mac/svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop-expected.png differ
diff --git a/LayoutTests/svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr-expected.txt b/LayoutTests/svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr-expected.txt
new file mode 100644 (file)
index 0000000..39cac0b
--- /dev/null
@@ -0,0 +1,13 @@
+SVG 1.1 dynamic update tests
+
+Tests dynamic updates of the 'preserveAspectRatio' attribute of the SVGFEImageElement object
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS image.getAttribute('preserveAspectRatio') is "xMinYMin slice"
+PASS image.getAttribute('preserveAspectRatio') is "xMinYMid slice"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr.html b/LayoutTests/svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr.html
new file mode 100644 (file)
index 0000000..eb66575
--- /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/SVGFEImageElement-dom-preserveAspectRatio-attr.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop-expected.txt b/LayoutTests/svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop-expected.txt
new file mode 100644 (file)
index 0000000..e0bf43a
--- /dev/null
@@ -0,0 +1,15 @@
+SVG 1.1 dynamic update tests
+
+Tests dynamic updates of the 'preserveAspectRatio' property of the SVGFEImageElement object
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS image.preserveAspectRatio.baseVal.align is SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMIN
+PASS image.preserveAspectRatio.baseVal.meetOrSlice is SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE
+PASS image.preserveAspectRatio.baseVal.align is SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMID
+PASS image.preserveAspectRatio.baseVal.meetOrSlice is SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop.html b/LayoutTests/svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop.html
new file mode 100644 (file)
index 0000000..993451a
--- /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/SVGFEImageElement-svgdom-preserveAspectRatio-prop.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/svg/dynamic-updates/script-tests/SVGFEImageElement-dom-preserveAspectRatio-attr.js b/LayoutTests/svg/dynamic-updates/script-tests/SVGFEImageElement-dom-preserveAspectRatio-attr.js
new file mode 100644 (file)
index 0000000..461f0a6
--- /dev/null
@@ -0,0 +1,42 @@
+// [Name] SVGFEImageElement-dom-preserveAspectRatio-attr.js
+// [Expected rendering result] A rectangle with feImage filter - and a series of PASS messages
+
+description("Tests dynamic updates of the 'preserveAspectRatio' attribute of the SVGFEImageElement object")
+createSVGTestCase();
+
+var image = createSVGElement("feImage");
+image.setAttribute("width", "300");
+image.setAttribute("height", "200");
+image.setAttribute("preserveAspectRatio", "xMinYMin slice");
+image.setAttributeNS(xlinkNS, "xlink:href", "../W3C-SVG-1.1/resources/image1.jpg");
+
+var filterElement = createSVGElement("filter");
+filterElement.setAttribute("id", "myFilter");
+filterElement.appendChild(image);
+
+var defsElement = createSVGElement("defs");
+defsElement.appendChild(filterElement);
+
+rootSVGElement.appendChild(defsElement);
+rootSVGElement.setAttribute("height", "200");
+
+var rectElement = createSVGElement("rect");
+rectElement.setAttribute("width", "190");
+rectElement.setAttribute("height", "190");
+rectElement.setAttribute("filter", "url(#myFilter)");
+rootSVGElement.appendChild(rectElement);
+
+rootSVGElement.setAttribute("viewBox", "0 0 400 150");
+
+shouldBeEqualToString("image.getAttribute('preserveAspectRatio')", "xMinYMin slice");
+
+function executeTest() {
+    image.setAttribute("preserveAspectRatio", "xMinYMid slice");
+    shouldBeEqualToString("image.getAttribute('preserveAspectRatio')", "xMinYMid slice");
+
+    completeTest();
+}
+
+startTest(rootSVGElement, 100, 100);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/svg/dynamic-updates/script-tests/SVGFEImageElement-svgdom-preserveAspectRatio-prop.js b/LayoutTests/svg/dynamic-updates/script-tests/SVGFEImageElement-svgdom-preserveAspectRatio-prop.js
new file mode 100644 (file)
index 0000000..fce9c6e
--- /dev/null
@@ -0,0 +1,45 @@
+// [Name] SVGFEImageElement-svgdom-preserveAspectRatio-prop.js
+// [Expected rendering result] A rectangle with feImage filter - and a series of PASS messages
+
+description("Tests dynamic updates of the 'preserveAspectRatio' property of the SVGFEImageElement object")
+createSVGTestCase();
+
+var image = createSVGElement("feImage");
+image.setAttribute("width", "300");
+image.setAttribute("height", "200");
+image.setAttribute("preserveAspectRatio", "xMinYMin slice");
+image.setAttributeNS(xlinkNS, "xlink:href", "../W3C-SVG-1.1/resources/image1.jpg");
+
+var filterElement = createSVGElement("filter");
+filterElement.setAttribute("id", "myFilter");
+filterElement.appendChild(image);
+
+var defsElement = createSVGElement("defs");
+defsElement.appendChild(filterElement);
+
+rootSVGElement.appendChild(defsElement);
+rootSVGElement.setAttribute("height", "200");
+
+var rectElement = createSVGElement("rect");
+rectElement.setAttribute("width", "190");
+rectElement.setAttribute("height", "190");
+rectElement.setAttribute("filter", "url(#myFilter)");
+rootSVGElement.appendChild(rectElement);
+
+rootSVGElement.setAttribute("viewBox", "0 0 400 150");
+
+shouldBe("image.preserveAspectRatio.baseVal.align", "SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMIN");
+shouldBe("image.preserveAspectRatio.baseVal.meetOrSlice", "SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE");
+
+function executeTest() {
+    image.preserveAspectRatio.baseVal.align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMID;
+    image.preserveAspectRatio.baseVal.meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE;
+    shouldBe("image.preserveAspectRatio.baseVal.align", "SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMID");
+    shouldBe("image.preserveAspectRatio.baseVal.meetOrSlice", "SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE");
+
+    completeTest();
+}
+
+startTest(rootSVGElement, 100, 100);
+
+var successfullyParsed = true;
index 44b40ef..8d2f077 100644 (file)
@@ -1,3 +1,19 @@
+2010-11-15  Renata Hodovan  <reni@webkit.org>
+
+        Reviewed by Andreas Kling.
+
+        SVGFEImageElement doesn't support dynamic invalidation
+        https://bugs.webkit.org/show_bug.cgi?id=49536
+
+        The dynamic changes are captured by the svgAttributeChanged function. Invalidate the filter primitive if necessary.
+
+        Tests: svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr.html
+               svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop.html
+
+        * svg/SVGFEImageElement.cpp:
+        (WebCore::SVGFEImageElement::svgAttributeChanged):
+        * svg/SVGFEImageElement.h:
+
 2010-11-15  Yael Aharon  <yael.aharon@nokia.com>
 
         Reviewed by Antonio Gomes.
index 0ea7933..1db8edb 100644 (file)
@@ -90,6 +90,14 @@ void SVGFEImageElement::parseMappedAttribute(Attribute* attr)
     }
 }
 
+void SVGFEImageElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+    SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
+
+    if (attrName == SVGNames::preserveAspectRatioAttr)
+        invalidate();
+}
+
 void SVGFEImageElement::synchronizeProperty(const QualifiedName& attrName)
 {
     SVGFilterPrimitiveStandardAttributes::synchronizeProperty(attrName);
index 0dcf2c8..0b9c5d8 100644 (file)
@@ -48,6 +48,7 @@ private:
     SVGFEImageElement(const QualifiedName&, Document*);
 
     virtual void parseMappedAttribute(Attribute*);
+    virtual void svgAttributeChanged(const QualifiedName&);
     virtual void synchronizeProperty(const QualifiedName&);
     virtual void notifyFinished(CachedResource*);