[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

zimmermann at webkit.org zimmermann at webkit.org
Wed Dec 22 12:03:48 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit cff3134e937168d5bd74f95a78793d527a26a56b
Author: zimmermann at webkit.org <zimmermann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Aug 13 10:03:22 2010 +0000

    2010-08-12  Nikolas Zimmermann  <nzimmermann at rim.com>
    
            Reviewed by Dirk Schulze.
    
            Window size changes + resources on absolute sized content leads to pixelation
            https://bugs.webkit.org/show_bug.cgi?id=43921
    
            Avoid pixelation when using resources on absolute sized objects. Be sure to invalidate the used resources if window size changes.
            Otherwhise masks etc. will be scaled up and pixelate. As nice side-effect, this fixes run-webkit-tests --singly svg/W3C-SVG-1.1, which
            used to produce wrong results for the gradient tests, as the window size change from 800x600 for 480x360 (svg/W3C-SVG-1.1 specific DRT quirk)
            didn't invalidate the resources.
    
            Renamed invalidateClient -> removeClientFromCache and invalidateClients -> removeAllClientsFromCache.
            Add a boolean "markForInvalidation" parameter, that controls wheter the clients should be marked for repaint/boundaries invalidation/layout
            or wheter we only want to notify the parents that the resource changed, to avoid doing unncessary work in SVGRenderSupport::layoutChildren.
    
            Test: svg/custom/absolute-sized-content-with-resources.xhtml
    
            * rendering/RenderSVGGradientStop.cpp:
            (WebCore::RenderSVGGradientStop::styleDidChange): Don't do anything for StyleDifferenceEqual.
            * rendering/RenderSVGImage.cpp:
            (WebCore::RenderSVGImage::imageChanged):
            * rendering/RenderSVGResource.cpp:
            (WebCore::RenderSVGResource::markForLayoutAndParentResourceInvalidation):
            * rendering/RenderSVGResource.h:
            * rendering/RenderSVGResourceClipper.cpp:
            (WebCore::RenderSVGResourceClipper::removeAllClientsFromCache):
            (WebCore::RenderSVGResourceClipper::removeClientFromCache):
            * rendering/RenderSVGResourceClipper.h:
            * rendering/RenderSVGResourceContainer.cpp:
            (WebCore::RenderSVGResourceContainer::layout):
            (WebCore::RenderSVGResourceContainer::idChanged):
            (WebCore::RenderSVGResourceContainer::markAllClientsForInvalidation):
            (WebCore::RenderSVGResourceContainer::markClientForInvalidation):
            * rendering/RenderSVGResourceContainer.h:
            (WebCore::RenderSVGResourceContainer::):
            * rendering/RenderSVGResourceFilter.cpp:
            (WebCore::RenderSVGResourceFilter::removeAllClientsFromCache):
            (WebCore::RenderSVGResourceFilter::removeClientFromCache):
            (WebCore::RenderSVGResourceFilter::postApplyResource):
            * rendering/RenderSVGResourceFilter.h:
            * rendering/RenderSVGResourceGradient.cpp:
            (WebCore::RenderSVGResourceGradient::removeAllClientsFromCache):
            (WebCore::RenderSVGResourceGradient::removeClientFromCache):
            (WebCore::RenderSVGResourceGradient::applyResource):
            * rendering/RenderSVGResourceGradient.h:
            * rendering/RenderSVGResourceMarker.cpp:
            (WebCore::RenderSVGResourceMarker::layout):
            (WebCore::RenderSVGResourceMarker::removeAllClientsFromCache):
            (WebCore::RenderSVGResourceMarker::removeClientFromCache):
            * rendering/RenderSVGResourceMarker.h:
            * rendering/RenderSVGResourceMasker.cpp:
            (WebCore::RenderSVGResourceMasker::removeAllClientsFromCache):
            (WebCore::RenderSVGResourceMasker::removeClientFromCache):
            * rendering/RenderSVGResourceMasker.h:
            * rendering/RenderSVGResourcePattern.cpp:
            (WebCore::RenderSVGResourcePattern::removeAllClientsFromCache):
            (WebCore::RenderSVGResourcePattern::removeClientFromCache):
            (WebCore::RenderSVGResourcePattern::applyResource):
            * rendering/RenderSVGResourcePattern.h:
            * rendering/RenderSVGResourceSolidColor.h:
            (WebCore::RenderSVGResourceSolidColor::removeAllClientsFromCache):
            (WebCore::RenderSVGResourceSolidColor::removeClientFromCache):
            * rendering/SVGRenderSupport.cpp:
            (WebCore::invalidateResourcesOfChildren): Add new helper funtion recursively invalidating resources of a sub render tree.
            (WebCore::SVGRenderSupport::layoutChildren): Keep track of all objects that didn't need layout, as we still have to invalidate their resources, if window size changes.
            * rendering/SVGResources.cpp:
            (WebCore::SVGResources::removeClientFromCache):
            (WebCore::SVGResources::resourceDestroyed):
            * rendering/SVGResources.h:
            * rendering/SVGResourcesCache.cpp:
            (WebCore::SVGResourcesCache::clientLayoutChanged):
    
    2010-08-12  Nikolas Zimmermann  <nzimmermann at rim.com>
    
            Reviewed by Dirk Schulze.
    
            Window size changes + resources on absolute sized content leads to pixelation
            https://bugs.webkit.org/show_bug.cgi?id=43921
    
            * platform/mac/svg/custom/absolute-sized-content-with-resources-expected.checksum: Added.
            * platform/mac/svg/custom/absolute-sized-content-with-resources-expected.png: Added.
            * platform/mac/svg/custom/absolute-sized-content-with-resources-expected.txt: Added.
            * svg/custom/absolute-sized-content-with-resources.xhtml: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65310 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index cfda857..d4aa32a 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-08-12  Nikolas Zimmermann  <nzimmermann at rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        Window size changes + resources on absolute sized content leads to pixelation
+        https://bugs.webkit.org/show_bug.cgi?id=43921
+
+        * platform/mac/svg/custom/absolute-sized-content-with-resources-expected.checksum: Added.
+        * platform/mac/svg/custom/absolute-sized-content-with-resources-expected.png: Added.
+        * platform/mac/svg/custom/absolute-sized-content-with-resources-expected.txt: Added.
+        * svg/custom/absolute-sized-content-with-resources.xhtml: Added.
+
 2010-08-13  Pavel Feldman  <pfeldman at chromium.org>
 
         Reviewed by Yury Semikhatsky.
diff --git a/LayoutTests/platform/mac/svg/custom/absolute-sized-content-with-resources-expected.checksum b/LayoutTests/platform/mac/svg/custom/absolute-sized-content-with-resources-expected.checksum
new file mode 100644
index 0000000..b045fb9
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/absolute-sized-content-with-resources-expected.checksum
@@ -0,0 +1 @@
+5ec85bc07a87a4d0ca1b5fb065924a60
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/custom/absolute-sized-content-with-resources-expected.png b/LayoutTests/platform/mac/svg/custom/absolute-sized-content-with-resources-expected.png
new file mode 100644
index 0000000..156fffb
Binary files /dev/null and b/LayoutTests/platform/mac/svg/custom/absolute-sized-content-with-resources-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/custom/absolute-sized-content-with-resources-expected.txt b/LayoutTests/platform/mac/svg/custom/absolute-sized-content-with-resources-expected.txt
new file mode 100644
index 0000000..0a2ce09
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/absolute-sized-content-with-resources-expected.txt
@@ -0,0 +1,24 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x460
+  RenderBlock {html} at (0,0) size 800x460
+    RenderBody {body} at (8,16) size 784x436
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 763x18
+          text run at (0,0) width 763: "The svg area contained in the div element (red box), should contain four masked circles, that do not pixelate after resizing"
+      RenderBlock {div} at (0,34) size 402x402 [border: (1px solid #FF0000)]
+        RenderSVGRoot {svg} at (42,117) size 334x268
+          RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+            RenderSVGResourceLinearGradient {linearGradient} [id="gradient"] [gradientUnits=objectBoundingBox] [start=(0,0)] [end=(1,1)]
+              RenderSVGGradientStop {stop} [offset=0.00] [color=#0000FF]
+              RenderSVGGradientStop {stop} [offset=1.00] [color=#FF0000]
+            RenderSVGResourceMasker {mask} [id="mask"] [maskUnits=userSpaceOnUse] [maskContentUnits=userSpaceOnUse]
+              RenderPath {circle} at (9,51) size 167x200 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M45.00,20.00 L44.96,21.26 L44.84,22.51 L44.65,23.75 L44.37,24.97 L44.02,26.18 L43.60,27.36 L43.10,28.52 L42.53,29.64 L41.89,30.72 L41.18,31.76 L40.41,32.75 L39.58,33.69 L38.69,34.58 L37.75,35.41 L36.76,36.18 L35.72,36.89 L34.64,37.53 L33.52,38.10 L32.36,38.60 L31.18,39.02 L29.97,39.37 L28.75,39.65 L27.51,39.84 L26.26,39.96 L25.00,40.00 L23.74,39.96 L22.49,39.84 L21.25,39.65 L20.03,39.37 L18.82,39.02 L17.64,38.60 L16.48,38.10 L15.36,37.53 L14.28,36.89 L13.24,36.18 L12.25,35.41 L11.31,34.58 L10.42,33.69 L9.59,32.75 L8.82,31.76 L8.11,30.72 L7.47,29.64 L6.90,28.52 L6.40,27.36 L5.98,26.18 L5.63,24.97 L5.35,23.75 L5.16,22.51 L5.04,21.26 L5.00,20.00 L5.04,18.74 L5.16,17.49 L5.35,16.25 L5.63,15.03 L5.98,13.82 L6.40,12.64 L6.90,11.48 L7.47,10.36 L8.11,9.28 L8.82,8.24 L9.59,7.25 L10.42,6.31 L11.31,5.42 L12.25,4.59 L13.24,3.82 L14.28,3.11 L15.36,2.47 L16.48,1.90 L17.64,1.40 L18.82,0.98 L20.03,0.63 L21.25,0.35 L22.49,0.16 L23.74,0.04 L25.00,0.00 L26.26,0.04 L27.51,0.16 L28.75,0.35 L29.97,0.63 L31.18,0.98 L32.36,1.40 L33.52,1.90 L34.64,2.47 L35.72,3.11 L36.76,3.82 L37.75,4.59 L38.69,5.42 L39.58,6.31 L40.41,7.25 L41.18,8.24 L41.89,9.28 L42.53,10.36 L43.10,11.48 L43.60,12.64 L44.02,13.82 L44.37,15.03 L44.65,16.25 L44.84,17.49 L44.96,18.74 Z"]
+              RenderPath {circle} at (9,251) size 167x200 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M45.00,60.00 L44.96,61.26 L44.84,62.51 L44.65,63.75 L44.37,64.97 L44.02,66.18 L43.60,67.36 L43.10,68.52 L42.53,69.64 L41.89,70.72 L41.18,71.76 L40.41,72.75 L39.58,73.69 L38.69,74.58 L37.75,75.41 L36.76,76.18 L35.72,76.89 L34.64,77.53 L33.52,78.10 L32.36,78.60 L31.18,79.02 L29.97,79.37 L28.75,79.65 L27.51,79.84 L26.26,79.96 L25.00,80.00 L23.74,79.96 L22.49,79.84 L21.25,79.65 L20.03,79.37 L18.82,79.02 L17.64,78.60 L16.48,78.10 L15.36,77.53 L14.28,76.89 L13.24,76.18 L12.25,75.41 L11.31,74.58 L10.42,73.69 L9.59,72.75 L8.82,71.76 L8.11,70.72 L7.47,69.64 L6.90,68.52 L6.40,67.36 L5.98,66.18 L5.63,64.97 L5.35,63.75 L5.16,62.51 L5.04,61.26 L5.00,60.00 L5.04,58.74 L5.16,57.49 L5.35,56.25 L5.63,55.03 L5.98,53.82 L6.40,52.64 L6.90,51.48 L7.47,50.36 L8.11,49.28 L8.82,48.24 L9.59,47.25 L10.42,46.31 L11.31,45.42 L12.25,44.59 L13.24,43.82 L14.28,43.11 L15.36,42.47 L16.48,41.90 L17.64,41.40 L18.82,40.98 L20.03,40.63 L21.25,40.35 L22.49,40.16 L23.74,40.04 L25.00,40.00 L26.26,40.04 L27.51,40.16 L28.75,40.35 L29.97,40.63 L31.18,40.98 L32.36,41.40 L33.52,41.90 L34.64,42.47 L35.72,43.11 L36.76,43.82 L37.75,44.59 L38.69,45.42 L39.58,46.31 L40.41,47.25 L41.18,48.24 L41.89,49.28 L42.53,50.36 L43.10,51.48 L43.60,52.64 L44.02,53.82 L44.37,55.03 L44.65,56.25 L44.84,57.49 L44.96,58.74 Z"]
+              RenderPath {circle} at (242,51) size 167x200 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M95.00,20.00 L94.96,21.26 L94.84,22.51 L94.65,23.75 L94.37,24.97 L94.02,26.18 L93.60,27.36 L93.10,28.52 L92.53,29.64 L91.89,30.72 L91.18,31.76 L90.41,32.75 L89.58,33.69 L88.69,34.58 L87.75,35.41 L86.76,36.18 L85.72,36.89 L84.64,37.53 L83.52,38.10 L82.36,38.60 L81.18,39.02 L79.97,39.37 L78.75,39.65 L77.51,39.84 L76.26,39.96 L75.00,40.00 L73.74,39.96 L72.49,39.84 L71.25,39.65 L70.03,39.37 L68.82,39.02 L67.64,38.60 L66.48,38.10 L65.36,37.53 L64.28,36.89 L63.24,36.18 L62.25,35.41 L61.31,34.58 L60.42,33.69 L59.59,32.75 L58.82,31.76 L58.11,30.72 L57.47,29.64 L56.90,28.52 L56.40,27.36 L55.98,26.18 L55.63,24.97 L55.35,23.75 L55.16,22.51 L55.04,21.26 L55.00,20.00 L55.04,18.74 L55.16,17.49 L55.35,16.25 L55.63,15.03 L55.98,13.82 L56.40,12.64 L56.90,11.48 L57.47,10.36 L58.11,9.28 L58.82,8.24 L59.59,7.25 L60.42,6.31 L61.31,5.42 L62.25,4.59 L63.24,3.82 L64.28,3.11 L65.36,2.47 L66.48,1.90 L67.64,1.40 L68.82,0.98 L70.03,0.63 L71.25,0.35 L72.49,0.16 L73.74,0.04 L75.00,0.00 L76.26,0.04 L77.51,0.16 L78.75,0.35 L79.97,0.63 L81.18,0.98 L82.36,1.40 L83.52,1.90 L84.64,2.47 L85.72,3.11 L86.76,3.82 L87.75,4.59 L88.69,5.42 L89.58,6.31 L90.41,7.25 L91.18,8.24 L91.89,9.28 L92.53,10.36 L93.10,11.48 L93.60,12.64 L94.02,13.82 L94.37,15.03 L94.65,16.25 L94.84,17.49 L94.96,18.74 Z"]
+              RenderPath {circle} at (242,251) size 167x200 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M95.00,60.00 L94.96,61.26 L94.84,62.51 L94.65,63.75 L94.37,64.97 L94.02,66.18 L93.60,67.36 L93.10,68.52 L92.53,69.64 L91.89,70.72 L91.18,71.76 L90.41,72.75 L89.58,73.69 L88.69,74.58 L87.75,75.41 L86.76,76.18 L85.72,76.89 L84.64,77.53 L83.52,78.10 L82.36,78.60 L81.18,79.02 L79.97,79.37 L78.75,79.65 L77.51,79.84 L76.26,79.96 L75.00,80.00 L73.74,79.96 L72.49,79.84 L71.25,79.65 L70.03,79.37 L68.82,79.02 L67.64,78.60 L66.48,78.10 L65.36,77.53 L64.28,76.89 L63.24,76.18 L62.25,75.41 L61.31,74.58 L60.42,73.69 L59.59,72.75 L58.82,71.76 L58.11,70.72 L57.47,69.64 L56.90,68.52 L56.40,67.36 L55.98,66.18 L55.63,64.97 L55.35,63.75 L55.16,62.51 L55.04,61.26 L55.00,60.00 L55.04,58.74 L55.16,57.49 L55.35,56.25 L55.63,55.03 L55.98,53.82 L56.40,52.64 L56.90,51.48 L57.47,50.36 L58.11,49.28 L58.82,48.24 L59.59,47.25 L60.42,46.31 L61.31,45.42 L62.25,44.59 L63.24,43.82 L64.28,43.11 L65.36,42.47 L66.48,41.90 L67.64,41.40 L68.82,40.98 L70.03,40.63 L71.25,40.35 L72.49,40.16 L73.74,40.04 L75.00,40.00 L76.26,40.04 L77.51,40.16 L78.75,40.35 L79.97,40.63 L81.18,40.98 L82.36,41.40 L83.52,41.90 L84.64,42.47 L85.72,43.11 L86.76,43.82 L87.75,44.59 L88.69,45.42 L89.58,46.31 L90.41,47.25 L91.18,48.24 L91.89,49.28 L92.53,50.36 L93.10,51.48 L93.60,52.64 L94.02,53.82 L94.37,55.03 L94.65,56.25 L94.84,57.49 L94.96,58.74 Z"]
+          RenderSVGContainer {g} at (42,117) size 334x268
+            RenderPath {rect} at (42,117) size 334x268 [fill={[type=LINEAR-GRADIENT] [id="gradient"]}] [data="M0.00,0.00 L100.00,0.00 L100.00,80.00 L0.00,80.00 Z"]
+              [masker="mask"] RenderSVGResourceMasker {mask} at (25,20) size 50x40
+        RenderText {#text} at (0,0) size 0x0
+caret: position 124 of child 0 {#text} of child 1 {p} of body
diff --git a/LayoutTests/svg/custom/absolute-sized-content-with-resources.xhtml b/LayoutTests/svg/custom/absolute-sized-content-with-resources.xhtml
new file mode 100644
index 0000000..013955e
--- /dev/null
+++ b/LayoutTests/svg/custom/absolute-sized-content-with-resources.xhtml
@@ -0,0 +1,44 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<body>
+    <p>The svg area contained in the div element (red box), should contain four masked circles, that do not pixelate after resizing</p>
+    <div id="contentBox" style="width: 100px; height: 400px; border: 1px solid red;">
+        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onclick="resizeBox()" viewBox="20 15 60 50">
+        <defs>
+            <linearGradient id="gradient" x1="0" x2="1" y1="0" y2="1" color-interpolation="linearRGB">
+                <stop offset="0" stop-color="blue" />
+                <stop offset="1" stop-color="red" />
+            </linearGradient>
+
+            <mask id="mask" maskUnits="userSpaceOnUse" x="25" y="20" width="50" height="40">
+                <circle cx="25" cy="20" r="20" fill="#ffffff" />
+                <circle cx="25" cy="60" r="20" fill="#ffffff" />
+                <circle cx="75" cy="20" r="20" fill="#ffffff" />
+                <circle cx="75" cy="60" r="20" fill="#ffffff" />
+            </mask>
+        </defs>
+
+        <g fill="url(#gradient)">
+            <rect width="100" height="80" mask="url(#mask)" />
+        </g>
+        </svg>
+    </div>
+    <script type="JavaScript">
+        if (window.layoutTestController)
+            layoutTestController.waitUntilDone();
+
+        if (window.eventSender) {
+            window.setTimeout(function() {
+                eventSender.mouseMoveTo(50, 250);
+                eventSender.mouseDown();
+                eventSender.mouseUp();
+            }, 0);
+        }
+
+        function resizeBox() {
+            document.getElementById("contentBox").style.setProperty("width", "400px");
+            if (window.layoutTestController)
+                layoutTestController.notifyDone();
+        }
+    </script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 14afdb1..d049493 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,76 @@
+2010-08-12  Nikolas Zimmermann  <nzimmermann at rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        Window size changes + resources on absolute sized content leads to pixelation
+        https://bugs.webkit.org/show_bug.cgi?id=43921
+
+        Avoid pixelation when using resources on absolute sized objects. Be sure to invalidate the used resources if window size changes.
+        Otherwhise masks etc. will be scaled up and pixelate. As nice side-effect, this fixes run-webkit-tests --singly svg/W3C-SVG-1.1, which
+        used to produce wrong results for the gradient tests, as the window size change from 800x600 for 480x360 (svg/W3C-SVG-1.1 specific DRT quirk)
+        didn't invalidate the resources.
+
+        Renamed invalidateClient -> removeClientFromCache and invalidateClients -> removeAllClientsFromCache.
+        Add a boolean "markForInvalidation" parameter, that controls wheter the clients should be marked for repaint/boundaries invalidation/layout
+        or wheter we only want to notify the parents that the resource changed, to avoid doing unncessary work in SVGRenderSupport::layoutChildren.
+
+        Test: svg/custom/absolute-sized-content-with-resources.xhtml
+
+        * rendering/RenderSVGGradientStop.cpp:
+        (WebCore::RenderSVGGradientStop::styleDidChange): Don't do anything for StyleDifferenceEqual.
+        * rendering/RenderSVGImage.cpp:
+        (WebCore::RenderSVGImage::imageChanged):
+        * rendering/RenderSVGResource.cpp:
+        (WebCore::RenderSVGResource::markForLayoutAndParentResourceInvalidation):
+        * rendering/RenderSVGResource.h:
+        * rendering/RenderSVGResourceClipper.cpp:
+        (WebCore::RenderSVGResourceClipper::removeAllClientsFromCache):
+        (WebCore::RenderSVGResourceClipper::removeClientFromCache):
+        * rendering/RenderSVGResourceClipper.h:
+        * rendering/RenderSVGResourceContainer.cpp:
+        (WebCore::RenderSVGResourceContainer::layout):
+        (WebCore::RenderSVGResourceContainer::idChanged):
+        (WebCore::RenderSVGResourceContainer::markAllClientsForInvalidation):
+        (WebCore::RenderSVGResourceContainer::markClientForInvalidation):
+        * rendering/RenderSVGResourceContainer.h:
+        (WebCore::RenderSVGResourceContainer::):
+        * rendering/RenderSVGResourceFilter.cpp:
+        (WebCore::RenderSVGResourceFilter::removeAllClientsFromCache):
+        (WebCore::RenderSVGResourceFilter::removeClientFromCache):
+        (WebCore::RenderSVGResourceFilter::postApplyResource):
+        * rendering/RenderSVGResourceFilter.h:
+        * rendering/RenderSVGResourceGradient.cpp:
+        (WebCore::RenderSVGResourceGradient::removeAllClientsFromCache):
+        (WebCore::RenderSVGResourceGradient::removeClientFromCache):
+        (WebCore::RenderSVGResourceGradient::applyResource):
+        * rendering/RenderSVGResourceGradient.h:
+        * rendering/RenderSVGResourceMarker.cpp:
+        (WebCore::RenderSVGResourceMarker::layout):
+        (WebCore::RenderSVGResourceMarker::removeAllClientsFromCache):
+        (WebCore::RenderSVGResourceMarker::removeClientFromCache):
+        * rendering/RenderSVGResourceMarker.h:
+        * rendering/RenderSVGResourceMasker.cpp:
+        (WebCore::RenderSVGResourceMasker::removeAllClientsFromCache):
+        (WebCore::RenderSVGResourceMasker::removeClientFromCache):
+        * rendering/RenderSVGResourceMasker.h:
+        * rendering/RenderSVGResourcePattern.cpp:
+        (WebCore::RenderSVGResourcePattern::removeAllClientsFromCache):
+        (WebCore::RenderSVGResourcePattern::removeClientFromCache):
+        (WebCore::RenderSVGResourcePattern::applyResource):
+        * rendering/RenderSVGResourcePattern.h:
+        * rendering/RenderSVGResourceSolidColor.h:
+        (WebCore::RenderSVGResourceSolidColor::removeAllClientsFromCache):
+        (WebCore::RenderSVGResourceSolidColor::removeClientFromCache):
+        * rendering/SVGRenderSupport.cpp:
+        (WebCore::invalidateResourcesOfChildren): Add new helper funtion recursively invalidating resources of a sub render tree.
+        (WebCore::SVGRenderSupport::layoutChildren): Keep track of all objects that didn't need layout, as we still have to invalidate their resources, if window size changes.
+        * rendering/SVGResources.cpp:
+        (WebCore::SVGResources::removeClientFromCache):
+        (WebCore::SVGResources::resourceDestroyed):
+        * rendering/SVGResources.h:
+        * rendering/SVGResourcesCache.cpp:
+        (WebCore::SVGResourcesCache::clientLayoutChanged):
+
 2010-08-13  Pavel Feldman  <pfeldman at chromium.org>
 
         Reviewed by Yury Semikhatsky.
diff --git a/WebCore/rendering/RenderSVGGradientStop.cpp b/WebCore/rendering/RenderSVGGradientStop.cpp
index 3494aa7..ebf7385 100644
--- a/WebCore/rendering/RenderSVGGradientStop.cpp
+++ b/WebCore/rendering/RenderSVGGradientStop.cpp
@@ -47,6 +47,8 @@ RenderSVGGradientStop::~RenderSVGGradientStop()
 void RenderSVGGradientStop::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
 {
     RenderObject::styleDidChange(diff, oldStyle);
+    if (diff == StyleDifferenceEqual)
+        return;
 
     // <stop> elements should only be allowed to make renderers under gradient elements
     // but I can imagine a few cases we might not be catching, so let's not crash if our parent isn't a gradient.
@@ -60,7 +62,7 @@ void RenderSVGGradientStop::styleDidChange(StyleDifference diff, const RenderSty
 
     ASSERT(renderer->isSVGResourceContainer());
     RenderSVGResourceContainer* container = renderer->toRenderSVGResourceContainer();
-    container->invalidateClients();
+    container->removeAllClientsFromCache();
 }
 
 void RenderSVGGradientStop::layout()
diff --git a/WebCore/rendering/RenderSVGImage.cpp b/WebCore/rendering/RenderSVGImage.cpp
index 993278c..893a4ea 100644
--- a/WebCore/rendering/RenderSVGImage.cpp
+++ b/WebCore/rendering/RenderSVGImage.cpp
@@ -177,7 +177,7 @@ void RenderSVGImage::imageChanged(WrappedImagePtr image, const IntRect* rect)
     // The image resource defaults to nullImage until the resource arrives.
     // This empty image may be cached by SVG resources which must be invalidated.
     if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this))
-        resources->invalidateClient(this);
+        resources->removeClientFromCache(this);
 
     // Eventually notify parent resources, that we've changed.
     RenderSVGResource::markForLayoutAndParentResourceInvalidation(this, false);
diff --git a/WebCore/rendering/RenderSVGResource.cpp b/WebCore/rendering/RenderSVGResource.cpp
index 9c89d3c..0c943e5 100644
--- a/WebCore/rendering/RenderSVGResource.cpp
+++ b/WebCore/rendering/RenderSVGResource.cpp
@@ -171,7 +171,7 @@ void RenderSVGResource::markForLayoutAndParentResourceInvalidation(RenderObject*
     RenderObject* current = object->parent();
     while (current) {
         if (current->isSVGResourceContainer()) {
-            current->toRenderSVGResourceContainer()->invalidateClients();
+            current->toRenderSVGResourceContainer()->removeAllClientsFromCache();
             break;
         }
 
diff --git a/WebCore/rendering/RenderSVGResource.h b/WebCore/rendering/RenderSVGResource.h
index e2d8216..a70ce52 100644
--- a/WebCore/rendering/RenderSVGResource.h
+++ b/WebCore/rendering/RenderSVGResource.h
@@ -57,8 +57,8 @@ public:
     RenderSVGResource() { }
     virtual ~RenderSVGResource() { }
 
-    virtual void invalidateClients() = 0;
-    virtual void invalidateClient(RenderObject*) = 0;
+    virtual void removeAllClientsFromCache(bool markForInvalidation = true) = 0;
+    virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true) = 0;
 
     virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) = 0;
     virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short) { }
diff --git a/WebCore/rendering/RenderSVGResourceClipper.cpp b/WebCore/rendering/RenderSVGResourceClipper.cpp
index a201d1f..60081dd 100644
--- a/WebCore/rendering/RenderSVGResourceClipper.cpp
+++ b/WebCore/rendering/RenderSVGResourceClipper.cpp
@@ -64,7 +64,7 @@ RenderSVGResourceClipper::~RenderSVGResourceClipper()
     m_clipper.clear();
 }
 
-void RenderSVGResourceClipper::invalidateClients()
+void RenderSVGResourceClipper::removeAllClientsFromCache(bool markForInvalidation)
 {
     if (m_invalidationBlocked)
         return;
@@ -75,20 +75,19 @@ void RenderSVGResourceClipper::invalidateClients()
         m_clipper.clear();
     }
 
-    markAllClientsForInvalidation(LayoutAndBoundariesInvalidation);
+    markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInvalidation : ParentOnlyInvalidation);
 }
 
-void RenderSVGResourceClipper::invalidateClient(RenderObject* client)
+void RenderSVGResourceClipper::removeClientFromCache(RenderObject* client, bool markForInvalidation)
 {
     ASSERT(client);
     if (m_invalidationBlocked)
         return;
 
-    ASSERT(client->selfNeedsLayout());
     if (m_clipper.contains(client))
         delete m_clipper.take(client);
 
-    markClientForInvalidation(client, BoundariesInvalidation);
+    markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidation : ParentOnlyInvalidation);
 }
 
 bool RenderSVGResourceClipper::applyResource(RenderObject* object, RenderStyle*, GraphicsContext*& context, unsigned short resourceMode)
diff --git a/WebCore/rendering/RenderSVGResourceClipper.h b/WebCore/rendering/RenderSVGResourceClipper.h
index d334c7d..0f68c67 100644
--- a/WebCore/rendering/RenderSVGResourceClipper.h
+++ b/WebCore/rendering/RenderSVGResourceClipper.h
@@ -47,8 +47,8 @@ public:
 
     virtual const char* renderName() const { return "RenderSVGResourceClipper"; }
 
-    virtual void invalidateClients();
-    virtual void invalidateClient(RenderObject*);
+    virtual void removeAllClientsFromCache(bool markForInvalidation = true);
+    virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true);
 
     virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
     virtual FloatRect resourceBoundingBox(RenderObject*);
