2010-06-29 Nikolas Zimmermann <nzimmermann@rim.com>
authorzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Jun 2010 14:26:26 +0000 (14:26 +0000)
committerzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Jun 2010 14:26:26 +0000 (14:26 +0000)
        Reviewed by Dirk Schulze.

        Cleanup SVGRenderSupport
        https://bugs.webkit.org/show_bug.cgi?id=41347

        Remove SVGRenderBase base class from all SVG renderers. It was meant as temporary solution until all SVG renderers inherit from RenderSVGModelObject,
        though this is not going to happen. RenderSVGModelObject inherits from RenderObject, making it impossible to inherit eg. RenderSVGImage from it, as
        it already indirectly inherits from RenderObject, through RenderImage. Other examples are RenderForeignObject (RenderBlock inheritance),
        RenderSVGInlineText (RenderText inheritance) etc.

        Rename SVGRenderBase to SVGRenderSupport, just like the file is named, remove all free functions, and make them all static functions in SVGRenderSupport.
        We can still share code between all SVG renderers, but don't need a special base class for all renderers -> shrink size of all SVG renderers.

        Doesn't affect any test.

        * rendering/RenderBox.cpp: Remove localTransform() override, not needed at all.
        * rendering/RenderBox.h: Ditto.
        * rendering/RenderForeignObject.cpp: s/SVGRenderBase/SVGRenderSupport/
        (WebCore::RenderForeignObject::paint):
        (WebCore::RenderForeignObject::clippedOverflowRectForRepaint):
        (WebCore::RenderForeignObject::computeRectForRepaint):
        (WebCore::RenderForeignObject::nodeAtFloatPoint):
        (WebCore::RenderForeignObject::mapLocalToContainer):
        * rendering/RenderPath.cpp:
        (WebCore::BoundingRectStrokeStyleApplier::strokeStyle): applyStrokeStyleToContext is a static function in SVGRenderSupport now.
        (WebCore::RenderPath::paint): s/SVGRenderBase/SVGRenderSupport/
        (WebCore::RenderPath::nodeAtFloatPoint): Ditto.
        (WebCore::RenderPath::updateCachedBoundaries): Ditto.
        * rendering/RenderSVGBlock.h: Remove SVGRenderBase inheritance.
        * rendering/RenderSVGContainer.cpp:
        (WebCore::RenderSVGContainer::layout): layoutChildren is a static function in SVGRenderSupport now.
        (WebCore::RenderSVGContainer::paint): prepareToRenderSVGContent/finishRenderSVGContent are now static functions in SVGRenderSupport.
        (WebCore::RenderSVGContainer::objectBoundingBox): computeContainerBoundingBox is a static function in SVGRenderSupport now.
        (WebCore::RenderSVGContainer::strokeBoundingBox): Ditto.
        (WebCore::RenderSVGContainer::repaintRectInLocalCoordinates): Remove call to computeContainerBoundingBox, use strokeBoundingBox instead, for consistency.
        (WebCore::RenderSVGContainer::nodeAtFloatPoint): pointInClippingArea is a static function in SVGRenderSupport now.
        * rendering/RenderSVGHiddenContainer.cpp:
        (WebCore::RenderSVGHiddenContainer::layout): layoutChildren is a static function in SVGRenderSupport now.
        * rendering/RenderSVGImage.cpp:
        (WebCore::RenderSVGImage::paint): prepareToRenderSVGContent/finishRenderSVGContent are static functions in SVGRenderSupport now.
        (WebCore::RenderSVGImage::destroy): deregisterResource was renamed to invalidateAllResourcesOfRenderer and is a static function in SVGRenderSupport.
        (WebCore::RenderSVGImage::nodeAtFloatPoint): pointInClippingArea is a static function in SVGRenderSupport now.
        (WebCore::RenderSVGImage::repaintRectInLocalCoordinates): intersectRepaintRectWithResources is a static function in SVGRenderSupport now.
        (WebCore::RenderSVGImage::clippedOverflowRectForRepaint): s/SVGRenderBase/SVGRenderSupport/
        (WebCore::RenderSVGImage::computeRectForRepaint): Ditto.
        (WebCore::RenderSVGImage::mapLocalToContainer): Ditto.
        * rendering/RenderSVGImage.h: Remove SVGRenderBase inheritance.
        * rendering/RenderSVGInline.cpp:
        (WebCore::RenderSVGInline::objectBoundingBox): findTextRootObject is a static function in SVGRenderSupport now.
        (WebCore::RenderSVGInline::strokeBoundingBox): Ditto.
        (WebCore::RenderSVGInline::repaintRectInLocalCoordinates): Ditto.
        (WebCore::RenderSVGInline::clippedOverflowRectForRepaint): s/SVGRenderBase/SVGRenderSupport/
        (WebCore::RenderSVGInline::computeRectForRepaint): Ditto,.
        (WebCore::RenderSVGInline::mapLocalToContainer): Ditto.
        (WebCore::RenderSVGInline::absoluteQuads): findTextRootObject is a static function in SVGRenderSupport now.
        * rendering/RenderSVGInline.h: Remove SVGRenderBase inheritance.
        * rendering/RenderSVGModelObject.cpp:
        (WebCore::RenderSVGModelObject::clippedOverflowRectForRepaint): s/SVGRenderBase/SVGRenderSupport/
        (WebCore::RenderSVGModelObject::computeRectForRepaint): Ditto.
        (WebCore::RenderSVGModelObject::mapLocalToContainer): Ditto.
        (WebCore::RenderSVGModelObject::destroy): deregisterResource was renamed to invalidateAllResourcesOfRenderer and is a static function in SVGRenderSupport.
        * rendering/RenderSVGModelObject.h: Remove SVGRenderBase inheritance.
        * rendering/RenderSVGResource.cpp:
        (WebCore::invalidatePaintingResource): Moved here from SVGRenderSupport (static inline helper function).
        (WebCore::RenderSVGResource::invalidateAllResourcesOfRenderer): Moved here from SVGRenderSupport and renamed from deregisterFromResources.
        * rendering/RenderSVGResource.h: Expose invalidateAllResourcesOfRenderer function.
        * rendering/RenderSVGResourceClipper.cpp:
        (WebCore::RenderSVGResourceClipper::createClipData): renderSubtreeToImage is a static function in SVGRenderSupport now.
        (WebCore::RenderSVGResourceClipper::hitTestClipContent): Ditto.
        * rendering/RenderSVGResourceGradient.cpp:
        (WebCore::createMaskAndSwapContextForTextGradient): findTextRootObject is a static function in SVGRenderSupport now.
        (WebCore::clipToTextMask): Ditto.
        (WebCore::RenderSVGResourceGradient::applyResource): applyStrokeStyleToContext is a static function in SVGRenderSupport now.
        (WebCore::RenderSVGResourceGradient::postApplyResource): findTextRootObject is a static function in SVGRenderSupport now.
        * rendering/RenderSVGResourceMarker.cpp:
        (WebCore::RenderSVGResourceMarker::applyViewportClip): s/SVGRenderBase/SVGRenderSupport/
        * rendering/RenderSVGResourceMasker.cpp:
        (WebCore::RenderSVGResourceMasker::createMaskImage): renderSubtreeToImage is a static function in SVGRenderSupport now.
        * rendering/RenderSVGResourcePattern.cpp:
        (WebCore::RenderSVGResourcePattern::applyResource): applyStrokeStyleToContext is a static function in SVGRenderSupport now.
        (WebCore::clampImageBufferSizeToViewport): Moved here from SVGRenderSupport.
        (WebCore::RenderSVGResourcePattern::createTileImage): renderSubtreeToImage is a static function in SVGRenderSupport now.
        * rendering/RenderSVGResourceSolidColor.cpp:
        (WebCore::RenderSVGResourceSolidColor::applyResource): applyStrokeStyleToContext is a static function in SVGRenderSupport now
        * rendering/RenderSVGRoot.cpp:
        (WebCore::RenderSVGRoot::layout): layoutChildren is a static function in SVGRenderSupport now.
        (WebCore::RenderSVGRoot::paint): prepareToRenderSVGContent/finishRenderSVGContent are now static functions in SVGRenderSupport.
        (WebCore::RenderSVGRoot::destroy): deregisterResource was renamed to invalidateAllResourcesOfRenderer and is a static function in SVGRenderSupport.
        (WebCore::RenderSVGRoot::repaintRectInLocalCoordinates): Remove call to computeContainerBoundingBox, use strokeBoundingBox instead, for consistency.
        * rendering/RenderSVGRoot.h: Remove localTransform() override, no longer needed. Remove SVGRenderBase inheritance.
        (WebCore::RenderSVGRoot::objectBoundingBox): Inlined for speeed.
        (WebCore::RenderSVGRoot::strokeBoundingBox): computeContainerBoundingBox is a static function in SVGRenderSupport now.
        * rendering/RenderSVGText.cpp:
        (WebCore::RenderSVGText::clippedOverflowRectForRepaint): s/SVGRenderBase/SVGRenderSupport/
        (WebCore::RenderSVGText::computeRectForRepaint): Ditto.
        (WebCore::RenderSVGText::mapLocalToContainer): Ditto.
        (WebCore::RenderSVGText::nodeAtFloatPoint): pointInClippingArea is a static function in SVGRenderSupport now.
        (WebCore::RenderSVGText::destroy): deregisterResource was renamed to invalidateAllResourcesOfRenderer and is a static function in SVGRenderSupport.
        (WebCore::RenderSVGText::repaintRectInLocalCoordinates): intersectRepaintRectWithResources is a static function in SVGRenderSupport now.
        * rendering/RenderSVGViewportContainer.cpp:
        (WebCore::RenderSVGViewportContainer::applyViewportClip): s/SVGRenderBase/SVGRenderSupport/
        (WebCore::RenderSVGViewportContainer::pointIsInsideViewportClip): pointInClippingArea is a static function in SVGRenderSupport now.
        * rendering/SVGInlineFlowBox.cpp:
        (WebCore::SVGInlineFlowBox::paint): prepareToRenderSVGContent/finishRenderSVGContent are now static functions in SVGRenderSupport.
        * rendering/SVGRenderSupport.cpp: Make it impossible to construct the class. Remove virtual destructor, made all methods static.
        (WebCore::SVGRenderSupport::clippedOverflowRectForRepaint): s/SVGRenderBase/SVGRenderSupport/
        (WebCore::SVGRenderSupport::computeRectForRepaint): Ditto.
        (WebCore::SVGRenderSupport::mapLocalToContainer): Ditto.
        (WebCore::SVGRenderSupport::prepareToRenderSVGContent): Ditto.
        (WebCore::SVGRenderSupport::finishRenderSVGContent): Ditto.
        (WebCore::SVGRenderSupport::renderSubtreeToImage): Made static.
        (WebCore::SVGRenderSupport::computeContainerBoundingBox): Ditto.
        (WebCore::SVGRenderSupport::layoutChildren): Ditto.
        (WebCore::SVGRenderSupport::isOverflowHidden): s/SVGRenderBase/SVGRenderSupport/
        (WebCore::SVGRenderSupport::intersectRepaintRectWithResources): Ditto.
        (WebCore::SVGRenderSupport::pointInClippingArea): Made static.
        (WebCore::SVGRenderSupport::dashArrayFromRenderingStyle): Ditto.
        (WebCore::SVGRenderSupport::applyStrokeStyleToContext): Ditto.
        (WebCore::SVGRenderSupport::findTextRootObject): Ditto.
        * rendering/SVGRenderSupport.h:
        * rendering/SVGRenderTreeAsText.cpp:
        (WebCore::writeStyle): dashArrayFromRenderingStyle is a static function in SVGRenderSupport now.
        * rendering/SVGRootInlineBox.cpp:
        (WebCore::SVGRootInlineBox::paint): s/SVGRenderBase/SVGRenderSupport/
        * rendering/SVGRootInlineBox.h: Remove SVGRenderBase inheritance.
        * svg/SVGFEImageElement.cpp: Add RenderObject.h include, otherwhise it won't build anymore.
        (WebCore::SVGFEImageElement::build): renderSubtreeToImage is a static function in SVGRenderSupport now.
        * svg/SVGStyledElement.cpp:
        (WebCore::SVGStyledElement::svgAttributeChanged): deregisterResource was renamed to invalidateAllResourcesOfRenderer and is a static function in SVGRenderSupport.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@62118 268f45cc-cd09-0410-ab3c-d52691b4dbfc

