2010-02-17 Dirk Schulze <krit@webkit.org>
authorkrit@webkit.org <krit@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Feb 2010 22:12:55 +0000 (22:12 +0000)
committerkrit@webkit.org <krit@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Feb 2010 22:12:55 +0000 (22:12 +0000)
commit7fa506a9691af9179db5e874af0585ede47a3d40
tree9772e8ce579b43f467fac5d60899024da533ebb8
parenta417131dba6cdc0537f909ac32165863761d2c1d
2010-02-17  Dirk Schulze  <krit@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@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: https://svn.webkit.org/repository/webkit/trunk@54909 268f45cc-cd09-0410-ab3c-d52691b4dbfc
57 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/svg/W3C-SVG-1.1/masking-intro-01-f-expected.txt
LayoutTests/platform/mac/svg/W3C-SVG-1.1/masking-mask-01-b-expected.txt
LayoutTests/platform/mac/svg/batik/masking/maskRegions-expected.txt
LayoutTests/platform/mac/svg/css/circle-in-mask-with-shadow-expected.txt
LayoutTests/platform/mac/svg/css/mask-with-shadow-expected.txt
LayoutTests/platform/mac/svg/custom/empty-mask-expected.txt
LayoutTests/platform/mac/svg/custom/grayscale-gradient-mask-expected.txt
LayoutTests/platform/mac/svg/custom/js-late-mask-and-object-creation-expected.txt
LayoutTests/platform/mac/svg/custom/js-late-mask-creation-expected.txt
LayoutTests/platform/mac/svg/custom/mask-changes-expected.txt
LayoutTests/platform/mac/svg/custom/mask-child-changes-expected.txt
LayoutTests/platform/mac/svg/custom/mask-excessive-malloc-expected.txt
LayoutTests/platform/mac/svg/custom/mask-inside-defs-expected.txt
LayoutTests/platform/mac/svg/custom/mask-invalidation-expected.txt
LayoutTests/platform/mac/svg/custom/mask-on-multiple-objects-expected.txt
LayoutTests/platform/mac/svg/custom/mask-with-all-units-expected.txt
LayoutTests/platform/mac/svg/custom/mask-with-default-value-expected.txt
LayoutTests/platform/mac/svg/custom/resource-invalidate-on-target-update-expected.txt
LayoutTests/platform/mac/svg/custom/visibility-override-mask-expected.txt
LayoutTests/platform/mac/svg/filters/filter-clip-expected.txt
LayoutTests/svg/custom/transformedMaskFails-expected.txt
WebCore/Android.mk
WebCore/ChangeLog
WebCore/GNUmakefile.am
WebCore/WebCore.gypi
WebCore/WebCore.pro
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/rendering/RenderObject.cpp
WebCore/rendering/RenderObject.h
WebCore/rendering/RenderPath.cpp
WebCore/rendering/RenderSVGImage.cpp
WebCore/rendering/RenderSVGImage.h
WebCore/rendering/RenderSVGInlineText.h
WebCore/rendering/RenderSVGModelObject.cpp
WebCore/rendering/RenderSVGModelObject.h
WebCore/rendering/RenderSVGResource.h [new file with mode: 0644]
WebCore/rendering/RenderSVGResourceMasker.cpp [new file with mode: 0644]
WebCore/rendering/RenderSVGResourceMasker.h [new file with mode: 0644]
WebCore/rendering/RenderSVGRoot.cpp
WebCore/rendering/RenderSVGRoot.h
WebCore/rendering/RenderSVGText.cpp
WebCore/rendering/RenderSVGText.h
WebCore/rendering/RenderTreeAsText.cpp
WebCore/rendering/SVGRenderSupport.cpp
WebCore/rendering/SVGRenderSupport.h
WebCore/rendering/SVGRenderTreeAsText.cpp
WebCore/rendering/SVGRenderTreeAsText.h
WebCore/svg/SVGMaskElement.cpp
WebCore/svg/SVGMaskElement.h
WebCore/svg/SVGStyledElement.cpp
WebCore/svg/SVGStyledElement.h
WebCore/svg/SVGUnitTypes.h
WebCore/svg/graphics/SVGResource.h
WebCore/svg/graphics/SVGResourceMasker.cpp [deleted file]
WebCore/svg/graphics/SVGResourceMasker.h [deleted file]