diff --git a/WebCore/rendering/RenderSVGResourceContainer.cpp b/WebCore/rendering/RenderSVGResourceContainer.cpp
index 7e43300..5652dcc 100644
--- a/WebCore/rendering/RenderSVGResourceContainer.cpp
+++ b/WebCore/rendering/RenderSVGResourceContainer.cpp
@@ -52,7 +52,7 @@ void RenderSVGResourceContainer::layout()
 {
     // Invalidate all resources if our layout changed.
     if (m_everHadLayout && selfNeedsLayout())
-        invalidateClients();
+        removeAllClientsFromCache();
 
     RenderSVGHiddenContainer::layout();
 }
@@ -76,7 +76,7 @@ void RenderSVGResourceContainer::styleDidChange(StyleDifference diff, const Rend
 void RenderSVGResourceContainer::idChanged()
 {
     // Invalidate all our current clients.
-    invalidateClients();
+    removeAllClientsFromCache();
 
     // Remove old id, that is guaranteed to be present in cache.
     SVGDocumentExtensions* extensions = svgExtensionsFromNode(node());
@@ -92,17 +92,32 @@ void RenderSVGResourceContainer::markAllClientsForInvalidation(InvalidationMode
         return;
 
     bool needsLayout = mode == LayoutAndBoundariesInvalidation;
+    bool markForInvalidation = mode != ParentOnlyInvalidation;
 
     HashSet<RenderObject*>::iterator end = m_clients.end();
     for (HashSet<RenderObject*>::iterator it = m_clients.begin(); it != end; ++it) {
         RenderObject* client = *it;
         if (client->isSVGResourceContainer()) {
-            client->toRenderSVGResourceContainer()->invalidateClients();
+            client->toRenderSVGResourceContainer()->removeAllClientsFromCache(markForInvalidation);
             continue;
         }
 
-        markClientForInvalidation(client, mode);
-        RenderSVGResource::markForLayoutAndParentResourceInvalidation(client, needsLayout);
+        if (markForInvalidation)
+            markClientForInvalidation(client, mode);
+
+        if (needsLayout)
+            client->setNeedsLayout(true);
+
+        // Invalidate resources in ancestor chain, if needed.
+        RenderObject* current = client->parent();
+        while (current) {
+            if (current->isSVGResourceContainer()) {
+                current->toRenderSVGResourceContainer()->removeAllClientsFromCache(markForInvalidation);
+                break;
+            }
+
+            current = current->parent();
+        }
     }
 }
 
@@ -120,6 +135,8 @@ void RenderSVGResourceContainer::markClientForInvalidation(RenderObject* client,
         if (client->view())
             client->repaint();
         break;
+    case ParentOnlyInvalidation:
+        break;
     }
 }
 
diff --git a/WebCore/rendering/RenderSVGResourceContainer.h b/WebCore/rendering/RenderSVGResourceContainer.h
index 4271a5f..08e18d4 100644
--- a/WebCore/rendering/RenderSVGResourceContainer.h
+++ b/WebCore/rendering/RenderSVGResourceContainer.h
@@ -49,7 +49,8 @@ protected:
     enum InvalidationMode {
         LayoutAndBoundariesInvalidation,
         BoundariesInvalidation,
-        RepaintInvalidation
+        RepaintInvalidation,
+        ParentOnlyInvalidation
     };
 
     // Used from the invalidateClient/invalidateClients methods from classes, inheriting from us.
diff --git a/WebCore/rendering/RenderSVGResourceFilter.cpp b/WebCore/rendering/RenderSVGResourceFilter.cpp
index bc5feaf..54abd1e 100644
--- a/WebCore/rendering/RenderSVGResourceFilter.cpp
+++ b/WebCore/rendering/RenderSVGResourceFilter.cpp
@@ -67,25 +67,24 @@ RenderSVGResourceFilter::~RenderSVGResourceFilter()
     m_filter.clear();
 }
 