34 files changed:
WebCore/ChangeLog
WebCore/rendering/RenderBox.cpp
WebCore/rendering/RenderBox.h
WebCore/rendering/RenderForeignObject.cpp
WebCore/rendering/RenderPath.cpp
WebCore/rendering/RenderSVGBlock.h
WebCore/rendering/RenderSVGContainer.cpp
WebCore/rendering/RenderSVGHiddenContainer.cpp
WebCore/rendering/RenderSVGImage.cpp
WebCore/rendering/RenderSVGImage.h
WebCore/rendering/RenderSVGInline.cpp
WebCore/rendering/RenderSVGInline.h
WebCore/rendering/RenderSVGModelObject.cpp
WebCore/rendering/RenderSVGModelObject.h
WebCore/rendering/RenderSVGResource.cpp
WebCore/rendering/RenderSVGResource.h
WebCore/rendering/RenderSVGResourceClipper.cpp
WebCore/rendering/RenderSVGResourceGradient.cpp
WebCore/rendering/RenderSVGResourceMarker.cpp
WebCore/rendering/RenderSVGResourceMasker.cpp
WebCore/rendering/RenderSVGResourcePattern.cpp
WebCore/rendering/RenderSVGResourceSolidColor.cpp
WebCore/rendering/RenderSVGRoot.cpp
WebCore/rendering/RenderSVGRoot.h
WebCore/rendering/RenderSVGText.cpp
WebCore/rendering/RenderSVGViewportContainer.cpp
WebCore/rendering/SVGInlineFlowBox.cpp
WebCore/rendering/SVGRenderSupport.cpp
WebCore/rendering/SVGRenderSupport.h
WebCore/rendering/SVGRenderTreeAsText.cpp
WebCore/rendering/SVGRootInlineBox.cpp
WebCore/rendering/SVGRootInlineBox.h
WebCore/svg/SVGFEImageElement.cpp
WebCore/svg/SVGStyledElement.cpp

