[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756

bdakin at apple.com bdakin at apple.com
Fri Feb 26 22:17:28 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit fe591736217334905f3d22c2f349e8b79c893416
Author: bdakin at apple.com <bdakin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Feb 11 03:04:38 2010 +0000

    WebCore: Fix for https://bugs.webkit.org/show_bug.cgi?id=34185 REGRESSION:
    Mask not invalidating
    
    Reviewed by Simon Fraser and Darin Adler.
    
    SVGMaskElement is the only class that keeps a HashMap of canvas
    resources rather than just a pointer to a resource. This
    patch makes SVGMaskElement invalidate all of its resources in the
    HashMap instead of just one.
    
    * svg/SVGMaskElement.cpp:
    (WebCore::SVGMaskElement::svgAttributeChanged):
    (WebCore::SVGMaskElement::childrenChanged):
    (WebCore::SVGMaskElement::invalidateCanvasResources):
    * svg/SVGMaskElement.h:
    * svg/SVGStyledElement.cpp:
    (WebCore::SVGStyledElement::invalidateResourcesInAncestorChain):
    (WebCore::SVGStyledElement::invalidateCanvasResources):
    * svg/SVGStyledElement.h:
    
    LayoutTests: Test for https://bugs.webkit.org/show_bug.cgi?id=34185 REGRESSION:
    Mask not invalidating
    
    Reviewed by Simon Fraser and Darin Adler.
    
    * platform/mac/svg/custom/mask-invalidation-expected.checksum: Added.
    * platform/mac/svg/custom/mask-invalidation-expected.png: Added.
    * platform/mac/svg/custom/mask-invalidation-expected.txt: Added.
    * svg/custom/mask-invalidation.svg: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54638 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 5a22cda..7b5323c 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-02-10  Beth Dakin  <bdakin at apple.com>
+
+        Reviewed by Simon Fraser and Darin Adler.
+
+        Test for https://bugs.webkit.org/show_bug.cgi?id=34185 REGRESSION: 
+        Mask not invalidating
+
+        * platform/mac/svg/custom/mask-invalidation-expected.checksum: Added.
+        * platform/mac/svg/custom/mask-invalidation-expected.png: Added.
+        * platform/mac/svg/custom/mask-invalidation-expected.txt: Added.
+        * svg/custom/mask-invalidation.svg: Added.
+
 2010-02-10  Csaba Osztrogonác  <ossy at webkit.org>
 
         Unreviewed. Roll out r54626, because it broke GTK and Win build.
diff --git a/LayoutTests/platform/mac/svg/custom/mask-invalidation-expected.checksum b/LayoutTests/platform/mac/svg/custom/mask-invalidation-expected.checksum
new file mode 100644
index 0000000..ab41bbd
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/mask-invalidation-expected.checksum
@@ -0,0 +1 @@
+eba47dc5e56745ca81fa1d3eaa3559cc
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/custom/mask-invalidation-expected.png b/LayoutTests/platform/mac/svg/custom/mask-invalidation-expected.png
new file mode 100644
index 0000000..b14eee1
Binary files /dev/null and b/LayoutTests/platform/mac/svg/custom/mask-invalidation-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/custom/mask-invalidation-expected.txt b/LayoutTests/platform/mac/svg/custom/mask-invalidation-expected.txt
new file mode 100644
index 0000000..cfd8d08
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/mask-invalidation-expected.txt
@@ -0,0 +1,16 @@
+KCanvasResource {id="mask" [type=MASKER]}
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (0,0) size 800x600
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+      RenderSVGContainer {mask} at (50,50) size 460x316
+        RenderPath {rect} at (50,50) size 460x316 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M50.00,50.00 L510.00,50.00 L510.00,366.00 L50.00,366.00 Z"]
+    RenderSVGContainer {g} at (50,50) size 453x299
+      RenderPath {rect} at (50,50) size 453x299 [fill={[type=SOLID] [color=#008000]}] [data="M50.00,50.00 L503.00,50.00 L503.00,349.00 L50.00,349.00 Z"]
+    RenderSVGText {text} at (14,20) size 83x18 contains 1 chunk(s)
+      RenderSVGInlineText {#text} at (0,-14) size 83x18
+        chunk 1 text run 1 at (14.00,20.00) startOffset 0 endOffset 11 width 83.00: "Move Object"
+    RenderSVGText {text} at (208,20) size 94x18 contains 1 chunk(s)
+      RenderSVGInlineText {#text} at (0,-14) size 94x18
+        chunk 1 text run 1 at (208.00,20.00) startOffset 0 endOffset 14 width 94.00: "Restore Object"
diff --git a/LayoutTests/svg/custom/mask-invalidation.svg b/LayoutTests/svg/custom/mask-invalidation.svg
new file mode 100644
index 0000000..d566425
--- /dev/null
+++ b/LayoutTests/svg/custom/mask-invalidation.svg
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<script>
+if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
+
+function draw(x, y) {
+    var maskrect = document.getElementById("maskRect");
+    maskrect.setAttribute("transform", "translate(" + x + "," + y + ")");
+
+    var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
+    rect.setAttribute("x", x);
+    rect.setAttribute("y", y);
+    rect.setAttribute("width", 453);
+    rect.setAttribute("height", 299);
+    rect.setAttribute("fill", "green");
+    rect.setAttribute("mask", "url(#mask)");
+
+    var root = document.getElementById("root");
+    while (root.firstChild) {
+        root.removeChild(root.firstChild);
+    }
+    root.appendChild(rect);
+}
+
+function moveObject() {
+    window.setTimeout('draw(150, 50)', 100);
+}
+
+function restore() {
+    window.setTimeout('draw(50, 50)', 100);
+}
+
+function finish() {
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+</script>
+<defs>
+<mask id="mask" maskUnits="userSpaceOnUse" maskContentUnits="userSpaceOnUse">
+    <rect id="maskRect" x="50" y="50" width="460" height="316" fill="white" />
+</mask>
+</defs>
+<g id="root">
+    <rect x="50" y="50" width="453" height="299" fill="green" mask="url(#mask)"/>
+</g>
+<text x="14" y="20" font-size="16" onclick="draw(150, 50)">Move Object</text>
+<text x="208" y="20" font-size="16" onclick="draw(50, 50)">Restore Object</text>
+<script>
+    window.setTimeout('moveObject()', 100);
+    window.setTimeout('restore()', 100);
+    window.setTimeout('moveObject()', 100);
+    window.setTimeout('restore()', 100);
+    window.setTimeout('finish()', 0);
+</script>
+</svg>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 0584b8c..5d66247 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2010-02-10  Beth Dakin  <bdakin at apple.com>
+
+        Reviewed by Simon Fraser and Darin Adler.
+
+        Fix for https://bugs.webkit.org/show_bug.cgi?id=34185 REGRESSION: 
+        Mask not invalidating
+
+        SVGMaskElement is the only class that keeps a HashMap of canvas 
+        resources rather than just a pointer to a resource. This 
+        patch makes SVGMaskElement invalidate all of its resources in the 
+        HashMap instead of just one.
+
+        * svg/SVGMaskElement.cpp:
+        (WebCore::SVGMaskElement::svgAttributeChanged):
+        (WebCore::SVGMaskElement::childrenChanged):
+        (WebCore::SVGMaskElement::invalidateCanvasResources):
+        * svg/SVGMaskElement.h:
+        * svg/SVGStyledElement.cpp:
+        (WebCore::SVGStyledElement::invalidateResourcesInAncestorChain):
+        (WebCore::SVGStyledElement::invalidateCanvasResources):
+        * svg/SVGStyledElement.h:
+
 2010-02-10  Stephan Aßmus  <superstippi at gmx.de>
 
         Reviewed by David Levin.
diff --git a/WebCore/svg/SVGMaskElement.cpp b/WebCore/svg/SVGMaskElement.cpp
index dc330be..86d1062 100644
--- a/WebCore/svg/SVGMaskElement.cpp
+++ b/WebCore/svg/SVGMaskElement.cpp
@@ -105,9 +105,6 @@ void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName)
 {
     SVGStyledElement::svgAttributeChanged(attrName);
 
-    if (m_masker.isEmpty())
-        return;
-
     if (attrName == SVGNames::maskUnitsAttr || attrName == SVGNames::maskContentUnitsAttr ||
         attrName == SVGNames::xAttr || attrName == SVGNames::yAttr ||
         attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr ||
@@ -116,8 +113,7 @@ void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName)
         SVGLangSpace::isKnownAttribute(attrName) ||
         SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
         SVGStyledElement::isKnownAttribute(attrName))
-        for (HashMap<const RenderObject*, RefPtr<SVGResourceMasker> >::iterator it = m_masker.begin(); it != m_masker.end(); ++it)
-            it->second->invalidate();
+        invalidateCanvasResources();
 }
 
 void SVGMaskElement::synchronizeProperty(const QualifiedName& attrName)
@@ -151,12 +147,7 @@ void SVGMaskElement::synchronizeProperty(const QualifiedName& attrName)
 void SVGMaskElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
 {
     SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
-
-    if (m_masker.isEmpty())
-        return;
-
-    for (HashMap<const RenderObject*, RefPtr<SVGResourceMasker> >::iterator it = m_masker.begin(); it != m_masker.end(); ++it)
-        it->second->invalidate();
+    invalidateCanvasResources();
 }
 
 FloatRect SVGMaskElement::maskBoundingBox(const FloatRect& objectBoundingBox) const
@@ -285,6 +276,15 @@ SVGResource* SVGMaskElement::canvasResource(const RenderObject* object)
     return maskerPtr;
 }
 
+void SVGMaskElement::invalidateCanvasResources()
+{
+    // Don't call through to the base class since the base class will just
+    // invalidate one item in the HashMap. 
+    HashMap<const RenderObject*, RefPtr<SVGResourceMasker> >::const_iterator end = m_masker.end();
+    for (HashMap<const RenderObject*, RefPtr<SVGResourceMasker> >::const_iterator it = m_masker.begin(); it != end; ++it)
+        it->second->invalidate();
+}
+
 }
 
 #endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGMaskElement.h b/WebCore/svg/SVGMaskElement.h
index 3abc08b..005fa4f 100644
--- a/WebCore/svg/SVGMaskElement.h
+++ b/WebCore/svg/SVGMaskElement.h
@@ -71,6 +71,8 @@ namespace WebCore {
         // SVGExternalResourcesRequired
         DECLARE_ANIMATED_PROPERTY(SVGMaskElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired)
 
+        virtual void invalidateCanvasResources();
+
         HashMap<const RenderObject*, RefPtr<SVGResourceMasker> > m_masker;
     };
 
diff --git a/WebCore/svg/SVGStyledElement.cpp b/WebCore/svg/SVGStyledElement.cpp
index 4228a4c..be1ba9c 100644
--- a/WebCore/svg/SVGStyledElement.cpp
+++ b/WebCore/svg/SVGStyledElement.cpp
@@ -251,15 +251,19 @@ void SVGStyledElement::invalidateResourcesInAncestorChain() const
             break;
 
         SVGElement* element = static_cast<SVGElement*>(node);
-        if (SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(element->isStyled() ? element : 0)) {
-            if (SVGResource* resource = styledElement->canvasResource(node->renderer()))
-                resource->invalidate();
-        }
+        if (SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(element->isStyled() ? element : 0))
+            styledElement->invalidateCanvasResources();
 
         node = node->parentNode();
     }
 }
 
+void SVGStyledElement::invalidateCanvasResources()
+{
+    if (SVGResource* resource = canvasResource(renderer()))
+        resource->invalidate();
+}
+
 void SVGStyledElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
 {
     SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
diff --git a/WebCore/svg/SVGStyledElement.h b/WebCore/svg/SVGStyledElement.h
index 9f76c68..aec3e75 100644
--- a/WebCore/svg/SVGStyledElement.h
+++ b/WebCore/svg/SVGStyledElement.h
@@ -71,6 +71,8 @@ namespace WebCore {
     protected: 
         static int cssPropertyIdForSVGAttributeName(const QualifiedName&);
 
+        virtual void invalidateCanvasResources();
+
     private:
         DECLARE_ANIMATED_PROPERTY(SVGStyledElement, HTMLNames::classAttr, String, ClassName, className)
     };

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list