-void RenderSVGResourceFilter::invalidateClients()
+void RenderSVGResourceFilter::removeAllClientsFromCache(bool markForInvalidation)
 {
     if (!m_filter.isEmpty()) {
         deleteAllValues(m_filter);
         m_filter.clear();
     }
 
-    markAllClientsForInvalidation(LayoutAndBoundariesInvalidation);
+    markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInvalidation : ParentOnlyInvalidation);
 }
 
-void RenderSVGResourceFilter::invalidateClient(RenderObject* client)
+void RenderSVGResourceFilter::removeClientFromCache(RenderObject* client, bool markForInvalidation)
 {
     ASSERT(client);
-    ASSERT(client->selfNeedsLayout());
 
     if (m_filter.contains(client))
         delete m_filter.take(client);
 
-    markClientForInvalidation(client, BoundariesInvalidation);
+    markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidation : ParentOnlyInvalidation);
 }
 
 PassRefPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives()
@@ -243,7 +242,7 @@ void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsCo
     FilterData* filterData = m_filter.get(object);
     if (!filterData->builded) {
         if (!filterData->savedContext) {
-            invalidateClient(object);
+            removeClientFromCache(object);
             return;
         }
 
diff --git a/WebCore/rendering/RenderSVGResourceFilter.h b/WebCore/rendering/RenderSVGResourceFilter.h
index 7b5ab09..314c94d 100644
--- a/WebCore/rendering/RenderSVGResourceFilter.h
+++ b/WebCore/rendering/RenderSVGResourceFilter.h
@@ -64,8 +64,8 @@ public:
 
     virtual const char* renderName() const { return "RenderSVGResourceFilter"; }
 
-    virtual void invalidateClients();
-    virtual void invalidateClient(RenderObject*);
+    virtual void removeAllClientsFromCache(bool markForInvalidation = true);
+    virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true);
 
     virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
     virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode);
