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

krit at webkit.org krit at webkit.org
Fri Feb 26 22:23:15 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 7f054d7efeef6806b8b7f41a659680aa71664c1b
Author: krit at webkit.org <krit at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Feb 17 22:12:55 2010 +0000

    2010-02-17  Dirk Schulze  <krit at webkit.org>
    
            Reviewed by Nikolas Zimmermann.
    
            Move SVGResources to Renderers, starting with Masker
            https://bugs.webkit.org/show_bug.cgi?id=35020
    
            We have rendering specific code in WebCore/svg/graphics. The goal is to move
            this code into suitable Renderers. This helps us to clean up the code and makes
            maintenance easier. It also makes it possible to remove rendering specific code
            from SVG*Elements into this renderers. So the Renderer contains everything that
            is needed to use the resource.
            RenderSVGResource will be the base class for all new resource render classes like
            RenderSVGResourceMasker, RenderSVGResourceClipper and the other resources.
    
            This patch starts moving SVGResourceMasker to RenderSVGResourceMasker.
            Another benefit is the much more useful result in DRT on using masker.
    
            * Android.mk:
            * GNUmakefile.am:
            * WebCore.gypi:
            * WebCore.pro:
            * WebCore.vcproj/WebCore.vcproj:
            * WebCore.xcodeproj/project.pbxproj:
            * rendering/RenderObject.cpp:
            (WebCore::RenderObject::toRenderSVGResource): Conversion to RenderSVGResource base class.
            * rendering/RenderObject.h:
            (WebCore::RenderObject::isSVGResource): Check if renderer is a resource.
            * rendering/RenderPath.cpp:
            * rendering/RenderSVGImage.cpp:
            (WebCore::RenderSVGImage::destroy): Renderer gets destroyed, unregister it from it's resources.
            * rendering/RenderSVGImage.h: Some code clean up according to the webkit style.
            (WebCore::RenderSVGImage::toSVGRenderBase):
            (WebCore::RenderSVGImage::renderName):
            (WebCore::RenderSVGImage::isSVGImage):
            (WebCore::RenderSVGImage::localToParentTransform):
            (WebCore::RenderSVGImage::strokeBoundingBox):
            (WebCore::RenderSVGImage::requiresLayer):
            (WebCore::RenderSVGImage::localTransform):
            * rendering/RenderSVGInlineText.h:
            (WebCore::RenderSVGInlineText::objectBoundingBox): Needed for SVGRenderTreeAsText
            * rendering/RenderSVGModelObject.cpp:
            (WebCore::RenderSVGModelObject::destroy): Renderer gets destroyed, unregister it from it's resources.
            * rendering/RenderSVGModelObject.h:
            * rendering/RenderSVGResource.h: Added.
            (WebCore::): Base class for all Resource renderers like masker, clipper and others.
            (WebCore::RenderSVGResource::RenderSVGResource):
            (WebCore::RenderSVGResource::cast):
            (WebCore::RenderSVGResource::toRenderSVGResource):
            (WebCore::RenderSVGResource::isSVGResource):
            (WebCore::RenderSVGResource::drawsContents):
            (WebCore::getRenderSVGResourceById):
            * rendering/RenderSVGResourceMasker.cpp: Added.
            (WebCore::RenderSVGResourceMasker::RenderSVGResourceMasker):
            (WebCore::RenderSVGResourceMasker::~RenderSVGResourceMasker):
            (WebCore::RenderSVGResourceMasker::invalidateClients): Status of masker changed, remove all clients.
            (WebCore::RenderSVGResourceMasker::invalidateClient): Status of an object changed, remove pending client.
            (WebCore::RenderSVGResourceMasker::applyResource): Apply masker to object.
            (WebCore::RenderSVGResourceMasker::resourceBoundingBox): boundingBox of the resource, depending on the object.
            (WebCore::RenderSVGResourceMasker::createMaskImage): Creates the mask image, the context gets clipped with.
            * rendering/RenderSVGResourceMasker.h: Added.
            (WebCore::MaskerData::MaskerData):
            (WebCore::RenderSVGResourceMasker::renderName):
            (WebCore::RenderSVGResourceMasker::maskUnits): Unit of mask for DRT.
            (WebCore::RenderSVGResourceMasker::maskContentUnits): Unit of childs from mask for DRT.
            (WebCore::RenderSVGResourceMasker::resourceType):
            * rendering/RenderSVGRoot.cpp:
            (WebCore::RenderSVGRoot::destroy): Renderer gets destroyed, unregister it from it's resources.
            * rendering/RenderSVGRoot.h:
            * rendering/RenderSVGText.cpp:
            (WebCore::RenderSVGText::destroy): dito.
            * rendering/RenderSVGText.h:
            * rendering/RenderTreeAsText.cpp:
            (WebCore::write):
            * rendering/SVGRenderSupport.cpp:
            (WebCore::SVGRenderBase::prepareToRenderSVGContent):
            (WebCore::SVGRenderBase::maskerBoundingBoxForRenderer):
            (WebCore::SVGRenderBase::deregisterFromResources): Unregister object from all it's resources after status changed.
            * rendering/SVGRenderSupport.h:
            (WebCore::SVGRenderBase::toSVGRenderBase):
            (WebCore::SVGRenderBase::strokeBoundingBox):
            (WebCore::SVGRenderBase::markerBoundingBox):
            * rendering/SVGRenderTreeAsText.cpp: Update TreeAsText to dump maskers correctly.
            (WebCore::operator<<):
            (WebCore::writeSVGResource):
            (WebCore::writeSVGContainer):
            (WebCore::writeSVGText):
            (WebCore::writeSVGInlineText):
            (WebCore::writeSVGImage):
            (WebCore::write):
            (WebCore::writeResourcesToObject):
            * rendering/SVGRenderTreeAsText.h:
            * svg/SVGMaskElement.cpp: Update Masker to use the new renderer.
            (WebCore::SVGMaskElement::svgAttributeChanged):
            (WebCore::SVGMaskElement::childrenChanged):
            (WebCore::SVGMaskElement::maskBoundingBox):
            (WebCore::SVGMaskElement::createRenderer):
            * svg/SVGMaskElement.h:
            * svg/SVGStyledElement.cpp: We need to tell the renderer to unregister object, after the status changed.
            (WebCore::SVGStyledElement::invalidateResources):
            (WebCore::SVGStyledElement::invalidateResourcesInAncestorChain):
            * svg/SVGUnitTypes.h: Conversion of integer to SVGUnitType.
            (WebCore::toUnitType):
            * svg/graphics/SVGResource.h:
            (WebCore::):
            (WebCore::SVGResource::isMarker):
            * svg/graphics/SVGResourceMasker.cpp: Removed.
            * svg/graphics/SVGResourceMasker.h: Removed.
    
    2010-02-17  Dirk Schulze  <krit at webkit.org>
    
            Reviewed by Nikolas Zimmermann.
    
            Move SVGResources to Renderers, starting with Masker
            https://bugs.webkit.org/show_bug.cgi?id=35020
    
            With the move from SVGResourceMasker to RenderSVGResourceMasker, I changed
            the way DRT dumps resources. DRT is now able to dump multi-access
            of resources.
            Also the size of a Mask resource (depending of the object) and the access of
            the resource (togeter with the resource name) is pointed out as an insertion
            under the object.
    
            * platform/mac/svg/W3C-SVG-1.1/masking-intro-01-f-expected.txt:
            * platform/mac/svg/W3C-SVG-1.1/masking-mask-01-b-expected.txt:
            * platform/mac/svg/batik/masking/maskRegions-expected.txt:
            * platform/mac/svg/css/circle-in-mask-with-shadow-expected.txt:
            * platform/mac/svg/css/mask-with-shadow-expected.txt:
            * platform/mac/svg/custom/empty-mask-expected.txt:
            * platform/mac/svg/custom/grayscale-gradient-mask-expected.txt:
            * platform/mac/svg/custom/js-late-mask-and-object-creation-expected.txt:
            * platform/mac/svg/custom/js-late-mask-creation-expected.txt:
            * platform/mac/svg/custom/mask-changes-expected.txt:
            * platform/mac/svg/custom/mask-child-changes-expected.txt:
            * platform/mac/svg/custom/mask-excessive-malloc-expected.txt:
            * platform/mac/svg/custom/mask-inside-defs-expected.txt:
            * platform/mac/svg/custom/mask-invalidation-expected.txt:
            * platform/mac/svg/custom/mask-on-multiple-objects-expected.txt:
            * platform/mac/svg/custom/mask-with-all-units-expected.txt:
            * platform/mac/svg/custom/mask-with-default-value-expected.txt:
            * platform/mac/svg/custom/resource-invalidate-on-target-update-expected.txt:
            * platform/mac/svg/custom/visibility-override-mask-expected.txt:
            * platform/mac/svg/filters/filter-clip-expected.txt:
            * svg/custom/transformedMaskFails-expected.txt:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54909 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index e02ff77..61b1257 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,39 @@
+2010-02-17  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        Move SVGResources to Renderers, starting with Masker
+        https://bugs.webkit.org/show_bug.cgi?id=35020
+
+        With the move from SVGResourceMasker to RenderSVGResourceMasker, I changed
+        the way DRT dumps resources. DRT is now able to dump multi-access
+        of resources.
+        Also the size of a Mask resource (depending of the object) and the access of
+        the resource (togeter with the resource name) is pointed out as an insertion
+        under the object.
+
+        * platform/mac/svg/W3C-SVG-1.1/masking-intro-01-f-expected.txt:
+        * platform/mac/svg/W3C-SVG-1.1/masking-mask-01-b-expected.txt:
+        * platform/mac/svg/batik/masking/maskRegions-expected.txt:
+        * platform/mac/svg/css/circle-in-mask-with-shadow-expected.txt:
+        * platform/mac/svg/css/mask-with-shadow-expected.txt:
+        * platform/mac/svg/custom/empty-mask-expected.txt:
+        * platform/mac/svg/custom/grayscale-gradient-mask-expected.txt:
+        * platform/mac/svg/custom/js-late-mask-and-object-creation-expected.txt:
+        * platform/mac/svg/custom/js-late-mask-creation-expected.txt:
+        * platform/mac/svg/custom/mask-changes-expected.txt:
+        * platform/mac/svg/custom/mask-child-changes-expected.txt:
+        * platform/mac/svg/custom/mask-excessive-malloc-expected.txt:
+        * platform/mac/svg/custom/mask-inside-defs-expected.txt:
+        * platform/mac/svg/custom/mask-invalidation-expected.txt:
+        * platform/mac/svg/custom/mask-on-multiple-objects-expected.txt:
+        * platform/mac/svg/custom/mask-with-all-units-expected.txt:
+        * platform/mac/svg/custom/mask-with-default-value-expected.txt:
+        * platform/mac/svg/custom/resource-invalidate-on-target-update-expected.txt:
+        * platform/mac/svg/custom/visibility-override-mask-expected.txt:
+        * platform/mac/svg/filters/filter-clip-expected.txt:
+        * svg/custom/transformedMaskFails-expected.txt:
+
 2010-02-17  Kenneth Russell  <kbr at google.com>
 
         Reviewed by Oliver Hunt.
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/masking-intro-01-f-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/masking-intro-01-f-expected.txt
index 9265aba..e059fb8 100644
--- a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/masking-intro-01-f-expected.txt
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/masking-intro-01-f-expected.txt
@@ -1,5 +1,4 @@
 KCanvasResource {id="one" [type=CLIPPER] [clip data=[[winding=NON-ZERO] [bounding box mode=1] [path=M0.50,0.50 L0.50,0.51 L0.50,0.53 L0.50,0.54 L0.49,0.55 L0.49,0.56 L0.49,0.57 L0.48,0.59 L0.48,0.60 L0.47,0.61 L0.46,0.62 L0.45,0.63 L0.45,0.64 L0.44,0.65 L0.43,0.65 L0.42,0.66 L0.41,0.67 L0.40,0.68 L0.39,0.68 L0.37,0.69 L0.36,0.69 L0.35,0.69 L0.34,0.70 L0.33,0.70 L0.31,0.70 L0.30,0.70 L0.29,0.70 L0.27,0.70 L0.26,0.70 L0.25,0.69 L0.24,0.69 L0.23,0.69 L0.21,0.68 L0.20,0.68 L0.19,0.67 L0.18,0.66 L0.17,0.65 L0.16,0.65 L0.15,0.64 L0.15,0.63 L0.14,0.62 L0.13,0.61 L0.12,0.60 L0.12,0.59 L0.11,0.57 L0.11,0.56 L0.11,0.55 L0.10,0.54 L0.10,0.53 L0.10,0.51 L0.10,0.50 L0.10,0.49 L0.10,0.47 L0.10,0.46 L0.11,0.45 L0.11,0.44 L0.11,0.43 L0.12,0.41 L0.12,0.40 L0.13,0.39 L0.14,0.38 L0.15,0.37 L0.15,0.36 L0.16,0.35 L0.17,0.35 L0.18,0.34 L0.19,0.33 L0.20,0.32 L0.21,0.32 L0.23,0.31 L0.24,0.31 L0.25,0.31 L0.26,0.30 L0.27,0.30 L0.29,0.30 L0.30,0.30 L0.31,0.30 L0.33,0.30 L0.34,0.30 L0.35,0.31 L0.36,0.31 L0.37,0.31 L0.39,0.32 L0.40,0.32 L0.41,0.33 L0.42,0.34 L0.43,0.35 L0.44,0.35 L0.45,0.36 L0.45,0.37 L0.46,0.38 L0.47,0.39 L0.48,0.40 L0.48,0.41 L0.49,0.43 L0.49,0.44 L0.49,0.45 L0.50,0.46 L0.50,0.47 L0.50,0.49 Z], [winding=NON-ZERO] [bounding box mode=1] [path=M0.90,0.50 L0.90,0.51 L0.90,0.53 L0.90,0.54 L0.89,0.55 L0.89,0.56 L0.89,0.57 L0.88,0.59 L0.88,0.60 L0.87,0.61 L0.86,0.62 L0.85,0.63 L0.85,0.64 L0.84,0.65 L0.83,0.65 L0.82,0.66 L0.81,0.67 L0.80,0.68 L0.79,0.68 L0.77,0.69 L0.76,0.69 L0.75,0.69 L0.74,0.70 L0.73,0.70 L0.71,0.70 L0.70,0.70 L0.69,0.70 L0.67,0.70 L0.66,0.70 L0.65,0.69 L0.64,0.69 L0.63,0.69 L0.61,0.68 L0.60,0.68 L0.59,0.67 L0.58,0.66 L0.57,0.65 L0.56,0.65 L0.55,0.64 L0.55,0.63 L0.54,0.62 L0.53,0.61 L0.52,0.60 L0.52,0.59 L0.51,0.57 L0.51,0.56 L0.51,0.55 L0.50,0.54 L0.50,0.53 L0.50,0.51 L0.50,0.50 L0.50,0.49 L0.50,0.47 L0.50,0.46 L0.51,0.45 L0.51,0.44 L0.51,0.43 L0.52,0.41 L0.52,0.40 L0.53,0.39 L0.54,0.38 L0.55,0.37 L0.55,0.36 L0.56,0.35 L0.57,0.35 L0.58,0.34 L0.59,0.33 L0.60,0.32 L0.61,0.32 L0.63,0.31 L0.64,0.31 L0.65,0.31 L0.66,0.30 L0.67,0.30 L0.69,0.30 L0.70,0.30 L0.71,0.30 L0.73,0.30 L0.74,0.30 L0.75,0.31 L0.76,0.31 L0.77,0.31 L0.79,0.32 L0.80,0.32 L0.81,0.33 L0.82,0.34 L0.83,0.35 L0.84,0.35 L0.85,0.36 L0.85,0.37 L0.86,0.38 L0.87,0.39 L0.88,0.40 L0.88,0.41 L0.89,0.43 L0.89,0.44 L0.89,0.45 L0.90,0.46 L0.90,0.47 L0.90,0.49 Z]]]}
-KCanvasResource {id="two" [type=MASKER]}
 layer at (0,0) size 480x360
   RenderView at (0,0) size 480x360
 layer at (0,0) size 480x360
