<animateColor> applied to filtered ellipse does not update
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Sep 2011 00:36:19 +0000 (00:36 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Sep 2011 00:36:19 +0000 (00:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=68457
<rdar://problem/10154777>

Reviewed by Darin Adler.

Invalidate the filter's cache when style changes take place so that style changes are respected.

Test: svg/filters/animate-fill.svg

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

LayoutTests/ChangeLog
LayoutTests/svg/filters/animate-fill-expected.png [new file with mode: 0644]
LayoutTests/svg/filters/animate-fill-expected.txt [new file with mode: 0644]
LayoutTests/svg/filters/animate-fill.svg [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/svg/SVGResourcesCache.cpp

index 6dd99b8..ca84b93 100644 (file)
@@ -1,3 +1,17 @@
+2011-09-26  Tim Horton  <timothy_horton@apple.com>
+
+        <animateColor> applied to filtered ellipse does not update
+        https://bugs.webkit.org/show_bug.cgi?id=68457
+        <rdar://problem/10154777>
+
+        Reviewed by Darin Adler.
+
+        Test that changing the fill on a filtered shape properly invalidates the filtered result.
+
+        * svg/filters/animate-fill-expected.png: Added.
+        * svg/filters/animate-fill-expected.txt: Added.
+        * svg/filters/animate-fill.svg: Added.
+
 2011-09-26  Mihai Parparita  <mihaip@chromium.org>
 
         Remove failing expectations for some ruby tests, since they were
diff --git a/LayoutTests/svg/filters/animate-fill-expected.png b/LayoutTests/svg/filters/animate-fill-expected.png
new file mode 100644 (file)
index 0000000..a0d7ee4
Binary files /dev/null and b/LayoutTests/svg/filters/animate-fill-expected.png differ
diff --git a/LayoutTests/svg/filters/animate-fill-expected.txt b/LayoutTests/svg/filters/animate-fill-expected.txt
new file mode 100644 (file)
index 0000000..29fea9e
--- /dev/null
@@ -0,0 +1,10 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (0,0) size 111x111
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+      RenderSVGResourceFilter {filter} [id="filt"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+        [feOffset dx="0.00" dy="0.00"]
+          [SourceGraphic]
+    RenderSVGPath {rect} at (0,0) size 111x111 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
+      [filter="filt"] RenderSVGResourceFilter {filter} at (-10,-10) size 120x120
diff --git a/LayoutTests/svg/filters/animate-fill.svg b/LayoutTests/svg/filters/animate-fill.svg
new file mode 100644 (file)
index 0000000..daf8e32
--- /dev/null
@@ -0,0 +1,25 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <title>The rectangle should rapidly animate to green.</title>
+<defs>
+    <filter id="filt">
+        <feOffset />
+    </filter>
+</defs>
+<rect id="rect" width="100px" height="100px" x="0" y="0" fill="red" filter="url(#filt)" />
+<script>
+    function finish()
+    {
+        document.getElementById('rect').setAttribute('fill', 'green');
+
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    }
+
+    if (window.layoutTestController) {
+        layoutTestController.waitUntilDone();
+        layoutTestController.display();
+    }
+    
+    setTimeout(finish, 0);
+</script>
+</svg>
index 0ddde8d..51bb3b0 100644 (file)
@@ -1,3 +1,19 @@
+2011-09-26  Tim Horton  <timothy_horton@apple.com>
+
+        <animateColor> applied to filtered ellipse does not update
+        https://bugs.webkit.org/show_bug.cgi?id=68457
+        <rdar://problem/10154777>
+
+        Reviewed by Darin Adler.
+
+        Invalidate the filter's cache when style changes take place so that style changes are respected.
+
+        Test: svg/filters/animate-fill.svg
+
+        * rendering/svg/SVGResourcesCache.cpp:
+        (WebCore::SVGResourcesCache::clientStyleChanged):
+        (WebCore::SVGResourcesCache::clientUpdatedFromElement):
+
 2011-09-26  Max Perepelitsyn  <pph34r@gmail.com>
 
         Set but unused variables cleanup in v8 bindings (gcc 4.6)
index 30f86c3..bbd4454 100644 (file)
@@ -128,7 +128,7 @@ 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.
+    // In this case the proper SVGFE*Element will decide whether the modified CSS properties require a relayout or repaint.
     if (renderer->isSVGResourceFilterPrimitive() && diff == StyleDifferenceRepaint)
         return;
 
@@ -144,6 +144,12 @@ void SVGResourcesCache::clientUpdatedFromElement(RenderObject* renderer, const R
     SVGResourcesCache* cache = resourcesCacheFromRenderObject(renderer);
     cache->removeResourcesFromRenderObject(renderer);
     cache->addResourcesFromRenderObject(renderer, newStyle);
+
+    SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(renderer);
+    if (!resources)
+        return;
+
+    resources->removeClientFromCache(renderer);
 }
 
 void SVGResourcesCache::clientDestroyed(RenderObject* renderer)