diff --git a/WebCore/rendering/RenderSVGResourceGradient.cpp b/WebCore/rendering/RenderSVGResourceGradient.cpp
index 9716236..d29192a 100644
--- a/WebCore/rendering/RenderSVGResourceGradient.cpp
+++ b/WebCore/rendering/RenderSVGResourceGradient.cpp
@@ -51,25 +51,24 @@ RenderSVGResourceGradient::~RenderSVGResourceGradient()
     m_gradient.clear();
 }
 
-void RenderSVGResourceGradient::invalidateClients()
+void RenderSVGResourceGradient::removeAllClientsFromCache(bool markForInvalidation)
 {
     if (!m_gradient.isEmpty()) {
         deleteAllValues(m_gradient);
         m_gradient.clear();
     }
 
-    markAllClientsForInvalidation(RepaintInvalidation);
+    markAllClientsForInvalidation(markForInvalidation ? RepaintInvalidation : ParentOnlyInvalidation);
 }
 
-void RenderSVGResourceGradient::invalidateClient(RenderObject* client)
+void RenderSVGResourceGradient::removeClientFromCache(RenderObject* client, bool markForInvalidation)
 {
     ASSERT(client);
-    ASSERT(client->selfNeedsLayout());
 
     if (m_gradient.contains(client))
         delete m_gradient.take(client);
 
-    markClientForInvalidation(client, RepaintInvalidation);
+    markClientForInvalidation(client, markForInvalidation ? RepaintInvalidation : ParentOnlyInvalidation);
 }
 
 #if PLATFORM(CG)