@@ -16,10 +15,11 @@ layer at (0,0) size 480x360
       RenderSVGInlineText {#text} at (0,-14) size 111x18
         chunk 1 text run 1 at (50.00,110.00) startOffset 0 endOffset 19 width 111.00: "With a 'clip-path':"
     RenderSVGHiddenContainer {defs} at (0,0) size 0x0
-      RenderSVGContainer {mask} at (0,0) size 1x1
+      RenderSVGResourceMasker {mask} [id="two"] [maskUnits=objectBoundingBox] [maskContentUnits=objectBoundingBox]
         RenderPath {circle} at (0,0) size 1x1 [stroke={[type=SOLID] [color=#FF0000] [stroke width=0.15]}] [fill={[type=SOLID] [color=#0000FF]}] [data="M0.50,0.50 L0.50,0.51 L0.50,0.53 L0.50,0.54 L0.49,0.55 L0.49,0.56 L0.49,0.57 L0.48,0.59 L0.48,0.60 L0.47,0.61 L0.46,0.62 L0.45,0.63 L0.45,0.64 L0.44,0.65 L0.43,0.65 L0.42,0.66 L0.41,0.67 L0.40,0.68 L0.39,0.68 L0.37,0.69 L0.36,0.69 L0.35,0.69 L0.34,0.70 L0.33,0.70 L0.31,0.70 L0.30,0.70 L0.29,0.70 L0.27,0.70 L0.26,0.70 L0.25,0.69 L0.24,0.69 L0.23,0.69 L0.21,0.68 L0.20,0.68 L0.19,0.67 L0.18,0.66 L0.17,0.65 L0.16,0.65 L0.15,0.64 L0.15,0.63 L0.14,0.62 L0.13,0.61 L0.12,0.60 L0.12,0.59 L0.11,0.57 L0.11,0.56 L0.11,0.55 L0.10,0.54 L0.10,0.53 L0.10,0.51 L0.10,0.50 L0.10,0.49 L0.10,0.47 L0.10,0.46 L0.11,0.45 L0.11,0.44 L0.11,0.43 L0.12,0.41 L0.12,0.40 L0.13,0.39 L0.14,0.38 L0.15,0.37 L0.15,0.36 L0.16,0.35 L0.17,0.35 L0.18,0.34 L0.19,0.33 L0.20,0.32 L0.21,0.32 L0.23,0.31 L0.24,0.31 L0.25,0.31 L0.26,0.30 L0.27,0.30 L0.29,0.30 L0.30,0.30 L0.31,0.30 L0.33,0.30 L0.34,0.30 L0.35,0.31 L0.36,0.31 L0.37,0.31 L0.39,0.32 L0.40,0.32 L0.41,0.33 L0.42,0.34 L0.43,0.35 L0.44,0.35 L0.45,0.36 L0.45,0.37 L0.46,0.38 L0.47,0.39 L0.48,0.40 L0.48,0.41 L0.49,0.43 L0.49,0.44 L0.49,0.45 L0.50,0.46 L0.50,0.47 L0.50,0.49 Z"]
         RenderPath {circle} at (0,0) size 1x1 [fill={[type=SOLID] [color=#0000FF]}] [data="M0.90,0.50 L0.90,0.51 L0.90,0.53 L0.90,0.54 L0.89,0.55 L0.89,0.56 L0.89,0.57 L0.88,0.59 L0.88,0.60 L0.87,0.61 L0.86,0.62 L0.85,0.63 L0.85,0.64 L0.84,0.65 L0.83,0.65 L0.82,0.66 L0.81,0.67 L0.80,0.68 L0.79,0.68 L0.77,0.69 L0.76,0.69 L0.75,0.69 L0.74,0.70 L0.73,0.70 L0.71,0.70 L0.70,0.70 L0.69,0.70 L0.67,0.70 L0.66,0.70 L0.65,0.69 L0.64,0.69 L0.63,0.69 L0.61,0.68 L0.60,0.68 L0.59,0.67 L0.58,0.66 L0.57,0.65 L0.56,0.65 L0.55,0.64 L0.55,0.63 L0.54,0.62 L0.53,0.61 L0.52,0.60 L0.52,0.59 L0.51,0.57 L0.51,0.56 L0.51,0.55 L0.50,0.54 L0.50,0.53 L0.50,0.51 L0.50,0.50 L0.50,0.49 L0.50,0.47 L0.50,0.46 L0.51,0.45 L0.51,0.44 L0.51,0.43 L0.52,0.41 L0.52,0.40 L0.53,0.39 L0.54,0.38 L0.55,0.37 L0.55,0.36 L0.56,0.35 L0.57,0.35 L0.58,0.34 L0.59,0.33 L0.60,0.32 L0.61,0.32 L0.63,0.31 L0.64,0.31 L0.65,0.31 L0.66,0.30 L0.67,0.30 L0.69,0.30 L0.70,0.30 L0.71,0.30 L0.73,0.30 L0.74,0.30 L0.75,0.31 L0.76,0.31 L0.77,0.31 L0.79,0.32 L0.80,0.32 L0.81,0.33 L0.82,0.34 L0.83,0.35 L0.84,0.35 L0.85,0.36 L0.85,0.37 L0.86,0.38 L0.87,0.39 L0.88,0.40 L0.88,0.41 L0.89,0.43 L0.89,0.44 L0.89,0.45 L0.90,0.46 L0.90,0.47 L0.90,0.49 Z"]
     RenderPath {rect} at (150,150) size 200x200 [fill={[type=SOLID] [color=#00008B]}] [data="M150.00,150.00 L350.00,150.00 L350.00,350.00 L150.00,350.00 Z"]
+      [masker="two"] RenderSVGResourceMasker {mask} at (130,130) size 240x240
     RenderSVGText {text} at (50,260) size 89x18 contains 1 chunk(s)
       RenderSVGInlineText {#text} at (0,-14) size 89x18
         chunk 1 text run 1 at (50.00,260.00) startOffset 0 endOffset 14 width 89.00: "With a 'mask':"
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/masking-mask-01-b-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/masking-mask-01-b-expected.txt
index c72042b..acafaa8 100644
--- a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/masking-mask-01-b-expected.txt
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/masking-mask-01-b-expected.txt
@@ -1,7 +1,4 @@
-KCanvasResource {id="mask1" [type=MASKER]}
 KRenderingPaintServer {id="Grad1" [type=LINEAR-GRADIENT] [stops=[(0.00,#FFFFFF), (1.00,#FFFFFF7F)]] [bounding box mode=0] [start=(60,50)] [end=(60,120)]}
-KCanvasResource {id="mask2" [type=MASKER]}
-KCanvasResource {id="mask3" [type=MASKER]}
 layer at (0,0) size 480x360
   RenderView at (0,0) size 480x360
 layer at (0,0) size 480x360
@@ -12,22 +9,24 @@ layer at (0,0) size 480x360
         RenderSVGInlineText {#text} at (0,-13) size 139x16
           chunk 1 text run 1 at (10.00,20.00) startOffset 0 endOffset 21 width 139.00: "Test for mask support"
       RenderPath {rect} at (10,30) size 100x260 [fill={[type=SOLID] [color=#FF0000]}] [data="M10.00,30.00 L110.00,30.00 L110.00,290.00 L10.00,290.00 Z"]
-      RenderSVGContainer {mask} at (60,50) size 100x60
+      RenderSVGResourceMasker {mask} [id="mask1"] [maskUnits=userSpaceOnUse] [maskContentUnits=userSpaceOnUse]
         RenderSVGHiddenContainer {defs} at (0,0) size 0x0
           RenderSVGHiddenContainer {linearGradient} at (0,0) size 0x0
             RenderSVGGradientStop {stop} at (0,0) size 0x0
             RenderSVGGradientStop {stop} at (0,0) size 0x0
         RenderPath {rect} at (60,50) size 100x60 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#FFFFFF), (1.00,#FFFFFF7F)]] [bounding box mode=0] [start=(60,50)] [end=(60,120)]}] [data="M60.00,50.00 L160.00,50.00 L160.00,110.00 L60.00,110.00 Z"]
       RenderPath {rect} at (60,50) size 100x60 [fill={[type=SOLID] [color=#00FF00]}] [data="M60.00,50.00 L160.00,50.00 L160.00,110.00 L60.00,110.00 Z"]
+        [masker="mask1"] RenderSVGResourceMasker {mask} at (60,50) size 100x60
       RenderSVGText {text} at (200,65) size 163x14 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,-11) size 163x14
           chunk 1 text run 1 at (200.00,65.00) startOffset 0 endOffset 30 width 163.00: "Mask with linear gradient from"
       RenderSVGText {text} at (200,80) size 135x14 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,-11) size 135x14
           chunk 1 text run 1 at (200.00,80.00) startOffset 0 endOffset 25 width 135.00: "opacity=1 to opactity=0.5"
-      RenderSVGContainer {mask} at (60,120) size 100x30
+      RenderSVGResourceMasker {mask} [id="mask2"] [maskUnits=userSpaceOnUse] [maskContentUnits=userSpaceOnUse]
         RenderPath {rect} at (60,120) size 100x30 [fill={[type=SOLID] [color=#FFFFFF] [opacity=0.50]}] [data="M60.00,120.00 L160.00,120.00 L160.00,150.00 L60.00,150.00 Z"]
       RenderPath {rect} at (60,120) size 100x30 [fill={[type=SOLID] [color=#00FF00]}] [data="M60.00,120.00 L160.00,120.00 L160.00,150.00 L60.00,150.00 Z"]
+        [masker="mask2"] RenderSVGResourceMasker {mask} at (60,120) size 100x30
       RenderSVGText {text} at (200,135) size 173x14 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,-11) size 173x14
           chunk 1 text run 1 at (200.00,135.00) startOffset 0 endOffset 32 width 173.00: "Mask with uniform opacity of 0.5"
@@ -35,13 +34,15 @@ layer at (0,0) size 480x360
       RenderSVGText {text} at (200,175) size 200x14 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,-11) size 200x14
           chunk 1 text run 1 at (200.00,175.00) startOffset 0 endOffset 37 width 200.00: "Rectangle with uniform opacity of 0.5"
-      RenderSVGContainer {mask} at (60,200) size 200x100
+      RenderSVGResourceMasker {mask} [id="mask3"] [maskUnits=userSpaceOnUse] [maskContentUnits=userSpaceOnUse]
         RenderPath {rect} at (60,200) size 200x25 [fill={[type=SOLID] [color=#FFFFFF] [opacity=0.50]}] [data="M60.00,200.00 L260.00,200.00 L260.00,225.00 L60.00,225.00 Z"]
         RenderPath {rect} at (60,225) size 200x25 [fill={[type=SOLID] [color=#FFFFFF] [opacity=0.20]}] [data="M60.00,225.00 L260.00,225.00 L260.00,250.00 L60.00,250.00 Z"]
         RenderPath {rect} at (60,250) size 200x25 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M60.00,250.00 L260.00,250.00 L260.00,275.00 L60.00,275.00 Z"]
         RenderPath {rect} at (60,275) size 200x25 [fill={[type=SOLID] [color=#FFFFFF] [opacity=0.70]}] [data="M60.00,275.00 L260.00,275.00 L260.00,300.00 L60.00,300.00 Z"]
       RenderSVGText {text} at (60,280) size 162x110 contains 1 chunk(s)
+        [masker="mask3"] RenderSVGResourceMasker {mask} at (60,200) size 200x100
         RenderSVGInlineText {#text} at (0,-77) size 162x110
+          [masker="mask3"] RenderSVGResourceMasker {mask} at (60,200) size 200x100
           chunk 1 text run 1 at (60.00,280.00) startOffset 0 endOffset 3 width 121.33: "SVG"
       RenderSVGText {text} at (200,225) size 200x14 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,-11) size 200x14
diff --git a/LayoutTests/platform/mac/svg/batik/masking/maskRegions-expected.txt b/LayoutTests/platform/mac/svg/batik/masking/maskRegions-expected.txt
index 1877e8a..1c45610 100644
--- a/LayoutTests/platform/mac/svg/batik/masking/maskRegions-expected.txt
+++ b/LayoutTests/platform/mac/svg/batik/masking/maskRegions-expected.txt
@@ -1,8 +1,4 @@
 KRenderingPaintServer {id="maskedGradient" [type=LINEAR-GRADIENT] [stops=[(0.00,#0000FF), (1.00,#FF0000)]] [start=(0,0)] [end=(1,1)]}
-KCanvasResource {id="mask_1" [type=MASKER]}
-KCanvasResource {id="mask_2" [type=MASKER]}
-KCanvasResource {id="mask_3" [type=MASKER]}
-KCanvasResource {id="mask_4" [type=MASKER]}
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 450x500
@@ -16,22 +12,22 @@ layer at (0,0) size 450x500
           RenderSVGGradientStop {stop} at (0,0) size 0x0
           RenderSVGGradientStop {stop} at (0,0) size 0x0
         RenderPath {rect} at (0,0) size 100x80 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#0000FF), (1.00,#FF0000)]] [start=(0,0)] [end=(1,1)]}] [data="M0.00,0.00 L100.00,0.00 L100.00,80.00 L0.00,80.00 Z"]
-        RenderSVGContainer {mask} at (5,0) size 90x80
+        RenderSVGResourceMasker {mask} [id="mask_1"] [maskUnits=objectBoundingBox] [maskContentUnits=userSpaceOnUse]
           RenderPath {circle} at (5,0) size 40x40 [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 (5,40) size 40x40 [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 (55,0) size 40x40 [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 (55,40) size 40x40 [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 {mask} at (5,0) size 90x80
+        RenderSVGResourceMasker {mask} [id="mask_2"] [maskUnits=objectBoundingBox] [maskContentUnits=userSpaceOnUse]
           RenderPath {circle} at (5,0) size 40x40 [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 (5,40) size 40x40 [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 (55,0) size 40x40 [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 (55,40) size 40x40 [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 {mask} at (5,0) size 90x80
+        RenderSVGResourceMasker {mask} [id="mask_3"] [maskUnits=userSpaceOnUse] [maskContentUnits=userSpaceOnUse]
           RenderPath {circle} at (5,0) size 40x40 [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 (5,40) size 40x40 [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 (55,0) size 40x40 [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 (55,40) size 40x40 [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 {mask} at (0,0) size 1x1
+        RenderSVGResourceMasker {mask} [id="mask_4"] [maskUnits=objectBoundingBox] [maskContentUnits=objectBoundingBox]
           RenderPath {circle} at (0,0) size 1x1 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M0.45,0.20 L0.45,0.21 L0.45,0.23 L0.45,0.24 L0.44,0.25 L0.44,0.26 L0.44,0.27 L0.43,0.29 L0.43,0.30 L0.42,0.31 L0.41,0.32 L0.40,0.33 L0.40,0.34 L0.39,0.35 L0.38,0.35 L0.37,0.36 L0.36,0.37 L0.35,0.38 L0.34,0.38 L0.32,0.39 L0.31,0.39 L0.30,0.39 L0.29,0.40 L0.28,0.40 L0.26,0.40 L0.25,0.40 L0.24,0.40 L0.22,0.40 L0.21,0.40 L0.20,0.39 L0.19,0.39 L0.18,0.39 L0.16,0.38 L0.15,0.38 L0.14,0.37 L0.13,0.36 L0.12,0.35 L0.11,0.35 L0.10,0.34 L0.10,0.33 L0.09,0.32 L0.08,0.31 L0.07,0.30 L0.07,0.29 L0.06,0.27 L0.06,0.26 L0.06,0.25 L0.05,0.24 L0.05,0.23 L0.05,0.21 L0.05,0.20 L0.05,0.19 L0.05,0.17 L0.05,0.16 L0.06,0.15 L0.06,0.14 L0.06,0.13 L0.07,0.11 L0.07,0.10 L0.08,0.09 L0.09,0.08 L0.10,0.07 L0.10,0.06 L0.11,0.05 L0.12,0.05 L0.13,0.04 L0.14,0.03 L0.15,0.02 L0.16,0.02 L0.18,0.01 L0.19,0.01 L0.20,0.01 L0.21,0.00 L0.22,0.00 L0.24,0.00 L0.25,0.00 L0.26,0.00 L0.28,0.00 L0.29,0.00 L0.30,0.01 L0.31,0.01 L0.32,0.01 L0.34,0.02 L0.35,0.02 L0.36,0.03 L0.37,0.04 L0.38,0.05 L0.39,0.05 L0.40,0.06 L0.40,0.07 L0.41,0.08 L0.42,0.09 L0.43,0.10 L0.43,0.11 L0.44,0.13 L0.44,0.14 L0.44,0.15 L0.45,0.16 L0.45,0.17 L0.45,0.19 Z"]
           RenderPath {circle} at (0,0) size 1x1 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M0.45,0.60 L0.45,0.61 L0.45,0.63 L0.45,0.64 L0.44,0.65 L0.44,0.66 L0.44,0.67 L0.43,0.69 L0.43,0.70 L0.42,0.71 L0.41,0.72 L0.40,0.73 L0.40,0.74 L0.39,0.75 L0.38,0.75 L0.37,0.76 L0.36,0.77 L0.35,0.78 L0.34,0.78 L0.32,0.79 L0.31,0.79 L0.30,0.79 L0.29,0.80 L0.28,0.80 L0.26,0.80 L0.25,0.80 L0.24,0.80 L0.22,0.80 L0.21,0.80 L0.20,0.79 L0.19,0.79 L0.18,0.79 L0.16,0.78 L0.15,0.78 L0.14,0.77 L0.13,0.76 L0.12,0.75 L0.11,0.75 L0.10,0.74 L0.10,0.73 L0.09,0.72 L0.08,0.71 L0.07,0.70 L0.07,0.69 L0.06,0.67 L0.06,0.66 L0.06,0.65 L0.05,0.64 L0.05,0.63 L0.05,0.61 L0.05,0.60 L0.05,0.59 L0.05,0.57 L0.05,0.56 L0.06,0.55 L0.06,0.54 L0.06,0.53 L0.07,0.51 L0.07,0.50 L0.08,0.49 L0.09,0.48 L0.10,0.47 L0.10,0.46 L0.11,0.45 L0.12,0.45 L0.13,0.44 L0.14,0.43 L0.15,0.42 L0.16,0.42 L0.18,0.41 L0.19,0.41 L0.20,0.41 L0.21,0.40 L0.22,0.40 L0.24,0.40 L0.25,0.40 L0.26,0.40 L0.28,0.40 L0.29,0.40 L0.30,0.41 L0.31,0.41 L0.32,0.41 L0.34,0.42 L0.35,0.42 L0.36,0.43 L0.37,0.44 L0.38,0.45 L0.39,0.45 L0.40,0.46 L0.40,0.47 L0.41,0.48 L0.42,0.49 L0.43,0.50 L0.43,0.51 L0.44,0.53 L0.44,0.54 L0.44,0.55 L0.45,0.56 L0.45,0.57 L0.45,0.59 Z"]
           RenderPath {circle} at (0,0) size 1x1 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M0.95,0.20 L0.95,0.21 L0.95,0.23 L0.95,0.24 L0.94,0.25 L0.94,0.26 L0.94,0.27 L0.93,0.29 L0.93,0.30 L0.92,0.31 L0.91,0.32 L0.90,0.33 L0.90,0.34 L0.89,0.35 L0.88,0.35 L0.87,0.36 L0.86,0.37 L0.85,0.38 L0.84,0.38 L0.82,0.39 L0.81,0.39 L0.80,0.39 L0.79,0.40 L0.78,0.40 L0.76,0.40 L0.75,0.40 L0.74,0.40 L0.72,0.40 L0.71,0.40 L0.70,0.39 L0.69,0.39 L0.68,0.39 L0.66,0.38 L0.65,0.38 L0.64,0.37 L0.63,0.36 L0.62,0.35 L0.61,0.35 L0.60,0.34 L0.60,0.33 L0.59,0.32 L0.58,0.31 L0.57,0.30 L0.57,0.29 L0.56,0.27 L0.56,0.26 L0.56,0.25 L0.55,0.24 L0.55,0.23 L0.55,0.21 L0.55,0.20 L0.55,0.19 L0.55,0.17 L0.55,0.16 L0.56,0.15 L0.56,0.14 L0.56,0.13 L0.57,0.11 L0.57,0.10 L0.58,0.09 L0.59,0.08 L0.60,0.07 L0.60,0.06 L0.61,0.05 L0.62,0.05 L0.63,0.04 L0.64,0.03 L0.65,0.02 L0.66,0.02 L0.68,0.01 L0.69,0.01 L0.70,0.01 L0.71,0.00 L0.72,0.00 L0.74,0.00 L0.75,0.00 L0.76,0.00 L0.78,0.00 L0.79,0.00 L0.80,0.01 L0.81,0.01 L0.82,0.01 L0.84,0.02 L0.85,0.02 L0.86,0.03 L0.87,0.04 L0.88,0.05 L0.89,0.05 L0.90,0.06 L0.90,0.07 L0.91,0.08 L0.92,0.09 L0.93,0.10 L0.93,0.11 L0.94,0.13 L0.94,0.14 L0.94,0.15 L0.95,0.16 L0.95,0.17 L0.95,0.19 Z"]
@@ -45,6 +41,7 @@ layer at (0,0) size 450x500
             chunk 1 (middle anchor) text run 1 at (22.00,-3.00) startOffset 0 endOffset 6 width 56.00: "Masked"
       RenderSVGContainer {g} at (85,203) size 100x97 [transform={m=((1.00,0.00)(0.00,1.00)) t=(85.00,220.00)}]
         RenderSVGContainer {use} at (85,220) size 100x80
+          [masker="mask_1"] RenderSVGResourceMasker {mask} at (-10,-8) size 120x96
           RenderSVGContainer {g} at (85,220) size 100x80
             RenderPath {rect} at (85,220) size 100x80 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#0000FF), (1.00,#FF0000)]] [start=(0,0)] [end=(1,1)]}] [data="M0.00,0.00 L100.00,0.00 L100.00,80.00 L0.00,80.00 Z"]
         RenderSVGText {text} at (24,-3) size 52x17 contains 1 chunk(s)
@@ -52,6 +49,7 @@ layer at (0,0) size 450x500
             chunk 1 (middle anchor) text run 1 at (24.50,-3.00) startOffset 0 endOffset 6 width 51.00: "Mask 1"
       RenderSVGContainer {g} at (109,323) size 52x77 [transform={m=((1.00,0.00)(0.00,1.00)) t=(85.00,340.00)}]
         RenderSVGContainer {use} at (110,360) size 50x40
+          [masker="mask_2"] RenderSVGResourceMasker {mask} at (25,20) size 50x40
           RenderSVGContainer {g} at (85,340) size 100x80
             RenderPath {rect} at (85,340) size 100x80 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#0000FF), (1.00,#FF0000)]] [start=(0,0)] [end=(1,1)]}] [data="M0.00,0.00 L100.00,0.00 L100.00,80.00 L0.00,80.00 Z"]
         RenderSVGText {text} at (24,-3) size 52x17 contains 1 chunk(s)
@@ -59,6 +57,7 @@ layer at (0,0) size 450x500
             chunk 1 (middle anchor) text run 1 at (24.50,-3.00) startOffset 0 endOffset 6 width 51.00: "Mask 2"
       RenderSVGContainer {g} at (284,203) size 52x77 [transform={m=((1.00,0.00)(0.00,1.00)) t=(260.00,220.00)}]
         RenderSVGContainer {use} at (285,240) size 50x40
+          [masker="mask_3"] RenderSVGResourceMasker {mask} at (25,20) size 50.00x40
           RenderSVGContainer {g} at (260,220) size 100x80
             RenderPath {rect} at (260,220) size 100x80 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#0000FF), (1.00,#FF0000)]] [start=(0,0)] [end=(1,1)]}] [data="M0.00,0.00 L100.00,0.00 L100.00,80.00 L0.00,80.00 Z"]
         RenderSVGText {text} at (24,-3) size 52x17 contains 1 chunk(s)
@@ -66,6 +65,7 @@ layer at (0,0) size 450x500
             chunk 1 (middle anchor) text run 1 at (24.50,-3.00) startOffset 0 endOffset 6 width 51.00: "Mask 3"
       RenderSVGContainer {g} at (260,323) size 100x97 [transform={m=((1.00,0.00)(0.00,1.00)) t=(260.00,340.00)}]
         RenderSVGContainer {use} at (260,340) size 100x80
+          [masker="mask_4"] RenderSVGResourceMasker {mask} at (0,0) size 100x80
           RenderSVGContainer {g} at (260,340) size 100x80
             RenderPath {rect} at (260,340) size 100x80 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#0000FF), (1.00,#FF0000)]] [start=(0,0)] [end=(1,1)]}] [data="M0.00,0.00 L100.00,0.00 L100.00,80.00 L0.00,80.00 Z"]
         RenderSVGText {text} at (24,-3) size 52x17 contains 1 chunk(s)
diff --git a/LayoutTests/platform/mac/svg/css/circle-in-mask-with-shadow-expected.txt b/LayoutTests/platform/mac/svg/css/circle-in-mask-with-shadow-expected.txt
index 4fa9ab8..e25a33c 100644
--- a/LayoutTests/platform/mac/svg/css/circle-in-mask-with-shadow-expected.txt
+++ b/LayoutTests/platform/mac/svg/css/circle-in-mask-with-shadow-expected.txt
@@ -1,5 +1,4 @@
 KRenderingPaintServer {id="maskedGradient" [type=LINEAR-GRADIENT] [stops=[(0.00,#0000FF), (1.00,#FF0000)]] [start=(0,0)] [end=(1,1)]}
-KCanvasResource {id="mask_1" [type=MASKER]}
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 450x500
@@ -10,12 +9,13 @@ layer at (0,0) size 450x500
           RenderSVGGradientStop {stop} at (0,0) size 0x0
           RenderSVGGradientStop {stop} at (0,0) size 0x0
         RenderPath {rect} at (0,0) size 300x300 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#0000FF), (1.00,#FF0000)]] [start=(0,0)] [end=(1,1)]}] [data="M0.00,0.00 L300.00,0.00 L300.00,300.00 L0.00,300.00 Z"]
-        RenderSVGContainer {mask} at (5,5) size 220x220
+        RenderSVGResourceMasker {mask} [id="mask_1"] [maskUnits=objectBoundingBox] [maskContentUnits=userSpaceOnUse]
           RenderPath {circle} at (5,5) size 120x120 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M105.00,55.00 L104.90,58.14 L104.61,61.27 L104.11,64.37 L103.43,67.43 L102.55,70.45 L101.49,73.41 L100.24,76.29 L98.82,79.09 L97.22,81.79 L95.45,84.39 L93.53,86.87 L91.45,89.23 L89.23,91.45 L86.87,93.53 L84.39,95.45 L81.79,97.22 L79.09,98.82 L76.29,100.24 L73.41,101.49 L70.45,102.55 L67.43,103.43 L64.37,104.11 L61.27,104.61 L58.14,104.90 L55.00,105.00 L51.86,104.90 L48.73,104.61 L45.63,104.11 L42.57,103.43 L39.55,102.55 L36.59,101.49 L33.71,100.24 L30.91,98.82 L28.21,97.22 L25.61,95.45 L23.13,93.53 L20.77,91.45 L18.55,89.23 L16.47,86.87 L14.55,84.39 L12.78,81.79 L11.18,79.09 L9.76,76.29 L8.51,73.41 L7.45,70.45 L6.57,67.43 L5.89,64.37 L5.39,61.27 L5.10,58.14 L5.00,55.00 L5.10,51.86 L5.39,48.73 L5.89,45.63 L6.57,42.57 L7.45,39.55 L8.51,36.59 L9.76,33.71 L11.18,30.91 L12.78,28.21 L14.55,25.61 L16.47,23.13 L18.55,20.77 L20.77,18.55 L23.13,16.47 L25.61,14.55 L28.21,12.78 L30.91,11.18 L33.71,9.76 L36.59,8.51 L39.55,7.45 L42.57,6.57 L45.63,5.89 L48.73,5.39 L51.86,5.10 L55.00,5.00 L58.14,5.10 L61.27,5.39 L64.37,5.89 L67.43,6.57 L70.45,7.45 L73.41,8.51 L76.29,9.76 L79.09,11.18 L81.79,12.78 L84.39,14.55 L86.87,16.47 L89.23,18.55 L91.45,20.77 L93.53,23.13 L95.45,25.61 L97.22,28.21 L98.82,30.91 L100.24,33.71 L101.49,36.59 L102.55,39.55 L103.43,42.57 L104.11,45.63 L104.61,48.73 L104.90,51.86 Z"]
           RenderPath {circle} at (5,115) size 120x120 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M105.00,165.00 L104.90,168.14 L104.61,171.27 L104.11,174.37 L103.43,177.43 L102.55,180.45 L101.49,183.41 L100.24,186.29 L98.82,189.09 L97.22,191.79 L95.45,194.39 L93.53,196.87 L91.45,199.23 L89.23,201.45 L86.87,203.53 L84.39,205.45 L81.79,207.22 L79.09,208.82 L76.29,210.24 L73.41,211.49 L70.45,212.55 L67.43,213.43 L64.37,214.11 L61.27,214.61 L58.14,214.90 L55.00,215.00 L51.86,214.90 L48.73,214.61 L45.63,214.11 L42.57,213.43 L39.55,212.55 L36.59,211.49 L33.71,210.24 L30.91,208.82 L28.21,207.22 L25.61,205.45 L23.13,203.53 L20.77,201.45 L18.55,199.23 L16.47,196.87 L14.55,194.39 L12.78,191.79 L11.18,189.09 L9.76,186.29 L8.51,183.41 L7.45,180.45 L6.57,177.43 L5.89,174.37 L5.39,171.27 L5.10,168.14 L5.00,165.00 L5.10,161.86 L5.39,158.73 L5.89,155.63 L6.57,152.57 L7.45,149.55 L8.51,146.59 L9.76,143.71 L11.18,140.91 L12.78,138.21 L14.55,135.61 L16.47,133.13 L18.55,130.77 L20.77,128.55 L23.13,126.47 L25.61,124.55 L28.21,122.78 L30.91,121.18 L33.71,119.76 L36.59,118.51 L39.55,117.45 L42.57,116.57 L45.63,115.89 L48.73,115.39 L51.86,115.10 L55.00,115.00 L58.14,115.10 L61.27,115.39 L64.37,115.89 L67.43,116.57 L70.45,117.45 L73.41,118.51 L76.29,119.76 L79.09,121.18 L81.79,122.78 L84.39,124.55 L86.87,126.47 L89.23,128.55 L91.45,130.77 L93.53,133.13 L95.45,135.61 L97.22,138.21 L98.82,140.91 L100.24,143.71 L101.49,146.59 L102.55,149.55 L103.43,152.57 L104.11,155.63 L104.61,158.73 L104.90,161.86 Z"]
           RenderPath {circle} at (115,5) size 120x120 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M215.00,55.00 L214.90,58.14 L214.61,61.27 L214.11,64.37 L213.43,67.43 L212.55,70.45 L211.49,73.41 L210.24,76.29 L208.82,79.09 L207.22,81.79 L205.45,84.39 L203.53,86.87 L201.45,89.23 L199.23,91.45 L196.87,93.53 L194.39,95.45 L191.79,97.22 L189.09,98.82 L186.29,100.24 L183.41,101.49 L180.45,102.55 L177.43,103.43 L174.37,104.11 L171.27,104.61 L168.14,104.90 L165.00,105.00 L161.86,104.90 L158.73,104.61 L155.63,104.11 L152.57,103.43 L149.55,102.55 L146.59,101.49 L143.71,100.24 L140.91,98.82 L138.21,97.22 L135.61,95.45 L133.13,93.53 L130.77,91.45 L128.55,89.23 L126.47,86.87 L124.55,84.39 L122.78,81.79 L121.18,79.09 L119.76,76.29 L118.51,73.41 L117.45,70.45 L116.57,67.43 L115.89,64.37 L115.39,61.27 L115.10,58.14 L115.00,55.00 L115.10,51.86 L115.39,48.73 L115.89,45.63 L116.57,42.57 L117.45,39.55 L118.51,36.59 L119.76,33.71 L121.18,30.91 L122.78,28.21 L124.55,25.61 L126.47,23.13 L128.55,20.77 L130.77,18.55 L133.13,16.47 L135.61,14.55 L138.21,12.78 L140.91,11.18 L143.71,9.76 L146.59,8.51 L149.55,7.45 L152.57,6.57 L155.63,5.89 L158.73,5.39 L161.86,5.10 L165.00,5.00 L168.14,5.10 L171.27,5.39 L174.37,5.89 L177.43,6.57 L180.45,7.45 L183.41,8.51 L186.29,9.76 L189.09,11.18 L191.79,12.78 L194.39,14.55 L196.87,16.47 L199.23,18.55 L201.45,20.77 L203.53,23.13 L205.45,25.61 L207.22,28.21 L208.82,30.91 L210.24,33.71 L211.49,36.59 L212.55,39.55 L213.43,42.57 L214.11,45.63 L214.61,48.73 L214.90,51.86 Z"]
           RenderPath {circle} at (115,115) size 120x120 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M215.00,165.00 L214.90,168.14 L214.61,171.27 L214.11,174.37 L213.43,177.43 L212.55,180.45 L211.49,183.41 L210.24,186.29 L208.82,189.09 L207.22,191.79 L205.45,194.39 L203.53,196.87 L201.45,199.23 L199.23,201.45 L196.87,203.53 L194.39,205.45 L191.79,207.22 L189.09,208.82 L186.29,210.24 L183.41,211.49 L180.45,212.55 L177.43,213.43 L174.37,214.11 L171.27,214.61 L168.14,214.90 L165.00,215.00 L161.86,214.90 L158.73,214.61 L155.63,214.11 L152.57,213.43 L149.55,212.55 L146.59,211.49 L143.71,210.24 L140.91,208.82 L138.21,207.22 L135.61,205.45 L133.13,203.53 L130.77,201.45 L128.55,199.23 L126.47,196.87 L124.55,194.39 L122.78,191.79 L121.18,189.09 L119.76,186.29 L118.51,183.41 L117.45,180.45 L116.57,177.43 L115.89,174.37 L115.39,171.27 L115.10,168.14 L115.00,165.00 L115.10,161.86 L115.39,158.73 L115.89,155.63 L116.57,152.57 L117.45,149.55 L118.51,146.59 L119.76,143.71 L121.18,140.91 L122.78,138.21 L124.55,135.61 L126.47,133.13 L128.55,130.77 L130.77,128.55 L133.13,126.47 L135.61,124.55 L138.21,122.78 L140.91,121.18 L143.71,119.76 L146.59,118.51 L149.55,117.45 L152.57,116.57 L155.63,115.89 L158.73,115.39 L161.86,115.10 L165.00,115.00 L168.14,115.10 L171.27,115.39 L174.37,115.89 L177.43,116.57 L180.45,117.45 L183.41,118.51 L186.29,119.76 L189.09,121.18 L191.79,122.78 L194.39,124.55 L196.87,126.47 L199.23,128.55 L201.45,130.77 L203.53,133.13 L205.45,135.61 L207.22,138.21 L208.82,140.91 L210.24,143.71 L211.49,146.59 L212.55,149.55 L213.43,152.57 L214.11,155.63 L214.61,158.73 L214.90,161.86 Z"]
       RenderSVGContainer {g} at (0,0) size 300x300
         RenderSVGContainer {use} at (0,0) size 300x300
+          [masker="mask_1"] RenderSVGResourceMasker {mask} at (-30,-30) size 360x360
           RenderSVGContainer {g} at (0,0) size 300x300
             RenderPath {rect} at (0,0) size 300x300 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#0000FF), (1.00,#FF0000)]] [start=(0,0)] [end=(1,1)]}] [data="M0.00,0.00 L300.00,0.00 L300.00,300.00 L0.00,300.00 Z"]
diff --git a/LayoutTests/platform/mac/svg/css/mask-with-shadow-expected.txt b/LayoutTests/platform/mac/svg/css/mask-with-shadow-expected.txt
index 930b46e..c5866a4 100644
--- a/LayoutTests/platform/mac/svg/css/mask-with-shadow-expected.txt
+++ b/LayoutTests/platform/mac/svg/css/mask-with-shadow-expected.txt
@@ -1,5 +1,4 @@
 KRenderingPaintServer {id="maskedGradient" [type=LINEAR-GRADIENT] [stops=[(0.00,#0000FF), (1.00,#FF0000)]] [start=(0,0)] [end=(1,1)]}
-KCanvasResource {id="mask_1" [type=MASKER]}
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 450x500
@@ -10,12 +9,13 @@ layer at (0,0) size 450x500
           RenderSVGGradientStop {stop} at (0,0) size 0x0
           RenderSVGGradientStop {stop} at (0,0) size 0x0
         RenderPath {rect} at (0,0) size 300x300 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#0000FF), (1.00,#FF0000)]] [start=(0,0)] [end=(1,1)]}] [data="M0.00,0.00 L300.00,0.00 L300.00,300.00 L0.00,300.00 Z"]
-        RenderSVGContainer {mask} at (5,5) size 230x230
+        RenderSVGResourceMasker {mask} [id="mask_1"] [maskUnits=objectBoundingBox] [maskContentUnits=userSpaceOnUse]
           RenderPath {circle} at (5,5) size 110x110 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M105.00,55.00 L104.90,58.14 L104.61,61.27 L104.11,64.37 L103.43,67.43 L102.55,70.45 L101.49,73.41 L100.24,76.29 L98.82,79.09 L97.22,81.79 L95.45,84.39 L93.53,86.87 L91.45,89.23 L89.23,91.45 L86.87,93.53 L84.39,95.45 L81.79,97.22 L79.09,98.82 L76.29,100.24 L73.41,101.49 L70.45,102.55 L67.43,103.43 L64.37,104.11 L61.27,104.61 L58.14,104.90 L55.00,105.00 L51.86,104.90 L48.73,104.61 L45.63,104.11 L42.57,103.43 L39.55,102.55 L36.59,101.49 L33.71,100.24 L30.91,98.82 L28.21,97.22 L25.61,95.45 L23.13,93.53 L20.77,91.45 L18.55,89.23 L16.47,86.87 L14.55,84.39 L12.78,81.79 L11.18,79.09 L9.76,76.29 L8.51,73.41 L7.45,70.45 L6.57,67.43 L5.89,64.37 L5.39,61.27 L5.10,58.14 L5.00,55.00 L5.10,51.86 L5.39,48.73 L5.89,45.63 L6.57,42.57 L7.45,39.55 L8.51,36.59 L9.76,33.71 L11.18,30.91 L12.78,28.21 L14.55,25.61 L16.47,23.13 L18.55,20.77 L20.77,18.55 L23.13,16.47 L25.61,14.55 L28.21,12.78 L30.91,11.18 L33.71,9.76 L36.59,8.51 L39.55,7.45 L42.57,6.57 L45.63,5.89 L48.73,5.39 L51.86,5.10 L55.00,5.00 L58.14,5.10 L61.27,5.39 L64.37,5.89 L67.43,6.57 L70.45,7.45 L73.41,8.51 L76.29,9.76 L79.09,11.18 L81.79,12.78 L84.39,14.55 L86.87,16.47 L89.23,18.55 L91.45,20.77 L93.53,23.13 L95.45,25.61 L97.22,28.21 L98.82,30.91 L100.24,33.71 L101.49,36.59 L102.55,39.55 L103.43,42.57 L104.11,45.63 L104.61,48.73 L104.90,51.86 Z"]
           RenderPath {circle} at (5,115) size 110x110 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M105.00,165.00 L104.90,168.14 L104.61,171.27 L104.11,174.37 L103.43,177.43 L102.55,180.45 L101.49,183.41 L100.24,186.29 L98.82,189.09 L97.22,191.79 L95.45,194.39 L93.53,196.87 L91.45,199.23 L89.23,201.45 L86.87,203.53 L84.39,205.45 L81.79,207.22 L79.09,208.82 L76.29,210.24 L73.41,211.49 L70.45,212.55 L67.43,213.43 L64.37,214.11 L61.27,214.61 L58.14,214.90 L55.00,215.00 L51.86,214.90 L48.73,214.61 L45.63,214.11 L42.57,213.43 L39.55,212.55 L36.59,211.49 L33.71,210.24 L30.91,208.82 L28.21,207.22 L25.61,205.45 L23.13,203.53 L20.77,201.45 L18.55,199.23 L16.47,196.87 L14.55,194.39 L12.78,191.79 L11.18,189.09 L9.76,186.29 L8.51,183.41 L7.45,180.45 L6.57,177.43 L5.89,174.37 L5.39,171.27 L5.10,168.14 L5.00,165.00 L5.10,161.86 L5.39,158.73 L5.89,155.63 L6.57,152.57 L7.45,149.55 L8.51,146.59 L9.76,143.71 L11.18,140.91 L12.78,138.21 L14.55,135.61 L16.47,133.13 L18.55,130.77 L20.77,128.55 L23.13,126.47 L25.61,124.55 L28.21,122.78 L30.91,121.18 L33.71,119.76 L36.59,118.51 L39.55,117.45 L42.57,116.57 L45.63,115.89 L48.73,115.39 L51.86,115.10 L55.00,115.00 L58.14,115.10 L61.27,115.39 L64.37,115.89 L67.43,116.57 L70.45,117.45 L73.41,118.51 L76.29,119.76 L79.09,121.18 L81.79,122.78 L84.39,124.55 L86.87,126.47 L89.23,128.55 L91.45,130.77 L93.53,133.13 L95.45,135.61 L97.22,138.21 L98.82,140.91 L100.24,143.71 L101.49,146.59 L102.55,149.55 L103.43,152.57 L104.11,155.63 L104.61,158.73 L104.90,161.86 Z"]
           RenderPath {circle} at (115,5) size 110x110 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M215.00,55.00 L214.90,58.14 L214.61,61.27 L214.11,64.37 L213.43,67.43 L212.55,70.45 L211.49,73.41 L210.24,76.29 L208.82,79.09 L207.22,81.79 L205.45,84.39 L203.53,86.87 L201.45,89.23 L199.23,91.45 L196.87,93.53 L194.39,95.45 L191.79,97.22 L189.09,98.82 L186.29,100.24 L183.41,101.49 L180.45,102.55 L177.43,103.43 L174.37,104.11 L171.27,104.61 L168.14,104.90 L165.00,105.00 L161.86,104.90 L158.73,104.61 L155.63,104.11 L152.57,103.43 L149.55,102.55 L146.59,101.49 L143.71,100.24 L140.91,98.82 L138.21,97.22 L135.61,95.45 L133.13,93.53 L130.77,91.45 L128.55,89.23 L126.47,86.87 L124.55,84.39 L122.78,81.79 L121.18,79.09 L119.76,76.29 L118.51,73.41 L117.45,70.45 L116.57,67.43 L115.89,64.37 L115.39,61.27 L115.10,58.14 L115.00,55.00 L115.10,51.86 L115.39,48.73 L115.89,45.63 L116.57,42.57 L117.45,39.55 L118.51,36.59 L119.76,33.71 L121.18,30.91 L122.78,28.21 L124.55,25.61 L126.47,23.13 L128.55,20.77 L130.77,18.55 L133.13,16.47 L135.61,14.55 L138.21,12.78 L140.91,11.18 L143.71,9.76 L146.59,8.51 L149.55,7.45 L152.57,6.57 L155.63,5.89 L158.73,5.39 L161.86,5.10 L165.00,5.00 L168.14,5.10 L171.27,5.39 L174.37,5.89 L177.43,6.57 L180.45,7.45 L183.41,8.51 L186.29,9.76 L189.09,11.18 L191.79,12.78 L194.39,14.55 L196.87,16.47 L199.23,18.55 L201.45,20.77 L203.53,23.13 L205.45,25.61 L207.22,28.21 L208.82,30.91 L210.24,33.71 L211.49,36.59 L212.55,39.55 L213.43,42.57 L214.11,45.63 L214.61,48.73 L214.90,51.86 Z"]
           RenderPath {circle} at (115,115) size 110x110 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M215.00,165.00 L214.90,168.14 L214.61,171.27 L214.11,174.37 L213.43,177.43 L212.55,180.45 L211.49,183.41 L210.24,186.29 L208.82,189.09 L207.22,191.79 L205.45,194.39 L203.53,196.87 L201.45,199.23 L199.23,201.45 L196.87,203.53 L194.39,205.45 L191.79,207.22 L189.09,208.82 L186.29,210.24 L183.41,211.49 L180.45,212.55 L177.43,213.43 L174.37,214.11 L171.27,214.61 L168.14,214.90 L165.00,215.00 L161.86,214.90 L158.73,214.61 L155.63,214.11 L152.57,213.43 L149.55,212.55 L146.59,211.49 L143.71,210.24 L140.91,208.82 L138.21,207.22 L135.61,205.45 L133.13,203.53 L130.77,201.45 L128.55,199.23 L126.47,196.87 L124.55,194.39 L122.78,191.79 L121.18,189.09 L119.76,186.29 L118.51,183.41 L117.45,180.45 L116.57,177.43 L115.89,174.37 L115.39,171.27 L115.10,168.14 L115.00,165.00 L115.10,161.86 L115.39,158.73 L115.89,155.63 L116.57,152.57 L117.45,149.55 L118.51,146.59 L119.76,143.71 L121.18,140.91 L122.78,138.21 L124.55,135.61 L126.47,133.13 L128.55,130.77 L130.77,128.55 L133.13,126.47 L135.61,124.55 L138.21,122.78 L140.91,121.18 L143.71,119.76 L146.59,118.51 L149.55,117.45 L152.57,116.57 L155.63,115.89 L158.73,115.39 L161.86,115.10 L165.00,115.00 L168.14,115.10 L171.27,115.39 L174.37,115.89 L177.43,116.57 L180.45,117.45 L183.41,118.51 L186.29,119.76 L189.09,121.18 L191.79,122.78 L194.39,124.55 L196.87,126.47 L199.23,128.55 L201.45,130.77 L203.53,133.13 L205.45,135.61 L207.22,138.21 L208.82,140.91 L210.24,143.71 L211.49,146.59 L212.55,149.55 L213.43,152.57 L214.11,155.63 L214.61,158.73 L214.90,161.86 Z"]
       RenderSVGContainer {g} at (0,0) size 300x300
         RenderSVGContainer {use} at (0,0) size 300x300
+          [masker="mask_1"] RenderSVGResourceMasker {mask} at (-30,-30) size 360x360
           RenderSVGContainer {g} at (0,0) size 300x300
             RenderPath {rect} at (0,0) size 300x300 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#0000FF), (1.00,#FF0000)]] [start=(0,0)] [end=(1,1)]}] [data="M0.00,0.00 L300.00,0.00 L300.00,300.00 L0.00,300.00 Z"]
diff --git a/LayoutTests/platform/mac/svg/custom/empty-mask-expected.txt b/LayoutTests/platform/mac/svg/custom/empty-mask-expected.txt
index 5321393..aa24c58 100644
--- a/LayoutTests/platform/mac/svg/custom/empty-mask-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/empty-mask-expected.txt
@@ -1,13 +1,14 @@
-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 (0,0) size 0x0
+      RenderSVGResourceMasker {mask} [id="mask"] [maskUnits=objectBoundingBox] [maskContentUnits=userSpaceOnUse]
         RenderPath {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M-0.50,-0.50 L-0.40,-0.50 L-0.40,-0.40 L-0.50,-0.40 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"]
+      [masker="mask"] RenderSVGResourceMasker {mask} at (10,10) size 120x120
     RenderSVGText {text} at (60,60) size 21x18 contains 1 chunk(s)
+      [masker="mask"] RenderSVGResourceMasker {mask} at (57.90,44.20) size 25.20x21.60
       RenderSVGTSpan {tspan} at (0,0) size 21x18
         RenderSVGInlineText {#text} at (0,-14) size 21x18
           chunk 1 text run 1 at (60.00,60.00) startOffset 0 endOffset 4 width 21.00: "test"
diff --git a/LayoutTests/platform/mac/svg/custom/grayscale-gradient-mask-expected.txt b/LayoutTests/platform/mac/svg/custom/grayscale-gradient-mask-expected.txt
index 97542fd..9bf0c0e 100644
--- a/LayoutTests/platform/mac/svg/custom/grayscale-gradient-mask-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/grayscale-gradient-mask-expected.txt
@@ -1,5 +1,4 @@
 KRenderingPaintServer {id="Gradient" [type=LINEAR-GRADIENT] [stops=[(0.00,#FFFFFF), (1.00,#000000)]] [bounding box mode=0] [start=(0,0)] [end=(800,0)]}
-KCanvasResource {id="Mask" [type=MASKER]}
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
@@ -8,7 +7,8 @@ layer at (0,0) size 800x600
       RenderSVGHiddenContainer {linearGradient} at (0,0) size 0x0
         RenderSVGGradientStop {stop} at (0,0) size 0x0
         RenderSVGGradientStop {stop} at (0,0) size 0x0
-    RenderSVGContainer {mask} at (0,143) size 781x294
+    RenderSVGResourceMasker {mask} [id="Mask"] [maskUnits=userSpaceOnUse] [maskContentUnits=userSpaceOnUse]
       RenderPath {rect} at (0,143) size 781x294 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#FFFFFF), (1.00,#000000)]] [bounding box mode=0] [start=(0,0)] [end=(800,0)]}] [data="M0.00,0.00 L800.00,0.00 L800.00,300.00 L0.00,300.00 Z"]
     RenderPath {rect} at (0,143) size 781x294 [fill={[type=SOLID] [color=#FF8080]}] [data="M0.00,0.00 L800.00,0.00 L800.00,300.00 L0.00,300.00 Z"]
     RenderPath {rect} at (0,241) size 781x99 [fill={[type=SOLID] [color=#0000FF]}] [data="M0.00,100.00 L800.00,100.00 L800.00,200.00 L0.00,200.00 Z"]
+      [masker="Mask"] RenderSVGResourceMasker {mask} at (0,0) size 800x300
diff --git a/LayoutTests/platform/mac/svg/custom/js-late-mask-and-object-creation-expected.txt b/LayoutTests/platform/mac/svg/custom/js-late-mask-and-object-creation-expected.txt
index adaa5ee..2853ece 100644
--- a/LayoutTests/platform/mac/svg/custom/js-late-mask-and-object-creation-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/js-late-mask-and-object-creation-expected.txt
@@ -1,9 +1,9 @@
-KCanvasResource {id="dynMask" [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
-    RenderSVGContainer {g} at (0,0) size 800x300
+    RenderSVGContainer {g} at (0,100) size 800x100
       RenderPath {rect} at (0,100) size 800x100 [fill={[type=SOLID] [color=#0000FF]}] [data="M0.00,100.00 L800.00,100.00 L800.00,200.00 L0.00,200.00 Z"]
-      RenderSVGContainer {mask} at (0,0) size 800x300
+        [masker="dynMask"] RenderSVGResourceMasker {mask} at (0,0) size 800x300
+      RenderSVGResourceMasker {mask} [id="dynMask"] [maskUnits=userSpaceOnUse] [maskContentUnits=userSpaceOnUse]
         RenderPath {rect} at (0,0) size 800x300 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00 L800.00,0.00 L800.00,300.00 L0.00,300.00 Z"]
diff --git a/LayoutTests/platform/mac/svg/custom/js-late-mask-creation-expected.txt b/LayoutTests/platform/mac/svg/custom/js-late-mask-creation-expected.txt
index 53ca8d6..f86e2c0 100644
--- a/LayoutTests/platform/mac/svg/custom/js-late-mask-creation-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/js-late-mask-creation-expected.txt
@@ -1,9 +1,9 @@
-KCanvasResource {id="dynMask" [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
     RenderPath {rect} at (0,100) size 800x100 [fill={[type=SOLID] [color=#0000FF]}] [data="M0.00,100.00 L800.00,100.00 L800.00,200.00 L0.00,200.00 Z"]
-    RenderSVGContainer {g} at (0,0) size 800x300
-      RenderSVGContainer {mask} at (0,0) size 800x300
+      [masker="dynMask"] RenderSVGResourceMasker {mask} at (0,0) size 800x300
+    RenderSVGContainer {g} at (0,0) size 0x0
+      RenderSVGResourceMasker {mask} [id="dynMask"] [maskUnits=userSpaceOnUse] [maskContentUnits=userSpaceOnUse]
         RenderPath {rect} at (0,0) size 800x300 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00 L800.00,0.00 L800.00,300.00 L0.00,300.00 Z"]
diff --git a/LayoutTests/platform/mac/svg/custom/mask-changes-expected.txt b/LayoutTests/platform/mac/svg/custom/mask-changes-expected.txt
index b434eff..a7cac3a 100644
--- a/LayoutTests/platform/mac/svg/custom/mask-changes-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/mask-changes-expected.txt
@@ -1,9 +1,9 @@
-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
-    RenderSVGContainer {mask} at (0,0) size 800x300
+    RenderSVGResourceMasker {mask} [id="Mask"] [maskUnits=userSpaceOnUse] [maskContentUnits=userSpaceOnUse]
       RenderPath {rect} at (0,0) size 800x300 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00 L800.00,0.00 L800.00,300.00 L0.00,300.00 Z"]
     RenderSVGContainer {g} at (0,100) size 800x100
       RenderPath {rect} at (0,100) size 800x100 [fill={[type=SOLID] [color=#0000FF]}] [data="M0.00,100.00 L800.00,100.00 L800.00,200.00 L0.00,200.00 Z"]
+        [masker="Mask"] RenderSVGResourceMasker {mask} at (0,0) size 800x300
diff --git a/LayoutTests/platform/mac/svg/custom/mask-child-changes-expected.txt b/LayoutTests/platform/mac/svg/custom/mask-child-changes-expected.txt
index a3b3195..6df6d2c 100644
--- a/LayoutTests/platform/mac/svg/custom/mask-child-changes-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/mask-child-changes-expected.txt
@@ -1,8 +1,8 @@
-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
-    RenderSVGContainer {mask} at (0,0) size 800x300
+    RenderSVGResourceMasker {mask} [id="Mask"] [maskUnits=userSpaceOnUse] [maskContentUnits=userSpaceOnUse]
       RenderPath {rect} at (0,0) size 800x300 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00 L800.00,0.00 L800.00,300.00 L0.00,300.00 Z"]
     RenderPath {rect} at (0,100) size 800x100 [fill={[type=SOLID] [color=#0000FF]}] [data="M0.00,100.00 L800.00,100.00 L800.00,200.00 L0.00,200.00 Z"]
+      [masker="Mask"] RenderSVGResourceMasker {mask} at (0,0) size 800x300
diff --git a/LayoutTests/platform/mac/svg/custom/mask-excessive-malloc-expected.txt b/LayoutTests/platform/mac/svg/custom/mask-excessive-malloc-expected.txt
index 677f96b..21d7a0c 100644
--- a/LayoutTests/platform/mac/svg/custom/mask-excessive-malloc-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/mask-excessive-malloc-expected.txt
@@ -1,8 +1,8 @@
-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
-    RenderSVGContainer {mask} at (0,0) size 0x0
+    RenderSVGResourceMasker {mask} [id="mask"] [maskUnits=objectBoundingBox] [maskContentUnits=userSpaceOnUse]
       RenderPath {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M0.00,0.00 L2147483648.00,0.00 L2147483648.00,2147483648.00 L0.00,2147483648.00 Z"]
     RenderPath {path} at (200,200) size 100x200 [fill={[type=SOLID] [color=#0000FF]}] [data="M200.00,200.00 L300.00,200.00 L300.00,400.00 L200.00,400.00 Z"]
+      [masker="mask"] RenderSVGResourceMasker {mask} at (190,180) size 214748364800.00x429496729600.00
diff --git a/LayoutTests/platform/mac/svg/custom/mask-inside-defs-expected.txt b/LayoutTests/platform/mac/svg/custom/mask-inside-defs-expected.txt
index df3dc14..de40847 100644
--- a/LayoutTests/platform/mac/svg/custom/mask-inside-defs-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/mask-inside-defs-expected.txt
@@ -1,10 +1,10 @@
-KCanvasResource {id="mymask" [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
-    RenderSVGContainer {mask} at (0,0) size 100x100
+    RenderSVGResourceMasker {mask} [id="mymask"] [maskUnits=objectBoundingBox] [maskContentUnits=userSpaceOnUse]
       RenderPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M0.00,0.00 L100.00,0.00 L100.00,100.00 L0.00,100.00 Z"]
     RenderSVGContainer {g} at (0,0) size 200x200
+      [masker="mymask"] RenderSVGResourceMasker {mask} at (-20,-20) size 240x240
       RenderPath {rect} at (0,0) size 200x200 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00 L200.00,0.00 L200.00,200.00 L0.00,200.00 Z"]
       RenderPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00 L100.00,0.00 L100.00,100.00 L0.00,100.00 Z"]
diff --git a/LayoutTests/platform/mac/svg/custom/mask-invalidation-expected.txt b/LayoutTests/platform/mac/svg/custom/mask-invalidation-expected.txt
index cfd8d08..b4d1bcc 100644
--- a/LayoutTests/platform/mac/svg/custom/mask-invalidation-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/mask-invalidation-expected.txt
@@ -1,13 +1,13 @@
-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
+      RenderSVGResourceMasker {mask} [id="mask"] [maskUnits=userSpaceOnUse] [maskContentUnits=userSpaceOnUse]
         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"]
+        [masker="mask"] RenderSVGResourceMasker {mask} at (-80,-60) size 960x720
     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"
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
index 3baee94..dddae4f 100644
--- a/LayoutTests/platform/mac/svg/custom/mask-on-multiple-objects-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/mask-on-multiple-objects-expected.txt
@@ -1,10 +1,11 @@
-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 (0,0) size 1x1
+      RenderSVGResourceMasker {mask} [id="mask"] [maskUnits=objectBoundingBox] [maskContentUnits=objectBoundingBox]
         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"]
+      [masker="mask"] RenderSVGResourceMasker {mask} at (20,20) size 100x100
     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"]
+      [masker="mask"] RenderSVGResourceMasker {mask} at (140,50) size 100x40
diff --git a/LayoutTests/platform/mac/svg/custom/mask-with-all-units-expected.txt b/LayoutTests/platform/mac/svg/custom/mask-with-all-units-expected.txt
index ac2178f..ffb34dc 100644
--- a/LayoutTests/platform/mac/svg/custom/mask-with-all-units-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/mask-with-all-units-expected.txt
@@ -1,21 +1,21 @@
-KCanvasResource {id="mask1" [type=MASKER]}
-KCanvasResource {id="mask2" [type=MASKER]}
-KCanvasResource {id="mask3" [type=MASKER]}
-KCanvasResource {id="mask4" [type=MASKER]}
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 250x250
   RenderSVGRoot {svg} at (0,0) size 250x250
     RenderSVGHiddenContainer {defs} at (0,0) size 0x0
-      RenderSVGContainer {mask} at (60,60) size 50x50
+      RenderSVGResourceMasker {mask} [id="mask1"] [maskUnits=userSpaceOnUse] [maskContentUnits=userSpaceOnUse]
         RenderPath {rect} at (60,60) size 50x50 [fill={[type=SOLID] [color=#FFFFFF] [opacity=0.50]}] [data="M60.00,60.00 L110.00,60.00 L110.00,110.00 L60.00,110.00 Z"]
-      RenderSVGContainer {mask} at (0,0) size 126x1
+      RenderSVGResourceMasker {mask} [id="mask2"] [maskUnits=objectBoundingBox] [maskContentUnits=objectBoundingBox]
         RenderPath {rect} at (0,0) size 126x1 [fill={[type=SOLID] [color=#FFFFFF] [opacity=0.50]}] [data="M0.50,0.50 L125.50,0.50 L125.50,1.00 L0.50,1.00 Z"]
-      RenderSVGContainer {mask} at (60,170) size 50x50
+      RenderSVGResourceMasker {mask} [id="mask3"] [maskUnits=objectBoundingBox] [maskContentUnits=userSpaceOnUse]
         RenderPath {rect} at (60,170) size 50x50 [fill={[type=SOLID] [color=#FFFFFF] [opacity=0.50]}] [data="M60.00,170.00 L110.00,170.00 L110.00,220.00 L60.00,220.00 Z"]
-      RenderSVGContainer {mask} at (0,0) size 1x1
+      RenderSVGResourceMasker {mask} [id="mask4"] [maskUnits=userSpaceOnUse] [maskContentUnits=objectBoundingBox]
         RenderPath {rect} at (0,0) size 1x1 [fill={[type=SOLID] [color=#FFFFFF] [opacity=0.50]}] [data="M0.50,0.50 L1.00,0.50 L1.00,1.00 L0.50,1.00 Z"]
     RenderPath {rect} at (10,10) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M10.00,10.00 L110.00,10.00 L110.00,110.00 L10.00,110.00 Z"]
+      [masker="mask1"] RenderSVGResourceMasker {mask} at (10,10) size 100x100
     RenderPath {rect} at (120,10) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M120.00,10.00 L220.00,10.00 L220.00,110.00 L120.00,110.00 Z"]
+      [masker="mask2"] RenderSVGResourceMasker {mask} at (110,0) size 120x120
     RenderPath {rect} at (10,170) size 100x50 [fill={[type=SOLID] [color=#008000]}] [data="M10.00,120.00 L110.00,120.00 L110.00,220.00 L10.00,220.00 Z"]
+      [masker="mask3"] RenderSVGResourceMasker {mask} at (0,170) size 120x120
     RenderPath {rect} at (120,120) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M120.00,120.00 L220.00,120.00 L220.00,220.00 L120.00,220.00 Z"]
+      [masker="mask4"] RenderSVGResourceMasker {mask} at (120,120) size 100x100
diff --git a/LayoutTests/platform/mac/svg/custom/mask-with-default-value-expected.txt b/LayoutTests/platform/mac/svg/custom/mask-with-default-value-expected.txt
index 80f5908..947812c 100644
--- a/LayoutTests/platform/mac/svg/custom/mask-with-default-value-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/mask-with-default-value-expected.txt
@@ -1,10 +1,10 @@
-KCanvasResource {id="m1" [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 (0,0) size 800x600
+      RenderSVGResourceMasker {mask} [id="m1"] [maskUnits=objectBoundingBox] [maskContentUnits=userSpaceOnUse]
         RenderPath {rect} at (0,0) size 800x600 [fill={[type=SOLID] [color=#000000]}] [data="M0.00,0.00 L800.00,0.00 L800.00,600.00 L0.00,600.00 Z"]
     RenderPath {rect} at (0,0) size 120x120 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00 L120.00,0.00 L120.00,120.00 L0.00,120.00 Z"]
     RenderPath {rect} at (10,10) size 100x100 [fill={[type=SOLID] [color=#FF0000]}] [data="M10.00,10.00 L110.00,10.00 L110.00,110.00 L10.00,110.00 Z"]
+      [masker="m1"] RenderSVGResourceMasker {mask} at (0,0) size 120x120
diff --git a/LayoutTests/platform/mac/svg/custom/resource-invalidate-on-target-update-expected.txt b/LayoutTests/platform/mac/svg/custom/resource-invalidate-on-target-update-expected.txt
index 59dbf65..3092c0e 100644
--- a/LayoutTests/platform/mac/svg/custom/resource-invalidate-on-target-update-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/resource-invalidate-on-target-update-expected.txt
@@ -1,6 +1,5 @@
 KCanvasResource {id="filter" [type=FILTER]  [bounding box=at (-10.00%,-10.00%) size 120.00%x120.00%]}
 KCanvasResource {id="clip" [type=CLIPPER] [clip data=[[winding=NON-ZERO] [bounding box mode=1] [path=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]]]}
-KCanvasResource {id="mask" [type=MASKER]}
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
@@ -8,9 +7,10 @@ layer at (0,0) size 800x600
     RenderSVGHiddenContainer {defs} at (0,0) size 0x0
       RenderSVGHiddenContainer {clipPath} at (0,0) size 0x0
         RenderPath {circle} at (0,0) size 1x1 [fill={[type=SOLID] [color=#000000]}] [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"]
-      RenderSVGContainer {mask} at (0,0) size 1x1
+      RenderSVGResourceMasker {mask} [id="mask"] [maskUnits=objectBoundingBox] [maskContentUnits=objectBoundingBox]
         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"]
     RenderSVGContainer {g} at (0,10) size 121x350
       RenderPath {rect} at (10,10) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M10.00,10.00 L110.00,10.00 L110.00,110.00 L10.00,110.00 Z"]
+        [masker="mask"] RenderSVGResourceMasker {mask} at (0,0) size 120x120
       RenderPath {rect} at (10,130) size 100x100 [fill={[type=SOLID] [color=#008000]}] [clip path="clip"] [data="M10.00,130.00 L110.00,130.00 L110.00,230.00 L10.00,230.00 Z"]
       RenderPath {rect} at (0,240) size 121x120 [fill={[type=SOLID] [color=#008000]}] [filter=filter] [data="M10.00,250.00 L110.00,250.00 L110.00,350.00 L10.00,350.00 Z"]
diff --git a/LayoutTests/platform/mac/svg/custom/visibility-override-mask-expected.txt b/LayoutTests/platform/mac/svg/custom/visibility-override-mask-expected.txt
index 49201c1..bd75554 100644
--- a/LayoutTests/platform/mac/svg/custom/visibility-override-mask-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/visibility-override-mask-expected.txt
@@ -1,13 +1,13 @@
-KCanvasResource {id="mymask" [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 (0,0) size 100x100
+      RenderSVGResourceMasker {mask} [id="mymask"] [maskUnits=objectBoundingBox] [maskContentUnits=userSpaceOnUse]
         RenderPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M0.00,0.00 L100.00,0.00 L100.00,100.00 L0.00,100.00 Z"]
     RenderPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#0000FF]}] [data="M0.00,0.00 L100.00,0.00 L100.00,100.00 L0.00,100.00 Z"]
     RenderSVGContainer {g} at (0,0) size 200x200
+      [masker="mymask"] RenderSVGResourceMasker {mask} at (-20,-20) size 240x240
       RenderSVGContainer {g} at (0,0) size 200x200
         RenderPath {rect} at (0,0) size 200x200 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00 L200.00,0.00 L200.00,200.00 L0.00,200.00 Z"]
         RenderPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00 L100.00,0.00 L100.00,100.00 L0.00,100.00 Z"]
diff --git a/LayoutTests/platform/mac/svg/filters/filter-clip-expected.txt b/LayoutTests/platform/mac/svg/filters/filter-clip-expected.txt
index 571f682..c8d71e9 100644
--- a/LayoutTests/platform/mac/svg/filters/filter-clip-expected.txt
+++ b/LayoutTests/platform/mac/svg/filters/filter-clip-expected.txt
@@ -1,4 +1,3 @@
-KCanvasResource {id="mask" [type=MASKER]}
 KCanvasResource {id="blur" [type=FILTER]  [bounding box=at (-20.00%,-20.00%) size 140.00%x140.00%]}
 KCanvasResource {id="clip" [type=CLIPPER] [clip data=[[winding=NON-ZERO] [path=M120.00,70.00 L119.90,73.14 L119.61,76.27 L119.11,79.37 L118.43,82.43 L117.55,85.45 L116.49,88.41 L115.24,91.29 L113.82,94.09 L112.22,96.79 L110.45,99.39 L108.53,101.87 L106.45,104.23 L104.23,106.45 L101.87,108.53 L99.39,110.45 L96.79,112.22 L94.09,113.82 L91.29,115.24 L88.41,116.49 L85.45,117.55 L82.43,118.43 L79.37,119.11 L76.27,119.61 L73.14,119.90 L70.00,120.00 L66.86,119.90 L63.73,119.61 L60.63,119.11 L57.57,118.43 L54.55,117.55 L51.59,116.49 L48.71,115.24 L45.91,113.82 L43.21,112.22 L40.61,110.45 L38.13,108.53 L35.77,106.45 L33.55,104.23 L31.47,101.87 L29.55,99.39 L27.78,96.79 L26.18,94.09 L24.76,91.29 L23.51,88.41 L22.45,85.45 L21.57,82.43 L20.89,79.37 L20.39,76.27 L20.10,73.14 L20.00,70.00 L20.10,66.86 L20.39,63.73 L20.89,60.63 L21.57,57.57 L22.45,54.55 L23.51,51.59 L24.76,48.71 L26.18,45.91 L27.78,43.21 L29.55,40.61 L31.47,38.13 L33.55,35.77 L35.77,33.55 L38.13,31.47 L40.61,29.55 L43.21,27.78 L45.91,26.18 L48.71,24.76 L51.59,23.51 L54.55,22.45 L57.57,21.57 L60.63,20.89 L63.73,20.39 L66.86,20.10 L70.00,20.00 L73.14,20.10 L76.27,20.39 L79.37,20.89 L82.43,21.57 L85.45,22.45 L88.41,23.51 L91.29,24.76 L94.09,26.18 L96.79,27.78 L99.39,29.55 L101.87,31.47 L104.23,33.55 L106.45,35.77 L108.53,38.13 L110.45,40.61 L112.22,43.21 L113.82,45.91 L115.24,48.71 L116.49,51.59 L117.55,54.55 L118.43,57.57 L119.11,60.63 L119.61,63.73 L119.90,66.86 Z]]]}
 layer at (0,0) size 800x600
@@ -6,9 +5,10 @@ layer 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 (0,0) size 140x140
+      RenderSVGResourceMasker {mask} [id="mask"] [maskUnits=objectBoundingBox] [maskContentUnits=userSpaceOnUse]
         RenderPath {rect} at (0,0) size 140x140 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00 L140.00,0.00 L140.00,140.00 L0.00,140.00 Z"]
         RenderPath {circle} at (30,30) size 80x80 [fill={[type=SOLID] [color=#FFFF00]}] [data="M110.00,70.00 L109.92,72.51 L109.68,75.01 L109.29,77.50 L108.74,79.95 L108.04,82.36 L107.19,84.72 L106.19,87.03 L105.05,89.27 L103.77,91.43 L102.36,93.51 L100.82,95.50 L99.16,97.38 L97.38,99.16 L95.50,100.82 L93.51,102.36 L91.43,103.77 L89.27,105.05 L87.03,106.19 L84.72,107.19 L82.36,108.04 L79.95,108.74 L77.50,109.29 L75.01,109.68 L72.51,109.92 L70.00,110.00 L67.49,109.92 L64.99,109.68 L62.50,109.29 L60.05,108.74 L57.64,108.04 L55.28,107.19 L52.97,106.19 L50.73,105.05 L48.57,103.77 L46.49,102.36 L44.50,100.82 L42.62,99.16 L40.84,97.38 L39.18,95.50 L37.64,93.51 L36.23,91.43 L34.95,89.27 L33.81,87.03 L32.81,84.72 L31.96,82.36 L31.26,79.95 L30.71,77.50 L30.32,75.01 L30.08,72.51 L30.00,70.00 L30.08,67.49 L30.32,64.99 L30.71,62.50 L31.26,60.05 L31.96,57.64 L32.81,55.28 L33.81,52.97 L34.95,50.73 L36.23,48.57 L37.64,46.49 L39.18,44.50 L40.84,42.62 L42.62,40.84 L44.50,39.18 L46.49,37.64 L48.57,36.23 L50.73,34.95 L52.97,33.81 L55.28,32.81 L57.64,31.96 L60.05,31.26 L62.50,30.71 L64.99,30.32 L67.49,30.08 L70.00,30.00 L72.51,30.08 L75.01,30.32 L77.50,30.71 L79.95,31.26 L82.36,31.96 L84.72,32.81 L87.03,33.81 L89.27,34.95 L91.43,36.23 L93.51,37.64 L95.50,39.18 L97.38,40.84 L99.16,42.62 L100.82,44.50 L102.36,46.49 L103.77,48.57 L105.05,50.73 L106.19,52.97 L107.19,55.28 L108.04,57.64 L108.74,60.05 L109.29,62.50 L109.68,64.99 L109.92,67.49 Z"]
       RenderSVGHiddenContainer {clipPath} at (0,0) size 0x0
         RenderPath {circle} at (20,20) size 100x100 [fill={[type=SOLID] [color=#000000]}] [data="M120.00,70.00 L119.90,73.14 L119.61,76.27 L119.11,79.37 L118.43,82.43 L117.55,85.45 L116.49,88.41 L115.24,91.29 L113.82,94.09 L112.22,96.79 L110.45,99.39 L108.53,101.87 L106.45,104.23 L104.23,106.45 L101.87,108.53 L99.39,110.45 L96.79,112.22 L94.09,113.82 L91.29,115.24 L88.41,116.49 L85.45,117.55 L82.43,118.43 L79.37,119.11 L76.27,119.61 L73.14,119.90 L70.00,120.00 L66.86,119.90 L63.73,119.61 L60.63,119.11 L57.57,118.43 L54.55,117.55 L51.59,116.49 L48.71,115.24 L45.91,113.82 L43.21,112.22 L40.61,110.45 L38.13,108.53 L35.77,106.45 L33.55,104.23 L31.47,101.87 L29.55,99.39 L27.78,96.79 L26.18,94.09 L24.76,91.29 L23.51,88.41 L22.45,85.45 L21.57,82.43 L20.89,79.37 L20.39,76.27 L20.10,73.14 L20.00,70.00 L20.10,66.86 L20.39,63.73 L20.89,60.63 L21.57,57.57 L22.45,54.55 L23.51,51.59 L24.76,48.71 L26.18,45.91 L27.78,43.21 L29.55,40.61 L31.47,38.13 L33.55,35.77 L35.77,33.55 L38.13,31.47 L40.61,29.55 L43.21,27.78 L45.91,26.18 L48.71,24.76 L51.59,23.51 L54.55,22.45 L57.57,21.57 L60.63,20.89 L63.73,20.39 L66.86,20.10 L70.00,20.00 L73.14,20.10 L76.27,20.39 L79.37,20.89 L82.43,21.57 L85.45,22.45 L88.41,23.51 L91.29,24.76 L94.09,26.18 L96.79,27.78 L99.39,29.55 L101.87,31.47 L104.23,33.55 L106.45,35.77 L108.53,38.13 L110.45,40.61 L112.22,43.21 L113.82,45.91 L115.24,48.71 L116.49,51.59 L117.55,54.55 L118.43,57.57 L119.11,60.63 L119.61,63.73 L119.90,66.86 Z"]
     RenderPath {rect} at (20,20) size 100x100 [fill={[type=SOLID] [color=#008000]}] [clip path="clip"] [filter=blur] [data="M20.00,20.00 L120.00,20.00 L120.00,120.00 L20.00,120.00 Z"]
+      [masker="mask"] RenderSVGResourceMasker {mask} at (10,10) size 120x120
diff --git a/LayoutTests/svg/custom/transformedMaskFails-expected.txt b/LayoutTests/svg/custom/transformedMaskFails-expected.txt
index cd8a57b..4d69a3d 100644
--- a/LayoutTests/svg/custom/transformedMaskFails-expected.txt
+++ b/LayoutTests/svg/custom/transformedMaskFails-expected.txt
@@ -1,11 +1,11 @@
-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 (100,100) size 150x150
+      RenderSVGResourceMasker {mask} [id="mask"] [maskUnits=objectBoundingBox] [maskContentUnits=userSpaceOnUse]
         RenderSVGContainer {g} at (100,100) size 150x150 [transform={m=((1.00,0.00)(0.00,1.00)) t=(100.00,100.00)}]
           RenderPath {rect} at (100,100) size 150x150 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M0.00,0.00 L150.00,0.00 L150.00,150.00 L0.00,150.00 Z"]
     RenderPath {rect} at (100,100) size 100x100 [fill={[type=SOLID] [color=#FF0000]}] [data="M100.00,100.00 L200.00,100.00 L200.00,200.00 L100.00,200.00 Z"]
     RenderPath {rect} at (100,100) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M100.00,100.00 L200.00,100.00 L200.00,200.00 L100.00,200.00 Z"]
+      [masker="mask"] RenderSVGResourceMasker {mask} at (90,90) size 120x120
diff --git a/WebCore/Android.mk b/WebCore/Android.mk
index 8cbc91d..bb991f3 100644
--- a/WebCore/Android.mk
+++ b/WebCore/Android.mk
@@ -602,6 +602,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
 	rendering/RenderSVGInline.cpp \
 	rendering/RenderSVGInlineText.cpp \
 	rendering/RenderSVGModelObject.cpp \
+	rendering/RenderSVGResourceMasker.cpp \
 	rendering/RenderSVGRoot.cpp \
 	rendering/RenderSVGShadowTreeRootContainer.cpp \
 	rendering/RenderSVGTSpan.cpp \
@@ -857,7 +858,6 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
 	svg/graphics/SVGResourceClipper.cpp \
 	svg/graphics/SVGResourceFilter.cpp \
 	svg/graphics/SVGResourceMarker.cpp \
-	svg/graphics/SVGResourceMasker.cpp \
 	\
 	svg/graphics/filters/SVGFEConvolveMatrix.cpp \
 	svg/graphics/filters/SVGFEDiffuseLighting.cpp \
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4976d8c..e64ca8d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,112 @@
+2010-02-17  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        Move SVGResources to Renderers, starting with Masker
+        https://bugs.webkit.org/show_bug.cgi?id=35020
+
+        We have rendering specific code in WebCore/svg/graphics. The goal is to move
+        this code into suitable Renderers. This helps us to clean up the code and makes
+        maintenance easier. It also makes it possible to remove rendering specific code
+        from SVG*Elements into this renderers. So the Renderer contains everything that
+        is needed to use the resource.
+        RenderSVGResource will be the base class for all new resource render classes like
+        RenderSVGResourceMasker, RenderSVGResourceClipper and the other resources.
+
+        This patch starts moving SVGResourceMasker to RenderSVGResourceMasker.
+        Another benefit is the much more useful result in DRT on using masker.
+
+        * Android.mk:
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::toRenderSVGResource): Conversion to RenderSVGResource base class.
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::isSVGResource): Check if renderer is a resource.
+        * rendering/RenderPath.cpp:
+        * rendering/RenderSVGImage.cpp:
+        (WebCore::RenderSVGImage::destroy): Renderer gets destroyed, unregister it from it's resources.
+        * rendering/RenderSVGImage.h: Some code clean up according to the webkit style.
+        (WebCore::RenderSVGImage::toSVGRenderBase):
+        (WebCore::RenderSVGImage::renderName):
+        (WebCore::RenderSVGImage::isSVGImage):
+        (WebCore::RenderSVGImage::localToParentTransform):
+        (WebCore::RenderSVGImage::strokeBoundingBox):
+        (WebCore::RenderSVGImage::requiresLayer):
+        (WebCore::RenderSVGImage::localTransform):
+        * rendering/RenderSVGInlineText.h:
+        (WebCore::RenderSVGInlineText::objectBoundingBox): Needed for SVGRenderTreeAsText
+        * rendering/RenderSVGModelObject.cpp:
+        (WebCore::RenderSVGModelObject::destroy): Renderer gets destroyed, unregister it from it's resources.
+        * rendering/RenderSVGModelObject.h:
+        * rendering/RenderSVGResource.h: Added.
+        (WebCore::): Base class for all Resource renderers like masker, clipper and others.
+        (WebCore::RenderSVGResource::RenderSVGResource):
+        (WebCore::RenderSVGResource::cast):
+        (WebCore::RenderSVGResource::toRenderSVGResource):
+        (WebCore::RenderSVGResource::isSVGResource): 
+        (WebCore::RenderSVGResource::drawsContents):
+        (WebCore::getRenderSVGResourceById):
+        * rendering/RenderSVGResourceMasker.cpp: Added.
+        (WebCore::RenderSVGResourceMasker::RenderSVGResourceMasker):
+        (WebCore::RenderSVGResourceMasker::~RenderSVGResourceMasker):
+        (WebCore::RenderSVGResourceMasker::invalidateClients): Status of masker changed, remove all clients.
+        (WebCore::RenderSVGResourceMasker::invalidateClient): Status of an object changed, remove pending client.
+        (WebCore::RenderSVGResourceMasker::applyResource): Apply masker to object.
+        (WebCore::RenderSVGResourceMasker::resourceBoundingBox): boundingBox of the resource, depending on the object.
+        (WebCore::RenderSVGResourceMasker::createMaskImage): Creates the mask image, the context gets clipped with.
+        * rendering/RenderSVGResourceMasker.h: Added.
+        (WebCore::MaskerData::MaskerData):
+        (WebCore::RenderSVGResourceMasker::renderName):
+        (WebCore::RenderSVGResourceMasker::maskUnits): Unit of mask for DRT.
+        (WebCore::RenderSVGResourceMasker::maskContentUnits): Unit of childs from mask for DRT.
+        (WebCore::RenderSVGResourceMasker::resourceType):
+        * rendering/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::destroy): Renderer gets destroyed, unregister it from it's resources.
+        * rendering/RenderSVGRoot.h:
+        * rendering/RenderSVGText.cpp:
+        (WebCore::RenderSVGText::destroy): dito.
+        * rendering/RenderSVGText.h:
+        * rendering/RenderTreeAsText.cpp:
+        (WebCore::write):
+        * rendering/SVGRenderSupport.cpp:
+        (WebCore::SVGRenderBase::prepareToRenderSVGContent):
+        (WebCore::SVGRenderBase::maskerBoundingBoxForRenderer):
+        (WebCore::SVGRenderBase::deregisterFromResources): Unregister object from all it's resources after status changed.
+        * rendering/SVGRenderSupport.h:
+        (WebCore::SVGRenderBase::toSVGRenderBase):
+        (WebCore::SVGRenderBase::strokeBoundingBox):
+        (WebCore::SVGRenderBase::markerBoundingBox):
+        * rendering/SVGRenderTreeAsText.cpp: Update TreeAsText to dump maskers correctly.
+        (WebCore::operator<<):
+        (WebCore::writeSVGResource):
+        (WebCore::writeSVGContainer):
+        (WebCore::writeSVGText):
+        (WebCore::writeSVGInlineText):
+        (WebCore::writeSVGImage):
+        (WebCore::write):
+        (WebCore::writeResourcesToObject):
+        * rendering/SVGRenderTreeAsText.h:
+        * svg/SVGMaskElement.cpp: Update Masker to use the new renderer.
+        (WebCore::SVGMaskElement::svgAttributeChanged):
+        (WebCore::SVGMaskElement::childrenChanged):
+        (WebCore::SVGMaskElement::maskBoundingBox):
+        (WebCore::SVGMaskElement::createRenderer):
+        * svg/SVGMaskElement.h:
+        * svg/SVGStyledElement.cpp: We need to tell the renderer to unregister object, after the status changed.
+        (WebCore::SVGStyledElement::invalidateResources):
+        (WebCore::SVGStyledElement::invalidateResourcesInAncestorChain):
+        * svg/SVGUnitTypes.h: Conversion of integer to SVGUnitType.
+        (WebCore::toUnitType):
+        * svg/graphics/SVGResource.h:
+        (WebCore::):
+        (WebCore::SVGResource::isMarker):
+        * svg/graphics/SVGResourceMasker.cpp: Removed.
+        * svg/graphics/SVGResourceMasker.h: Removed.
+
 2010-02-17  Kenneth Russell  <kbr at google.com>
 
         Reviewed by Oliver Hunt.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index b56885c..17fe33f 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -2990,6 +2990,9 @@ webcore_sources += \
 	WebCore/rendering/RenderSVGInlineText.h \
 	WebCore/rendering/RenderSVGModelObject.cpp \
 	WebCore/rendering/RenderSVGModelObject.h \
+	WebCore/rendering/RenderSVGResource.h \
+	WebCore/rendering/RenderSVGResourceMasker.cpp \
+	WebCore/rendering/RenderSVGResourceMasker.h \
 	WebCore/rendering/RenderSVGRoot.cpp \
 	WebCore/rendering/RenderSVGRoot.h \
 	WebCore/rendering/RenderSVGShadowTreeRootContainer.cpp \
@@ -3332,8 +3335,6 @@ webcore_sources += \
 	WebCore/svg/graphics/SVGResourceListener.h \
 	WebCore/svg/graphics/SVGResourceMarker.cpp \
 	WebCore/svg/graphics/SVGResourceMarker.h \
-	WebCore/svg/graphics/SVGResourceMasker.cpp \
-	WebCore/svg/graphics/SVGResourceMasker.h \
 	WebCore/svg/graphics/filters/SVGDistantLightSource.h \
 	WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp \
 	WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 6191360..9ab6ecc 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -3098,6 +3098,9 @@
             'rendering/RenderSVGInlineText.h',
             'rendering/RenderSVGModelObject.cpp',
             'rendering/RenderSVGModelObject.h',
+            'rendering/RenderSVGResource.h',
+            'rendering/RenderSVGResourceMasker.cpp',
+            'rendering/RenderSVGResourceMasker.h',
             'rendering/RenderSVGRoot.cpp',
             'rendering/RenderSVGRoot.h',
             'rendering/RenderSVGShadowTreeRootContainer.cpp',
@@ -3324,8 +3327,6 @@
             'svg/graphics/SVGResourceListener.h',
             'svg/graphics/SVGResourceMarker.cpp',
             'svg/graphics/SVGResourceMarker.h',
-            'svg/graphics/SVGResourceMasker.cpp',
-            'svg/graphics/SVGResourceMasker.h',
             'svg/ColorDistance.cpp',
             'svg/ColorDistance.h',
             'svg/ElementTimeControl.h',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 11be106..4cb4794 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -1656,6 +1656,8 @@ HEADERS += \
     rendering/RenderSVGInline.h \
     rendering/RenderSVGInlineText.h \
     rendering/RenderSVGModelObject.h \
+    rendering/RenderSVGResource.h \
+    rendering/RenderSVGResourceMasker.h \
     rendering/RenderSVGRoot.h \
     rendering/RenderSVGShadowTreeRootContainer.h \
     rendering/RenderSVGText.h \
@@ -1747,7 +1749,6 @@ HEADERS += \
     svg/graphics/SVGResourceFilter.h \
     svg/graphics/SVGResource.h \
     svg/graphics/SVGResourceMarker.h \
-    svg/graphics/SVGResourceMasker.h \
     svg/SVGAElement.h \
     svg/SVGAltGlyphElement.h \
     svg/SVGAngle.h \
@@ -2598,7 +2599,6 @@ contains(DEFINES, ENABLE_SVG=1) {
         svg/graphics/SVGResource.cpp \
         svg/graphics/SVGResourceFilter.cpp \
         svg/graphics/SVGResourceMarker.cpp \
-        svg/graphics/SVGResourceMasker.cpp \
         rendering/RenderForeignObject.cpp \
         rendering/RenderPath.cpp \
         rendering/RenderSVGBlock.cpp \
@@ -2609,6 +2609,7 @@ contains(DEFINES, ENABLE_SVG=1) {
         rendering/RenderSVGInline.cpp \
         rendering/RenderSVGInlineText.cpp \
         rendering/RenderSVGModelObject.cpp \
+        rendering/RenderSVGResourceMasker.cpp \
         rendering/RenderSVGRoot.cpp \
         rendering/RenderSVGShadowTreeRootContainer.cpp \
         rendering/RenderSVGText.cpp \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index ae3a0b7..5f46c0e 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -27621,6 +27621,18 @@
 				>
 			</File>
 			<File
+				RelativePath="..\rendering\RenderSVGResource.h"
+				>
+			</File>
+			<File
+				RelativePath="..\rendering\RenderSVGResourceMasker.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\rendering\RenderSVGResourceMasker.h"
+				>
+			</File>
+			<File
 				RelativePath="..\rendering\RenderSVGRoot.cpp"
 				>
 			</File>
@@ -39896,22 +39908,22 @@
 					</FileConfiguration>
 				</File>
 				<File
-					RelativePath="..\bindings\js\JavaScriptProfile.cpp"
-					>
-				</File>
-				<File
-					RelativePath="..\bindings\js\JavaScriptProfile.h"
-					>
-				</File>
-				<File
-					RelativePath="..\bindings\js\JavaScriptProfileNode.cpp"
-					>
-				</File>
-				<File
-					RelativePath="..\bindings\js\JavaScriptProfileNode.h"
-					>
-				</File>
-				<File
+					RelativePath="..\bindings\js\JavaScriptProfile.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\bindings\js\JavaScriptProfile.h"
+					>
+				</File>
+				<File
+					RelativePath="..\bindings\js\JavaScriptProfileNode.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\bindings\js\JavaScriptProfileNode.h"
+					>
+				</File>
+				<File
 					RelativePath="..\bindings\js\ScheduledAction.cpp"
 					>
 					<FileConfiguration
@@ -41771,14 +41783,6 @@
 					RelativePath="..\svg\graphics\SVGResourceMarker.h"
 					>
 				</File>
-				<File
-					RelativePath="..\svg\graphics\SVGResourceMasker.cpp"
-					>
-				</File>
-				<File
-					RelativePath="..\svg\graphics\SVGResourceMasker.h"
-					>
-				</File>
 				<Filter
 					Name="filters"
 					>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 8ba5e4b..6692eca 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -64,6 +64,9 @@
 		082341C50FCF3A9500D75BD6 /* WMLSelectElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 082341C30FCF3A9400D75BD6 /* WMLSelectElement.cpp */; };
 		082341C60FCF3A9500D75BD6 /* WMLSelectElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 082341C40FCF3A9400D75BD6 /* WMLSelectElement.h */; };
 		082FCAC4110927CE00CC4821 /* JSSVGContextCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 082FCAC3110927CE00CC4821 /* JSSVGContextCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		083192AA112B43050083C3B9 /* RenderSVGResource.h in Headers */ = {isa = PBXBuildFile; fileRef = 083192A7112B43050083C3B9 /* RenderSVGResource.h */; };
+		083192AB112B43050083C3B9 /* RenderSVGResourceMasker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 083192A8112B43050083C3B9 /* RenderSVGResourceMasker.cpp */; };
+		083192AC112B43050083C3B9 /* RenderSVGResourceMasker.h in Headers */ = {isa = PBXBuildFile; fileRef = 083192A9112B43050083C3B9 /* RenderSVGResourceMasker.h */; };
 		08385FF610F0186000BFE07B /* SVGMarkerData.h in Headers */ = {isa = PBXBuildFile; fileRef = 08385FF510F0186000BFE07B /* SVGMarkerData.h */; };
 		0839476C0ECE4BD600027350 /* WMLElementFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08FB84B00ECE373300DC064E /* WMLElementFactory.cpp */; };
 		0839476D0ECE4BD600027350 /* WMLElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 08FB84B10ECE373300DC064E /* WMLElementFactory.h */; };
@@ -3688,8 +3691,6 @@
 		B25599B80D00D8BA00BB825C /* SVGResourceListener.h in Headers */ = {isa = PBXBuildFile; fileRef = B25599200D00D8B900BB825C /* SVGResourceListener.h */; };
 		B25599B90D00D8BA00BB825C /* SVGResourceMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25599210D00D8B900BB825C /* SVGResourceMarker.cpp */; };
 		B25599BA0D00D8BA00BB825C /* SVGResourceMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = B25599220D00D8B900BB825C /* SVGResourceMarker.h */; };
-		B25599BB0D00D8BA00BB825C /* SVGResourceMasker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25599230D00D8B900BB825C /* SVGResourceMasker.cpp */; };
-		B25599BC0D00D8BA00BB825C /* SVGResourceMasker.h in Headers */ = {isa = PBXBuildFile; fileRef = B25599240D00D8B900BB825C /* SVGResourceMasker.h */; };
 		B25DFAAF0B2E2929000E6510 /* JSSVGMatrixCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25DFAAE0B2E2929000E6510 /* JSSVGMatrixCustom.cpp */; };
 		B262B8040D1F32D000158F09 /* SVGFont.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B262B8030D1F32D000158F09 /* SVGFont.cpp */; };
 		B26554EA0B80D74900A50EC3 /* RenderSVGTextPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B26554E80B80D74900A50EC3 /* RenderSVGTextPath.cpp */; };
@@ -5354,6 +5355,9 @@
 		082341C30FCF3A9400D75BD6 /* WMLSelectElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLSelectElement.cpp; sourceTree = "<group>"; };
 		082341C40FCF3A9400D75BD6 /* WMLSelectElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLSelectElement.h; sourceTree = "<group>"; };
 		082FCAC3110927CE00CC4821 /* JSSVGContextCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSVGContextCache.h; sourceTree = "<group>"; };
+		083192A7112B43050083C3B9 /* RenderSVGResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGResource.h; sourceTree = "<group>"; };
+		083192A8112B43050083C3B9 /* RenderSVGResourceMasker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResourceMasker.cpp; sourceTree = "<group>"; };
+		083192A9112B43050083C3B9 /* RenderSVGResourceMasker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourceMasker.h; sourceTree = "<group>"; };
 		08385FF510F0186000BFE07B /* SVGMarkerData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMarkerData.h; sourceTree = "<group>"; };
 		083DAEA20F01A7FB00342754 /* RenderTextControlMultiLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTextControlMultiLine.cpp; sourceTree = "<group>"; };
 		083DAEA30F01A7FB00342754 /* RenderTextControlMultiLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderTextControlMultiLine.h; sourceTree = "<group>"; };
@@ -8925,8 +8929,6 @@
 		B25599200D00D8B900BB825C /* SVGResourceListener.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGResourceListener.h; sourceTree = "<group>"; };
 		B25599210D00D8B900BB825C /* SVGResourceMarker.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGResourceMarker.cpp; sourceTree = "<group>"; };
 		B25599220D00D8B900BB825C /* SVGResourceMarker.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGResourceMarker.h; sourceTree = "<group>"; };
-		B25599230D00D8B900BB825C /* SVGResourceMasker.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGResourceMasker.cpp; sourceTree = "<group>"; };
-		B25599240D00D8B900BB825C /* SVGResourceMasker.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGResourceMasker.h; sourceTree = "<group>"; };
 		B25DFAAE0B2E2929000E6510 /* JSSVGMatrixCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGMatrixCustom.cpp; sourceTree = "<group>"; };
 		B262B8030D1F32D000158F09 /* SVGFont.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFont.cpp; sourceTree = "<group>"; };
 		B26554E80B80D74900A50EC3 /* RenderSVGTextPath.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGTextPath.cpp; sourceTree = "<group>"; };
@@ -14271,8 +14273,6 @@
 				B25599200D00D8B900BB825C /* SVGResourceListener.h */,
 				B25599210D00D8B900BB825C /* SVGResourceMarker.cpp */,
 				B25599220D00D8B900BB825C /* SVGResourceMarker.h */,
-				B25599230D00D8B900BB825C /* SVGResourceMasker.cpp */,
-				B25599240D00D8B900BB825C /* SVGResourceMasker.h */,
 			);
 			path = graphics;
 			sourceTree = "<group>";
@@ -15718,6 +15718,9 @@
 				853CA9D10AEEC5E9002372DC /* RenderSVGInlineText.h */,
 				A8F5C0B70F9285AC0098E06B /* RenderSVGModelObject.cpp */,
 				A8F5C0B60F9285AC0098E06B /* RenderSVGModelObject.h */,
+				083192A7112B43050083C3B9 /* RenderSVGResource.h */,
+				083192A8112B43050083C3B9 /* RenderSVGResourceMasker.cpp */,
+				083192A9112B43050083C3B9 /* RenderSVGResourceMasker.h */,
 				AA31B5B20C1DFD1000AE7083 /* RenderSVGRoot.cpp */,
 				AA31B5B30C1DFD1000AE7083 /* RenderSVGRoot.h */,
 				08DAB9B81103D9A5003E7ABA /* RenderSVGShadowTreeRootContainer.cpp */,
@@ -17954,6 +17957,8 @@
 				853CA9DB0AEEC5E9002372DC /* RenderSVGInline.h in Headers */,
 				853CA9DD0AEEC5E9002372DC /* RenderSVGInlineText.h in Headers */,
 				A8F5C0B80F9285AC0098E06B /* RenderSVGModelObject.h in Headers */,
+ 				083192AA112B43050083C3B9 /* RenderSVGResource.h in Headers */,
+ 				083192AC112B43050083C3B9 /* RenderSVGResourceMasker.h in Headers */,
 				AA31B5B50C1DFD1000AE7083 /* RenderSVGRoot.h in Headers */,
 				08DAB9BB1103D9A5003E7ABA /* RenderSVGShadowTreeRootContainer.h in Headers */,
 				853CA9DF0AEEC5E9002372DC /* RenderSVGText.h in Headers */,
@@ -18278,7 +18283,6 @@
 				B25599B70D00D8BA00BB825C /* SVGResourceFilter.h in Headers */,
 				B25599B80D00D8BA00BB825C /* SVGResourceListener.h in Headers */,
 				B25599BA0D00D8BA00BB825C /* SVGResourceMarker.h in Headers */,
-				B25599BC0D00D8BA00BB825C /* SVGResourceMasker.h in Headers */,
 				853CA9E90AEEC608002372DC /* SVGRootInlineBox.h in Headers */,
 				B2227AA30D00BF220071B782 /* SVGScriptElement.h in Headers */,
 				B2227AA60D00BF220071B782 /* SVGSetElement.h in Headers */,
@@ -20196,6 +20200,7 @@
 				853CA9DA0AEEC5E9002372DC /* RenderSVGInline.cpp in Sources */,
 				853CA9DC0AEEC5E9002372DC /* RenderSVGInlineText.cpp in Sources */,
 				A8F5C0B90F9285AC0098E06B /* RenderSVGModelObject.cpp in Sources */,
+ 				083192AB112B43050083C3B9 /* RenderSVGResourceMasker.cpp in Sources */,
 				AA31B5B40C1DFD1000AE7083 /* RenderSVGRoot.cpp in Sources */,
 				08DAB9BA1103D9A5003E7ABA /* RenderSVGShadowTreeRootContainer.cpp in Sources */,
 				853CA9DE0AEEC5E9002372DC /* RenderSVGText.cpp in Sources */,
@@ -20496,7 +20501,6 @@
 				B25599B40D00D8BA00BB825C /* SVGResourceClipper.cpp in Sources */,
 				B25599B60D00D8BA00BB825C /* SVGResourceFilter.cpp in Sources */,
 				B25599B90D00D8BA00BB825C /* SVGResourceMarker.cpp in Sources */,
-				B25599BB0D00D8BA00BB825C /* SVGResourceMasker.cpp in Sources */,
 				853CA9E80AEEC608002372DC /* SVGRootInlineBox.cpp in Sources */,
 				B2227AA20D00BF220071B782 /* SVGScriptElement.cpp in Sources */,
 				B2227AA50D00BF220071B782 /* SVGSetElement.cpp in Sources */,
diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp
index bc50c02..d7ce3c3 100644
--- a/WebCore/rendering/RenderObject.cpp
+++ b/WebCore/rendering/RenderObject.cpp
@@ -66,6 +66,7 @@
 #endif
 
 #if ENABLE(SVG)
+#include "RenderSVGResource.h"
 #include "SVGRenderSupport.h"
 #endif
 
@@ -2530,6 +2531,12 @@ const SVGRenderBase* RenderObject::toSVGRenderBase() const
     return 0;
 }
 
+RenderSVGResource* RenderObject::toRenderSVGResource()
+{
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
 FloatRect RenderObject::objectBoundingBox() const
 {
     ASSERT_NOT_REACHED();
diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h
index 3d24c43..791d4d0 100644
--- a/WebCore/rendering/RenderObject.h
+++ b/WebCore/rendering/RenderObject.h
@@ -54,6 +54,7 @@ class RenderTheme;
 class TransformState;
 class VisiblePosition;
 #if ENABLE(SVG)
+class RenderSVGResource;
 class SVGRenderBase;
 #endif
 
@@ -332,8 +333,10 @@ public:
     virtual bool isSVGText() const { return false; }
     virtual bool isSVGImage() const { return false; }
     virtual bool isSVGForeignObject() const { return false; }
+    virtual bool isSVGResource() const { return false; }
 
     virtual const SVGRenderBase* toSVGRenderBase() const;
+    virtual RenderSVGResource* toRenderSVGResource();
 
     // Per SVG 1.1 objectBoundingBox ignores clipping, masking, filter effects, opacity and stroke-width.
     // This is used for all computation of objectBoundingBox relative units and by SVGLocateable::getBBox().
diff --git a/WebCore/rendering/RenderPath.cpp b/WebCore/rendering/RenderPath.cpp
index 7dbde42..bcedd38 100644
--- a/WebCore/rendering/RenderPath.cpp
+++ b/WebCore/rendering/RenderPath.cpp
@@ -34,9 +34,7 @@
 #include "StrokeStyleApplier.h"
 #include "SVGPaintServer.h"
 #include "SVGRenderSupport.h"
-#include "SVGResourceFilter.h"
 #include "SVGResourceMarker.h"
-#include "SVGResourceMasker.h"
 #include "SVGStyledTransformableElement.h"
 #include "SVGTransformList.h"
 #include "SVGURIReference.h"
diff --git a/WebCore/rendering/RenderSVGImage.cpp b/WebCore/rendering/RenderSVGImage.cpp
index 96eeaf9..6fb9501 100644
--- a/WebCore/rendering/RenderSVGImage.cpp
+++ b/WebCore/rendering/RenderSVGImage.cpp
@@ -37,9 +37,6 @@
 #include "SVGLength.h"
 #include "SVGPreserveAspectRatio.h"
 #include "SVGRenderSupport.h"
-#include "SVGResourceClipper.h"
-#include "SVGResourceFilter.h"
-#include "SVGResourceMasker.h"
 
 namespace WebCore {
 
@@ -103,6 +100,12 @@ void RenderSVGImage::paint(PaintInfo& paintInfo, int, int)
     paintInfo.context->restore();
 }
 
+void RenderSVGImage::destroy()
+{
+    SVGRenderBase::deregisterFromResources(this);
+    RenderImage::destroy();
+}
+
 bool RenderSVGImage::nodeAtFloatPoint(const HitTestRequest&, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction)
 {
     // We only draw in the forground phase, so we only hit-test then.
diff --git a/WebCore/rendering/RenderSVGImage.h b/WebCore/rendering/RenderSVGImage.h
index 8ed9146..f48b9dd 100644
--- a/WebCore/rendering/RenderSVGImage.h
+++ b/WebCore/rendering/RenderSVGImage.h
@@ -32,48 +32,50 @@
 
 namespace WebCore {
 
-    class SVGImageElement;
+class SVGImageElement;
 
-    class RenderSVGImage : public RenderImage, protected SVGRenderBase {
-    public:
-        RenderSVGImage(SVGImageElement*);
+class RenderSVGImage : public RenderImage, protected SVGRenderBase {
+public:
+    RenderSVGImage(SVGImageElement*);
 
-    private:
-        virtual const SVGRenderBase* toSVGRenderBase() const { return this; }
-        virtual const char* renderName() const { return "RenderSVGImage"; }
-        virtual bool isSVGImage() const { return true; }
+private:
+    virtual const SVGRenderBase* toSVGRenderBase() const { return this; }
+    virtual const char* renderName() const { return "RenderSVGImage"; }
+    virtual bool isSVGImage() const { return true; }
 
-        virtual const AffineTransform& localToParentTransform() const { return m_localTransform; }
+    virtual const AffineTransform& localToParentTransform() const { return m_localTransform; }
 
-        virtual FloatRect objectBoundingBox() const;
-        virtual FloatRect strokeBoundingBox() const { return m_localBounds; }
-        virtual FloatRect repaintRectInLocalCoordinates() const;
+    virtual FloatRect objectBoundingBox() const;
+    virtual FloatRect strokeBoundingBox() const { return m_localBounds; }
+    virtual FloatRect repaintRectInLocalCoordinates() const;
 
-        virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer);
-        virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false);
+    virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer);
+    virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false);
 
-        virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&) const;
+    virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&) const;
 
-        virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
-        virtual void absoluteQuads(Vector<FloatQuad>&);
-        virtual void addFocusRingRects(Vector<IntRect>&, int tx, int ty);
+    virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
+    virtual void absoluteQuads(Vector<FloatQuad>&);
+    virtual void addFocusRingRects(Vector<IntRect>&, int tx, int ty);
 
-        virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
-        
-        virtual void layout();
-        virtual void paint(PaintInfo&, int parentX, int parentY);
+    virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
+    
+    virtual void layout();
+    virtual void paint(PaintInfo&, int parentX, int parentY);
 
-        virtual bool requiresLayer() const { return false; }
+    virtual void destroy();
 
-        virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction);
-        virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+    virtual bool requiresLayer() const { return false; }
 
-        virtual AffineTransform localTransform() const { return m_localTransform; }
+    virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction);
+    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
 
-        AffineTransform m_localTransform;
-        FloatRect m_localBounds;
-        mutable FloatRect m_cachedLocalRepaintRect;
-    };
+    virtual AffineTransform localTransform() const { return m_localTransform; }
+
+    AffineTransform m_localTransform;
+    FloatRect m_localBounds;
+    mutable FloatRect m_cachedLocalRepaintRect;
+};
 
 } // namespace WebCore
 
diff --git a/WebCore/rendering/RenderSVGInlineText.h b/WebCore/rendering/RenderSVGInlineText.h
index e9c5d6e..b475067 100644
--- a/WebCore/rendering/RenderSVGInlineText.h
+++ b/WebCore/rendering/RenderSVGInlineText.h
@@ -39,6 +39,10 @@ private:
         
     virtual void styleDidChange(StyleDifference, const RenderStyle*);
 
+    // FIXME: We need objectBoundingBox for DRT results and filters at the moment.
+    // This should be fixed to give back the objectBoundingBox of the text root.
+    virtual FloatRect objectBoundingBox() const { return FloatRect(); }
+
     virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty);
     virtual void absoluteQuads(Vector<FloatQuad>&);
 
diff --git a/WebCore/rendering/RenderSVGModelObject.cpp b/WebCore/rendering/RenderSVGModelObject.cpp
index 3fab5a6..c163dc6 100644
--- a/WebCore/rendering/RenderSVGModelObject.cpp
+++ b/WebCore/rendering/RenderSVGModelObject.cpp
@@ -38,10 +38,6 @@
 #include "RenderView.h"
 #include "SVGStyledElement.h"
 
-#if ENABLE(FILTERS)
-#include "SVGResourceFilter.h"
-#endif
-
 namespace WebCore {
 
 RenderSVGModelObject::RenderSVGModelObject(SVGStyledElement* node)
@@ -86,6 +82,12 @@ void RenderSVGModelObject::absoluteQuads(Vector<FloatQuad>& quads)
     quads.append(absoluteClippedOverflowRect());
 }
 
+void RenderSVGModelObject::destroy()
+{
+    deregisterFromResources(this);
+    RenderObject::destroy();
+}
+
 bool RenderSVGModelObject::nodeAtPoint(const HitTestRequest&, HitTestResult&, int, int, int, int, HitTestAction)
 {
     ASSERT_NOT_REACHED();
diff --git a/WebCore/rendering/RenderSVGModelObject.h b/WebCore/rendering/RenderSVGModelObject.h
index 4c50734..c04c590 100644
--- a/WebCore/rendering/RenderSVGModelObject.h
+++ b/WebCore/rendering/RenderSVGModelObject.h
@@ -60,6 +60,8 @@ public:
     virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty);
     virtual void absoluteQuads(Vector<FloatQuad>&);
 
+    virtual void destroy();
+
     virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&) const;
 
 private:
diff --git a/WebCore/rendering/RenderSVGResource.h b/WebCore/rendering/RenderSVGResource.h
new file mode 100644
index 0000000..49d5e24
--- /dev/null
+++ b/WebCore/rendering/RenderSVGResource.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderSVGResource_h
+#define RenderSVGResource_h
+
+#if ENABLE(SVG)
+#include "FloatRect.h"
+#include "RenderSVGHiddenContainer.h"
+
+namespace WebCore {
+
+enum RenderSVGResourceType {
+    MaskerResourceType
+};
+
+class RenderSVGResource : public RenderSVGHiddenContainer {
+public:
+    RenderSVGResource(SVGStyledElement* node) : RenderSVGHiddenContainer(node) { }
+
+    template<class Renderer>
+    Renderer* cast()
+    {
+        if (Renderer::s_resourceType == resourceType())
+            return static_cast<Renderer*>(this);
+
+        return 0;
+    }
+
+    virtual RenderSVGResource* toRenderSVGResource() { return this; }
+    virtual bool isSVGResource() const { return true; }
+    virtual bool drawsContents() { return false; }
+
+    virtual void invalidateClients() = 0;
+    virtual void invalidateClient(RenderObject*) = 0;
+
+    virtual bool applyResource(RenderObject*, const FloatRect&, GraphicsContext*) = 0;
+    virtual FloatRect resourceBoundingBox(const FloatRect&) const = 0;
+
+    virtual RenderSVGResourceType resourceType() const = 0;
+};
+
+template<typename Renderer>
+Renderer* getRenderSVGResourceById(Document* document, const AtomicString& id)
+{
+    if (id.isEmpty())
+        return 0;
+
+    Element* element = document->getElementById(id);
+    if (!element || !element->isSVGElement())
+        return 0;
+
+    RenderObject* renderer = element->renderer();
+    if (!renderer)
+        return 0;
+
+    RenderSVGResource* renderResource = renderer->toRenderSVGResource();
+    if (!renderResource)
+        return 0;
+
+    return renderResource->cast<Renderer>();
+}
+
+}
+
+#endif
+#endif
diff --git a/WebCore/rendering/RenderSVGResourceMasker.cpp b/WebCore/rendering/RenderSVGResourceMasker.cpp
new file mode 100644
index 0000000..f63845b
--- /dev/null
+++ b/WebCore/rendering/RenderSVGResourceMasker.cpp
@@ -0,0 +1,189 @@
+/*
+ * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "RenderSVGResourceMasker.h"
+
+#include "AffineTransform.h"
+#include "CanvasPixelArray.h"
+#include "Element.h"
+#include "FloatPoint.h"
+#include "FloatRect.h"
+#include "GraphicsContext.h"
+#include "Image.h"
+#include "ImageBuffer.h"
+#include "ImageData.h"
+#include "IntRect.h"
+#include "SVGElement.h"
+#include "SVGMaskElement.h"
+#include "SVGStyledElement.h"
+#include "SVGUnitTypes.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+RenderSVGResourceType RenderSVGResourceMasker::s_resourceType = MaskerResourceType;
+
+RenderSVGResourceMasker::RenderSVGResourceMasker(SVGStyledElement* node)
+    : RenderSVGResource(node)
+{
+}
+
+RenderSVGResourceMasker::~RenderSVGResourceMasker()
+{
+    deleteAllValues(m_masker);
+    m_masker.clear();
+}
+
+void RenderSVGResourceMasker::invalidateClients()
+{
+    HashMap<RenderObject*, MaskerData*>::const_iterator end = m_masker.end();
+    for (HashMap<RenderObject*, MaskerData*>::const_iterator it = m_masker.begin(); it != end; ++it)
+        it->first->setNeedsLayout(true);
+    deleteAllValues(m_masker);
+    m_masker.clear();
+}
+
+void RenderSVGResourceMasker::invalidateClient(RenderObject* object)
+{
+    ASSERT(object);
+    ASSERT(m_masker.contains(object));
+    delete m_masker.take(object); 
+}
+
+bool RenderSVGResourceMasker::applyResource(RenderObject* object, const FloatRect&, GraphicsContext* context)
+{
+    ASSERT(object);
+    ASSERT(context);
+
+    if (!m_masker.contains(object))
+        m_masker.set(object, new MaskerData);
+
+    MaskerData* maskerData = m_masker.get(object);
+    if (!maskerData->maskImage && !maskerData->emptyMask) {
+        SVGMaskElement* maskElement = static_cast<SVGMaskElement*>(node());
+        if (!maskElement)
+            return false;
+
+        createMaskImage(maskerData, maskElement, object);
+    }
+
+    if (!maskerData->maskImage)
+        return false;
+
+    context->clipToImageBuffer(maskerData->maskRect, maskerData->maskImage.get());
+    return true;
+}
+
+FloatRect RenderSVGResourceMasker::resourceBoundingBox(const FloatRect& objectBoundingBox) const
+{
+    if (SVGMaskElement* element = static_cast<SVGMaskElement*>(node()))
+        return element->maskBoundingBox(objectBoundingBox);
+
+    return FloatRect();
+}
+
+void RenderSVGResourceMasker::createMaskImage(MaskerData* maskerData, const SVGMaskElement* maskElement, RenderObject* object)
+{
+    FloatRect objectBoundingBox = object->objectBoundingBox();
+
+    // Mask rect clipped with clippingBoundingBox and filterBoundingBox as long as they are present.
+    maskerData->maskRect = object->repaintRectInLocalCoordinates();
+    if (maskerData->maskRect.isEmpty()) {
+        maskerData->emptyMask = true;
+        return;
+    }
+
+    // Calculate the smallest rect for the mask ImageBuffer.
+    FloatRect repaintRect;
+    Vector<RenderObject*> rendererList;
+    for (Node* node = maskElement->firstChild(); node; node = node->nextSibling()) {
+        RenderObject* renderer = node->renderer();
+        if (!node->isSVGElement() || !static_cast<SVGElement*>(node)->isStyled() || !renderer)
+            continue;
+
+        rendererList.append(renderer);
+        repaintRect.unite(renderer->localToParentTransform().mapRect(renderer->repaintRectInLocalCoordinates()));
+    }
+
+    AffineTransform contextTransform;
+    // We need to scale repaintRect for objectBoundingBox to get the drawing area.
+    if (maskElement->maskContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
+        contextTransform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
+        FloatPoint contextAdjustment = repaintRect.location();
+        repaintRect = contextTransform.mapRect(repaintRect);
+        repaintRect.move(objectBoundingBox.x(), objectBoundingBox.y());
+        contextTransform.translate(-contextAdjustment.x(), -contextAdjustment.y());
+    }
+    repaintRect.intersect(maskerData->maskRect);
+    maskerData->maskRect = repaintRect;
+    IntRect maskImageRect = enclosingIntRect(maskerData->maskRect);
+
+    maskImageRect.setLocation(IntPoint());
+
+    // Don't create ImageBuffers with image size of 0
+    if (!maskImageRect.width() || !maskImageRect.height()) {
+        maskerData->emptyMask = true;
+        return;
+    }
+
+    // FIXME: This changes color space to linearRGB, the default color space
+    // for masking operations in SVG. We need a switch for the other color-space
+    // attribute values sRGB, inherit and auto.
+    maskerData->maskImage = ImageBuffer::create(maskImageRect.size(), LinearRGB);
+    if (!maskerData->maskImage)
+        return;
+
+    GraphicsContext* maskImageContext = maskerData->maskImage->context();
+    ASSERT(maskImageContext);
+
+    maskImageContext->save();
+
+    if (maskElement->maskContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
+        maskImageContext->translate(-maskerData->maskRect.x(), -maskerData->maskRect.y());
+    maskImageContext->concatCTM(contextTransform);
+
+    // draw the content into the ImageBuffer
+    Vector<RenderObject*>::iterator end = rendererList.end();
+    for (Vector<RenderObject*>::iterator it = rendererList.begin(); it != end; it++)
+        renderSubtreeToImage(maskerData->maskImage.get(), *it);
+
+    maskImageContext->restore();
+
+    // create the luminance mask
+    RefPtr<ImageData> imageData(maskerData->maskImage->getUnmultipliedImageData(maskImageRect));
+    CanvasPixelArray* srcPixelArray(imageData->data());
+
+    for (unsigned pixelOffset = 0; pixelOffset < srcPixelArray->length(); pixelOffset += 4) {
+        unsigned char a = srcPixelArray->get(pixelOffset + 3);
+        if (!a)
+            continue;
+        unsigned char r = srcPixelArray->get(pixelOffset);
+        unsigned char g = srcPixelArray->get(pixelOffset + 1);
+        unsigned char b = srcPixelArray->get(pixelOffset + 2);
+
+        double luma = (r * 0.2125 + g * 0.7154 + b * 0.0721) * ((double)a / 255.0);
+        srcPixelArray->set(pixelOffset + 3, luma);
+    }
+
+    maskerData->maskImage->putUnmultipliedImageData(imageData.get(), maskImageRect, IntPoint());
+}
+
+}
diff --git a/WebCore/rendering/RenderSVGResourceMasker.h b/WebCore/rendering/RenderSVGResourceMasker.h
new file mode 100644
index 0000000..3255a2a
--- /dev/null
+++ b/WebCore/rendering/RenderSVGResourceMasker.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderSVGResourceMasker_h
+#define RenderSVGResourceMasker_h
+
+#if ENABLE(SVG)
+#include "FloatRect.h"
+#include "GraphicsContext.h"
+#include "ImageBuffer.h"
+#include "IntSize.h"
+#include "RenderSVGResource.h"
+#include "SVGMaskElement.h"
+#include "SVGUnitTypes.h"
+
+#include <wtf/HashMap.h>
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+struct MaskerData {
+    MaskerData(FloatRect rect = FloatRect(), bool emptyObject = false)
+        : maskRect(rect)
+        , emptyMask(emptyObject)
+    {
+    }
+
+    OwnPtr<ImageBuffer> maskImage;
+    FloatRect maskRect;
+    bool emptyMask;
+};
+
+class RenderSVGResourceMasker : public RenderSVGResource {
+
+public:
+    RenderSVGResourceMasker(SVGStyledElement*);
+    virtual ~RenderSVGResourceMasker();
+
+    virtual const char* renderName() const { return "RenderSVGResourceMasker"; }
+
+    virtual void invalidateClients();
+    virtual void invalidateClient(RenderObject*);
+
+    virtual bool applyResource(RenderObject*, const FloatRect&, GraphicsContext*);
+    virtual FloatRect resourceBoundingBox(const FloatRect&) const;
+
+    SVGUnitTypes::SVGUnitType maskUnits() const { return toUnitType(static_cast<SVGMaskElement*>(node())->maskUnits()); }
+    SVGUnitTypes::SVGUnitType maskContentUnits() const { return toUnitType(static_cast<SVGMaskElement*>(node())->maskContentUnits()); }
+
+    virtual RenderSVGResourceType resourceType() const { return s_resourceType; }
+    static RenderSVGResourceType s_resourceType;
+
+private:
+    void createMaskImage(MaskerData*, const SVGMaskElement*, RenderObject*);
+
+    HashMap<RenderObject*, MaskerData*> m_masker;
+};
+
+}
+
+#endif
+#endif
diff --git a/WebCore/rendering/RenderSVGRoot.cpp b/WebCore/rendering/RenderSVGRoot.cpp
index 7c14c10..51bf3e7 100644
--- a/WebCore/rendering/RenderSVGRoot.cpp
+++ b/WebCore/rendering/RenderSVGRoot.cpp
@@ -185,6 +185,12 @@ void RenderSVGRoot::paint(PaintInfo& paintInfo, int parentX, int parentY)
         paintOutline(paintInfo.context, borderBoxOriginInContainer.x(), borderBoxOriginInContainer.y(), width(), height(), style());
 }
 
+void RenderSVGRoot::destroy()
+{
+    deregisterFromResources(this);
+    RenderBox::destroy();
+}
+
 void RenderSVGRoot::calcViewport()
 {
     SVGSVGElement* svg = static_cast<SVGSVGElement*>(node());
diff --git a/WebCore/rendering/RenderSVGRoot.h b/WebCore/rendering/RenderSVGRoot.h
index da231ac..53c1298 100644
--- a/WebCore/rendering/RenderSVGRoot.h
+++ b/WebCore/rendering/RenderSVGRoot.h
@@ -55,6 +55,8 @@ private:
     virtual void layout();
     virtual void paint(PaintInfo&, int parentX, int parentY);
 
+    virtual void destroy();
+
     virtual const AffineTransform& localToParentTransform() const;
 
     bool fillContains(const FloatPoint&) const;
diff --git a/WebCore/rendering/RenderSVGText.cpp b/WebCore/rendering/RenderSVGText.cpp
index e332c85..b8b9553 100644
--- a/WebCore/rendering/RenderSVGText.cpp
+++ b/WebCore/rendering/RenderSVGText.cpp
@@ -108,6 +108,12 @@ bool RenderSVGText::nodeAtFloatPoint(const HitTestRequest& request, HitTestResul
     return false;
 }
 
+void RenderSVGText::destroy()
+{
+    deregisterFromResources(this);
+    RenderSVGBlock::destroy();
+}
+
 bool RenderSVGText::nodeAtPoint(const HitTestRequest&, HitTestResult&, int, int, int, int, HitTestAction)
 {
     ASSERT_NOT_REACHED();
diff --git a/WebCore/rendering/RenderSVGText.h b/WebCore/rendering/RenderSVGText.h
index 9ae96a0..ab4b09b 100644
--- a/WebCore/rendering/RenderSVGText.h
+++ b/WebCore/rendering/RenderSVGText.h
@@ -53,6 +53,8 @@ private:
     virtual bool requiresLayer() const { return false; }
     virtual void layout();
 
+    virtual void destroy();
+
     virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
     virtual void absoluteQuads(Vector<FloatQuad>&);
 
diff --git a/WebCore/rendering/RenderTreeAsText.cpp b/WebCore/rendering/RenderTreeAsText.cpp
index ca4d9d1..164a656 100644
--- a/WebCore/rendering/RenderTreeAsText.cpp
+++ b/WebCore/rendering/RenderTreeAsText.cpp
@@ -395,6 +395,10 @@ void write(TextStream& ts, const RenderObject& o, int indent)
         write(ts, *toRenderPath(&o), indent);
         return;
     }
+    if (o.isSVGResource()) {
+        writeSVGResource(ts, o, indent);
+        return;
+    }
     if (o.isSVGContainer()) {
         writeSVGContainer(ts, o, indent);
         return;
diff --git a/WebCore/rendering/SVGRenderSupport.cpp b/WebCore/rendering/SVGRenderSupport.cpp
index 079a36e..6d2f665 100644
--- a/WebCore/rendering/SVGRenderSupport.cpp
+++ b/WebCore/rendering/SVGRenderSupport.cpp
@@ -28,13 +28,15 @@
 #include "SVGRenderSupport.h"
 
 #include "AffineTransform.h"
+#include "Document.h"
 #include "ImageBuffer.h"
 #include "RenderObject.h"
 #include "RenderSVGContainer.h"
+#include "RenderSVGResource.h"
+#include "RenderSVGResourceMasker.h"
 #include "RenderView.h"
 #include "SVGResourceClipper.h"
 #include "SVGResourceFilter.h"
-#include "SVGResourceMasker.h"
 #include "SVGStyledElement.h"
 #include "SVGURIReference.h"
 #include "TransformState.h"
@@ -127,17 +129,14 @@ bool SVGRenderBase::prepareToRenderSVGContent(RenderObject* object, RenderObject
         filter = newFilter;
 #endif
 
-    SVGResourceClipper* clipper = getClipperById(document, clipperId, object);
-    SVGResourceMasker* masker = getMaskerById(document, maskerId, object);
-
-    if (masker) {
-        masker->addClient(styledElement);
-        if (!masker->applyMask(paintInfo.context, object))
+    // apply Masker
+    if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(document, maskerId)) {
+        if (!masker->applyResource(object, object->objectBoundingBox(), paintInfo.context))
             return false;
-    } else if (!maskerId.isEmpty())
+    } else if (!clipperId.isEmpty())
         svgElement->document()->accessSVGExtensions()->addPendingResource(maskerId, styledElement);
 
-    if (clipper) {
+    if (SVGResourceClipper* clipper = getClipperById(document, clipperId, object)) {
         clipper->addClient(styledElement);
         clipper->applyClip(paintInfo.context, object->objectBoundingBox());
     } else if (!clipperId.isEmpty())
@@ -297,13 +296,19 @@ FloatRect SVGRenderBase::clipperBoundingBoxForRenderer(const RenderObject* objec
 
 FloatRect SVGRenderBase::maskerBoundingBoxForRenderer(const RenderObject* object) const
 {
-    SVGResourceMasker* masker = getMaskerById(object->document(), object->style()->svgStyle()->maskElement(), object);
-    if (masker)
-        return masker->maskerBoundingBox(object->objectBoundingBox());
+    if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(object->document(), object->style()->svgStyle()->maskElement()))
+        return masker->resourceBoundingBox(object->objectBoundingBox());
 
     return FloatRect();
 }
 
+void SVGRenderBase::deregisterFromResources(RenderObject* object)
+{
+    // We only have a renderer for masker at the moment.
+    if (RenderSVGResourceMasker* resource = getRenderSVGResourceById<RenderSVGResourceMasker>(object->document(), object->style()->svgStyle()->maskElement()))
+        resource->invalidateClient(object);
+}
+
 void applyTransformToPaintInfo(RenderObject::PaintInfo& paintInfo, const AffineTransform& localToAncestorTransform)
 {
     if (localToAncestorTransform.isIdentity())
diff --git a/WebCore/rendering/SVGRenderSupport.h b/WebCore/rendering/SVGRenderSupport.h
index cf75365..427ff1f 100644
--- a/WebCore/rendering/SVGRenderSupport.h
+++ b/WebCore/rendering/SVGRenderSupport.h
@@ -26,61 +26,65 @@
 
 #if ENABLE(SVG)
 #include "RenderObject.h"
+#include "SVGElement.h"
+#include "SVGStyledElement.h"
 
 namespace WebCore {
 
-    class SVGResourceFilter;
-    class ImageBuffer;
+class SVGResourceFilter;
+class ImageBuffer;
 
-    // SVGRendererBase is an abstract base class which all SVG renderers inherit
-    // from in order to share SVG renderer code.
-    // FIXME: This code can all move into RenderSVGModelObject once
-    // all SVG renderers inherit from RenderSVGModelObject.
-    class SVGRenderBase {
-    public:
-        virtual ~SVGRenderBase();
+// SVGRendererBase is an abstract base class which all SVG renderers inherit
+// from in order to share SVG renderer code.
+// FIXME: This code can all move into RenderSVGModelObject once
+// all SVG renderers inherit from RenderSVGModelObject.
+class SVGRenderBase {
+public:
+    virtual ~SVGRenderBase();
 
-        virtual const SVGRenderBase* toSVGRenderBase() const { return this; }
+    virtual const SVGRenderBase* toSVGRenderBase() const { return this; }
 
-        // FIXME: These are only public for SVGRootInlineBox.
-        // It's unclear if these should be exposed or not.  SVGRootInlineBox may
-        // pass the wrong RenderObject* and boundingBox to these functions.
-        static bool prepareToRenderSVGContent(RenderObject*, RenderObject::PaintInfo&, const FloatRect& boundingBox, SVGResourceFilter*&, SVGResourceFilter* rootFilter = 0);
-        static void finishRenderSVGContent(RenderObject*, RenderObject::PaintInfo&, SVGResourceFilter*&, GraphicsContext* savedContext);
+    // FIXME: These are only public for SVGRootInlineBox.
+    // It's unclear if these should be exposed or not.  SVGRootInlineBox may
+    // pass the wrong RenderObject* and boundingBox to these functions.
+    static bool prepareToRenderSVGContent(RenderObject*, RenderObject::PaintInfo&, const FloatRect& boundingBox, SVGResourceFilter*&, SVGResourceFilter* rootFilter = 0);
+    static void finishRenderSVGContent(RenderObject*, RenderObject::PaintInfo&, SVGResourceFilter*&, GraphicsContext* savedContext);
 
-        // Layout all children of the passed render object
-        static void layoutChildren(RenderObject*, bool selfNeedsLayout);
+    // Layout all children of the passed render object
+    static void layoutChildren(RenderObject*, bool selfNeedsLayout);
 
-        // Helper function determining wheter overflow is hidden
-        static bool isOverflowHidden(const RenderObject*);
+    // Helper function determining wheter overflow is hidden
+    static bool isOverflowHidden(const RenderObject*);
 
-        virtual FloatRect strokeBoundingBox() const { return FloatRect(); }
-        virtual FloatRect markerBoundingBox() const { return FloatRect(); }
+    virtual FloatRect strokeBoundingBox() const { return FloatRect(); }
+    virtual FloatRect markerBoundingBox() const { return FloatRect(); }
 
-        // returns the bounding box of filter, clipper, marker and masker (or the empty rect if no filter) in local coordinates
-        FloatRect filterBoundingBoxForRenderer(const RenderObject*) const;
-        FloatRect clipperBoundingBoxForRenderer(const RenderObject*) const;
-        FloatRect maskerBoundingBoxForRenderer(const RenderObject*) const;
+    // returns the bounding box of filter, clipper, marker and masker (or the empty rect if no filter) in local coordinates
+    FloatRect filterBoundingBoxForRenderer(const RenderObject*) const;
+    FloatRect clipperBoundingBoxForRenderer(const RenderObject*) const;
+    FloatRect maskerBoundingBoxForRenderer(const RenderObject*) const;
 
-    protected:
-        static IntRect clippedOverflowRectForRepaint(RenderObject*, RenderBoxModelObject* repaintContainer);
-        static void computeRectForRepaint(RenderObject*, RenderBoxModelObject* repaintContainer, IntRect&, bool fixed);
+protected:
+    static IntRect clippedOverflowRectForRepaint(RenderObject*, RenderBoxModelObject* repaintContainer);
+    static void computeRectForRepaint(RenderObject*, RenderBoxModelObject* repaintContainer, IntRect&, bool fixed);
 
-        static void mapLocalToContainer(const RenderObject*, RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&);
+    static void mapLocalToContainer(const RenderObject*, RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&);
 
-        // Used to share the "walk all the children" logic between objectBoundingBox
-        // and repaintRectInLocalCoordinates in RenderSVGRoot and RenderSVGContainer
-        static FloatRect computeContainerBoundingBox(const RenderObject* container, bool includeAllPaintedContent);
-    };
+    // Used to share the "walk all the children" logic between objectBoundingBox
+    // and repaintRectInLocalCoordinates in RenderSVGRoot and RenderSVGContainer
+    static FloatRect computeContainerBoundingBox(const RenderObject* container, bool includeAllPaintedContent);
 
-    // FIXME: This should move to RenderObject or PaintInfo
-    // Used for transforming the GraphicsContext and damage rect before passing PaintInfo to child renderers.
-    void applyTransformToPaintInfo(RenderObject::PaintInfo&, const AffineTransform& localToChildTransform);
+    static void deregisterFromResources(RenderObject*);
+};
 
-    // This offers a way to render parts of a WebKit rendering tree into a ImageBuffer.
-    void renderSubtreeToImage(ImageBuffer*, RenderObject*);
+// FIXME: This should move to RenderObject or PaintInfo
+// Used for transforming the GraphicsContext and damage rect before passing PaintInfo to child renderers.
+void applyTransformToPaintInfo(RenderObject::PaintInfo&, const AffineTransform& localToChildTransform);
 
-    void clampImageBufferSizeToViewport(FrameView*, IntSize& imageBufferSize);
+// This offers a way to render parts of a WebKit rendering tree into a ImageBuffer.
+void renderSubtreeToImage(ImageBuffer*, RenderObject*);
+
+void clampImageBufferSizeToViewport(FrameView*, IntSize& imageBufferSize);
 } // namespace WebCore
 
 #endif // ENABLE(SVG)
diff --git a/WebCore/rendering/SVGRenderTreeAsText.cpp b/WebCore/rendering/SVGRenderTreeAsText.cpp
index aff718f..f96ad64 100644
--- a/WebCore/rendering/SVGRenderTreeAsText.cpp
+++ b/WebCore/rendering/SVGRenderTreeAsText.cpp
@@ -38,6 +38,7 @@
 #include "RenderPath.h"
 #include "RenderSVGContainer.h"
 #include "RenderSVGInlineText.h"
+#include "RenderSVGResourceMasker.h"
 #include "RenderSVGRoot.h"
 #include "RenderSVGText.h"
 #include "RenderTreeAsText.h"
@@ -195,6 +196,23 @@ TextStream& operator<<(TextStream& ts, const AffineTransform& transform)
     return ts;
 }
 
+TextStream& operator<<(TextStream& ts, const SVGUnitTypes::SVGUnitType& unitType)
+{
+    switch (unitType) {
+    case SVGUnitTypes::SVG_UNIT_TYPE_UNKNOWN:
+        ts << "unknown";
+        break;
+    case SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE:
+        ts << "userSpaceOnUse";
+        break;
+    case SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX:
+        ts << "objectBoundingBox";
+        break;
+    }
+
+    return ts;
+}
+
 TextStream& operator<<(TextStream& ts, const Color& c)
 {
     return ts << c.name();
@@ -464,11 +482,33 @@ static void writeChildren(TextStream& ts, const RenderObject& object, int indent
         write(ts, *child, indent + 1);
 }
 
+void writeSVGResource(TextStream& ts, const RenderObject& object, int indent)
+{
+    writeStandardPrefix(ts, object, indent);
+
+    Element* element = static_cast<Element*>(object.node());
+    const AtomicString& id = element->getIDAttribute();
+    writeNameAndQuotedValue(ts, "id", id);    
+
+    RenderSVGResource* resource = const_cast<RenderObject&>(object).toRenderSVGResource();
+    if (resource->resourceType() == MaskerResourceType) {
+        RenderSVGResourceMasker* masker = static_cast<RenderSVGResourceMasker*>(resource);
+        ASSERT(masker);
+        writeNameValuePair(ts, "maskUnits", masker->maskUnits());
+        writeNameValuePair(ts, "maskContentUnits", masker->maskContentUnits());
+    }
+
+    // FIXME: Handle other RenderSVGResource* classes here, after converting them from SVGResource*.
+    ts << "\n";
+    writeChildren(ts, object, indent);
+}
+
 void writeSVGContainer(TextStream& ts, const RenderObject& container, int indent)
 {
     writeStandardPrefix(ts, container, indent);
     writePositionAndStyle(ts, container);
     ts << "\n";
+    writeResources(ts, container, indent);
     writeChildren(ts, container, indent);
 }
 
@@ -484,6 +524,7 @@ void writeSVGText(TextStream& ts, const RenderBlock& text, int indent)
     writeStandardPrefix(ts, text, indent);
     writeRenderSVGTextBox(ts, text);
     ts << "\n";
+    writeResources(ts, text, indent);
     writeChildren(ts, text, indent);
 }
 
@@ -493,20 +534,41 @@ void writeSVGInlineText(TextStream& ts, const RenderText& text, int indent)
 
     // Why not just linesBoundingBox()?
     ts << " " << FloatRect(text.firstRunOrigin(), text.linesBoundingBox().size()) << "\n";
+    writeResources(ts, text, indent);
     writeSVGInlineTextBoxes(ts, text, indent);
 }
 
+void writeSVGImage(TextStream& ts, const RenderImage& image, int indent)
+{
+    writeStandardPrefix(ts, image, indent);
+    writePositionAndStyle(ts, image);
+    ts << "\n";
+    writeResources(ts, image, indent);
+}
+
 void write(TextStream& ts, const RenderPath& path, int indent)
 {
     writeStandardPrefix(ts, path, indent);
     ts << path << "\n";
+    writeResources(ts, path, indent);
 }
 
-void writeSVGImage(TextStream& ts, const RenderImage& image, int indent)
+void writeResources(TextStream& ts, const RenderObject& object, int indent)
 {
-    writeStandardPrefix(ts, image, indent);
-    writePositionAndStyle(ts, image);
-    ts << "\n";
+    const RenderStyle* style = object.style();
+    const SVGRenderStyle* svgStyle = style->svgStyle();
+
+    if (!svgStyle->maskElement().isEmpty()) {
+        if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(object.document(), svgStyle->maskElement())) {
+            writeIndent(ts, indent);
+            ts << " ";
+            writeNameAndQuotedValue(ts, "masker", svgStyle->maskElement());
+            ts << " ";
+            writeStandardPrefix(ts, *masker, 0);
+            ts << " " << masker->resourceBoundingBox(object.objectBoundingBox()) << "\n";
+        }
+    }
+    // FIXME: Handle other RenderSVGResource* classes here, after converting them from SVGResource*.
 }
 
 void writeRenderResources(TextStream& ts, Node* parent)
diff --git a/WebCore/rendering/SVGRenderTreeAsText.h b/WebCore/rendering/SVGRenderTreeAsText.h
index 13fc475..363875c 100644
--- a/WebCore/rendering/SVGRenderTreeAsText.h
+++ b/WebCore/rendering/SVGRenderTreeAsText.h
@@ -46,18 +46,22 @@ namespace WebCore {
     class RenderSVGRoot;
     class RenderText;
     class AffineTransform;
+    class SVGUnitTypes;
 
 // functions used by the main RenderTreeAsText code
 void write(TextStream&, const RenderPath&, int indent);
 void write(TextStream&, const RenderSVGRoot&, int indent);
+void writeSVGResource(TextStream&, const RenderObject&, int indent);
 void writeSVGContainer(TextStream&, const RenderObject&, int indent);
 void writeSVGImage(TextStream&, const RenderImage&, int indent);
 void writeSVGInlineText(TextStream&, const RenderText&, int indent);
 void writeSVGText(TextStream&, const RenderBlock&, int indent);
+void writeResources(TextStream&, const RenderObject&, int indent);
 
 void writeRenderResources(TextStream&, Node* parent);
 
 // helper operators defined used in various classes to dump the render tree.
+TextStream& operator<<(TextStream& ts, const SVGUnitTypes&);
 TextStream& operator<<(TextStream&, const AffineTransform&);
 TextStream& operator<<(TextStream&, const IntRect&);
 TextStream& operator<<(TextStream&, const Color&);
diff --git a/WebCore/svg/SVGMaskElement.cpp b/WebCore/svg/SVGMaskElement.cpp
index 86d1062..67b0a98 100644
--- a/WebCore/svg/SVGMaskElement.cpp
+++ b/WebCore/svg/SVGMaskElement.cpp
@@ -3,6 +3,7 @@
                   2004, 2005, 2006, 2007 Rob Buis <buis at kde.org>
                   2005 Alexander Kellett <lypanov at kde.org>
                   2009 Dirk Schulze <krit at webkit.org>
+    Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Library General Public
@@ -25,23 +26,13 @@
 #if ENABLE(SVG)
 #include "SVGMaskElement.h"
 
-#include "CanvasPixelArray.h"
 #include "CSSStyleSelector.h"
-#include "GraphicsContext.h"
-#include "Image.h"
-#include "ImageBuffer.h"
-#include "ImageData.h"
 #include "MappedAttribute.h"
-#include "RenderObject.h"
-#include "RenderSVGContainer.h"
+#include "RenderSVGResourceMasker.h"
 #include "SVGLength.h"
 #include "SVGNames.h"
 #include "SVGRenderSupport.h"
 #include "SVGUnitTypes.h"
-#include <math.h>
-#include <wtf/MathExtras.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/Vector.h>
 
 using namespace std;
 
@@ -167,122 +158,9 @@ FloatRect SVGMaskElement::maskBoundingBox(const FloatRect& objectBoundingBox) co
     return maskBBox;
 }
 
-PassOwnPtr<ImageBuffer> SVGMaskElement::drawMaskerContent(const RenderObject* object, FloatRect& maskDestRect, bool& emptyMask) const
-{    
-    FloatRect objectBoundingBox = object->objectBoundingBox();
-
-    // Mask rect clipped with clippingBoundingBox and filterBoundingBox as long as they are present.
-    maskDestRect = object->repaintRectInLocalCoordinates();
-    if (maskDestRect.isEmpty()) {
-        emptyMask = true;
-        return 0;
-    }
-
-    // Calculate the smallest rect for the mask ImageBuffer.
-    FloatRect repaintRect;
-    Vector<RenderObject*> rendererList;
-    for (Node* node = firstChild(); node; node = node->nextSibling()) {
-        if (!node->isSVGElement() || !static_cast<SVGElement*>(node)->isStyled() || !node->renderer())
-            continue;
-
-        rendererList.append(node->renderer());
-        repaintRect.unite(node->renderer()->localToParentTransform().mapRect(node->renderer()->repaintRectInLocalCoordinates()));
-    }
-
-    AffineTransform contextTransform;
-    // We need to scale repaintRect for objectBoundingBox to get the drawing area.
-    if (maskContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
-        contextTransform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
-        FloatPoint contextAdjustment = repaintRect.location();
-        repaintRect = contextTransform.mapRect(repaintRect);
-        repaintRect.move(objectBoundingBox.x(), objectBoundingBox.y());
-        contextTransform.translate(-contextAdjustment.x(), -contextAdjustment.y());
-    }
-    repaintRect.intersect(maskDestRect);
-    maskDestRect = repaintRect;
-    IntRect maskImageRect = enclosingIntRect(maskDestRect);
-
-    maskImageRect.setLocation(IntPoint());
-
-    // Don't create ImageBuffers with image size of 0
-    if (!maskImageRect.width() || !maskImageRect.height()) {
-        emptyMask = true;
-        return 0;
-    }
-
-    // FIXME: This changes color space to linearRGB, the default color space
-    // for masking operations in SVG. We need a switch for the other color-space
-    // attribute values sRGB, inherit and auto.
-    OwnPtr<ImageBuffer> maskImage = ImageBuffer::create(maskImageRect.size(), LinearRGB);
-    if (!maskImage)
-        return 0;
-
-    GraphicsContext* maskImageContext = maskImage->context();
-    ASSERT(maskImageContext);
-
-    maskImageContext->save();
-
-    if (maskContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
-        maskImageContext->translate(-maskDestRect.x(), -maskDestRect.y());
-    maskImageContext->concatCTM(contextTransform);
-
-    // draw the content into the ImageBuffer
-    Vector<RenderObject*>::iterator end = rendererList.end();
-    for (Vector<RenderObject*>::iterator it = rendererList.begin(); it != end; it++)
-        renderSubtreeToImage(maskImage.get(), *it);
-
-
-    maskImageContext->restore();
-
-    // create the luminance mask
-    RefPtr<ImageData> imageData(maskImage->getUnmultipliedImageData(maskImageRect));
-    CanvasPixelArray* srcPixelArray(imageData->data());
-
-    for (unsigned pixelOffset = 0; pixelOffset < srcPixelArray->length(); pixelOffset += 4) {
-        unsigned char a = srcPixelArray->get(pixelOffset + 3);
-        if (!a)
-            continue;
-        unsigned char r = srcPixelArray->get(pixelOffset);
-        unsigned char g = srcPixelArray->get(pixelOffset + 1);
-        unsigned char b = srcPixelArray->get(pixelOffset + 2);
-
-        double luma = (r * 0.2125 + g * 0.7154 + b * 0.0721) * ((double)a / 255.0);
-        srcPixelArray->set(pixelOffset + 3, luma);
-    }
-
-    maskImage->putUnmultipliedImageData(imageData.get(), maskImageRect, IntPoint());
-
-    return maskImage.release();
-}
- 
 RenderObject* SVGMaskElement::createRenderer(RenderArena* arena, RenderStyle*)
 {
-    RenderSVGContainer* maskContainer = new (arena) RenderSVGContainer(this);
-    maskContainer->setDrawsContents(false);
-    return maskContainer;
-}
-
-SVGResource* SVGMaskElement::canvasResource(const RenderObject* object)
-{
-    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;
-}
-
-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();
+    return new (arena) RenderSVGResourceMasker(this);
 }
 
 }
diff --git a/WebCore/svg/SVGMaskElement.h b/WebCore/svg/SVGMaskElement.h
index 005fa4f..7730e37 100644
--- a/WebCore/svg/SVGMaskElement.h
+++ b/WebCore/svg/SVGMaskElement.h
@@ -22,19 +22,15 @@
 
 #if ENABLE(SVG)
 #include "RenderObject.h"
-#include "SVGResourceMasker.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGLangSpace.h"
 #include "SVGStyledLocatableElement.h"
 #include "SVGTests.h"
 #include "SVGURIReference.h"
-#include <wtf/HashMap.h>
-#include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
 
     class SVGLength;
-    class SVGResourceMasker;
 
     class SVGMaskElement : public SVGStyledLocatableElement,
                            public SVGURIReference,
@@ -53,9 +49,6 @@ 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(const RenderObject*);
-
-        PassOwnPtr<ImageBuffer> drawMaskerContent(const RenderObject*, FloatRect& maskRect, bool& emptyMask) const;
 
     private:
         DECLARE_ANIMATED_PROPERTY(SVGMaskElement, SVGNames::maskUnitsAttr, int, MaskUnits, maskUnits)
@@ -70,13 +63,9 @@ namespace WebCore {
 
         // SVGExternalResourcesRequired
         DECLARE_ANIMATED_PROPERTY(SVGMaskElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired)
-
-        virtual void invalidateCanvasResources();
-
-        HashMap<const RenderObject*, RefPtr<SVGResourceMasker> > m_masker;
     };
 
-} // namespace WebCore
+}
 
-#endif // ENABLE(SVG)
+#endif
 #endif
diff --git a/WebCore/svg/SVGStyledElement.cpp b/WebCore/svg/SVGStyledElement.cpp
index be1ba9c..8b78038 100644
--- a/WebCore/svg/SVGStyledElement.cpp
+++ b/WebCore/svg/SVGStyledElement.cpp
@@ -32,6 +32,8 @@
 #include "MappedAttribute.h"
 #include "PlatformString.h"
 #include "RenderObject.h"
+#include "RenderSVGResource.h"
+#include "RenderSVGResourceMasker.h"
 #include "SVGElement.h"
 #include "SVGElementInstance.h"
 #include "SVGElementRareData.h"
@@ -39,7 +41,6 @@
 #include "SVGRenderStyle.h"
 #include "SVGResourceClipper.h"
 #include "SVGResourceFilter.h"
-#include "SVGResourceMasker.h"
 #include "SVGSVGElement.h"
 #include <wtf/Assertions.h>
 
@@ -234,9 +235,8 @@ void SVGStyledElement::invalidateResources()
         filter->invalidate();
 #endif
 
-    SVGResourceMasker* masker = getMaskerById(document, svgStyle->maskElement(), object);
-    if (masker)
-        masker->invalidate();
+    if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(document, svgStyle->maskElement()))
+        masker->invalidateClient(object);
 
     SVGResourceClipper* clipper = getClipperById(document, svgStyle->clipPath(), object);
     if (clipper)
@@ -260,7 +260,13 @@ void SVGStyledElement::invalidateResourcesInAncestorChain() const
 
 void SVGStyledElement::invalidateCanvasResources()
 {
-    if (SVGResource* resource = canvasResource(renderer()))
+    RenderObject* object = renderer();
+    ASSERT(object);
+    if (object->isSVGResource())
+        object->toRenderSVGResource()->invalidateClients();
+
+    // The following lines will be removed soon, once all resources are handled by renderers.
+    if (SVGResource* resource = canvasResource(object))
         resource->invalidate();
 }
 
diff --git a/WebCore/svg/SVGStyledElement.h b/WebCore/svg/SVGStyledElement.h
index aec3e75..9645db4 100644
--- a/WebCore/svg/SVGStyledElement.h
+++ b/WebCore/svg/SVGStyledElement.h
@@ -71,7 +71,7 @@ namespace WebCore {
     protected: 
         static int cssPropertyIdForSVGAttributeName(const QualifiedName&);
 
-        virtual void invalidateCanvasResources();
+        void invalidateCanvasResources();
 
     private:
         DECLARE_ANIMATED_PROPERTY(SVGStyledElement, HTMLNames::classAttr, String, ClassName, className)
diff --git a/WebCore/svg/SVGUnitTypes.h b/WebCore/svg/SVGUnitTypes.h
index b639f29..86d49b4 100644
--- a/WebCore/svg/SVGUnitTypes.h
+++ b/WebCore/svg/SVGUnitTypes.h
@@ -38,9 +38,9 @@ private:
     SVGUnitTypes() { }
 };
 
-} // namespace WebCore
+static inline SVGUnitTypes::SVGUnitType toUnitType(int type) { return static_cast<SVGUnitTypes::SVGUnitType>(type); }
 
-#endif // ENABLE(SVG)
-#endif // SVGUnitTypes_h
+}
 
-// vim:ts=4:noet
+#endif
+#endif
diff --git a/WebCore/svg/graphics/SVGResource.h b/WebCore/svg/graphics/SVGResource.h
index 8f303b5..b231b89 100644
--- a/WebCore/svg/graphics/SVGResource.h
+++ b/WebCore/svg/graphics/SVGResource.h
@@ -45,10 +45,9 @@ namespace WebCore {
     enum SVGResourceType {
         // Painting mode
         ClipperResourceType = 0,
-        MarkerResourceType,
         ImageResourceType,
         FilterResourceType,
-        MaskerResourceType,
+        MarkerResourceType,
         PaintServerResourceType,
         
         // For resource tracking we need to know how many types of resource there are
@@ -78,7 +77,6 @@ namespace WebCore {
         bool isFilter() const { return resourceType() == FilterResourceType; }
         bool isClipper() const { return resourceType() == ClipperResourceType; }
         bool isMarker() const { return resourceType() == MarkerResourceType; }
-        bool isMasker() const { return resourceType() == MaskerResourceType; }
 
         virtual TextStream& externalRepresentation(TextStream&) const;
 
diff --git a/WebCore/svg/graphics/SVGResourceMasker.cpp b/WebCore/svg/graphics/SVGResourceMasker.cpp
deleted file mode 100644
index 18bc71a..0000000
--- a/WebCore/svg/graphics/SVGResourceMasker.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann at kde.org>
- *               2009 Dirk Schulze <krit at webkit.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include "config.h"
-
-#if ENABLE(SVG)
-#include "SVGResourceMasker.h"
-
-#include "CanvasPixelArray.h"
-#include "Image.h"
-#include "ImageBuffer.h"
-#include "ImageData.h"
-#include "GraphicsContext.h"
-#include "RenderObject.h"
-#include "SVGMaskElement.h"
-#include "SVGRenderSupport.h"
-#include "SVGRenderStyle.h"
-#include "TextStream.h"
-
-using namespace std;
-
-namespace WebCore {
-
-SVGResourceMasker::SVGResourceMasker(const SVGMaskElement* ownerElement)
-    : SVGResource()
-    , m_ownerElement(ownerElement)
-    , m_emptyMask(false)
-{
-}
-
-SVGResourceMasker::~SVGResourceMasker()
-{
-}
-
-void SVGResourceMasker::invalidate()
-{
-    SVGResource::invalidate();
-    m_mask.clear();
-    m_emptyMask = false;
-}
-
-FloatRect SVGResourceMasker::maskerBoundingBox(const FloatRect& objectBoundingBox) const
-{
-    return m_ownerElement->maskBoundingBox(objectBoundingBox);
-}
-
-bool SVGResourceMasker::applyMask(GraphicsContext* context, const RenderObject* object)
-{
-    if (!m_mask && !m_emptyMask)
-        m_mask = m_ownerElement->drawMaskerContent(object, m_maskRect, m_emptyMask);
-
-    if (!m_mask)
-        return false;
-
-    context->clipToImageBuffer(m_maskRect, m_mask.get());
-    return true;
-}
-
-TextStream& SVGResourceMasker::externalRepresentation(TextStream& ts) const
-{
-    ts << "[type=MASKER]";
-    return ts;
-}
-
-SVGResourceMasker* getMaskerById(Document* document, const AtomicString& id, const RenderObject* object)
-{
-    SVGResource* resource = getResourceById(document, id, object);
-    if (resource && resource->isMasker())
-        return static_cast<SVGResourceMasker*>(resource);
-
-    return 0;
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/svg/graphics/SVGResourceMasker.h b/WebCore/svg/graphics/SVGResourceMasker.h
deleted file mode 100644
index 27364c2..0000000
--- a/WebCore/svg/graphics/SVGResourceMasker.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann at kde.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#ifndef SVGResourceMasker_h
-#define SVGResourceMasker_h
-
-#if ENABLE(SVG)
-
-#include "GraphicsContext.h"
-#include "RenderObject.h"
-#include "SVGMaskElement.h"
-#include "SVGResource.h"
-
-#include <memory>
-
-#include <wtf/OwnPtr.h>
-#include <wtf/PassRefPtr.h>
-
-namespace WebCore {
-
-    class FloatRect;
-    class ImageBuffer;
-    class SVGMaskElement;
-
-    class SVGResourceMasker : public SVGResource {
-    public:
-        static PassRefPtr<SVGResourceMasker> create(const SVGMaskElement* ownerElement) { return adoptRef(new SVGResourceMasker(ownerElement)); }
-        virtual ~SVGResourceMasker();
-        
-        virtual void invalidate();
-        
-        virtual SVGResourceType resourceType() const { return MaskerResourceType; }
-        virtual TextStream& externalRepresentation(TextStream&) const;
-
-        FloatRect maskerBoundingBox(const FloatRect&) const;
-        bool applyMask(GraphicsContext*, const RenderObject*);
-
-    private:
-        SVGResourceMasker(const SVGMaskElement*);
-
-        const SVGMaskElement* m_ownerElement;
-        
-        OwnPtr<ImageBuffer> m_mask;
-        FloatRect m_maskRect;
-        bool m_emptyMask;
-    };
-
-    SVGResourceMasker* getMaskerById(Document*, const AtomicString&, const RenderObject* object);
-
-} // namespace WebCore
-
-#endif
-
-#endif // SVGResourceMasker_h

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list