[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

krit at webkit.org krit at webkit.org
Thu Apr 8 00:50:26 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit ca9f3d341451f8d9201b4c0a7cf7583397b7a3fd
Author: krit at webkit.org <krit at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Dec 27 17:08:50 2009 +0000

    2009-12-27  Dirk Schulze  <krit at webkit.org>
    
            Reviewed by Nikolas Zimmermann.
    
            SVG Mask result wrong, if two different objects call the same mask id
            https://bugs.webkit.org/show_bug.cgi?id=32787
    
            At the moment we create one resource per maskId. Some resources (like mask)
            create ImageBuffers and depends on the properties of the RenderObject,
            thus we can't use it for a second object.
            This patch stores multiple mask resources for one maskId and different
            RenderObject can use the same maskId.
            Clipper, Filter and Patterns also need to store multiple resources later.
    
            Test: svg/custom/mask-on-multiple-objects.svg
    
            * rendering/RenderPath.cpp:
            (WebCore::RenderPath::drawMarkersIfNeeded):
            * rendering/RenderSVGContainer.cpp:
            (WebCore::RenderSVGContainer::selfWillPaint):
            * rendering/RenderSVGGradientStop.cpp:
            (WebCore::RenderSVGGradientStop::styleDidChange):
            * rendering/RenderSVGRoot.cpp:
            (WebCore::RenderSVGRoot::selfWillPaint):
            * rendering/SVGRenderSupport.cpp:
            (WebCore::SVGRenderBase::prepareToRenderSVGContent):
            (WebCore::SVGRenderBase::filterBoundingBoxForRenderer):
            * rendering/SVGRenderTreeAsText.cpp:
            (WebCore::writeRenderResources):
            * svg/SVGClipPathElement.cpp:
            (WebCore::SVGClipPathElement::canvasResource):
            * svg/SVGClipPathElement.h:
            * svg/SVGFilterElement.cpp:
            (WebCore::SVGFilterElement::canvasResource):
            * svg/SVGFilterElement.h:
            * svg/SVGGradientElement.cpp:
            (WebCore::SVGGradientElement::canvasResource):
            * svg/SVGGradientElement.h:
            * svg/SVGMarkerElement.cpp:
            (WebCore::SVGMarkerElement::canvasResource):
            * svg/SVGMarkerElement.h:
            * svg/SVGMaskElement.cpp:
            (WebCore::SVGMaskElement::svgAttributeChanged):
            (WebCore::SVGMaskElement::childrenChanged):
            (WebCore::SVGMaskElement::canvasResource):
            * svg/SVGMaskElement.h:
            * svg/SVGPatternElement.cpp:
            (WebCore::SVGPatternElement::canvasResource):
            * svg/SVGPatternElement.h:
            * svg/SVGStyledElement.cpp:
            (WebCore::SVGStyledElement::invalidateResourcesInAncestorChain):
            * svg/SVGStyledElement.h:
            (WebCore::SVGStyledElement::canvasResource):
            * svg/graphics/SVGPaintServer.cpp:
            (WebCore::getPaintServerById):
            (WebCore::SVGPaintServer::fillPaintServer):
            (WebCore::SVGPaintServer::strokePaintServer):
            * svg/graphics/SVGPaintServer.h:
            * svg/graphics/SVGResource.cpp:
            (WebCore::getResourceById):
            * svg/graphics/SVGResource.h:
            * svg/graphics/SVGResourceClipper.cpp:
            (WebCore::getClipperById):
            * svg/graphics/SVGResourceClipper.h:
            * svg/graphics/SVGResourceFilter.cpp:
            (WebCore::getFilterById):
            * svg/graphics/SVGResourceFilter.h:
            * svg/graphics/SVGResourceMarker.cpp:
            (WebCore::getMarkerById):
            * svg/graphics/SVGResourceMarker.h:
            * svg/graphics/SVGResourceMasker.cpp:
            (WebCore::getMaskerById):
            * svg/graphics/SVGResourceMasker.h:
    
    2009-12-27  Dirk Schulze  <krit at webkit.org>
    
            Reviewed by Nikolas Zimmermann.
    
            SVG Mask result wrong, if two different objects call the same mask id
            https://bugs.webkit.org/show_bug.cgi?id=32787
    
            Two rects with different sizes and positions call the same mask id. Both
            rects should be masked to two circles, dependent on the properties of the
            rects.
    
            * platform/mac/svg/custom/mask-on-multiple-objects-expected.checksum: Added.
            * platform/mac/svg/custom/mask-on-multiple-objects-expected.png: Added.
            * platform/mac/svg/custom/mask-on-multiple-objects-expected.txt: Added.
            * svg/custom/mask-on-multiple-objects.svg: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52580 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 92854a4..ae44298 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,19 @@
+2009-12-27  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        SVG Mask result wrong, if two different objects call the same mask id
+        https://bugs.webkit.org/show_bug.cgi?id=32787
+
+        Two rects with different sizes and positions call the same mask id. Both
+        rects should be masked to two circles, dependent on the properties of the
+        rects.
+
+        * platform/mac/svg/custom/mask-on-multiple-objects-expected.checksum: Added.
+        * platform/mac/svg/custom/mask-on-multiple-objects-expected.png: Added.
+        * platform/mac/svg/custom/mask-on-multiple-objects-expected.txt: Added.
+        * svg/custom/mask-on-multiple-objects.svg: Added.
+
 2009-12-27  Csaba Osztrogonác  <ossy at webkit.org>
 
         Rubber-stamped by Simon Hausmann.
diff --git a/LayoutTests/platform/mac/svg/custom/mask-on-multiple-objects-expected.checksum b/LayoutTests/platform/mac/svg/custom/mask-on-multiple-objects-expected.checksum
new file mode 100644
index 0000000..7345e69
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/mask-on-multiple-objects-expected.checksum
@@ -0,0 +1 @@
+0e54f6f5676bc72ce4b2bab44a477046
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/custom/mask-on-multiple-objects-expected.png b/LayoutTests/platform/mac/svg/custom/mask-on-multiple-objects-expected.png
new file mode 100644
index 0000000..977a623
Binary files /dev/null and b/LayoutTests/platform/mac/svg/custom/mask-on-multiple-objects-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/custom/mask-on-multiple-objects-expected.txt b/LayoutTests/platform/mac/svg/custom/mask-on-multiple-objects-expected.txt
new file mode 100644
index 0000000..8c0b763
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/mask-on-multiple-objects-expected.txt
@@ -0,0 +1,10 @@
+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 (20,20) size 220x100
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+      RenderSVGContainer {mask} at (0,0) size 1x1
+        RenderPath {circle} at (0,0) size 1x1 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M1.00,0.50 L1.00,0.53 L1.00,0.56 L0.99,0.59 L0.98,0.62 L0.98,0.65 L0.96,0.68 L0.95,0.71 L0.94,0.74 L0.92,0.77 L0.90,0.79 L0.89,0.82 L0.86,0.84 L0.84,0.86 L0.82,0.89 L0.79,0.90 L0.77,0.92 L0.74,0.94 L0.71,0.95 L0.68,0.96 L0.65,0.98 L0.62,0.98 L0.59,0.99 L0.56,1.00 L0.53,1.00 L0.50,1.00 L0.47,1.00 L0.44,1.00 L0.41,0.99 L0.38,0.98 L0.35,0.98 L0.32,0.96 L0.29,0.95 L0.26,0.94 L0.23,0.92 L0.21,0.90 L0.18,0.89 L0.16,0.86 L0.14,0.84 L0.11,0.82 L0.10,0.79 L0.08,0.77 L0.06,0.74 L0.05,0.71 L0.04,0.68 L0.02,0.65 L0.02,0.62 L0.01,0.59 L0.00,0.56 L0.00,0.53 L0.00,0.50 L0.00,0.47 L0.00,0.44 L0.01,0.41 L0.02,0.38 L0.02,0.35 L0.04,0.32 L0.05,0.29 L0.06,0.26 L0.08,0.23 L0.10,0.21 L0.11,0.18 L0.14,0.16 L0.16,0.14 L0.18,0.11 L0.21,0.10 L0.23,0.08 L0.26,0.06 L0.29,0.05 L0.32,0.04 L0.35,0.02 L0.38,0.02 L0.41,0.01 L0.44,0.00 L0.47,0.00 L0.50,0.00 L0.53,0.00 L0.56,0.00 L0.59,0.01 L0.62,0.02 L0.65,0.02 L0.68,0.04 L0.71,0.05 L0.74,0.06 L0.77,0.08 L0.79,0.10 L0.82,0.11 L0.84,0.14 L0.86,0.16 L0.89,0.18 L0.90,0.21 L0.92,0.23 L0.94,0.26 L0.95,0.29 L0.96,0.32 L0.98,0.35 L0.98,0.38 L0.99,0.41 L1.00,0.44 L1.00,0.47 Z"]
+    RenderPath {rect} at (20,20) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M20.00,20.00 L120.00,20.00 L120.00,120.00 L20.00,120.00 Z"]
+    RenderPath {rect} at (140,50) size 100x40 [fill={[type=SOLID] [color=#008000]}] [data="M140.00,50.00 L240.00,50.00 L240.00,90.00 L140.00,90.00 Z"]
diff --git a/LayoutTests/svg/custom/mask-on-multiple-objects.svg b/LayoutTests/svg/custom/mask-on-multiple-objects.svg
new file mode 100644
index 0000000..8b53c33
--- /dev/null
+++ b/LayoutTests/svg/custom/mask-on-multiple-objects.svg
@@ -0,0 +1,10 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<defs>
+<!-- You should see two circles with different sizes -->
+<mask id="mask" x="0%" y="0%" width="100%" height="100%" maskContentUnits="objectBoundingBox">
+    <circle cx=".5" cy=".5" r=".5" fill="white"/>
+</mask>
+</defs>
+<rect x="20" y="20" width="100" height="100" style="fill:green;mask:url(#mask);"/>
+<rect x="140" y="50" width="100" height="40" style="fill:green;mask:url(#mask);"/>
+</svg>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 59ec637..ce4312e 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,77 @@
+2009-12-27  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        SVG Mask result wrong, if two different objects call the same mask id
+        https://bugs.webkit.org/show_bug.cgi?id=32787
+
+        At the moment we create one resource per maskId. Some resources (like mask)
+        create ImageBuffers and depends on the properties of the RenderObject,
+        thus we can't use it for a second object.
+        This patch stores multiple mask resources for one maskId and different
+        RenderObject can use the same maskId.
+        Clipper, Filter and Patterns also need to store multiple resources later.
+
+        Test: svg/custom/mask-on-multiple-objects.svg
+
+        * rendering/RenderPath.cpp:
+        (WebCore::RenderPath::drawMarkersIfNeeded):
+        * rendering/RenderSVGContainer.cpp:
+        (WebCore::RenderSVGContainer::selfWillPaint):
+        * rendering/RenderSVGGradientStop.cpp:
+        (WebCore::RenderSVGGradientStop::styleDidChange):
+        * rendering/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::selfWillPaint):
+        * rendering/SVGRenderSupport.cpp:
+        (WebCore::SVGRenderBase::prepareToRenderSVGContent):
+        (WebCore::SVGRenderBase::filterBoundingBoxForRenderer):
+        * rendering/SVGRenderTreeAsText.cpp:
+        (WebCore::writeRenderResources):
+        * svg/SVGClipPathElement.cpp:
+        (WebCore::SVGClipPathElement::canvasResource):
+        * svg/SVGClipPathElement.h:
+        * svg/SVGFilterElement.cpp:
+        (WebCore::SVGFilterElement::canvasResource):
+        * svg/SVGFilterElement.h:
+        * svg/SVGGradientElement.cpp:
+        (WebCore::SVGGradientElement::canvasResource):
+        * svg/SVGGradientElement.h:
+        * svg/SVGMarkerElement.cpp:
+        (WebCore::SVGMarkerElement::canvasResource):
+        * svg/SVGMarkerElement.h:
+        * svg/SVGMaskElement.cpp:
+        (WebCore::SVGMaskElement::svgAttributeChanged):
+        (WebCore::SVGMaskElement::childrenChanged):
+        (WebCore::SVGMaskElement::canvasResource):
+        * svg/SVGMaskElement.h:
+        * svg/SVGPatternElement.cpp:
+        (WebCore::SVGPatternElement::canvasResource):
+        * svg/SVGPatternElement.h:
+        * svg/SVGStyledElement.cpp:
+        (WebCore::SVGStyledElement::invalidateResourcesInAncestorChain):
+        * svg/SVGStyledElement.h:
+        (WebCore::SVGStyledElement::canvasResource):
+        * svg/graphics/SVGPaintServer.cpp:
+        (WebCore::getPaintServerById):
+        (WebCore::SVGPaintServer::fillPaintServer):
+        (WebCore::SVGPaintServer::strokePaintServer):
+        * svg/graphics/SVGPaintServer.h:
+        * svg/graphics/SVGResource.cpp:
+        (WebCore::getResourceById):
+        * svg/graphics/SVGResource.h:
+        * svg/graphics/SVGResourceClipper.cpp:
+        (WebCore::getClipperById):
+        * svg/graphics/SVGResourceClipper.h:
+        * svg/graphics/SVGResourceFilter.cpp:
+        (WebCore::getFilterById):
+        * svg/graphics/SVGResourceFilter.h:
+        * svg/graphics/SVGResourceMarker.cpp:
+        (WebCore::getMarkerById):
+        * svg/graphics/SVGResourceMarker.h:
+        * svg/graphics/SVGResourceMasker.cpp:
+        (WebCore::getMaskerById):
+        * svg/graphics/SVGResourceMasker.h:
+
 2009-12-27  Nikolas Zimmermann  <nzimmermann at rim.com>
 
         Reviewed by Dirk Schulze.
diff --git a/WebCore/rendering/RenderPath.cpp b/WebCore/rendering/RenderPath.cpp
index cced56c..0438ec4 100644
--- a/WebCore/rendering/RenderPath.cpp
+++ b/WebCore/rendering/RenderPath.cpp
@@ -371,9 +371,9 @@ FloatRect RenderPath::drawMarkersIfNeeded(PaintInfo& paintInfo, const Path& path
     AtomicString midMarkerId(svgStyle->midMarker());
     AtomicString endMarkerId(svgStyle->endMarker());
 
-    SVGResourceMarker* startMarker = getMarkerById(doc, startMarkerId);
-    SVGResourceMarker* midMarker = getMarkerById(doc, midMarkerId);
-    SVGResourceMarker* endMarker = getMarkerById(doc, endMarkerId);
+    SVGResourceMarker* startMarker = getMarkerById(doc, startMarkerId, this);
+    SVGResourceMarker* midMarker = getMarkerById(doc, midMarkerId, this);
+    SVGResourceMarker* endMarker = getMarkerById(doc, endMarkerId, this);
 
     if (!startMarker && !startMarkerId.isEmpty())
         svgElement->document()->accessSVGExtensions()->addPendingResource(startMarkerId, styledElement);
diff --git a/WebCore/rendering/RenderSVGContainer.cpp b/WebCore/rendering/RenderSVGContainer.cpp
index d7aec99..a3d5867 100644
--- a/WebCore/rendering/RenderSVGContainer.cpp
+++ b/WebCore/rendering/RenderSVGContainer.cpp
@@ -82,7 +82,7 @@ bool RenderSVGContainer::selfWillPaint() const
 {
 #if ENABLE(FILTERS)
     const SVGRenderStyle* svgStyle = style()->svgStyle();
-    SVGResourceFilter* filter = getFilterById(document(), svgStyle->filter());
+    SVGResourceFilter* filter = getFilterById(document(), svgStyle->filter(), this);
     if (filter)
         return true;
 #endif
diff --git a/WebCore/rendering/RenderSVGGradientStop.cpp b/WebCore/rendering/RenderSVGGradientStop.cpp
index b81e7f4..66391c8 100644
--- a/WebCore/rendering/RenderSVGGradientStop.cpp
+++ b/WebCore/rendering/RenderSVGGradientStop.cpp
@@ -49,7 +49,7 @@ void RenderSVGGradientStop::styleDidChange(StyleDifference diff, const RenderSty
     // <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.
     if (SVGGradientElement* gradient = gradientElement()) {
-        if (SVGResource* resource = gradient->canvasResource())
+        if (SVGResource* resource = gradient->canvasResource(this))
             resource->invalidate();
     }
 }
diff --git a/WebCore/rendering/RenderSVGRoot.cpp b/WebCore/rendering/RenderSVGRoot.cpp
index 0a39bf4..d014277 100644
--- a/WebCore/rendering/RenderSVGRoot.cpp
+++ b/WebCore/rendering/RenderSVGRoot.cpp
@@ -113,7 +113,7 @@ bool RenderSVGRoot::selfWillPaint() const
 {
 #if ENABLE(FILTERS)
     const SVGRenderStyle* svgStyle = style()->svgStyle();
-    SVGResourceFilter* filter = getFilterById(document(), svgStyle->filter());
+    SVGResourceFilter* filter = getFilterById(document(), svgStyle->filter(), this);
     if (filter)
         return true;
 #endif
diff --git a/WebCore/rendering/SVGRenderSupport.cpp b/WebCore/rendering/SVGRenderSupport.cpp
index 1935a22..bfaa9a8 100644
--- a/WebCore/rendering/SVGRenderSupport.cpp
+++ b/WebCore/rendering/SVGRenderSupport.cpp
@@ -116,7 +116,7 @@ void SVGRenderBase::prepareToRenderSVGContent(RenderObject* object, RenderObject
     Document* document = object->document();
 
 #if ENABLE(FILTERS)
-    SVGResourceFilter* newFilter = getFilterById(document, filterId);
+    SVGResourceFilter* newFilter = getFilterById(document, filterId, object);
     if (newFilter == rootFilter) {
         // Catch <text filter="url(#foo)">Test<tspan filter="url(#foo)">123</tspan></text>.
         // The filter is NOT meant to be applied twice in that case!
@@ -126,8 +126,8 @@ void SVGRenderBase::prepareToRenderSVGContent(RenderObject* object, RenderObject
         filter = newFilter;
 #endif
 
-    SVGResourceClipper* clipper = getClipperById(document, clipperId);
-    SVGResourceMasker* masker = getMaskerById(document, maskerId);
+    SVGResourceClipper* clipper = getClipperById(document, clipperId, object);
+    SVGResourceMasker* masker = getMaskerById(document, maskerId, object);
 
     if (masker) {
         masker->addClient(styledElement);
@@ -235,7 +235,7 @@ FloatRect SVGRenderBase::computeContainerBoundingBox(const RenderObject* contain
 FloatRect SVGRenderBase::filterBoundingBoxForRenderer(const RenderObject* object)
 {
 #if ENABLE(FILTERS)
-    SVGResourceFilter* filter = getFilterById(object->document(), object->style()->svgStyle()->filter());
+    SVGResourceFilter* filter = getFilterById(object->document(), object->style()->svgStyle()->filter(), object);
     if (filter)
         return filter->filterBoundingBox();
 #else
diff --git a/WebCore/rendering/SVGRenderTreeAsText.cpp b/WebCore/rendering/SVGRenderTreeAsText.cpp
index 5aa53a2..bd6a465 100644
--- a/WebCore/rendering/SVGRenderTreeAsText.cpp
+++ b/WebCore/rendering/SVGRenderTreeAsText.cpp
@@ -521,7 +521,7 @@ void writeRenderResources(TextStream& ts, Node* parent)
             continue;
 
         SVGStyledElement* styled = static_cast<SVGStyledElement*>(svgElement);
-        RefPtr<SVGResource> resource(styled->canvasResource());
+        RefPtr<SVGResource> resource(styled->canvasResource(node->renderer()));
         if (!resource)
             continue;
 
diff --git a/WebCore/svg/SVGClipPathElement.cpp b/WebCore/svg/SVGClipPathElement.cpp
index d5df29c..6cf0219 100644
--- a/WebCore/svg/SVGClipPathElement.cpp
+++ b/WebCore/svg/SVGClipPathElement.cpp
@@ -89,7 +89,7 @@ void SVGClipPathElement::childrenChanged(bool changedByParser, Node* beforeChang
     m_clipper->invalidate();
 }
 
-SVGResource* SVGClipPathElement::canvasResource()
+SVGResource* SVGClipPathElement::canvasResource(const RenderObject*)
 {
     if (!m_clipper)
         m_clipper = SVGResourceClipper::create();
diff --git a/WebCore/svg/SVGClipPathElement.h b/WebCore/svg/SVGClipPathElement.h
index 6079159..f8d37da 100644
--- a/WebCore/svg/SVGClipPathElement.h
+++ b/WebCore/svg/SVGClipPathElement.h
@@ -22,6 +22,7 @@
 #define SVGClipPathElement_h
 
 #if ENABLE(SVG)
+#include "RenderObject.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGLangSpace.h"
 #include "SVGResourceClipper.h"
@@ -45,7 +46,7 @@ namespace WebCore {
         virtual void svgAttributeChanged(const QualifiedName&);
         virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
 
-        virtual SVGResource* canvasResource();
+        virtual SVGResource* canvasResource(const RenderObject*);
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS(SVGClipPathElement, SVGNames::clipPathTagString, SVGNames::clipPathUnitsAttrString, int, ClipPathUnits, clipPathUnits)
diff --git a/WebCore/svg/SVGFilterElement.cpp b/WebCore/svg/SVGFilterElement.cpp
index bb14448..cb01ca8 100644
--- a/WebCore/svg/SVGFilterElement.cpp
+++ b/WebCore/svg/SVGFilterElement.cpp
@@ -160,7 +160,7 @@ void SVGFilterElement::buildFilter(const FloatRect& targetRect) const
     }
 }
 
-SVGResource* SVGFilterElement::canvasResource()
+SVGResource* SVGFilterElement::canvasResource(const RenderObject*)
 {
     if (!attached())
         return 0;
diff --git a/WebCore/svg/SVGFilterElement.h b/WebCore/svg/SVGFilterElement.h
index 836c689..b25e213 100644
--- a/WebCore/svg/SVGFilterElement.h
+++ b/WebCore/svg/SVGFilterElement.h
@@ -23,6 +23,7 @@
 #define SVGFilterElement_h
 
 #if ENABLE(SVG) && ENABLE(FILTERS)
+#include "RenderObject.h"
 #include "SVGResourceFilter.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGLangSpace.h"
@@ -42,7 +43,7 @@ namespace WebCore {
         SVGFilterElement(const QualifiedName&, Document*);
         virtual ~SVGFilterElement();
 
-        virtual SVGResource* canvasResource();
+        virtual SVGResource* canvasResource(const RenderObject*);
 
         void setFilterRes(unsigned long filterResX, unsigned long filterResY) const;
 
diff --git a/WebCore/svg/SVGGradientElement.cpp b/WebCore/svg/SVGGradientElement.cpp
index b4fe21d..4f66505 100644
--- a/WebCore/svg/SVGGradientElement.cpp
+++ b/WebCore/svg/SVGGradientElement.cpp
@@ -114,7 +114,7 @@ RenderObject* SVGGradientElement::createRenderer(RenderArena* arena, RenderStyle
     return new (arena) RenderSVGHiddenContainer(this);
 }
 
-SVGResource* SVGGradientElement::canvasResource()
+SVGResource* SVGGradientElement::canvasResource(const RenderObject*)
 {
     if (!m_resource) {
         if (gradientType() == LinearGradientPaintServer)
diff --git a/WebCore/svg/SVGGradientElement.h b/WebCore/svg/SVGGradientElement.h
index 8413597..4974e6b 100644
--- a/WebCore/svg/SVGGradientElement.h
+++ b/WebCore/svg/SVGGradientElement.h
@@ -22,6 +22,7 @@
 #define SVGGradientElement_h
 
 #if ENABLE(SVG)
+#include "RenderObject.h"
 #include "SVGPaintServerGradient.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGStyledElement.h"
@@ -45,7 +46,7 @@ namespace WebCore {
         virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
         virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
 
-        virtual SVGResource* canvasResource();
+        virtual SVGResource* canvasResource(const RenderObject*);
 
     protected:
         friend class SVGPaintServerGradient;
diff --git a/WebCore/svg/SVGMarkerElement.cpp b/WebCore/svg/SVGMarkerElement.cpp
index 5ef3d5c..104b5d4 100644
--- a/WebCore/svg/SVGMarkerElement.cpp
+++ b/WebCore/svg/SVGMarkerElement.cpp
@@ -170,7 +170,7 @@ void SVGMarkerElement::setOrientToAngle(const SVGAngle& angle)
     m_marker->invalidate();
 }
 
-SVGResource* SVGMarkerElement::canvasResource()
+SVGResource* SVGMarkerElement::canvasResource(const RenderObject*)
 {
     if (!m_marker)
         m_marker = SVGResourceMarker::create();
diff --git a/WebCore/svg/SVGMarkerElement.h b/WebCore/svg/SVGMarkerElement.h
index 0898aac..10d4b1a 100644
--- a/WebCore/svg/SVGMarkerElement.h
+++ b/WebCore/svg/SVGMarkerElement.h
@@ -22,7 +22,7 @@
 #define SVGMarkerElement_h
 
 #if ENABLE(SVG)
-
+#include "RenderObject.h"
 #include "SVGAngle.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGFitToViewBox.h"
@@ -67,7 +67,7 @@ namespace WebCore {
         virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
 
         virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
-        virtual SVGResource* canvasResource();
+        virtual SVGResource* canvasResource(const RenderObject*);
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS(SVGMarkerElement, SVGNames::markerTagString, SVGNames::refXAttrString, SVGLength, RefX, refX)
diff --git a/WebCore/svg/SVGMaskElement.cpp b/WebCore/svg/SVGMaskElement.cpp
index 327bd74..ba6b7a6 100644
--- a/WebCore/svg/SVGMaskElement.cpp
+++ b/WebCore/svg/SVGMaskElement.cpp
@@ -32,6 +32,7 @@
 #include "ImageBuffer.h"
 #include "ImageData.h"
 #include "MappedAttribute.h"
+#include "RenderObject.h"
 #include "RenderSVGContainer.h"
 #include "SVGLength.h"
 #include "SVGNames.h"
@@ -106,7 +107,7 @@ void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName)
 {
     SVGStyledElement::svgAttributeChanged(attrName);
 
-    if (!m_masker)
+    if (m_masker.isEmpty())
         return;
 
     if (attrName == SVGNames::maskUnitsAttr || attrName == SVGNames::maskContentUnitsAttr ||
@@ -117,17 +118,19 @@ void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName)
         SVGLangSpace::isKnownAttribute(attrName) ||
         SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
         SVGStyledElement::isKnownAttribute(attrName))
-        m_masker->invalidate();
+        for (HashMap<const RenderObject*, RefPtr<SVGResourceMasker> >::iterator it = m_masker.begin(); it != m_masker.end(); ++it)
+            it->second->invalidate();
 }
 
 void SVGMaskElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
 {
     SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
 
-    if (!m_masker)
+    if (m_masker.isEmpty())
         return;
 
-    m_masker->invalidate();
+    for (HashMap<const RenderObject*, RefPtr<SVGResourceMasker> >::iterator it = m_masker.begin(); it != m_masker.end(); ++it)
+        it->second->invalidate();
 }
 
 PassOwnPtr<ImageBuffer> SVGMaskElement::drawMaskerContent(const FloatRect& objectBoundingBox, FloatRect& maskDestRect) const
@@ -228,11 +231,18 @@ RenderObject* SVGMaskElement::createRenderer(RenderArena* arena, RenderStyle*)
     return maskContainer;
 }
 
-SVGResource* SVGMaskElement::canvasResource()
+SVGResource* SVGMaskElement::canvasResource(const RenderObject* object)
 {
-    if (!m_masker)
-        m_masker = SVGResourceMasker::create(this);
-    return m_masker.get();
+    ASSERT(object);
+
+    if (m_masker.contains(object))
+        return m_masker.get(object).get();
+
+    RefPtr<SVGResourceMasker> masker = SVGResourceMasker::create(this);
+    SVGResourceMasker* maskerPtr = masker.get();
+    m_masker.set(object, masker.release());
+
+    return maskerPtr;
 }
 
 }
diff --git a/WebCore/svg/SVGMaskElement.h b/WebCore/svg/SVGMaskElement.h
index 362c730..3df8977 100644
--- a/WebCore/svg/SVGMaskElement.h
+++ b/WebCore/svg/SVGMaskElement.h
@@ -27,6 +27,7 @@
 #include "SVGStyledLocatableElement.h"
 #include "SVGTests.h"
 #include "SVGURIReference.h"
+#include <wtf/HashMap.h>
 #include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
@@ -48,7 +49,7 @@ namespace WebCore {
         virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
 
         virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
-        virtual SVGResource* canvasResource();
+        virtual SVGResource* canvasResource(const RenderObject*);
 
         PassOwnPtr<ImageBuffer> drawMaskerContent(const FloatRect& targetRect, FloatRect& maskRect) const;
 
@@ -68,7 +69,7 @@ namespace WebCore {
                                        SVGNames::externalResourcesRequiredAttrString, bool,
                                        ExternalResourcesRequired, externalResourcesRequired)
 
-        RefPtr<SVGResourceMasker> m_masker;
+        HashMap<const RenderObject*, RefPtr<SVGResourceMasker> > m_masker;
     };
 
 } // namespace WebCore
diff --git a/WebCore/svg/SVGPatternElement.cpp b/WebCore/svg/SVGPatternElement.cpp
index 2ec71bb..6423c18 100644
--- a/WebCore/svg/SVGPatternElement.cpp
+++ b/WebCore/svg/SVGPatternElement.cpp
@@ -263,7 +263,7 @@ RenderObject* SVGPatternElement::createRenderer(RenderArena* arena, RenderStyle*
     return patternContainer;
 }
 
-SVGResource* SVGPatternElement::canvasResource()
+SVGResource* SVGPatternElement::canvasResource(const RenderObject*)
 {
     if (!m_resource)
         m_resource = SVGPaintServerPattern::create(this);
diff --git a/WebCore/svg/SVGPatternElement.h b/WebCore/svg/SVGPatternElement.h
index 6a679af..2e7deed 100644
--- a/WebCore/svg/SVGPatternElement.h
+++ b/WebCore/svg/SVGPatternElement.h
@@ -22,6 +22,7 @@
 #define SVGPatternElement_h
 
 #if ENABLE(SVG)
+#include "RenderObject.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGFitToViewBox.h"
 #include "SVGLangSpace.h"
@@ -54,7 +55,7 @@ namespace WebCore {
         virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
 
         virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
-        virtual SVGResource* canvasResource();
+        virtual SVGResource* canvasResource(const RenderObject*);
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS(SVGPatternElement, SVGNames::patternTagString, SVGNames::xAttrString, SVGLength, X, x)
diff --git a/WebCore/svg/SVGStyledElement.cpp b/WebCore/svg/SVGStyledElement.cpp
index c0cd5d9..46d7cbe 100644
--- a/WebCore/svg/SVGStyledElement.cpp
+++ b/WebCore/svg/SVGStyledElement.cpp
@@ -215,7 +215,7 @@ void SVGStyledElement::invalidateResourcesInAncestorChain() const
 
         SVGElement* element = static_cast<SVGElement*>(node);
         if (SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(element->isStyled() ? element : 0)) {
-            if (SVGResource* resource = styledElement->canvasResource())
+            if (SVGResource* resource = styledElement->canvasResource(node->renderer()))
                 resource->invalidate();
         }
 
diff --git a/WebCore/svg/SVGStyledElement.h b/WebCore/svg/SVGStyledElement.h
index 121dfea..a17128c 100644
--- a/WebCore/svg/SVGStyledElement.h
+++ b/WebCore/svg/SVGStyledElement.h
@@ -48,7 +48,7 @@ namespace WebCore {
         bool isKnownAttribute(const QualifiedName&);
 
         virtual bool rendererIsNeeded(RenderStyle*);
-        virtual SVGResource* canvasResource() { return 0; }
+        virtual SVGResource* canvasResource(const RenderObject*) { return 0; }
         
         virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
         virtual void parseMappedAttribute(MappedAttribute*);
diff --git a/WebCore/svg/graphics/SVGPaintServer.cpp b/WebCore/svg/graphics/SVGPaintServer.cpp
index 728ff1b..6703ed6 100644
--- a/WebCore/svg/graphics/SVGPaintServer.cpp
+++ b/WebCore/svg/graphics/SVGPaintServer.cpp
@@ -57,9 +57,9 @@ TextStream& operator<<(TextStream& ts, const SVGPaintServer& paintServer)
     return paintServer.externalRepresentation(ts);
 }
 
-SVGPaintServer* getPaintServerById(Document* document, const AtomicString& id)
+SVGPaintServer* getPaintServerById(Document* document, const AtomicString& id, const RenderObject* object)
 {
-    SVGResource* resource = getResourceById(document, id);
+    SVGResource* resource = getResourceById(document, id, object);
     if (resource && resource->isPaintServer())
         return static_cast<SVGPaintServer*>(resource);
 
@@ -85,7 +85,7 @@ SVGPaintServer* SVGPaintServer::fillPaintServer(const RenderStyle* style, const
     if (paintType == SVGPaint::SVG_PAINTTYPE_URI ||
         paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) {
         AtomicString id(SVGURIReference::getTarget(fill->uri()));
-        fillPaintServer = getPaintServerById(item->document(), id);
+        fillPaintServer = getPaintServerById(item->document(), id, item);
 
         SVGElement* svgElement = static_cast<SVGElement*>(item->node());
         ASSERT(svgElement && svgElement->document() && svgElement->isStyled());
@@ -126,7 +126,7 @@ SVGPaintServer* SVGPaintServer::strokePaintServer(const RenderStyle* style, cons
     if (paintType == SVGPaint::SVG_PAINTTYPE_URI ||
         paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) {
         AtomicString id(SVGURIReference::getTarget(stroke->uri()));
-        strokePaintServer = getPaintServerById(item->document(), id);
+        strokePaintServer = getPaintServerById(item->document(), id, item);
 
         SVGElement* svgElement = static_cast<SVGElement*>(item->node());
         ASSERT(svgElement && svgElement->document() && svgElement->isStyled());
diff --git a/WebCore/svg/graphics/SVGPaintServer.h b/WebCore/svg/graphics/SVGPaintServer.h
index 244243c..6e8997c 100644
--- a/WebCore/svg/graphics/SVGPaintServer.h
+++ b/WebCore/svg/graphics/SVGPaintServer.h
@@ -29,6 +29,7 @@
 #if ENABLE(SVG)
 
 #include "DashArray.h"
+#include "RenderObject.h"
 #include "SVGResource.h"
 
 #if PLATFORM(CG)
@@ -82,7 +83,7 @@ namespace WebCore {
 
     TextStream& operator<<(TextStream&, const SVGPaintServer&);
 
-    SVGPaintServer* getPaintServerById(Document*, const AtomicString&);
+    SVGPaintServer* getPaintServerById(Document*, const AtomicString&, const RenderObject*);
 
     void applyStrokeStyleToContext(GraphicsContext*, RenderStyle*, const RenderObject*);
     DashArray dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle);
diff --git a/WebCore/svg/graphics/SVGResource.cpp b/WebCore/svg/graphics/SVGResource.cpp
index 514b70d..9a1b287 100644
--- a/WebCore/svg/graphics/SVGResource.cpp
+++ b/WebCore/svg/graphics/SVGResource.cpp
@@ -160,7 +160,7 @@ TextStream& SVGResource::externalRepresentation(TextStream& ts) const
     return ts;
 }
 
-SVGResource* getResourceById(Document* document, const AtomicString& id)
+SVGResource* getResourceById(Document* document, const AtomicString& id, const RenderObject* object)
 {
     if (id.isEmpty())
         return 0;
@@ -171,7 +171,7 @@ SVGResource* getResourceById(Document* document, const AtomicString& id)
         svgElement = static_cast<SVGElement*>(element);
 
     if (svgElement && svgElement->isStyled())
-        return static_cast<SVGStyledElement*>(svgElement)->canvasResource();
+        return static_cast<SVGStyledElement*>(svgElement)->canvasResource(object);
 
     return 0;
 }
diff --git a/WebCore/svg/graphics/SVGResource.h b/WebCore/svg/graphics/SVGResource.h
index 7ee98f6..8f303b5 100644
--- a/WebCore/svg/graphics/SVGResource.h
+++ b/WebCore/svg/graphics/SVGResource.h
@@ -28,6 +28,7 @@
 
 #if ENABLE(SVG)
 #include "PlatformString.h"
+#include "RenderObject.h"
 #include "StringHash.h"
 
 #include <wtf/HashMap.h>
@@ -91,7 +92,7 @@ namespace WebCore {
         HashSet<SVGStyledElement*> m_clients;
     };
 
-    SVGResource* getResourceById(Document*, const AtomicString&);
+    SVGResource* getResourceById(Document*, const AtomicString&, const RenderObject*);
     
     TextStream& operator<<(TextStream&, const SVGResource&);
 
diff --git a/WebCore/svg/graphics/SVGResourceClipper.cpp b/WebCore/svg/graphics/SVGResourceClipper.cpp
index 5998afb..1f12e85 100644
--- a/WebCore/svg/graphics/SVGResourceClipper.cpp
+++ b/WebCore/svg/graphics/SVGResourceClipper.cpp
@@ -125,9 +125,9 @@ TextStream& operator<<(TextStream& ts, const ClipData& d)
     return ts;
 }
 
-SVGResourceClipper* getClipperById(Document* document, const AtomicString& id)
+SVGResourceClipper* getClipperById(Document* document, const AtomicString& id, const RenderObject* object)
 {
-    SVGResource* resource = getResourceById(document, id);
+    SVGResource* resource = getResourceById(document, id, object);
     if (resource && resource->isClipper())
         return static_cast<SVGResourceClipper*>(resource);
 
diff --git a/WebCore/svg/graphics/SVGResourceClipper.h b/WebCore/svg/graphics/SVGResourceClipper.h
index 98c295f..1056647 100644
--- a/WebCore/svg/graphics/SVGResourceClipper.h
+++ b/WebCore/svg/graphics/SVGResourceClipper.h
@@ -27,9 +27,9 @@
 #define SVGResourceClipper_h
 
 #if ENABLE(SVG)
-
-#include "SVGResource.h"
 #include "Path.h"
+#include "RenderObject.h"
+#include "SVGResource.h"
 
 namespace WebCore {
 
@@ -84,7 +84,7 @@ namespace WebCore {
     TextStream& operator<<(TextStream&, WindRule);
     TextStream& operator<<(TextStream&, const ClipData&);
 
-    SVGResourceClipper* getClipperById(Document*, const AtomicString&);
+    SVGResourceClipper* getClipperById(Document*, const AtomicString&, const RenderObject*);
 
 } // namespace WebCore
 
diff --git a/WebCore/svg/graphics/SVGResourceFilter.cpp b/WebCore/svg/graphics/SVGResourceFilter.cpp
index 660f3ed..272fb10 100644
--- a/WebCore/svg/graphics/SVGResourceFilter.cpp
+++ b/WebCore/svg/graphics/SVGResourceFilter.cpp
@@ -52,7 +52,7 @@ SVGResourceFilter::SVGResourceFilter(const SVGFilterElement* ownerElement)
     , m_savedContext(0)
     , m_sourceGraphicBuffer(0)
 {
-    m_filterBuilder.set(new SVGFilterBuilder());
+    m_filterBuilder.set(new SVGFilterBuilder());    
 }
 
 SVGResourceFilter::~SVGResourceFilter()
@@ -204,9 +204,9 @@ TextStream& SVGResourceFilter::externalRepresentation(TextStream& ts) const
     return ts;
 }
 
-SVGResourceFilter* getFilterById(Document* document, const AtomicString& id)
+SVGResourceFilter* getFilterById(Document* document, const AtomicString& id, const RenderObject* object)
 {
-    SVGResource* resource = getResourceById(document, id);
+    SVGResource* resource = getResourceById(document, id, object);
     if (resource && resource->isFilter())
         return static_cast<SVGResourceFilter*>(resource);
 
diff --git a/WebCore/svg/graphics/SVGResourceFilter.h b/WebCore/svg/graphics/SVGResourceFilter.h
index ffd926d..30f6daa 100644
--- a/WebCore/svg/graphics/SVGResourceFilter.h
+++ b/WebCore/svg/graphics/SVGResourceFilter.h
@@ -103,7 +103,7 @@ private:
     RefPtr<Filter> m_filter;
 };
 
-SVGResourceFilter* getFilterById(Document*, const AtomicString&);
+SVGResourceFilter* getFilterById(Document*, const AtomicString&, const RenderObject*);
 
 } // namespace WebCore
 
diff --git a/WebCore/svg/graphics/SVGResourceMarker.cpp b/WebCore/svg/graphics/SVGResourceMarker.cpp
index 5fdfc7e..cb8e71f 100644
--- a/WebCore/svg/graphics/SVGResourceMarker.cpp
+++ b/WebCore/svg/graphics/SVGResourceMarker.cpp
@@ -122,9 +122,9 @@ TextStream& SVGResourceMarker::externalRepresentation(TextStream& ts) const
     return ts;
 }
 
-SVGResourceMarker* getMarkerById(Document* document, const AtomicString& id)
+SVGResourceMarker* getMarkerById(Document* document, const AtomicString& id, const RenderObject* object)
 {
-    SVGResource* resource = getResourceById(document, id);
+    SVGResource* resource = getResourceById(document, id, object);
     if (resource && resource->isMarker())
         return static_cast<SVGResourceMarker*>(resource);
 
diff --git a/WebCore/svg/graphics/SVGResourceMarker.h b/WebCore/svg/graphics/SVGResourceMarker.h
index 5e63f5d..ec6dad8 100644
--- a/WebCore/svg/graphics/SVGResourceMarker.h
+++ b/WebCore/svg/graphics/SVGResourceMarker.h
@@ -69,7 +69,7 @@ namespace WebCore {
         bool m_useStrokeWidth;
     };
 
-    SVGResourceMarker* getMarkerById(Document*, const AtomicString&);
+    SVGResourceMarker* getMarkerById(Document*, const AtomicString&, const RenderObject*);
 
 } // namespace WebCore
 
diff --git a/WebCore/svg/graphics/SVGResourceMasker.cpp b/WebCore/svg/graphics/SVGResourceMasker.cpp
index 5c2dad8..8d95bdf 100644
--- a/WebCore/svg/graphics/SVGResourceMasker.cpp
+++ b/WebCore/svg/graphics/SVGResourceMasker.cpp
@@ -76,9 +76,9 @@ TextStream& SVGResourceMasker::externalRepresentation(TextStream& ts) const
     return ts;
 }
 
-SVGResourceMasker* getMaskerById(Document* document, const AtomicString& id)
+SVGResourceMasker* getMaskerById(Document* document, const AtomicString& id, const RenderObject* object)
 {
-    SVGResource* resource = getResourceById(document, id);
+    SVGResource* resource = getResourceById(document, id, object);
     if (resource && resource->isMasker())
         return static_cast<SVGResourceMasker*>(resource);
 
diff --git a/WebCore/svg/graphics/SVGResourceMasker.h b/WebCore/svg/graphics/SVGResourceMasker.h
index f945f56..594d416 100644
--- a/WebCore/svg/graphics/SVGResourceMasker.h
+++ b/WebCore/svg/graphics/SVGResourceMasker.h
@@ -29,6 +29,7 @@
 #if ENABLE(SVG)
 
 #include "GraphicsContext.h"
+#include "RenderObject.h"
 #include "SVGResource.h"
 
 #include <memory>
@@ -64,7 +65,7 @@ namespace WebCore {
         FloatRect m_maskRect;
     };
 
-    SVGResourceMasker* getMaskerById(Document*, const AtomicString&);
+    SVGResourceMasker* getMaskerById(Document*, const AtomicString&, const RenderObject* object);
 
 } // namespace WebCore
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list