@@ -131,7 +130,7 @@ bool RenderSVGResourceGradient::applyResource(RenderObject* object, RenderStyle*
 
     // Be sure to synchronize all SVG properties on the gradientElement _before_ processing any further.
     // Otherwhise the call to collectGradientAttributes() in createTileImage(), may cause the SVG DOM property
-    // synchronization to kick in, which causes invalidateClients() to be called, which in turn deletes our
+    // synchronization to kick in, which causes removeAllClientsFromCache() to be called, which in turn deletes our
     // GradientData object! Leaving out the line below will cause svg/dynamic-updates/SVG*GradientElement-svgdom* to crash.
     SVGGradientElement* gradientElement = static_cast<SVGGradientElement*>(node());
     if (!gradientElement)
diff --git a/WebCore/rendering/RenderSVGResourceGradient.h b/WebCore/rendering/RenderSVGResourceGradient.h
index b01af6d..4de4272 100644
--- a/WebCore/rendering/RenderSVGResourceGradient.h
+++ b/WebCore/rendering/RenderSVGResourceGradient.h
@@ -50,8 +50,8 @@ public:
     RenderSVGResourceGradient(SVGGradientElement*);
     virtual ~RenderSVGResourceGradient();
 
-    virtual void invalidateClients();
-    virtual void invalidateClient(RenderObject*);
+    virtual void removeAllClientsFromCache(bool markForInvalidation = true);
+    virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true);
 
     virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
     virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode);