index 4cda5e7..35fb1ab 100644 (file)
@@ -1,3 +1,135 @@
+2010-06-29  Nikolas Zimmermann  <nzimmermann@rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        Cleanup SVGRenderSupport
+        https://bugs.webkit.org/show_bug.cgi?id=41347
+
+        Remove SVGRenderBase base class from all SVG renderers. It was meant as temporary solution until all SVG renderers inherit from RenderSVGModelObject,
+        though this is not going to happen. RenderSVGModelObject inherits from RenderObject, making it impossible to inherit eg. RenderSVGImage from it, as
+        it already indirectly inherits from RenderObject, through RenderImage. Other examples are RenderForeignObject (RenderBlock inheritance),
+        RenderSVGInlineText (RenderText inheritance) etc.
+
+        Rename SVGRenderBase to SVGRenderSupport, just like the file is named, remove all free functions, and make them all static functions in SVGRenderSupport.
+        We can still share code between all SVG renderers, but don't need a special base class for all renderers -> shrink size of all SVG renderers.
+
+        Doesn't affect any test.
+
+        * rendering/RenderBox.cpp: Remove localTransform() override, not needed at all.
+        * rendering/RenderBox.h: Ditto.
+        * rendering/RenderForeignObject.cpp: s/SVGRenderBase/SVGRenderSupport/
+        (WebCore::RenderForeignObject::paint):
+        (WebCore::RenderForeignObject::clippedOverflowRectForRepaint):
+        (WebCore::RenderForeignObject::computeRectForRepaint):
+        (WebCore::RenderForeignObject::nodeAtFloatPoint):
+        (WebCore::RenderForeignObject::mapLocalToContainer):
+        * rendering/RenderPath.cpp:
+        (WebCore::BoundingRectStrokeStyleApplier::strokeStyle): applyStrokeStyleToContext is a static function in SVGRenderSupport now.
+        (WebCore::RenderPath::paint): s/SVGRenderBase/SVGRenderSupport/
+        (WebCore::RenderPath::nodeAtFloatPoint): Ditto.
+        (WebCore::RenderPath::updateCachedBoundaries): Ditto.
+        * rendering/RenderSVGBlock.h: Remove SVGRenderBase inheritance.
+        * rendering/RenderSVGContainer.cpp:
+        (WebCore::RenderSVGContainer::layout): layoutChildren is a static function in SVGRenderSupport now.
+        (WebCore::RenderSVGContainer::paint): prepareToRenderSVGContent/finishRenderSVGContent are now static functions in SVGRenderSupport.
+        (WebCore::RenderSVGContainer::objectBoundingBox): computeContainerBoundingBox is a static function in SVGRenderSupport now.
+        (WebCore::RenderSVGContainer::strokeBoundingBox): Ditto.
+        (WebCore::RenderSVGContainer::repaintRectInLocalCoordinates): Remove call to computeContainerBoundingBox, use strokeBoundingBox instead, for consistency.
+        (WebCore::RenderSVGContainer::nodeAtFloatPoint): pointInClippingArea is a static function in SVGRenderSupport now.
+        * rendering/RenderSVGHiddenContainer.cpp:
+        (WebCore::RenderSVGHiddenContainer::layout): layoutChildren is a static function in SVGRenderSupport now.
+        * rendering/RenderSVGImage.cpp:
+        (WebCore::RenderSVGImage::paint): prepareToRenderSVGContent/finishRenderSVGContent are static functions in SVGRenderSupport now.
+        (WebCore::RenderSVGImage::destroy): deregisterResource was renamed to invalidateAllResourcesOfRenderer and is a static function in SVGRenderSupport. 
+        (WebCore::RenderSVGImage::nodeAtFloatPoint): pointInClippingArea is a static function in SVGRenderSupport now.
+        (WebCore::RenderSVGImage::repaintRectInLocalCoordinates): intersectRepaintRectWithResources is a static function in SVGRenderSupport now.
+        (WebCore::RenderSVGImage::clippedOverflowRectForRepaint): s/SVGRenderBase/SVGRenderSupport/
+        (WebCore::RenderSVGImage::computeRectForRepaint): Ditto.
+        (WebCore::RenderSVGImage::mapLocalToContainer): Ditto.
+        * rendering/RenderSVGImage.h: Remove SVGRenderBase inheritance.
+        * rendering/RenderSVGInline.cpp:
+        (WebCore::RenderSVGInline::objectBoundingBox): findTextRootObject is a static function in SVGRenderSupport now.
+        (WebCore::RenderSVGInline::strokeBoundingBox): Ditto.
+        (WebCore::RenderSVGInline::repaintRectInLocalCoordinates): Ditto.
+        (WebCore::RenderSVGInline::clippedOverflowRectForRepaint): s/SVGRenderBase/SVGRenderSupport/
+        (WebCore::RenderSVGInline::computeRectForRepaint): Ditto,.
+        (WebCore::RenderSVGInline::mapLocalToContainer): Ditto.
+        (WebCore::RenderSVGInline::absoluteQuads): findTextRootObject is a static function in SVGRenderSupport now.
+        * rendering/RenderSVGInline.h: Remove SVGRenderBase inheritance.
+        * rendering/RenderSVGModelObject.cpp:
+        (WebCore::RenderSVGModelObject::clippedOverflowRectForRepaint): s/SVGRenderBase/SVGRenderSupport/
+        (WebCore::RenderSVGModelObject::computeRectForRepaint): Ditto.
+        (WebCore::RenderSVGModelObject::mapLocalToContainer): Ditto.
+        (WebCore::RenderSVGModelObject::destroy): deregisterResource was renamed to invalidateAllResourcesOfRenderer and is a static function in SVGRenderSupport.
+        * rendering/RenderSVGModelObject.h: Remove SVGRenderBase inheritance.
+        * rendering/RenderSVGResource.cpp:
+        (WebCore::invalidatePaintingResource): Moved here from SVGRenderSupport (static inline helper function).
+        (WebCore::RenderSVGResource::invalidateAllResourcesOfRenderer): Moved here from SVGRenderSupport and renamed from deregisterFromResources.
+        * rendering/RenderSVGResource.h: Expose invalidateAllResourcesOfRenderer function.
+        * rendering/RenderSVGResourceClipper.cpp:
+        (WebCore::RenderSVGResourceClipper::createClipData): renderSubtreeToImage is a static function in SVGRenderSupport now.
+        (WebCore::RenderSVGResourceClipper::hitTestClipContent): Ditto.
+        * rendering/RenderSVGResourceGradient.cpp:
+        (WebCore::createMaskAndSwapContextForTextGradient): findTextRootObject is a static function in SVGRenderSupport now.
+        (WebCore::clipToTextMask): Ditto.
+        (WebCore::RenderSVGResourceGradient::applyResource): applyStrokeStyleToContext is a static function in SVGRenderSupport now.
+        (WebCore::RenderSVGResourceGradient::postApplyResource): findTextRootObject is a static function in SVGRenderSupport now.
+        * rendering/RenderSVGResourceMarker.cpp:
+        (WebCore::RenderSVGResourceMarker::applyViewportClip): s/SVGRenderBase/SVGRenderSupport/
+        * rendering/RenderSVGResourceMasker.cpp:
+        (WebCore::RenderSVGResourceMasker::createMaskImage): renderSubtreeToImage is a static function in SVGRenderSupport now.
+        * rendering/RenderSVGResourcePattern.cpp:
+        (WebCore::RenderSVGResourcePattern::applyResource): applyStrokeStyleToContext is a static function in SVGRenderSupport now.
+        (WebCore::clampImageBufferSizeToViewport): Moved here from SVGRenderSupport.
+        (WebCore::RenderSVGResourcePattern::createTileImage): renderSubtreeToImage is a static function in SVGRenderSupport now.
+        * rendering/RenderSVGResourceSolidColor.cpp:
+        (WebCore::RenderSVGResourceSolidColor::applyResource): applyStrokeStyleToContext is a static function in SVGRenderSupport now
+        * rendering/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::layout): layoutChildren is a static function in SVGRenderSupport now.
+        (WebCore::RenderSVGRoot::paint): prepareToRenderSVGContent/finishRenderSVGContent are now static functions in SVGRenderSupport.
+        (WebCore::RenderSVGRoot::destroy): deregisterResource was renamed to invalidateAllResourcesOfRenderer and is a static function in SVGRenderSupport.
+        (WebCore::RenderSVGRoot::repaintRectInLocalCoordinates): Remove call to computeContainerBoundingBox, use strokeBoundingBox instead, for consistency.
+        * rendering/RenderSVGRoot.h: Remove localTransform() override, no longer needed. Remove SVGRenderBase inheritance.
+        (WebCore::RenderSVGRoot::objectBoundingBox): Inlined for speeed. 
+        (WebCore::RenderSVGRoot::strokeBoundingBox): computeContainerBoundingBox is a static function in SVGRenderSupport now.
+        * rendering/RenderSVGText.cpp: 
+        (WebCore::RenderSVGText::clippedOverflowRectForRepaint): s/SVGRenderBase/SVGRenderSupport/
+        (WebCore::RenderSVGText::computeRectForRepaint): Ditto.
+        (WebCore::RenderSVGText::mapLocalToContainer): Ditto.
+        (WebCore::RenderSVGText::nodeAtFloatPoint): pointInClippingArea is a static function in SVGRenderSupport now.
+        (WebCore::RenderSVGText::destroy): deregisterResource was renamed to invalidateAllResourcesOfRenderer and is a static function in SVGRenderSupport.
+        (WebCore::RenderSVGText::repaintRectInLocalCoordinates): intersectRepaintRectWithResources is a static function in SVGRenderSupport now.
+        * rendering/RenderSVGViewportContainer.cpp:
+        (WebCore::RenderSVGViewportContainer::applyViewportClip): s/SVGRenderBase/SVGRenderSupport/
+        (WebCore::RenderSVGViewportContainer::pointIsInsideViewportClip): pointInClippingArea is a static function in SVGRenderSupport now.
+        * rendering/SVGInlineFlowBox.cpp:
+        (WebCore::SVGInlineFlowBox::paint): prepareToRenderSVGContent/finishRenderSVGContent are now static functions in SVGRenderSupport.
+        * rendering/SVGRenderSupport.cpp: Make it impossible to construct the class. Remove virtual destructor, made all methods static.
+        (WebCore::SVGRenderSupport::clippedOverflowRectForRepaint): s/SVGRenderBase/SVGRenderSupport/
+        (WebCore::SVGRenderSupport::computeRectForRepaint): Ditto.
+        (WebCore::SVGRenderSupport::mapLocalToContainer): Ditto.
+        (WebCore::SVGRenderSupport::prepareToRenderSVGContent): Ditto.
+        (WebCore::SVGRenderSupport::finishRenderSVGContent): Ditto.
+        (WebCore::SVGRenderSupport::renderSubtreeToImage): Made static.
+        (WebCore::SVGRenderSupport::computeContainerBoundingBox): Ditto.
+        (WebCore::SVGRenderSupport::layoutChildren): Ditto.
+        (WebCore::SVGRenderSupport::isOverflowHidden): s/SVGRenderBase/SVGRenderSupport/
+        (WebCore::SVGRenderSupport::intersectRepaintRectWithResources): Ditto.
+        (WebCore::SVGRenderSupport::pointInClippingArea): Made static.
+        (WebCore::SVGRenderSupport::dashArrayFromRenderingStyle): Ditto.
+        (WebCore::SVGRenderSupport::applyStrokeStyleToContext): Ditto.
+        (WebCore::SVGRenderSupport::findTextRootObject): Ditto.
+        * rendering/SVGRenderSupport.h:
+        * rendering/SVGRenderTreeAsText.cpp:
+        (WebCore::writeStyle): dashArrayFromRenderingStyle is a static function in SVGRenderSupport now.
+        * rendering/SVGRootInlineBox.cpp:
+        (WebCore::SVGRootInlineBox::paint): s/SVGRenderBase/SVGRenderSupport/
+        * rendering/SVGRootInlineBox.h: Remove SVGRenderBase inheritance.
+        * svg/SVGFEImageElement.cpp: Add RenderObject.h include, otherwhise it won't build anymore.
+        (WebCore::SVGFEImageElement::build): renderSubtreeToImage is a static function in SVGRenderSupport now.
+        * svg/SVGStyledElement.cpp: 
+        (WebCore::SVGStyledElement::svgAttributeChanged): deregisterResource was renamed to invalidateAllResourcesOfRenderer and is a static function in SVGRenderSupport.
+
 2010-06-21  Philippe Normand  <pnormand@igalia.com>
 
         Reviewed by Xan Lopez.
index 30ab671..f8d9497 100644 (file)
@@ -2904,13 +2904,4 @@ void RenderBox::clearLayoutOverflow()
     m_overflow->resetLayoutOverflow(borderBoxRect());
 }
 
-#if ENABLE(SVG)
-
-AffineTransform RenderBox::localTransform() const
-{
-    return AffineTransform(1, 0, 0, 1, x(), y());
-}
-
-#endif
-
 } // namespace WebCore
index 3d4c1e6..392a297 100644 (file)
@@ -297,10 +297,6 @@ public:
     bool shrinkToAvoidFloats() const;
     virtual bool avoidsFloats() const;
 
-#if ENABLE(SVG)
-    virtual AffineTransform localTransform() const;
-#endif
-
 protected:
     virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
index 7937f78..4b94bab 100644 (file)
@@ -49,7 +49,7 @@ void RenderForeignObject::paint(PaintInfo& paintInfo, int, int)
     childPaintInfo.context->save();
     childPaintInfo.applyTransform(localTransform());
 
-    if (SVGRenderBase::isOverflowHidden(this))
+    if (SVGRenderSupport::isOverflowHidden(this))
         childPaintInfo.context->clip(m_viewport);
 
     float opacity = style()->opacity();
@@ -66,12 +66,12 @@ void RenderForeignObject::paint(PaintInfo& paintInfo, int, int)
 
 IntRect RenderForeignObject::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer)
 {
-    return SVGRenderBase::clippedOverflowRectForRepaint(this, repaintContainer);
+    return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer);
 }
 
 void RenderForeignObject::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
 {
-    SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed);
+    SVGRenderSupport::computeRectForRepaint(this, repaintContainer, repaintRect, fixed);
 }
 
 const AffineTransform& RenderForeignObject::localToParentTransform() const
@@ -127,7 +127,7 @@ bool RenderForeignObject::nodeAtFloatPoint(const HitTestRequest& request, HitTes
     FloatPoint localPoint = localTransform().inverse().mapPoint(pointInParent);
 
     // Early exit if local point is not contained in clipped viewport area
-    if (SVGRenderBase::isOverflowHidden(this) && !m_viewport.contains(localPoint))
+    if (SVGRenderSupport::isOverflowHidden(this) && !m_viewport.contains(localPoint))
         return false;
 
     IntPoint roundedLocalPoint = roundedIntPoint(localPoint);
@@ -145,7 +145,7 @@ void RenderForeignObject::mapLocalToContainer(RenderBoxModelObject* repaintConta
     // When crawling up the hierachy starting from foreignObject child content, useTransforms may not be set to true.
     if (!useTransforms)
         useTransforms = true;
-    SVGRenderBase::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState);
+    SVGRenderSupport::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState);
 }
 
 }
index 8985a0f..5c3c646 100644 (file)
@@ -57,7 +57,7 @@ public:
 
     void strokeStyle(GraphicsContext* gc)
     {
-        applyStrokeStyleToContext(gc, m_style, m_object);
+        SVGRenderSupport::applyStrokeStyleToContext(gc, m_style, m_object);
     }
 
 private:
