Title: [98989] trunk
Revision
98989
Author
[email protected]
Date
2011-11-01 12:13:54 -0700 (Tue, 01 Nov 2011)

Log Message

SVG Filter on a group doesn't invalidate when children are moved
https://bugs.webkit.org/show_bug.cgi?id=70044
<rdar://problem/10281530>

Reviewed by Nikolas Zimmermann.

Call SVGResourcesCache::clientLayoutChanged whenever the element or its children need layout. Previously,
invalidation was only performed if the element itself needed layout; now we also invalidate if any child
needs layout and there is a filter applied, as the cached filter result can depend on the layout of children.

Test: svg/filters/invalidate-on-child-layout.svg

* rendering/svg/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::layout):
* rendering/svg/SVGResourcesCache.cpp:
(WebCore::SVGResourcesCache::clientLayoutChanged):

Add a test that ensures that changing the layout of a child of a filtered element invalidates the filter.

* platform/mac/svg/filters/invalidate-on-child-layout-expected.png: Added.
* platform/mac/svg/filters/invalidate-on-child-layout-expected.txt: Added.
* svg/filters/invalidate-on-child-layout.svg: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (98988 => 98989)


--- trunk/LayoutTests/ChangeLog	2011-11-01 19:05:22 UTC (rev 98988)
+++ trunk/LayoutTests/ChangeLog	2011-11-01 19:13:54 UTC (rev 98989)
@@ -1,3 +1,17 @@
+2011-11-01  Tim Horton  <[email protected]>
+
+        SVG Filter on a group doesn't invalidate when children are moved
+        https://bugs.webkit.org/show_bug.cgi?id=70044
+        <rdar://problem/10281530>
+
+        Reviewed by Nikolas Zimmermann.
+        
+        Add a test that ensures that changing the layout of a child of a filtered element invalidates the filter.
+
+        * platform/mac/svg/filters/invalidate-on-child-layout-expected.png: Added.
+        * platform/mac/svg/filters/invalidate-on-child-layout-expected.txt: Added.
+        * svg/filters/invalidate-on-child-layout.svg: Added.
+
 2011-11-01  Jer Noble  <[email protected]>
 
         Four media tests failing on Lion due to incorrect cached times.

Added: trunk/LayoutTests/platform/mac/svg/filters/invalidate-on-child-layout-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/svg/filters/invalidate-on-child-layout-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/svg/filters/invalidate-on-child-layout-expected.txt (0 => 98989)


--- trunk/LayoutTests/platform/mac/svg/filters/invalidate-on-child-layout-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/svg/filters/invalidate-on-child-layout-expected.txt	2011-11-01 19:13:54 UTC (rev 98989)
@@ -0,0 +1,11 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (40,40) size 120x120
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+      RenderSVGResourceFilter {filter} [id="filt"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+        [feGaussianBlur stdDeviation="5.00, 5.00"]
+          [SourceGraphic]
+    RenderSVGContainer {g} at (40,40) size 120x120
+      [filter="filt"] RenderSVGResourceFilter {filter} at (40,40) size 120x120
+      RenderSVGPath {circle} at (50,50) size 100x100 [fill={[type=SOLID] [color=#000000]}] [cx=100.00] [cy=100.00] [r=50.00]

Added: trunk/LayoutTests/svg/filters/invalidate-on-child-layout.svg (0 => 98989)


--- trunk/LayoutTests/svg/filters/invalidate-on-child-layout.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/filters/invalidate-on-child-layout.svg	2011-11-01 19:13:54 UTC (rev 98989)
@@ -0,0 +1,29 @@
+<svg xmlns="http://www.w3.org/2000/svg" _onload_="setup()">
+<script>
+<![CDATA[
+if (window.layoutTestController) {
+    layoutTestController.waitUntilDone();
+    layoutTestController.display();
+}
+
+setTimeout(executeTest, 0);
+
+function executeTest() {
+    var circle = document.getElementById("circle");
+    circle.setAttribute("cx", 100);
+    circle.setAttribute("cy", 100);
+    
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+]]>
+</script>
+<defs>
+    <filter id="filter">
+        <feGaussianBlur stdDeviation="5"/>
+    </filter>
+</defs>
+<g filter="url(#filter)">
+    <circle id="circle" r="50" cx="50" cy="50" />
+</g>
+</svg>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (98988 => 98989)


--- trunk/Source/WebCore/ChangeLog	2011-11-01 19:05:22 UTC (rev 98988)
+++ trunk/Source/WebCore/ChangeLog	2011-11-01 19:13:54 UTC (rev 98989)
@@ -1,3 +1,22 @@
+2011-11-01  Tim Horton  <[email protected]>
+
+        SVG Filter on a group doesn't invalidate when children are moved
+        https://bugs.webkit.org/show_bug.cgi?id=70044
+        <rdar://problem/10281530>
+
+        Reviewed by Nikolas Zimmermann.
+
+        Call SVGResourcesCache::clientLayoutChanged whenever the element or its children need layout. Previously,
+        invalidation was only performed if the element itself needed layout; now we also invalidate if any child
+        needs layout and there is a filter applied, as the cached filter result can depend on the layout of children.
+
+        Test: svg/filters/invalidate-on-child-layout.svg
+
+        * rendering/svg/RenderSVGContainer.cpp:
+        (WebCore::RenderSVGContainer::layout):
+        * rendering/svg/SVGResourcesCache.cpp:
+        (WebCore::SVGResourcesCache::clientLayoutChanged):
+
 2011-11-01  Jer Noble  <[email protected]>
 
         Four media tests failing on Lion due to incorrect cached times.

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp (98988 => 98989)


--- trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp	2011-11-01 19:05:22 UTC (rev 98988)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp	2011-11-01 19:13:54 UTC (rev 98989)
@@ -65,7 +65,7 @@
     SVGRenderSupport::layoutChildren(this, selfNeedsLayout());
 
     // Invalidate all resources of this client if our layout changed.
-    if (m_everHadLayout && selfNeedsLayout())
+    if (m_everHadLayout && needsLayout())
         SVGResourcesCache::clientLayoutChanged(this);
 
     // At this point LayoutRepainter already grabbed the old bounds,

Modified: trunk/Source/WebCore/rendering/svg/SVGResourcesCache.cpp (98988 => 98989)


--- trunk/Source/WebCore/rendering/svg/SVGResourcesCache.cpp	2011-11-01 19:05:22 UTC (rev 98988)
+++ trunk/Source/WebCore/rendering/svg/SVGResourcesCache.cpp	2011-11-01 19:13:54 UTC (rev 98989)
@@ -119,7 +119,10 @@
     if (!resources)
         return;
 
-    resources->removeClientFromCache(object);
+    // Invalidate the resources if either the RenderObject itself changed,
+    // or we have filter resources, which could depend on the layout of children.
+    if (object->selfNeedsLayout() || resources->filter())
+        resources->removeClientFromCache(object);
 }
 
 void SVGResourcesCache::clientStyleChanged(RenderObject* renderer, StyleDifference diff, const RenderStyle* newStyle)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to