diff --git a/WebCore/rendering/RenderSVGResourceMarker.cpp b/WebCore/rendering/RenderSVGResourceMarker.cpp
index fa00fa3..1d5663b 100644
--- a/WebCore/rendering/RenderSVGResourceMarker.cpp
+++ b/WebCore/rendering/RenderSVGResourceMarker.cpp
@@ -50,7 +50,7 @@ void RenderSVGResourceMarker::layout()
 {
     // Invalidate all resources if our layout changed.
     if (m_everHadLayout && selfNeedsLayout())
-        invalidateClients();
+        removeAllClientsFromCache();
 
     // RenderSVGHiddenContainer overwrites layout(). We need the
     // layouting of RenderSVGContainer for calculating  local
@@ -58,16 +58,15 @@ void RenderSVGResourceMarker::layout()
     RenderSVGContainer::layout();
 }
 
-void RenderSVGResourceMarker::invalidateClients()
+void RenderSVGResourceMarker::removeAllClientsFromCache(bool markForInvalidation)
 {
-    markAllClientsForInvalidation(LayoutAndBoundariesInvalidation);
+    markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInvalidation : ParentOnlyInvalidation);
 }
 
-void RenderSVGResourceMarker::invalidateClient(RenderObject* client)
+void RenderSVGResourceMarker::removeClientFromCache(RenderObject* client, bool markForInvalidation)
 {
     ASSERT(client);
-    ASSERT(client->selfNeedsLayout());
-    markClientForInvalidation(client, BoundariesInvalidation);
+    markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidation : ParentOnlyInvalidation);
 }
 
 void RenderSVGResourceMarker::applyViewportClip(PaintInfo& paintInfo)
diff --git a/WebCore/rendering/RenderSVGResourceMarker.h b/WebCore/rendering/RenderSVGResourceMarker.h
index 8509aca..e41096e 100644
--- a/WebCore/rendering/RenderSVGResourceMarker.h
+++ b/WebCore/rendering/RenderSVGResourceMarker.h
@@ -41,8 +41,8 @@ public:
 
     virtual const char* renderName() const { return "RenderSVGResourceMarker"; }
 
-    virtual void invalidateClients();
-    virtual void invalidateClient(RenderObject*);
+    virtual void removeAllClientsFromCache(bool markForInvalidation = true);
+    virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true);
 
     void draw(PaintInfo&, const AffineTransform&);
 
diff --git a/WebCore/rendering/RenderSVGResourceMasker.cpp b/WebCore/rendering/RenderSVGResourceMasker.cpp
index 4c27a53..9713dd6 100644
--- a/WebCore/rendering/RenderSVGResourceMasker.cpp
+++ b/WebCore/rendering/RenderSVGResourceMasker.cpp
@@ -60,7 +60,7 @@ RenderSVGResourceMasker::~RenderSVGResourceMasker()
     m_masker.clear();
 }
 
-void RenderSVGResourceMasker::invalidateClients()
+void RenderSVGResourceMasker::removeAllClientsFromCache(bool markForInvalidation)
 {
     m_maskContentBoundaries = FloatRect();
     if (!m_masker.isEmpty()) {
@@ -68,18 +68,17 @@ void RenderSVGResourceMasker::invalidateClients()
         m_masker.clear();
     }
 
-    markAllClientsForInvalidation(LayoutAndBoundariesInvalidation);
+    markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInvalidation : ParentOnlyInvalidation);
 }
 