@@ -178,7 +178,7 @@ void RenderPath::paint(PaintInfo& paintInfo, int, int)
         if (childPaintInfo.phase == PaintPhaseForeground) {
             PaintInfo savedInfo(childPaintInfo);
 
-            if (prepareToRenderSVGContent(this, childPaintInfo, boundingBox, filter)) {
+            if (SVGRenderSupport::prepareToRenderSVGContent(this, childPaintInfo, boundingBox, filter)) {
                 const SVGRenderStyle* svgStyle = style()->svgStyle();
                 if (svgStyle->shapeRendering() == SR_CRISPEDGES)
                     childPaintInfo.context->setShouldAntialias(false);
@@ -189,7 +189,7 @@ void RenderPath::paint(PaintInfo& paintInfo, int, int)
                     m_markerLayoutInfo.drawMarkers(childPaintInfo);
             }
 
-            finishRenderSVGContent(this, childPaintInfo, filter, savedInfo.context);
+            SVGRenderSupport::finishRenderSVGContent(this, childPaintInfo, filter, savedInfo.context);
         }
 
         if (drawsOutline)
@@ -217,7 +217,7 @@ bool RenderPath::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult&
 
     FloatPoint localPoint = m_localTransform.inverse().mapPoint(pointInParent);
 
-    if (!pointInClippingArea(this, localPoint))
+    if (!SVGRenderSupport::pointInClippingArea(this, localPoint))
         return false;
 
     PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_PATH_HITTESTING, request, style()->pointerEvents());
@@ -317,7 +317,7 @@ void RenderPath::updateCachedBoundaries()
 
     // Cache smallest possible repaint rectangle
     m_repaintBoundingBox = m_strokeAndMarkerBoundingBox;
-    intersectRepaintRectWithResources(this, m_repaintBoundingBox);
+    SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBoundingBox);
 }
 
 }
index af819fd..8dd140b 100644 (file)
@@ -29,8 +29,7 @@ namespace WebCore {
 
 class SVGElement;
 
-class RenderSVGBlock : public RenderBlock
-                     , protected SVGRenderBase {
+class RenderSVGBlock : public RenderBlock {
 public:
     RenderSVGBlock(SVGElement*);
 
index 27635e5..63468a8 100644 (file)
@@ -60,7 +60,7 @@ void RenderSVGContainer::layout()
     LayoutRepainter repainter(*this, checkForRepaintDuringLayout() || selfWillPaint());
     calculateLocalTransform(); // Allow RenderSVGTransformableContainer to update its transform
 
-    layoutChildren(this, selfNeedsLayout());
+    SVGRenderSupport::layoutChildren(this, selfNeedsLayout());
     repainter.repaintAfterLayout();
 
     setNeedsLayout(false);
@@ -100,7 +100,7 @@ void RenderSVGContainer::paint(PaintInfo& paintInfo, int, int)
 
     bool continueRendering = true;
     if (childPaintInfo.phase == PaintPhaseForeground)
-        continueRendering = prepareToRenderSVGContent(this, childPaintInfo, boundingBox, filter);
+        continueRendering = SVGRenderSupport::prepareToRenderSVGContent(this, childPaintInfo, boundingBox, filter);
 
     if (continueRendering) {
         childPaintInfo.updatePaintingRootForChildren(this);
@@ -109,7 +109,7 @@ void RenderSVGContainer::paint(PaintInfo& paintInfo, int, int)
     }
 
     if (paintInfo.phase == PaintPhaseForeground)
-        finishRenderSVGContent(this, childPaintInfo, filter, paintInfo.context);
+        SVGRenderSupport::finishRenderSVGContent(this, childPaintInfo, filter, paintInfo.context);
 
     childPaintInfo.context->restore();
 
@@ -133,20 +133,20 @@ void RenderSVGContainer::addFocusRingRects(Vector<IntRect>& rects, int, int)
 
 FloatRect RenderSVGContainer::objectBoundingBox() const
 {
-    return computeContainerBoundingBox(this, false);
+    return SVGRenderSupport::computeContainerBoundingBox(this, false);
 }
 
 FloatRect RenderSVGContainer::strokeBoundingBox() const
 {
-    return computeContainerBoundingBox(this, true);
+    return SVGRenderSupport::computeContainerBoundingBox(this, true);
 }
 
 // RenderSVGContainer is used for <g> elements which do not themselves have a
 // width or height, so we union all of our child rects as our repaint rect.
 FloatRect RenderSVGContainer::repaintRectInLocalCoordinates() const
 {
-    FloatRect repaintRect = computeContainerBoundingBox(this, true);
-    intersectRepaintRectWithResources(this, repaintRect);
+    FloatRect repaintRect = strokeBoundingBox();
+    SVGRenderSupport::intersectRepaintRectWithResources(this, repaintRect);
 
     return repaintRect;
 }
@@ -159,7 +159,7 @@ bool RenderSVGContainer::nodeAtFloatPoint(const HitTestRequest& request, HitTest
 
     FloatPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent);
 
-    if (!pointInClippingArea(this, localPoint))
+    if (!SVGRenderSupport::pointInClippingArea(this, localPoint))
         return false;
                 
     for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
index 5d6bd25..0af4236 100644 (file)
@@ -38,7 +38,7 @@ RenderSVGHiddenContainer::RenderSVGHiddenContainer(SVGStyledElement* element)
 void RenderSVGHiddenContainer::layout()
 {
     ASSERT(needsLayout());
-    layoutChildren(this, selfNeedsLayout()); 
+    SVGRenderSupport::layoutChildren(this, selfNeedsLayout()); 
     setNeedsLayout(false);    
 }
 
index 45898c7..3c5e002 100644 (file)
@@ -87,7 +87,7 @@ void RenderSVGImage::paint(PaintInfo& paintInfo, int, int)
 
         PaintInfo savedInfo(paintInfo);
 
-        if (prepareToRenderSVGContent(this, paintInfo, m_localBounds, filter)) {
+        if (SVGRenderSupport::prepareToRenderSVGContent(this, paintInfo, m_localBounds, filter)) {
             FloatRect destRect = m_localBounds;
             FloatRect srcRect(0, 0, image()->width(), image()->height());
 
@@ -97,7 +97,7 @@ void RenderSVGImage::paint(PaintInfo& paintInfo, int, int)
 
             paintInfo.context->drawImage(image(), DeviceColorSpace, destRect, srcRect);
         }
-        finishRenderSVGContent(this, paintInfo, filter, savedInfo.context);
+        SVGRenderSupport::finishRenderSVGContent(this, paintInfo, filter, savedInfo.context);
     }
 
     if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth())
@@ -108,7 +108,7 @@ void RenderSVGImage::paint(PaintInfo& paintInfo, int, int)
 
 void RenderSVGImage::destroy()
 {
-    deregisterFromResources(this);
+    RenderSVGResource::invalidateAllResourcesOfRenderer(this);
     RenderImage::destroy();
 }
 
@@ -123,7 +123,7 @@ bool RenderSVGImage::nodeAtFloatPoint(const HitTestRequest& request, HitTestResu
     if (isVisible || !hitRules.requireVisible) {
         FloatPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent);
             
-        if (!pointInClippingArea(this, localPoint))
+        if (!SVGRenderSupport::pointInClippingArea(this, localPoint))
             return false;
 
         if (hitRules.canHitFill) {
@@ -150,7 +150,7 @@ FloatRect RenderSVGImage::repaintRectInLocalCoordinates() const
         return m_cachedLocalRepaintRect;
 
     m_cachedLocalRepaintRect = m_localBounds;
-    intersectRepaintRectWithResources(this, m_cachedLocalRepaintRect);
+    SVGRenderSupport::intersectRepaintRectWithResources(this, m_cachedLocalRepaintRect);
 
     return m_cachedLocalRepaintRect;
 }
@@ -169,17 +169,17 @@ void RenderSVGImage::imageChanged(WrappedImagePtr image, const IntRect* rect)
 
 IntRect RenderSVGImage::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer)
 {
-    return SVGRenderBase::clippedOverflowRectForRepaint(this, repaintContainer);
+    return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer);
 }
 
 void RenderSVGImage::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
 {
-    SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed);
+    SVGRenderSupport::computeRectForRepaint(this, repaintContainer, repaintRect, fixed);
 }
 
 void RenderSVGImage::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed , bool useTransforms, TransformState& transformState) const
 {
-    SVGRenderBase::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState);
+    SVGRenderSupport::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState);
 }
 
 void RenderSVGImage::addFocusRingRects(Vector<IntRect>& rects, int, int)