-void RenderSVGResourceMasker::invalidateClient(RenderObject* client)
+void RenderSVGResourceMasker::removeClientFromCache(RenderObject* client, bool markForInvalidation)
 {
     ASSERT(client);
-    ASSERT(client->selfNeedsLayout());
 
     if (m_masker.contains(client))
         delete m_masker.take(client);
 
-    markClientForInvalidation(client, BoundariesInvalidation);
+    markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidation : ParentOnlyInvalidation);
 }
 
 bool RenderSVGResourceMasker::applyResource(RenderObject* object, RenderStyle*, GraphicsContext*& context, unsigned short resourceMode)
diff --git a/WebCore/rendering/RenderSVGResourceMasker.h b/WebCore/rendering/RenderSVGResourceMasker.h
index ab90ce9..f2d8cb2 100644
--- a/WebCore/rendering/RenderSVGResourceMasker.h
+++ b/WebCore/rendering/RenderSVGResourceMasker.h
@@ -46,9 +46,8 @@ public:
 
     virtual const char* renderName() const { return "RenderSVGResourceMasker"; }
 
-    virtual void invalidateClients();
-    virtual void invalidateClient(RenderObject*);
-
+    virtual void removeAllClientsFromCache(bool markForInvalidation = true);
+    virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true);
     virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
     virtual FloatRect resourceBoundingBox(RenderObject*);
 
diff --git a/WebCore/rendering/RenderSVGResourcePattern.cpp b/WebCore/rendering/RenderSVGResourcePattern.cpp
index 902ff02..698a4d3 100644
--- a/WebCore/rendering/RenderSVGResourcePattern.cpp
+++ b/WebCore/rendering/RenderSVGResourcePattern.cpp
@@ -47,25 +47,24 @@ RenderSVGResourcePattern::~RenderSVGResourcePattern()
     m_pattern.clear();
 }
 
-void RenderSVGResourcePattern::invalidateClients()
+void RenderSVGResourcePattern::removeAllClientsFromCache(bool markForInvalidation)
 {
     if (!m_pattern.isEmpty()) {
         deleteAllValues(m_pattern);
         m_pattern.clear();
     }
 
-    markAllClientsForInvalidation(RepaintInvalidation);
+    markAllClientsForInvalidation(markForInvalidation ? RepaintInvalidation : ParentOnlyInvalidation);
 }
 
-void RenderSVGResourcePattern::invalidateClient(RenderObject* client)
+void RenderSVGResourcePattern::removeClientFromCache(RenderObject* client, bool markForInvalidation)
 {
     ASSERT(client);
-    ASSERT(client->selfNeedsLayout());
 
     if (m_pattern.contains(client))
         delete m_pattern.take(client);
 
-    markClientForInvalidation(client, RepaintInvalidation);
+    markClientForInvalidation(client, markForInvalidation ? RepaintInvalidation : ParentOnlyInvalidation);
 }
 
 bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle* style, GraphicsContext*& context, unsigned short resourceMode)
@@ -77,7 +76,7 @@ bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle*
 
     // Be sure to synchronize all SVG properties on the patternElement _before_ processing any further.
     // Otherwhise the call to collectPatternAttributes() in createTileImage(), may cause the SVG DOM property
-    // synchronization to kick in, which causes invalidateClients() to be called, which in turn deletes our
+    // synchronization to kick in, which causes removeAllClientsFromCache() to be called, which in turn deletes our
     // PatternData object! Leaving out the line below will cause svg/dynamic-updates/SVGPatternElement-svgdom* to crash.
     SVGPatternElement* patternElement = static_cast<SVGPatternElement*>(node());
     if (!patternElement)
diff --git a/WebCore/rendering/RenderSVGResourcePattern.h b/WebCore/rendering/RenderSVGResourcePattern.h
index 690b0de..52bf09d 100644
--- a/WebCore/rendering/RenderSVGResourcePattern.h
+++ b/WebCore/rendering/RenderSVGResourcePattern.h
@@ -51,8 +51,8 @@ public:
 
     virtual const char* renderName() const { return "RenderSVGResourcePattern"; }
 
-    virtual void invalidateClients();
-    virtual void invalidateClient(RenderObject*);
+    virtual void removeAllClientsFromCache(bool markForInvalidation = true);
+    virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true);
 
     virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
     virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode);
diff --git a/WebCore/rendering/RenderSVGResourceSolidColor.h b/WebCore/rendering/RenderSVGResourceSolidColor.h
index ad7fd27..44109db 100644
--- a/WebCore/rendering/RenderSVGResourceSolidColor.h
+++ b/WebCore/rendering/RenderSVGResourceSolidColor.h
@@ -33,8 +33,8 @@ public:
     RenderSVGResourceSolidColor();
     virtual ~RenderSVGResourceSolidColor();
 
-    virtual void invalidateClients() { }
-    virtual void invalidateClient(RenderObject*) { }
+    virtual void removeAllClientsFromCache(bool = true) { }
+    virtual void removeClientFromCache(RenderObject*, bool = true) { }
 
     virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
     virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode);
diff --git a/WebCore/rendering/SVGRenderSupport.cpp b/WebCore/rendering/SVGRenderSupport.cpp
index 67e19f2..e265b2b 100644
--- a/WebCore/rendering/SVGRenderSupport.cpp
+++ b/WebCore/rendering/SVGRenderSupport.cpp
@@ -229,9 +229,20 @@ static inline RenderSVGRoot* svgRootTreeObject(RenderObject* start)
     return toRenderSVGRoot(start);
 }
 
+static inline void invalidateResourcesOfChildren(RenderObject* start)
+{
+    ASSERT(!start->needsLayout());
+    if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(start))
+        resources->removeClientFromCache(start, false);
+
+    for (RenderObject* child = start->firstChild(); child; child = child->nextSibling())
+        invalidateResourcesOfChildren(child);
+}
+
 void SVGRenderSupport::layoutChildren(RenderObject* start, bool selfNeedsLayout)
 {
     bool layoutSizeChanged = svgRootTreeObject(start)->isLayoutSizeChanged();
+    HashSet<RenderObject*> notlayoutedObjects;
 
     for (RenderObject* child = start->firstChild(); child; child = child->nextSibling()) {
         bool needsLayout = selfNeedsLayout;
@@ -252,11 +263,25 @@ void SVGRenderSupport::layoutChildren(RenderObject* start, bool selfNeedsLayout)
         if (needsLayout) {
             child->setNeedsLayout(true, false);
             child->layout();
-        } else
-            child->layoutIfNeeded();
+        } else {
+            if (child->needsLayout())
+                child->layout();
+            else if (layoutSizeChanged)
+                notlayoutedObjects.add(child);
+        }
 
         ASSERT(!child->needsLayout());
     }
+
+    if (!layoutSizeChanged) {
+        ASSERT(notlayoutedObjects.isEmpty());
+        return;
+    }
+
+    // If the layout size changed, invalidate all resources of all children that didn't go through the layout() code path.
+    HashSet<RenderObject*>::iterator end = notlayoutedObjects.end();
+    for (HashSet<RenderObject*>::iterator it = notlayoutedObjects.begin(); it != end; ++it)
+        invalidateResourcesOfChildren(*it);
 }
 
 bool SVGRenderSupport::isOverflowHidden(const RenderObject* object)
diff --git a/WebCore/rendering/SVGResources.cpp b/WebCore/rendering/SVGResources.cpp
index 290ef41..799301b 100644
--- a/WebCore/rendering/SVGResources.cpp
+++ b/WebCore/rendering/SVGResources.cpp
@@ -279,7 +279,7 @@ bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRen
     return foundResources;
 }
 
-void SVGResources::invalidateClient(RenderObject* object) const
+void SVGResources::removeClientFromCache(RenderObject* object, bool markForInvalidation) const
 {
     if (!m_clipperFilterMaskerData && !m_markerData && !m_fillStrokeData && !m_linkedResource)
         return;
@@ -288,35 +288,35 @@ void SVGResources::invalidateClient(RenderObject* object) const
         ASSERT(!m_clipperFilterMaskerData);
         ASSERT(!m_markerData);
         ASSERT(!m_fillStrokeData);
-        m_linkedResource->invalidateClient(object);
+        m_linkedResource->removeClientFromCache(object, markForInvalidation);
         return;
     }
 
     if (m_clipperFilterMaskerData) {
         if (m_clipperFilterMaskerData->clipper)
-            m_clipperFilterMaskerData->clipper->invalidateClient(object);
+            m_clipperFilterMaskerData->clipper->removeClientFromCache(object, markForInvalidation);
 #if ENABLE(FILTERS)
         if (m_clipperFilterMaskerData->filter)
-            m_clipperFilterMaskerData->filter->invalidateClient(object);
+            m_clipperFilterMaskerData->filter->removeClientFromCache(object, markForInvalidation);
 #endif
         if (m_clipperFilterMaskerData->masker)
-            m_clipperFilterMaskerData->masker->invalidateClient(object);
+            m_clipperFilterMaskerData->masker->removeClientFromCache(object, markForInvalidation);
     }
 
     if (m_markerData) {
         if (m_markerData->markerStart)
-            m_markerData->markerStart->invalidateClient(object);
+            m_markerData->markerStart->removeClientFromCache(object, markForInvalidation);
         if (m_markerData->markerMid)
-            m_markerData->markerMid->invalidateClient(object);
+            m_markerData->markerMid->removeClientFromCache(object, markForInvalidation);
         if (m_markerData->markerEnd)
-            m_markerData->markerEnd->invalidateClient(object);
+            m_markerData->markerEnd->removeClientFromCache(object, markForInvalidation);
     }
 
     if (m_fillStrokeData) {
         if (m_fillStrokeData->fill)
-            m_fillStrokeData->fill->invalidateClient(object);
+            m_fillStrokeData->fill->removeClientFromCache(object, markForInvalidation);
         if (m_fillStrokeData->stroke)
-            m_fillStrokeData->stroke->invalidateClient(object);
+            m_fillStrokeData->stroke->removeClientFromCache(object, markForInvalidation);
     }
 }
 
@@ -330,7 +330,7 @@ void SVGResources::resourceDestroyed(RenderSVGResourceContainer* resource)
         ASSERT(!m_clipperFilterMaskerData);
         ASSERT(!m_markerData);
         ASSERT(!m_fillStrokeData);
-        m_linkedResource->invalidateClients();
+        m_linkedResource->removeAllClientsFromCache();
         m_linkedResource = 0;
         return;
     }
@@ -340,7 +340,7 @@ void SVGResources::resourceDestroyed(RenderSVGResourceContainer* resource)
         if (!m_clipperFilterMaskerData)
             break;
         if (m_clipperFilterMaskerData->masker == resource) {
-            m_clipperFilterMaskerData->masker->invalidateClients();
+            m_clipperFilterMaskerData->masker->removeAllClientsFromCache();
             m_clipperFilterMaskerData->masker = 0;
         }
         break;
@@ -348,15 +348,15 @@ void SVGResources::resourceDestroyed(RenderSVGResourceContainer* resource)
         if (!m_markerData)
             break;
         if (m_markerData->markerStart == resource) {
-            m_markerData->markerStart->invalidateClients();
+            m_markerData->markerStart->removeAllClientsFromCache();
             m_markerData->markerStart = 0;
         }
         if (m_markerData->markerMid == resource) {
-            m_markerData->markerMid->invalidateClients();
+            m_markerData->markerMid->removeAllClientsFromCache();
             m_markerData->markerMid = 0;
         }
         if (m_markerData->markerEnd == resource) {
-            m_markerData->markerEnd->invalidateClients();
+            m_markerData->markerEnd->removeAllClientsFromCache();
             m_markerData->markerEnd = 0;
         }
         break;
@@ -366,11 +366,11 @@ void SVGResources::resourceDestroyed(RenderSVGResourceContainer* resource)
         if (!m_fillStrokeData)
             break;
         if (m_fillStrokeData->fill == resource) {
-            m_fillStrokeData->fill->invalidateClients();
+            m_fillStrokeData->fill->removeAllClientsFromCache();
             m_fillStrokeData->fill = 0;
         }
         if (m_fillStrokeData->stroke == resource) {
-            m_fillStrokeData->stroke->invalidateClients();
+            m_fillStrokeData->stroke->removeAllClientsFromCache();
             m_fillStrokeData->stroke = 0;
         }
         break;
@@ -379,7 +379,7 @@ void SVGResources::resourceDestroyed(RenderSVGResourceContainer* resource)
         if (!m_clipperFilterMaskerData)
             break;
         if (m_clipperFilterMaskerData->filter == resource) {
-            m_clipperFilterMaskerData->filter->invalidateClients();
+            m_clipperFilterMaskerData->filter->removeAllClientsFromCache();
             m_clipperFilterMaskerData->filter = 0;
         }
 #else
@@ -390,7 +390,7 @@ void SVGResources::resourceDestroyed(RenderSVGResourceContainer* resource)
         if (!m_clipperFilterMaskerData)
             break; 
         if (m_clipperFilterMaskerData->clipper == resource) {
-            m_clipperFilterMaskerData->clipper->invalidateClients();
+            m_clipperFilterMaskerData->clipper->removeAllClientsFromCache();
             m_clipperFilterMaskerData->clipper = 0;
         }
         break;
diff --git a/WebCore/rendering/SVGResources.h b/WebCore/rendering/SVGResources.h
index a07a990..5f6e746 100644
--- a/WebCore/rendering/SVGResources.h
+++ b/WebCore/rendering/SVGResources.h
@@ -64,7 +64,7 @@ public:
     void buildSetOfResources(HashSet<RenderSVGResourceContainer*>&);
 
     // Methods operating on all cached resources
-    void invalidateClient(RenderObject*) const;
+    void removeClientFromCache(RenderObject*, bool markForInvalidation = true) const;
     void resourceDestroyed(RenderSVGResourceContainer*);
 
 #ifndef NDEBUG
diff --git a/WebCore/rendering/SVGResourcesCache.cpp b/WebCore/rendering/SVGResourcesCache.cpp
index b922b44..a4089d6 100644
--- a/WebCore/rendering/SVGResourcesCache.cpp
+++ b/WebCore/rendering/SVGResourcesCache.cpp
@@ -121,7 +121,7 @@ void SVGResourcesCache::clientLayoutChanged(RenderObject* object)
     if (!resources)
         return;
 
-    resources->invalidateClient(object);
+    resources->removeClientFromCache(object);
 }
 
 void SVGResourcesCache::clientStyleChanged(RenderObject* renderer, StyleDifference diff, const RenderStyle* newStyle)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list