index 37d2aee..3baac23 100644 (file)
@@ -34,8 +34,7 @@ namespace WebCore {
 
 class SVGImageElement;
 
-class RenderSVGImage : public RenderImage
-                     , protected SVGRenderBase {
+class RenderSVGImage : public RenderImage {
 public:
     RenderSVGImage(SVGImageElement*);
 
index ca0fdb5..ffc6b62 100644 (file)
@@ -44,7 +44,7 @@ InlineFlowBox* RenderSVGInline::createInlineFlowBox()
 
 FloatRect RenderSVGInline::objectBoundingBox() const
 {
-    if (const RenderObject* object = findTextRootObject(this))
+    if (const RenderObject* object = SVGRenderSupport::findTextRootObject(this))
         return object->objectBoundingBox();
 
     return FloatRect();
@@ -52,7 +52,7 @@ FloatRect RenderSVGInline::objectBoundingBox() const
 
 FloatRect RenderSVGInline::strokeBoundingBox() const
 {
-    if (const RenderObject* object = findTextRootObject(this))
+    if (const RenderObject* object = SVGRenderSupport::findTextRootObject(this))
         return object->strokeBoundingBox();
 
     return FloatRect();
@@ -60,7 +60,7 @@ FloatRect RenderSVGInline::strokeBoundingBox() const
 
 FloatRect RenderSVGInline::repaintRectInLocalCoordinates() const
 {
-    if (const RenderObject* object = findTextRootObject(this))
+    if (const RenderObject* object = SVGRenderSupport::findTextRootObject(this))
         return object->repaintRectInLocalCoordinates();
 
     return FloatRect();
@@ -68,22 +68,22 @@ FloatRect RenderSVGInline::repaintRectInLocalCoordinates() const
 
 IntRect RenderSVGInline::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer)
 {
-    return SVGRenderBase::clippedOverflowRectForRepaint(this, repaintContainer);
+    return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer);
 }
 
 void RenderSVGInline::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
 {
-    SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed);
+    SVGRenderSupport::computeRectForRepaint(this, repaintContainer, repaintRect, fixed);
 }
 
 void RenderSVGInline::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState& transformState) const
 {
-    SVGRenderBase::mapLocalToContainer(this, repaintContainer, useTransforms, fixed, transformState);
+    SVGRenderSupport::mapLocalToContainer(this, repaintContainer, useTransforms, fixed, transformState);
 }
 
 void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads)
 {
-    const RenderObject* object = findTextRootObject(this);
+    const RenderObject* object = SVGRenderSupport::findTextRootObject(this);
     if (!object)
         return;
 
index 2efb1aa..6f44162 100644 (file)
@@ -31,8 +31,7 @@
 
 namespace WebCore {
 
-class RenderSVGInline : public RenderInline
-                      , protected SVGRenderBase {
+class RenderSVGInline : public RenderInline {
 public:
     RenderSVGInline(Node*);
 
index a80a963..3d22e7a 100644 (file)
@@ -33,9 +33,7 @@
 #if ENABLE(SVG)
 #include "RenderSVGModelObject.h"
 
-#include "GraphicsContext.h"
-#include "RenderLayer.h"
-#include "RenderView.h"
+#include "RenderSVGResource.h"
 #include "SVGStyledElement.h"
 
 namespace WebCore {
@@ -47,21 +45,21 @@ RenderSVGModelObject::RenderSVGModelObject(SVGStyledElement* node)
 
 IntRect RenderSVGModelObject::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer)
 {
-    return SVGRenderBase::clippedOverflowRectForRepaint(this, repaintContainer);
+    return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer);
 }
 
 void RenderSVGModelObject::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
 {
-    SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed);
+    SVGRenderSupport::computeRectForRepaint(this, repaintContainer, repaintRect, fixed);
 }
 
 void RenderSVGModelObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed , bool useTransforms, TransformState& transformState) const
 {
-    SVGRenderBase::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState);
+    SVGRenderSupport::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState);
 }
 
 // Copied from RenderBox, this method likely requires further refactoring to work easily for both SVG and CSS Box Model content.
-// FIXME: This may also need to move into SVGRenderBase as the RenderBox version depends
+// FIXME: This may also need to move into SVGRenderSupport as the RenderBox version depends
 // on borderBoundingBox() which SVG RenderBox subclases (like SVGRenderBlock) do not implement.
 IntRect RenderSVGModelObject::outlineBoundsForRepaint(RenderBoxModelObject* repaintContainer, IntPoint*) const
 {
@@ -85,7 +83,7 @@ void RenderSVGModelObject::absoluteQuads(Vector<FloatQuad>& quads)
 
 void RenderSVGModelObject::destroy()
 {
-    deregisterFromResources(this);
+    RenderSVGResource::invalidateAllResourcesOfRenderer(this);
     RenderObject::destroy();
 }
 
index 42ca27f..82c08c0 100644 (file)
@@ -41,11 +41,11 @@ namespace WebCore {
 // Most renderers in the SVG rendering tree will inherit from this class
 // but not all. (e.g. RenderSVGForeignObject, RenderSVGBlock, RenderSVGImage) thus methods
 // required by SVG renders need to be declared on RenderObject, but shared
-// logic can go in this class or in SVGRenderBase.
+// logic can go in this class or in SVGRenderSupport.
 
 class SVGStyledElement;
 
-class RenderSVGModelObject : public RenderObject, protected SVGRenderBase {
+class RenderSVGModelObject : public RenderObject {
 public:
     RenderSVGModelObject(SVGStyledElement*);
 
index 129d800..0aa7182 100644 (file)
 #if ENABLE(SVG)
 #include "RenderSVGResource.h"
 
+#include "RenderSVGResourceClipper.h"
 #include "RenderSVGResourceContainer.h"
+#include "RenderSVGResourceFilter.h"
+#include "RenderSVGResourceMarker.h"
+#include "RenderSVGResourceMasker.h"
 #include "RenderSVGResourceSolidColor.h"
 #include "SVGURIReference.h"
 
@@ -197,6 +201,59 @@ void RenderSVGResource::markForLayoutAndResourceInvalidation(RenderObject* objec
     static_cast<SVGStyledElement*>(element)->invalidateResourcesInAncestorChain();
 }
 
+static inline void invalidatePaintingResource(SVGPaint* paint, RenderObject* object)
+{
+    ASSERT(paint);
+
+    SVGPaint::SVGPaintType paintType = paint->paintType();
+    if (paintType != SVGPaint::SVG_PAINTTYPE_URI && paintType != SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR)
+        return;
+
+    AtomicString id(SVGURIReference::getTarget(paint->uri()));
+    if (RenderSVGResourceContainer* paintingResource = getRenderSVGResourceContainerById(object->document(), id))
+        paintingResource->invalidateClient(object);
+}
+
+void RenderSVGResource::invalidateAllResourcesOfRenderer(RenderObject* object)
+{
+    ASSERT(object);
+    ASSERT(object->style());
+
+    Document* document = object->document();
+    ASSERT(document);
+
+    const SVGRenderStyle* svgStyle = object->style()->svgStyle();
+    ASSERT(svgStyle);
+
+    // Masker
+    if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(document, svgStyle->maskerResource()))
+        masker->invalidateClient(object);
+
+    // Clipper
+    if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(document, svgStyle->clipperResource()))
+        clipper->invalidateClient(object);
+
+    // Filter
+#if ENABLE(FILTERS)
+    if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document, svgStyle->filterResource()))
+        filter->invalidateClient(object);
+#endif
+
+    // Markers
+    if (RenderSVGResourceMarker* startMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerStartResource()))
+        startMarker->invalidateClient(object);
+    if (RenderSVGResourceMarker* midMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerMidResource()))
+        midMarker->invalidateClient(object);
+    if (RenderSVGResourceMarker* endMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerEndResource()))
+        endMarker->invalidateClient(object);
+
+    // Gradients/Patterns
+    if (svgStyle->hasFill())
+        invalidatePaintingResource(svgStyle->fillPaint(), object);
+    if (svgStyle->hasStroke())
+        invalidatePaintingResource(svgStyle->strokePaint(), object);
+}
+
 }
 
 #endif
index a14a972..34ff14e 100644 (file)
@@ -79,6 +79,8 @@ public:
     static RenderSVGResource* strokePaintingResource(const RenderObject*, const RenderStyle*);
     static RenderSVGResourceSolidColor* sharedSolidPaintingResource();
 
+    static void invalidateAllResourcesOfRenderer(RenderObject*);
+
 private:
     static void adjustColorForPseudoRules(const RenderStyle*, bool useFillPaint, Color&);
     
index 450c5d6..cc499bf 100644 (file)
@@ -242,7 +242,7 @@ bool RenderSVGResourceClipper::createClipData(ClipperData* clipperData, const Fl
         // In the case of a <use> element, we obtained its renderere above, to retrieve its clipRule.
         // We hsve to pass the <use> renderer itself to renderSubtreeToImage() to apply it's x/y/transform/etc. values when rendering.
         // So if isUseElement is true, refetch the childNode->renderer(), as renderer got overriden above.
-        renderSubtreeToImage(clipperData->clipMaskImage.get(), isUseElement ? childNode->renderer() : renderer);
+        SVGRenderSupport::renderSubtreeToImage(clipperData->clipMaskImage.get(), isUseElement ? childNode->renderer() : renderer);
 
         renderer->setStyle(oldRenderStyle.release());
     }
@@ -271,7 +271,7 @@ void RenderSVGResourceClipper::calculateClipContentRepaintRect()
 bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundingBox, const FloatPoint& nodeAtPoint)
 {
     FloatPoint point = nodeAtPoint;
-    if (!pointInClippingArea(this, point))
+    if (!SVGRenderSupport::pointInClippingArea(this, point))
         return false;
 
     if (static_cast<SVGClipPathElement*>(node())->clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
index e715f6f..7ea70d2 100644 (file)
@@ -91,7 +91,7 @@ static inline bool createMaskAndSwapContextForTextGradient(GraphicsContext*& con
                                                            OwnPtr<ImageBuffer>& imageBuffer,
                                                            const RenderObject* object)
 {
-    const RenderObject* textRootBlock = findTextRootObject(object);
+    const RenderObject* textRootBlock = SVGRenderSupport::findTextRootObject(object);
 
     AffineTransform transform = absoluteTransformForRenderer(textRootBlock);
     FloatRect maskAbsoluteBoundingBox = transform.mapRect(textRootBlock->repaintRectInLocalCoordinates());
@@ -123,7 +123,7 @@ static inline AffineTransform clipToTextMask(GraphicsContext* context,
                                              const RenderObject* object,
                                              GradientData* gradientData)
 {
-    const RenderObject* textRootBlock = findTextRootObject(object);
+    const RenderObject* textRootBlock = SVGRenderSupport::findTextRootObject(object);
     context->clipToImageBuffer(textRootBlock->repaintRectInLocalCoordinates(), imageBuffer.get());
 
     AffineTransform matrix;
@@ -211,7 +211,7 @@ bool RenderSVGResourceGradient::applyResource(RenderObject* object, RenderStyle*
             gradientData->gradient->setGradientSpaceTransform(transformOnNonScalingStroke(object, gradientData->userspaceTransform));
         context->setAlpha(svgStyle->strokeOpacity());
         context->setStrokeGradient(gradientData->gradient);
-        applyStrokeStyleToContext(context, style, object);
+        SVGRenderSupport::applyStrokeStyleToContext(context, style, object);
     }
 
     return true;
@@ -235,7 +235,7 @@ void RenderSVGResourceGradient::postApplyResource(RenderObject* object, Graphics
             gradientData->gradient->setGradientSpaceTransform(clipToTextMask(context, m_imageBuffer, object, gradientData));
             context->setFillGradient(gradientData->gradient);
 
-            const RenderObject* textRootBlock = findTextRootObject(object);
+            const RenderObject* textRootBlock = SVGRenderSupport::findTextRootObject(object);
             context->fillRect(textRootBlock->repaintRectInLocalCoordinates());
 
             m_imageBuffer.clear();
index 9e45d19..ce331a7 100644 (file)
@@ -88,7 +88,7 @@ void RenderSVGResourceMarker::invalidateClient(RenderObject* object)
 
 void RenderSVGResourceMarker::applyViewportClip(PaintInfo& paintInfo)
 {
-    if (SVGRenderBase::isOverflowHidden(this))
+    if (SVGRenderSupport::isOverflowHidden(this))
         paintInfo.context->clip(m_viewport);
 }
 
index ea79439..74d3fe6 100644 (file)
@@ -173,7 +173,7 @@ void RenderSVGResourceMasker::createMaskImage(MaskerData* maskerData, const SVGM
         RenderStyle* style = renderer->style();
         if (!style || style->display() == NONE || style->visibility() != VISIBLE)
             continue;
-        renderSubtreeToImage(maskerData->maskImage.get(), renderer);
+        SVGRenderSupport::renderSubtreeToImage(maskerData->maskImage.get(), renderer);
     }
 
     maskImageContext->restore();
index 040b2e2..ba24fcf 100644 (file)
@@ -24,6 +24,7 @@
 #if ENABLE(SVG)
 #include "RenderSVGResourcePattern.h"
 
+#include "FrameView.h"
 #include "GraphicsContext.h"
 #include "PatternAttributes.h"
 #include "SVGRenderSupport.h"
@@ -120,7 +121,7 @@ bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle*
             patternData->pattern->setPatternSpaceTransform(transformOnNonScalingStroke(object, patternData->transform));
         context->setAlpha(svgStyle->strokeOpacity());
         context->setStrokePattern(patternData->pattern);
-        applyStrokeStyleToContext(context, style, object);
+        SVGRenderSupport::applyStrokeStyleToContext(context, style, object);
     }
 
     if (resourceMode & ApplyToTextMode) {
@@ -208,6 +209,22 @@ FloatRect RenderSVGResourcePattern::calculatePatternBoundariesIncludingOverflow(
     return patternBoundariesIncludingOverflow;
 }
 
+// FIXME: This method should be removed. RenderSVGResourcePatterns usage of it is just wrong.
+static inline void clampImageBufferSizeToViewport(FrameView* frameView, IntSize& size)
+{
+    if (!frameView)
+        return;
+
+    int viewWidth = frameView->visibleWidth();
+    int viewHeight = frameView->visibleHeight();
+
+    if (size.width() > viewWidth)
+        size.setWidth(viewWidth);
+
+    if (size.height() > viewHeight)
+        size.setHeight(viewHeight);
+}
+
 PassOwnPtr<ImageBuffer> RenderSVGResourcePattern::createTileImage(PatternData* patternData,
                                                                   const SVGPatternElement* patternElement,
                                                                   RenderObject* object) const
@@ -268,7 +285,7 @@ PassOwnPtr<ImageBuffer> RenderSVGResourcePattern::createTileImage(PatternData* p
     for (Node* node = attributes.patternContentElement()->firstChild(); node; node = node->nextSibling()) {
         if (!node->isSVGElement() || !static_cast<SVGElement*>(node)->isStyled() || !node->renderer())
             continue;
-        renderSubtreeToImage(tileImage.get(), node->renderer());
+        SVGRenderSupport::renderSubtreeToImage(tileImage.get(), node->renderer());
     }
 
     patternData->boundaries = patternBoundaries;
index 9d34d79..fb07c21 100644 (file)
@@ -24,6 +24,7 @@
 #include "RenderSVGResourceSolidColor.h"
 
 #include "GraphicsContext.h"
+#include "RenderStyle.h"
 #include "SVGRenderSupport.h"
 
 #if PLATFORM(SKIA)
@@ -65,7 +66,7 @@ bool RenderSVGResourceSolidColor::applyResource(RenderObject* object, RenderStyl
         context->setStrokeColor(m_color, colorSpace);
 
         if (style)
-            applyStrokeStyleToContext(context, style, object);
+            SVGRenderSupport::applyStrokeStyleToContext(context, style, object);
 
         if (resourceMode & ApplyToTextMode)
             context->setTextDrawingMode(cTextStroke);
index d1c023a..1ec5b59 100644 (file)
@@ -118,7 +118,7 @@ void RenderSVGRoot::layout()
     // RenderSVGRoot needs to take special care to propagate window size changes to the children,
     // if the outermost <svg> is using relative x/y/width/height values. Hence the additonal parameters.
     SVGSVGElement* svg = static_cast<SVGSVGElement*>(node());
-    layoutChildren(this, needsLayout || (svg->hasRelativeValues() && oldSize != size()));
+    SVGRenderSupport::layoutChildren(this, needsLayout || (svg->hasRelativeValues() && oldSize != size()));
     repainter.repaintAfterLayout();
 
     view()->enableLayoutState();
@@ -175,13 +175,13 @@ void RenderSVGRoot::paint(PaintInfo& paintInfo, int parentX, int parentY)
 
     bool continueRendering = true;
     if (childPaintInfo.phase == PaintPhaseForeground)
-        continueRendering = prepareToRenderSVGContent(this, childPaintInfo, boundingBox, filter);
+        continueRendering = SVGRenderSupport::prepareToRenderSVGContent(this, childPaintInfo, boundingBox, filter);
 
     if (continueRendering)
         RenderBox::paint(childPaintInfo, 0, 0);
 
     if (childPaintInfo.phase == PaintPhaseForeground)
-        finishRenderSVGContent(this, childPaintInfo, filter, paintInfo.context);
+        SVGRenderSupport::finishRenderSVGContent(this, childPaintInfo, filter, paintInfo.context);
 
     childPaintInfo.context->restore();
 
@@ -191,7 +191,7 @@ void RenderSVGRoot::paint(PaintInfo& paintInfo, int parentX, int parentY)
 
 void RenderSVGRoot::destroy()
 {
-    deregisterFromResources(this);
+    RenderSVGResource::invalidateAllResourcesOfRenderer(this);
     RenderBox::destroy();
 }
 
@@ -257,24 +257,14 @@ const AffineTransform& RenderSVGRoot::localToParentTransform() const
     return m_localToParentTransform;
 }
 
-FloatRect RenderSVGRoot::objectBoundingBox() const
-{
-    return computeContainerBoundingBox(this, false);
-}
-
 FloatRect RenderSVGRoot::repaintRectInLocalCoordinates() const
 {
     // FIXME: This does not include the border but it should!
-    FloatRect repaintRect = computeContainerBoundingBox(this, true);
+    FloatRect repaintRect = strokeBoundingBox();
     style()->svgStyle()->inflateForShadow(repaintRect);
     return repaintRect;
 }
 
-AffineTransform RenderSVGRoot::localTransform() const
-{
-    return AffineTransform();
-}
-
 void RenderSVGRoot::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
 {
     // Apply our local transforms (except for x/y translation), then our shadow, 
index 53c1298..8264eaf 100644 (file)
@@ -33,7 +33,7 @@ namespace WebCore {
 class SVGStyledElement;
 class AffineTransform;
 
-class RenderSVGRoot : public RenderBox, protected SVGRenderBase {
+class RenderSVGRoot : public RenderBox {
 public:
     RenderSVGRoot(SVGStyledElement*);
 
@@ -62,13 +62,10 @@ private:
     bool fillContains(const FloatPoint&) const;
     bool strokeContains(const FloatPoint&) const;
 
-    virtual FloatRect objectBoundingBox() const;
-    virtual FloatRect strokeBoundingBox() const { return computeContainerBoundingBox(this, true); }
+    virtual FloatRect objectBoundingBox() const { return SVGRenderSupport::computeContainerBoundingBox(this, false); }
+    virtual FloatRect strokeBoundingBox() const { return SVGRenderSupport::computeContainerBoundingBox(this, true); }
     virtual FloatRect repaintRectInLocalCoordinates() const;
 
-    // FIXME: This override should be removed.
-    virtual AffineTransform localTransform() const;
-
     virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
 
     virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed);
@@ -108,5 +105,3 @@ void toRenderSVGRoot(const RenderSVGRoot*);
 
 #endif // ENABLE(SVG)
 #endif // RenderSVGRoot_h
-
-// vim:ts=4:noet
index f0f6a9e..12f3cb5 100644 (file)
@@ -36,6 +36,7 @@
 #include "HitTestRequest.h"
 #include "PointerEventsHitRules.h"
 #include "RenderLayer.h"
+#include "RenderSVGResource.h"
 #include "RenderSVGRoot.h"
 #include "SVGLengthList.h"
 #include "SVGRenderSupport.h"
@@ -56,17 +57,17 @@ RenderSVGText::RenderSVGText(SVGTextElement* node)
 
 IntRect RenderSVGText::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer)
 {
-    return SVGRenderBase::clippedOverflowRectForRepaint(this, repaintContainer);
+    return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer);
 }
 
 void RenderSVGText::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
 {
-    SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed);
+    SVGRenderSupport::computeRectForRepaint(this, repaintContainer, repaintRect, fixed);
 }
 
 void RenderSVGText::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState) const
 {
-    SVGRenderBase::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState);
+    SVGRenderSupport::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState);
 }
 
 void RenderSVGText::layout()
@@ -117,7 +118,7 @@ bool RenderSVGText::nodeAtFloatPoint(const HitTestRequest& request, HitTestResul
             || (hitRules.canHitFill && (style()->svgStyle()->hasFill() || !hitRules.requireFill))) {
             FloatPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent);
 
-            if (!pointInClippingArea(this, localPoint))
+            if (!SVGRenderSupport::pointInClippingArea(this, localPoint))
                 return false;       
 
             return RenderBlock::nodeAtPoint(request, result, (int)localPoint.x(), (int)localPoint.y(), 0, 0, hitTestAction);
@@ -129,7 +130,7 @@ bool RenderSVGText::nodeAtFloatPoint(const HitTestRequest& request, HitTestResul
 
 void RenderSVGText::destroy()
 {
-    deregisterFromResources(this);
+    RenderSVGResource::invalidateAllResourcesOfRenderer(this);
     RenderSVGBlock::destroy();
 }
 
@@ -174,7 +175,7 @@ FloatRect RenderSVGText::strokeBoundingBox() const
 FloatRect RenderSVGText::repaintRectInLocalCoordinates() const
 {
     FloatRect repaintRect = strokeBoundingBox();
-    intersectRepaintRectWithResources(this, repaintRect);
+    SVGRenderSupport::intersectRepaintRectWithResources(this, repaintRect);
 
     return repaintRect;
 }
index 1587e7f..26aa92f 100644 (file)
@@ -39,7 +39,7 @@ RenderSVGViewportContainer::RenderSVGViewportContainer(SVGStyledElement* node)
 
 void RenderSVGViewportContainer::applyViewportClip(PaintInfo& paintInfo)
 {
-    if (SVGRenderBase::isOverflowHidden(this))
+    if (SVGRenderSupport::isOverflowHidden(this))
         paintInfo.context->clip(m_viewport);
 }
 
@@ -82,7 +82,7 @@ const AffineTransform& RenderSVGViewportContainer::localToParentTransform() cons
 bool RenderSVGViewportContainer::pointIsInsideViewportClip(const FloatPoint& pointInParent)
 {
     // Respect the viewport clip (which is in parent coords)
-    if (!SVGRenderBase::isOverflowHidden(this))
+    if (!SVGRenderSupport::isOverflowHidden(this))
         return true;
     
     return m_viewport.contains(pointInParent);
index d20efb8..4896bf7 100644 (file)
@@ -44,12 +44,12 @@ void SVGInlineFlowBox::paint(PaintInfo& paintInfo, int, int)
     RenderSVGResourceFilter* filter = 0;
     FloatRect repaintRect = boxRenderer->repaintRectInLocalCoordinates();
 
-    if (SVGRenderBase::prepareToRenderSVGContent(boxRenderer, childPaintInfo, repaintRect, filter)) {
+    if (SVGRenderSupport::prepareToRenderSVGContent(boxRenderer, childPaintInfo, repaintRect, filter)) {
         for (InlineBox* child = firstChild(); child; child = child->nextOnLine())
             child->paint(childPaintInfo, 0, 0);
     }
 
-    SVGRenderBase::finishRenderSVGContent(boxRenderer, childPaintInfo, filter, paintInfo.context);
+    SVGRenderSupport::finishRenderSVGContent(boxRenderer, childPaintInfo, filter, paintInfo.context);
     childPaintInfo.context->restore();
 }
 
index 849e0e5..0893a0b 100644 (file)
 #if ENABLE(SVG)
 #include "SVGRenderSupport.h"
 
-#include "AffineTransform.h"
-#include "Document.h"
+#include "FrameView.h"
 #include "ImageBuffer.h"
 #include "NodeRenderStyle.h"
 #include "RenderLayer.h"
-#include "RenderObject.h"
 #include "RenderSVGContainer.h"
 #include "RenderSVGResource.h"
 #include "RenderSVGResourceClipper.h"
 #include "RenderSVGResourceFilter.h"
 #include "RenderSVGResourceMarker.h"
 #include "RenderSVGResourceMasker.h"
-#include "RenderView.h"
 #include "SVGStyledElement.h"
-#include "SVGURIReference.h"
 #include "TransformState.h"
 #include <wtf/UnusedParam.h>
 
 namespace WebCore {
 
-SVGRenderBase::~SVGRenderBase()
-{
-}
-
-IntRect SVGRenderBase::clippedOverflowRectForRepaint(RenderObject* object, RenderBoxModelObject* repaintContainer)
+IntRect SVGRenderSupport::clippedOverflowRectForRepaint(RenderObject* object, RenderBoxModelObject* repaintContainer)
 {
     // Return early for any cases where we don't actually paint
     if (object->style()->visibility() != VISIBLE && !object->enclosingLayer()->hasVisibleContent())
@@ -65,7 +57,7 @@ IntRect SVGRenderBase::clippedOverflowRectForRepaint(RenderObject* object, Rende
     return repaintRect;
 }
 
-void SVGRenderBase::computeRectForRepaint(RenderObject* object, RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
+void SVGRenderSupport::computeRectForRepaint(RenderObject* object, RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
 {
     object->style()->svgStyle()->inflateForShadow(repaintRect);
 
@@ -74,7 +66,7 @@ void SVGRenderBase::computeRectForRepaint(RenderObject* object, RenderBoxModelOb
     object->parent()->computeRectForRepaint(repaintContainer, repaintRect, fixed);
 }
 
-void SVGRenderBase::mapLocalToContainer(const RenderObject* object, RenderBoxModelObject* repaintContainer, bool fixed , bool useTransforms, TransformState& transformState)
+void SVGRenderSupport::mapLocalToContainer(const RenderObject* object, RenderBoxModelObject* repaintContainer, bool fixed , bool useTransforms, TransformState& transformState)
 {
     ASSERT(!fixed); // We should have no fixed content in the SVG rendering tree.
     ASSERT(useTransforms); // Mapping a point through SVG w/o respecting transforms is useless.
@@ -82,7 +74,7 @@ void SVGRenderBase::mapLocalToContainer(const RenderObject* object, RenderBoxMod
     object->parent()->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState);
 }
 
-bool SVGRenderBase::prepareToRenderSVGContent(RenderObject* object, PaintInfo& paintInfo, const FloatRect& repaintRect, RenderSVGResourceFilter*& filter)
+bool SVGRenderSupport::prepareToRenderSVGContent(RenderObject* object, PaintInfo& paintInfo, const FloatRect& repaintRect, RenderSVGResourceFilter*& filter)
 {
 #if !ENABLE(FILTERS)
     UNUSED_PARAM(filter);
@@ -146,7 +138,7 @@ bool SVGRenderBase::prepareToRenderSVGContent(RenderObject* object, PaintInfo& p
     return true;
 }
 
-void SVGRenderBase::finishRenderSVGContent(RenderObject* object, PaintInfo& paintInfo, RenderSVGResourceFilter*& filter, GraphicsContext* savedContext)
+void SVGRenderSupport::finishRenderSVGContent(RenderObject* object, PaintInfo& paintInfo, RenderSVGResourceFilter*& filter, GraphicsContext* savedContext)
 {
 #if !ENABLE(FILTERS)
     UNUSED_PARAM(filter);
@@ -175,7 +167,7 @@ void SVGRenderBase::finishRenderSVGContent(RenderObject* object, PaintInfo& pain
         paintInfo.context->endTransparencyLayer();
 }
 
-void renderSubtreeToImage(ImageBuffer* image, RenderObject* item)
+void SVGRenderSupport::renderSubtreeToImage(ImageBuffer* image, RenderObject* item)
 {
     ASSERT(item);
     ASSERT(image);
@@ -206,22 +198,7 @@ void renderSubtreeToImage(ImageBuffer* image, RenderObject* item)
         svgContainer->setDrawsContents(false);
 }
 
-void clampImageBufferSizeToViewport(FrameView* frameView, IntSize& size)
-{
-    if (!frameView)
-        return;
-
-    int viewWidth = frameView->visibleWidth();
-    int viewHeight = frameView->visibleHeight();
-
-    if (size.width() > viewWidth)
-        size.setWidth(viewWidth);
-
-    if (size.height() > viewHeight)
-        size.setHeight(viewHeight);
-}
-
-FloatRect SVGRenderBase::computeContainerBoundingBox(const RenderObject* container, bool includeAllPaintedContent)
+FloatRect SVGRenderSupport::computeContainerBoundingBox(const RenderObject* container, bool includeAllPaintedContent)
 {
     FloatRect boundingBox;
 
@@ -235,7 +212,7 @@ FloatRect SVGRenderBase::computeContainerBoundingBox(const RenderObject* contain
     return boundingBox;
 }
 
-void SVGRenderBase::layoutChildren(RenderObject* start, bool selfNeedsLayout)
+void SVGRenderSupport::layoutChildren(RenderObject* start, bool selfNeedsLayout)
 {
     for (RenderObject* child = start->firstChild(); child; child = child->nextSibling()) {
         // Only force our kids to layout if we're being asked to relayout as a result of a parent changing
@@ -258,7 +235,7 @@ void SVGRenderBase::layoutChildren(RenderObject* start, bool selfNeedsLayout)
     }
 }
 
-bool SVGRenderBase::isOverflowHidden(const RenderObject* object)
+bool SVGRenderSupport::isOverflowHidden(const RenderObject* object)
 {
     // SVG doesn't support independent x/y overflow
     ASSERT(object->style()->overflowX() == object->style()->overflowY());
@@ -272,7 +249,7 @@ bool SVGRenderBase::isOverflowHidden(const RenderObject* object)
     return object->style()->overflowX() == OHIDDEN;
 }
 
-void SVGRenderBase::intersectRepaintRectWithResources(const RenderObject* object, FloatRect& repaintRect) const
+void SVGRenderSupport::intersectRepaintRectWithResources(const RenderObject* object, FloatRect& repaintRect)
 {
     ASSERT(object);
     ASSERT(object->style());
@@ -301,20 +278,7 @@ void SVGRenderBase::intersectRepaintRectWithResources(const RenderObject* object
     svgStyle->inflateForShadow(repaintRect);
 }
 
-static inline void invalidatePaintingResource(SVGPaint* paint, RenderObject* object)
-{
-    ASSERT(paint);
-
-    SVGPaint::SVGPaintType paintType = paint->paintType();
-    if (paintType != SVGPaint::SVG_PAINTTYPE_URI && paintType != SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR)
-        return;
-
-    AtomicString id(SVGURIReference::getTarget(paint->uri()));
-    if (RenderSVGResourceContainer* paintingResource = getRenderSVGResourceContainerById(object->document(), id))
-        paintingResource->invalidateClient(object);
-}
-
-bool pointInClippingArea(const RenderObject* object, const FloatPoint& point)
+bool SVGRenderSupport::pointInClippingArea(const RenderObject* object, const FloatPoint& point)
 {
     ASSERT(object);
     ASSERT(object->style());
@@ -335,67 +299,28 @@ bool pointInClippingArea(const RenderObject* object, const FloatPoint& point)
     return true;
 }
 
-void deregisterFromResources(RenderObject* object)
-{
-    ASSERT(object);
-    ASSERT(object->style());
-
-    Document* document = object->document();
-    ASSERT(document);
-
-    const SVGRenderStyle* svgStyle = object->style()->svgStyle();
-    ASSERT(svgStyle);
-
-    // Masker
-    if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(document, svgStyle->maskerResource()))
-        masker->invalidateClient(object);
-
-    // Clipper
-    if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(document, svgStyle->clipperResource()))
-        clipper->invalidateClient(object);
-
-    // Filter
-#if ENABLE(FILTERS)
-    if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document, svgStyle->filterResource()))
-        filter->invalidateClient(object);
-#endif
-
-    // Markers
-    if (RenderSVGResourceMarker* startMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerStartResource()))
-        startMarker->invalidateClient(object);
-    if (RenderSVGResourceMarker* midMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerMidResource()))
-        midMarker->invalidateClient(object);
-    if (RenderSVGResourceMarker* endMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerEndResource()))
-        endMarker->invalidateClient(object);
-
-    // Gradients/Patterns
-    if (svgStyle->hasFill())
-        invalidatePaintingResource(svgStyle->fillPaint(), object);
-    if (svgStyle->hasStroke())
-        invalidatePaintingResource(svgStyle->strokePaint(), object);
-}
-
-DashArray dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle)
+DashArray SVGRenderSupport::dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle)
 {
     DashArray array;
     
     CSSValueList* dashes = style->svgStyle()->strokeDashArray();
-    if (dashes) {
-        CSSPrimitiveValue* dash = 0;
-        unsigned long len = dashes->length();
-        for (unsigned long i = 0; i < len; i++) {
-            dash = static_cast<CSSPrimitiveValue*>(dashes->itemWithoutBoundsCheck(i));
-            if (!dash)
-                continue;
-
-            array.append((float) dash->computeLengthFloat(const_cast<RenderStyle*>(style), rootStyle));
-        }
+    if (!dashes)
+        return array;
+
+    CSSPrimitiveValue* dash = 0;
+    unsigned long len = dashes->length();
+    for (unsigned long i = 0; i < len; ++i) {
+        dash = static_cast<CSSPrimitiveValue*>(dashes->itemWithoutBoundsCheck(i));
+        if (!dash)
+            continue;
+
+        array.append(dash->computeLengthFloat(const_cast<RenderStyle*>(style), rootStyle));
     }
 
     return array;
 }
 
-void applyStrokeStyleToContext(GraphicsContext* context, const RenderStyle* style, const RenderObject* object)
+void SVGRenderSupport::applyStrokeStyleToContext(GraphicsContext* context, const RenderStyle* style, const RenderObject* object)
 {
     context->setStrokeThickness(SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeWidth(), 1.0f));
     context->setLineCap(style->svgStyle()->capStyle());
@@ -411,7 +336,7 @@ void applyStrokeStyleToContext(GraphicsContext* context, const RenderStyle* styl
         context->setLineDash(dashes, dashOffset);
 }
 
-const RenderObject* findTextRootObject(const RenderObject* start)
+const RenderObject* SVGRenderSupport::findTextRootObject(const RenderObject* start)
 {
     while (start && !start->isSVGText())
         start = start->parent();
index cca3a9d..00d5487 100644 (file)
@@ -3,6 +3,7 @@
  *           (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
  *           (C) 2007 Eric Seidel <eric@webkit.org>
  * Copyright (C) 2009 Google, Inc.  All rights reserved.
+ * Copyright (C) Research In Motion Limited 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
 
 #if ENABLE(SVG)
 #include "DashArray.h"
-#include "RenderObject.h"
-#include "SVGElement.h"
-#include "SVGStyledElement.h"
+#include "PaintInfo.h"
 
 namespace WebCore {
 
-class RenderSVGResourceFilter;
+class FloatPoint;
+class FloatRect;
 class ImageBuffer;
+class RenderBoxModelObject;
+class RenderObject;
+class RenderStyle;
+class RenderSVGResourceFilter;
+class TransformState;
 
-// 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 {
+// SVGRendererSupport is a helper class sharing code between all SVG renderers.
+class SVGRenderSupport {
 public:
-    virtual ~SVGRenderBase();
-
-    // 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.
+    // Used by all SVG renderers who apply clip/filter/etc. resources to the renderer content
     static bool prepareToRenderSVGContent(RenderObject*, PaintInfo&, const FloatRect& boundingBox, RenderSVGResourceFilter*&);
     static void finishRenderSVGContent(RenderObject*, PaintInfo&, RenderSVGResourceFilter*&, GraphicsContext* savedContext);
 
-    // Layout all children of the passed render object
+    // Shares child layouting code between RenderSVGRoot/RenderSVG(Hidden)Container
     static void layoutChildren(RenderObject*, bool selfNeedsLayout);
 
     // Helper function determining wheter overflow is hidden
     static bool isOverflowHidden(const RenderObject*);
 
     // Calculates the repaintRect in combination with filter, clipper and masker in local coordinates.
-    void intersectRepaintRectWithResources(const RenderObject*, FloatRect&) const;
+    static void intersectRepaintRectWithResources(const RenderObject*, FloatRect&);
 
-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&);
+    // Determines whether the passed point lies in a clipping area
+    static bool pointInClippingArea(const RenderObject*, const FloatPoint&);
 
     // 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);
-};
 
-// This offers a way to render parts of a WebKit rendering tree into a ImageBuffer.
-void renderSubtreeToImage(ImageBuffer*, RenderObject*);
+    // Important functions used by nearly all SVG renderers centralizing coordinate transformations / repaint rect calculations
+    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&);
 
-bool pointInClippingArea(const RenderObject*, const FloatPoint&);
+    // This offers a way to render parts of a WebKit rendering tree into a ImageBuffer.
+    static void renderSubtreeToImage(ImageBuffer*, RenderObject*);
 
-void deregisterFromResources(RenderObject*);
-void clampImageBufferSizeToViewport(FrameView*, IntSize& imageBufferSize);
+    // Shared between SVG renderers and resources.
+    static void applyStrokeStyleToContext(GraphicsContext*, const RenderStyle*, const RenderObject*);
 
-void applyStrokeStyleToContext(GraphicsContext*, const RenderStyle*, const RenderObject*);
-DashArray dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle);
+    // FIXME: These methods do not belong here.
+    static const RenderObject* findTextRootObject(const RenderObject* start);
+    static DashArray dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle);
 
-const RenderObject* findTextRootObject(const RenderObject* start);
+private:
+    // This class is not constructable.
+    SVGRenderSupport();
+    ~SVGRenderSupport();
+};
 
 } // namespace WebCore
 
 #endif // ENABLE(SVG)
-
 #endif // SVGRenderSupport_h
index e110ce6..bec78e7 100644 (file)
@@ -372,7 +372,7 @@ static void writeStyle(TextStream& ts, const RenderObject& object)
             writeSVGPaintingResource(ts, strokePaintingResource);
 
             double dashOffset = SVGRenderStyle::cssPrimitiveToLength(&path, svgStyle->strokeDashOffset(), 0.0f);
-            const DashArray& dashArray = dashArrayFromRenderingStyle(style, object.document()->documentElement()->renderStyle());
+            const DashArray& dashArray = SVGRenderSupport::dashArrayFromRenderingStyle(style, object.document()->documentElement()->renderStyle());
             double strokeWidth = SVGRenderStyle::cssPrimitiveToLength(&path, svgStyle->strokeWidth(), 1.0f);
 
             writeIfNotDefault(ts, "opacity", svgStyle->strokeOpacity(), 1.0f);
index bcc8042..e438164 100644 (file)
@@ -53,12 +53,12 @@ void SVGRootInlineBox::paint(PaintInfo& paintInfo, int, int)
     FloatRect repaintRect = boxRenderer->repaintRectInLocalCoordinates();
 
     RenderSVGResourceFilter* filter = 0;
-    if (SVGRenderBase::prepareToRenderSVGContent(boxRenderer, childPaintInfo, repaintRect, filter)) {
+    if (SVGRenderSupport::prepareToRenderSVGContent(boxRenderer, childPaintInfo, repaintRect, filter)) {
         for (InlineBox* child = firstChild(); child; child = child->nextOnLine())
             child->paint(childPaintInfo, 0, 0);
     }
 
-    SVGRenderBase::finishRenderSVGContent(boxRenderer, childPaintInfo, filter, paintInfo.context);
+    SVGRenderSupport::finishRenderSVGContent(boxRenderer, childPaintInfo, filter, paintInfo.context);
     childPaintInfo.context->restore();
 }
 
index e44a592..4e61190 100644 (file)
@@ -35,8 +35,7 @@ namespace WebCore {
 
 class SVGInlineTextBox;
 
-class SVGRootInlineBox : public RootInlineBox
-                       , protected SVGRenderBase {
+class SVGRootInlineBox : public RootInlineBox {
 public:
     SVGRootInlineBox(RenderObject* obj)
         : RootInlineBox(obj)
index 7fa4c51..84f8734 100644 (file)
@@ -28,6 +28,7 @@
 #include "CachedImage.h"
 #include "DocLoader.h"
 #include "Document.h"
+#include "RenderObject.h"
 #include "SVGLength.h"
 #include "SVGNames.h"
 #include "SVGPreserveAspectRatio.h"
@@ -123,7 +124,7 @@ PassRefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*)
         IntRect targetRect = enclosingIntRect(renderer->objectBoundingBox());
         m_targetImage = ImageBuffer::create(targetRect.size(), LinearRGB);
 
-        renderSubtreeToImage(m_targetImage.get(), renderer);
+        SVGRenderSupport::renderSubtreeToImage(m_targetImage.get(), renderer);
     }
 
     return FEImage::create(m_targetImage ? m_targetImage->image() : m_cachedImage->image(), preserveAspectRatio());
index 10cc793..008ae31 100644 (file)
@@ -251,7 +251,7 @@ void SVGStyledElement::svgAttributeChanged(const QualifiedName& attrName)
         invalidateResourcesInAncestorChain();
 
         // If we're referencing resources, tell them we've changed.
-        deregisterFromResources(object);
+        RenderSVGResource::invalidateAllResourcesOfRenderer(object);
     }
 
     // Invalidate all SVGElementInstances associated with us