Beat SVGRenderSupport with the RenderElement stick.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Nov 2013 11:32:57 +0000 (11:32 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Nov 2013 11:32:57 +0000 (11:32 +0000)
<https://webkit.org/b/124102>

Tighten up all the SVGRenderSupport helper functions by making them
take const RenderElements references instead of raw RenderObject
pointers as much as possible.

This tunes up a bunch of branchy style() calls.

The patch looks big but it's mostly mechanical. I just changed the
signatures and then worked backwards until everything built again.

Reviewed by Antti Koivisto.

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

18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderObject.h
Source/WebCore/rendering/svg/RenderSVGContainer.cpp
Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp
Source/WebCore/rendering/svg/RenderSVGHiddenContainer.cpp
Source/WebCore/rendering/svg/RenderSVGImage.cpp
Source/WebCore/rendering/svg/RenderSVGInline.cpp
Source/WebCore/rendering/svg/RenderSVGModelObject.cpp
Source/WebCore/rendering/svg/RenderSVGModelObject.h
Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp
Source/WebCore/rendering/svg/RenderSVGResourceMarker.cpp
Source/WebCore/rendering/svg/RenderSVGRoot.cpp
Source/WebCore/rendering/svg/RenderSVGShape.cpp
Source/WebCore/rendering/svg/RenderSVGText.cpp
Source/WebCore/rendering/svg/RenderSVGViewportContainer.cpp
Source/WebCore/rendering/svg/SVGRenderSupport.cpp
Source/WebCore/rendering/svg/SVGRenderSupport.h

index b5a253b..f5485c5 100644 (file)
@@ -1,5 +1,21 @@
 2013-11-09  Andreas Kling  <akling@apple.com>
 
+        Beat SVGRenderSupport with the RenderElement stick.
+        <https://webkit.org/b/124102>
+
+        Tighten up all the SVGRenderSupport helper functions by making them
+        take const RenderElements references instead of raw RenderObject
+        pointers as much as possible.
+
+        This tunes up a bunch of branchy style() calls.
+
+        The patch looks big but it's mostly mechanical. I just changed the
+        signatures and then worked backwards until everything built again.
+
+        Reviewed by Antti Koivisto.
+
+2013-11-09  Andreas Kling  <akling@apple.com>
+
         SVGTextLayoutAttributes always has a RenderSVGInlineText.
         <https://webkit.org/b/124101>
 
index 2adac6e..cdbae51 100644 (file)
@@ -521,7 +521,7 @@ void RenderElement::addChild(RenderObject* newChild, RenderObject* beforeChild)
         toRenderLayerModelObject(newChild)->layer()->removeOnlyThisLayer();
 
 #if ENABLE(SVG)
-    SVGRenderSupport::childAdded(this, newChild);
+    SVGRenderSupport::childAdded(*this, *newChild);
 #endif
 }
 
@@ -940,7 +940,7 @@ void RenderElement::styleDidChange(StyleDifference diff, const RenderStyle* oldS
     if (s_noLongerAffectsParentBlock)
         removeAnonymousWrappersForInlinesIfNecessary();
 #if ENABLE(SVG)
-    SVGRenderSupport::styleChanged(this);
+    SVGRenderSupport::styleChanged(*this);
 #endif
 
     if (!m_parent)
index 42fc981..6a17b70 100644 (file)
@@ -412,6 +412,7 @@ public:
 #if ENABLE(SVG)
     // FIXME: Until all SVG renders can be subclasses of RenderSVGModelObject we have
     // to add SVG renderer methods to RenderObject with an ASSERT_NOT_REACHED() default implementation.
+    virtual bool isRenderSVGModelObject() const { return false; }
     virtual bool isSVGRoot() const { return false; }
     virtual bool isSVGContainer() const { return false; }
     virtual bool isSVGTransformableContainer() const { return false; }
index ff713b1..c40782b 100644 (file)
@@ -59,7 +59,7 @@ void RenderSVGContainer::layout()
     // RenderSVGRoot disables layoutState for the SVG rendering tree.
     ASSERT(!view().layoutStateEnabled());
 
-    LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(this) || selfWillPaint());
+    LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(*this) || selfWillPaint());
 
     // Allow RenderSVGViewportContainer to update its viewport.
     calcViewport();
@@ -70,7 +70,7 @@ void RenderSVGContainer::layout()
     // RenderSVGViewportContainer needs to set the 'layout size changed' flag.
     determineIfLayoutSizeChanged();
 
-    SVGRenderSupport::layoutChildren(this, selfNeedsLayout() || SVGRenderSupport::filtersForceContainerLayout(this));
+    SVGRenderSupport::layoutChildren(*this, selfNeedsLayout() || SVGRenderSupport::filtersForceContainerLayout(*this));
 
     // Invalidate all resources of this client if our layout changed.
     if (everHadLayout() && needsLayout())
@@ -167,7 +167,7 @@ void RenderSVGContainer::addFocusRingRects(Vector<IntRect>& rects, const LayoutP
 
 void RenderSVGContainer::updateCachedBoundaries()
 {
-    SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m_objectBoundingBoxValid, m_strokeBoundingBox, m_repaintBoundingBox);
+    SVGRenderSupport::computeContainerBoundingBoxes(*this, m_objectBoundingBox, m_objectBoundingBoxValid, m_strokeBoundingBox, m_repaintBoundingBox);
     SVGRenderSupport::intersectRepaintRectWithResources(*this, m_repaintBoundingBox);
 }
 
@@ -179,7 +179,7 @@ bool RenderSVGContainer::nodeAtFloatPoint(const HitTestRequest& request, HitTest
 
     FloatPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent);
 
-    if (!SVGRenderSupport::pointInClippingArea(this, localPoint))
+    if (!SVGRenderSupport::pointInClippingArea(*this, localPoint))
         return false;
                 
     for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
index 9b6cbfa..4ab8295 100644 (file)
@@ -64,7 +64,7 @@ void RenderSVGForeignObject::paint(PaintInfo& paintInfo, const LayoutPoint&)
     GraphicsContextStateSaver stateSaver(*childPaintInfo.context);
     childPaintInfo.applyTransform(localTransform());
 
-    if (SVGRenderSupport::isOverflowHidden(this))
+    if (SVGRenderSupport::isOverflowHidden(*this))
         childPaintInfo.context->clip(m_viewport);
 
     SVGRenderingContext renderingContext;
@@ -96,12 +96,12 @@ void RenderSVGForeignObject::paint(PaintInfo& paintInfo, const LayoutPoint&)
 
 LayoutRect RenderSVGForeignObject::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const
 {
-    return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer);
+    return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer);
 }
 
 void RenderSVGForeignObject::computeFloatRectForRepaint(const RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const
 {
-    SVGRenderSupport::computeFloatRectForRepaint(this, repaintContainer, repaintRect, fixed);
+    SVGRenderSupport::computeFloatRectForRepaint(*this, repaintContainer, repaintRect, fixed);
 }
 
 const AffineTransform& RenderSVGForeignObject::localToParentTransform() const
@@ -133,7 +133,7 @@ void RenderSVGForeignObject::layout()
     ASSERT(needsLayout());
     ASSERT(!view().layoutStateEnabled()); // RenderSVGRoot disables layoutState for the SVG rendering tree.
 
-    LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(this));
+    LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(*this));
 
     bool updateCachedBoundariesInParents = false;
     if (m_needsTransformUpdate) {
@@ -182,7 +182,7 @@ bool RenderSVGForeignObject::nodeAtFloatPoint(const HitTestRequest& request, Hit
     FloatPoint localPoint = localTransform().inverse().mapPoint(pointInParent);
 
     // Early exit if local point is not contained in clipped viewport area
-    if (SVGRenderSupport::isOverflowHidden(this) && !m_viewport.contains(localPoint))
+    if (SVGRenderSupport::isOverflowHidden(*this) && !m_viewport.contains(localPoint))
         return false;
 
     // FOs establish a stacking context, so we need to hit-test all layers.
@@ -200,12 +200,12 @@ bool RenderSVGForeignObject::nodeAtPoint(const HitTestRequest&, HitTestResult&,
 
 void RenderSVGForeignObject::mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState& transformState, MapCoordinatesFlags, bool* wasFixed) const
 {
-    SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, wasFixed);
+    SVGRenderSupport::mapLocalToContainer(*this, repaintContainer, transformState, wasFixed);
 }
 
 const RenderObject* RenderSVGForeignObject::pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const
 {
-    return SVGRenderSupport::pushMappingToContainer(this, ancestorToStopAt, geometryMap);
+    return SVGRenderSupport::pushMappingToContainer(*this, ancestorToStopAt, geometryMap);
 }
 
 }
index 4d6438f..a9b3e8e 100644 (file)
@@ -37,7 +37,7 @@ void RenderSVGHiddenContainer::layout()
 {
     StackStats::LayoutCheckPoint layoutCheckPoint;
     ASSERT(needsLayout());
-    SVGRenderSupport::layoutChildren(this, selfNeedsLayout()); 
+    SVGRenderSupport::layoutChildren(*this, selfNeedsLayout());
     clearNeedsLayout();    
 }
 
index f29c719..6cf830b 100644 (file)
@@ -87,7 +87,7 @@ void RenderSVGImage::layout()
     StackStats::LayoutCheckPoint layoutCheckPoint;
     ASSERT(needsLayout());
 
-    LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(this) && selfNeedsLayout());
+    LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(*this) && selfNeedsLayout());
     updateImageViewport();
 
     bool transformOrBoundariesUpdate = m_needsTransformUpdate || m_needsBoundariesUpdate;
@@ -101,7 +101,7 @@ void RenderSVGImage::layout()
         SVGRenderSupport::intersectRepaintRectWithResources(*this, m_repaintBoundingBoxExcludingShadow);
 
         m_repaintBoundingBox = m_repaintBoundingBoxExcludingShadow;
-        SVGRenderSupport::intersectRepaintRectWithShadows(this, m_repaintBoundingBox);
+        SVGRenderSupport::intersectRepaintRectWithShadows(*this, m_repaintBoundingBox);
 
         m_needsBoundariesUpdate = false;
     }
@@ -176,7 +176,7 @@ bool RenderSVGImage::nodeAtFloatPoint(const HitTestRequest& request, HitTestResu
     if (isVisible || !hitRules.requireVisible) {
         FloatPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent);
             
-        if (!SVGRenderSupport::pointInClippingArea(this, localPoint))
+        if (!SVGRenderSupport::pointInClippingArea(*this, localPoint))
             return false;
 
         if (hitRules.canHitFill) {
index b887641..f1f384e 100644 (file)
@@ -71,22 +71,22 @@ FloatRect RenderSVGInline::repaintRectInLocalCoordinates() const
 
 LayoutRect RenderSVGInline::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const
 {
-    return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer);
+    return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer);
 }
 
 void RenderSVGInline::computeFloatRectForRepaint(const RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const
 {
-    SVGRenderSupport::computeFloatRectForRepaint(this, repaintContainer, repaintRect, fixed);
+    SVGRenderSupport::computeFloatRectForRepaint(*this, repaintContainer, repaintRect, fixed);
 }
 
 void RenderSVGInline::mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState& transformState, MapCoordinatesFlags, bool* wasFixed) const
 {
-    SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, wasFixed);
+    SVGRenderSupport::mapLocalToContainer(*this, repaintContainer, transformState, wasFixed);
 }
 
 const RenderObject* RenderSVGInline::pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const
 {
-    return SVGRenderSupport::pushMappingToContainer(this, ancestorToStopAt, geometryMap);
+    return SVGRenderSupport::pushMappingToContainer(*this, ancestorToStopAt, geometryMap);
 }
 
 void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const
index 6994969..5ee3376 100644 (file)
@@ -50,22 +50,22 @@ RenderSVGModelObject::RenderSVGModelObject(SVGElement& element, PassRef<RenderSt
 
 LayoutRect RenderSVGModelObject::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const
 {
-    return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer);
+    return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer);
 }
 
 void RenderSVGModelObject::computeFloatRectForRepaint(const RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const
 {
-    SVGRenderSupport::computeFloatRectForRepaint(this, repaintContainer, repaintRect, fixed);
+    SVGRenderSupport::computeFloatRectForRepaint(*this, repaintContainer, repaintRect, fixed);
 }
 
 void RenderSVGModelObject::mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState& transformState, MapCoordinatesFlags, bool* wasFixed) const
 {
-    SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, wasFixed);
+    SVGRenderSupport::mapLocalToContainer(*this, repaintContainer, transformState, wasFixed);
 }
 
 const RenderObject* RenderSVGModelObject::pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const
 {
-    return SVGRenderSupport::pushMappingToContainer(this, ancestorToStopAt, geometryMap);
+    return SVGRenderSupport::pushMappingToContainer(*this, ancestorToStopAt, geometryMap);
 }
 
 // Copied from RenderBox, this method likely requires further refactoring to work easily for both SVG and CSS Box Model content.
index 599bad4..06fc128 100644 (file)
@@ -74,12 +74,16 @@ protected:
     virtual void willBeDestroyed() OVERRIDE;
 
 private:
+    virtual bool isRenderSVGModelObject() const OVERRIDE FINAL { return true; }
+
     // This method should never be called, SVG uses a different nodeAtPoint method
     virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
     virtual void absoluteFocusRingQuads(Vector<FloatQuad>&) OVERRIDE FINAL;
     bool m_hasSVGShadow;
 };
 
+RENDER_OBJECT_TYPE_CASTS(RenderSVGModelObject, isRenderSVGModelObject());
+
 }
 
 #endif // ENABLE(SVG)
index 38d0e95..f903131 100644 (file)
@@ -281,7 +281,7 @@ void RenderSVGResourceClipper::calculateClipContentRepaintRect()
 bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundingBox, const FloatPoint& nodeAtPoint)
 {
     FloatPoint point = nodeAtPoint;
-    if (!SVGRenderSupport::pointInClippingArea(this, point))
+    if (!SVGRenderSupport::pointInClippingArea(*this, point))
         return false;
 
     if (clipPathElement().clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
index deb60fb..50d4c17 100644 (file)
@@ -72,7 +72,7 @@ void RenderSVGResourceMarker::removeClientFromCache(RenderObject* client, bool m
 
 void RenderSVGResourceMarker::applyViewportClip(PaintInfo& paintInfo)
 {
-    if (SVGRenderSupport::isOverflowHidden(this))
+    if (SVGRenderSupport::isOverflowHidden(*this))
         paintInfo.context->clip(m_viewport);
 }
 
index 211e39a..f129f86 100644 (file)
@@ -214,7 +214,7 @@ void RenderSVGRoot::layout()
     buildLocalToBorderBoxTransform();
 
     m_isLayoutSizeChanged = needsLayout || (svgSVGElement().hasRelativeLengths() && oldSize != size());
-    SVGRenderSupport::layoutChildren(this, needsLayout || SVGRenderSupport::filtersForceContainerLayout(this));
+    SVGRenderSupport::layoutChildren(*this, needsLayout || SVGRenderSupport::filtersForceContainerLayout(*this));
 
     if (!m_resourcesNeedingToInvalidateClients.isEmpty()) {
         // Invalidate resource clients, which may mark some nodes for layout.
@@ -223,7 +223,7 @@ void RenderSVGRoot::layout()
             (*it)->removeAllClientsFromCache();
 
         m_isLayoutSizeChanged = false;
-        SVGRenderSupport::layoutChildren(this, false);
+        SVGRenderSupport::layoutChildren(*this, false);
     }
 
     // At this point LayoutRepainter already grabbed the old bounds,
@@ -357,7 +357,7 @@ const AffineTransform& RenderSVGRoot::localToParentTransform() const
 
 LayoutRect RenderSVGRoot::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const
 {
-    return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer);
+    return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer);
 }
 
 void RenderSVGRoot::computeFloatRectForRepaint(const RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const
@@ -396,12 +396,12 @@ const RenderObject* RenderSVGRoot::pushMappingToContainer(const RenderLayerModel
 
 void RenderSVGRoot::updateCachedBoundaries()
 {
-    SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m_objectBoundingBoxValid, m_strokeBoundingBox, m_repaintBoundingBoxExcludingShadow);
+    SVGRenderSupport::computeContainerBoundingBoxes(*this, m_objectBoundingBox, m_objectBoundingBoxValid, m_strokeBoundingBox, m_repaintBoundingBoxExcludingShadow);
     SVGRenderSupport::intersectRepaintRectWithResources(*this, m_repaintBoundingBoxExcludingShadow);
     m_repaintBoundingBoxExcludingShadow.inflate(borderAndPaddingWidth());
 
     m_repaintBoundingBox = m_repaintBoundingBoxExcludingShadow;
-    SVGRenderSupport::intersectRepaintRectWithShadows(this, m_repaintBoundingBox);
+    SVGRenderSupport::intersectRepaintRectWithShadows(*this, m_repaintBoundingBox);
 }
 
 bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
index a6c0f51..60de2b8 100644 (file)
@@ -161,7 +161,7 @@ bool RenderSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke
 void RenderSVGShape::layout()
 {
     StackStats::LayoutCheckPoint layoutCheckPoint;
-    LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(this) && selfNeedsLayout());
+    LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(*this) && selfNeedsLayout());
 
     bool updateCachedBoundariesInParents = false;
 
@@ -329,7 +329,7 @@ bool RenderSVGShape::nodeAtFloatPoint(const HitTestRequest& request, HitTestResu
 
     FloatPoint localPoint = m_localTransform.inverse().mapPoint(pointInParent);
 
-    if (!SVGRenderSupport::pointInClippingArea(this, localPoint))
+    if (!SVGRenderSupport::pointInClippingArea(*this, localPoint))
         return false;
 
     PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_PATH_HITTESTING, request, style().pointerEvents());
@@ -421,7 +421,7 @@ void RenderSVGShape::updateRepaintBoundingBox()
     SVGRenderSupport::intersectRepaintRectWithResources(*this, m_repaintBoundingBoxExcludingShadow);
 
     m_repaintBoundingBox = m_repaintBoundingBoxExcludingShadow;
-    SVGRenderSupport::intersectRepaintRectWithShadows(this, m_repaintBoundingBox);
+    SVGRenderSupport::intersectRepaintRectWithShadows(*this, m_repaintBoundingBox);
 }
 
 float RenderSVGShape::strokeWidth() const
index 96946e6..6373795 100644 (file)
@@ -102,7 +102,7 @@ const RenderSVGText* RenderSVGText::locateRenderSVGTextAncestor(const RenderObje
 
 LayoutRect RenderSVGText::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const
 {
-    return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer);
+    return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer);
 }
 
 void RenderSVGText::computeRectForRepaint(const RenderLayerModelObject* repaintContainer, LayoutRect& rect, bool fixed) const
@@ -114,17 +114,17 @@ void RenderSVGText::computeRectForRepaint(const RenderLayerModelObject* repaintC
 
 void RenderSVGText::computeFloatRectForRepaint(const RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const
 {
-    SVGRenderSupport::computeFloatRectForRepaint(this, repaintContainer, repaintRect, fixed);
+    SVGRenderSupport::computeFloatRectForRepaint(*this, repaintContainer, repaintRect, fixed);
 }
 
 void RenderSVGText::mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState& transformState, MapCoordinatesFlags, bool* wasFixed) const
 {
-    SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, wasFixed);
+    SVGRenderSupport::mapLocalToContainer(*this, repaintContainer, transformState, wasFixed);
 }
 
 const RenderObject* RenderSVGText::pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const
 {
-    return SVGRenderSupport::pushMappingToContainer(this, ancestorToStopAt, geometryMap);
+    return SVGRenderSupport::pushMappingToContainer(*this, ancestorToStopAt, geometryMap);
 }
 
 static inline void collectLayoutAttributes(RenderObject* text, Vector<SVGTextLayoutAttributes*>& attributes)
@@ -355,7 +355,7 @@ void RenderSVGText::layout()
 {
     StackStats::LayoutCheckPoint layoutCheckPoint;
     ASSERT(needsLayout());
-    LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(this));
+    LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(*this));
 
     bool updateCachedBoundariesInParents = false;
     if (m_needsTransformUpdate) {
@@ -388,7 +388,7 @@ void RenderSVGText::layout()
         m_needsReordering = true;
         m_needsPositioningValuesUpdate = false;
         updateCachedBoundariesInParents = true;
-    } else if (m_needsTextMetricsUpdate || SVGRenderSupport::findTreeRootObject(this)->isLayoutSizeChanged()) {
+    } else if (m_needsTextMetricsUpdate || SVGRenderSupport::findTreeRootObject(*this).isLayoutSizeChanged()) {
         // If the root layout size changed (eg. window size changes) or the transform to the root
         // context has changed then recompute the on-screen font size.
         updateFontInAllDescendants(this, &m_layoutAttributesBuilder);
@@ -457,7 +457,7 @@ bool RenderSVGText::nodeAtFloatPoint(const HitTestRequest& request, HitTestResul
             || (hitRules.canHitFill && (style().svgStyle().hasFill() || !hitRules.requireFill))) {
             FloatPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent);
 
-            if (!SVGRenderSupport::pointInClippingArea(this, localPoint))
+            if (!SVGRenderSupport::pointInClippingArea(*this, localPoint))
                 return false;       
 
             HitTestLocation hitTestLocation(LayoutPoint(flooredIntPoint(localPoint)));
index 0cc0ad7..f03467c 100644 (file)
@@ -54,7 +54,7 @@ void RenderSVGViewportContainer::determineIfLayoutSizeChanged()
 
 void RenderSVGViewportContainer::applyViewportClip(PaintInfo& paintInfo)
 {
-    if (SVGRenderSupport::isOverflowHidden(this))
+    if (SVGRenderSupport::isOverflowHidden(*this))
         paintInfo.context->clip(m_viewport);
 }
 
@@ -137,7 +137,7 @@ AffineTransform RenderSVGViewportContainer::viewportTransform() const
 bool RenderSVGViewportContainer::pointIsInsideViewportClip(const FloatPoint& pointInParent)
 {
     // Respect the viewport clip (which is in parent coords)
-    if (!SVGRenderSupport::isOverflowHidden(this))
+    if (!SVGRenderSupport::isOverflowHidden(*this))
         return true;
     
     return m_viewport.contains(pointInParent);
index b77b399..1cbd5d7 100644 (file)
 
 namespace WebCore {
 
-FloatRect SVGRenderSupport::repaintRectForRendererInLocalCoordinatesExcludingSVGShadow(const RenderObject* object)
+FloatRect SVGRenderSupport::repaintRectForRendererInLocalCoordinatesExcludingSVGShadow(const RenderElement& renderer)
 {
     // FIXME: Add support for RenderSVGBlock.
 
-    // FIXME: This should use a safer cast such as toRenderSVGModelObject().
-    if (object->isSVGShape() || object->isSVGImage() || object->isSVGContainer())
-        return static_cast<const RenderSVGModelObject*>(object)->repaintRectInLocalCoordinatesExcludingSVGShadow();
+    if (renderer.isSVGShape() || renderer.isSVGImage() || renderer.isSVGContainer())
+        return toRenderSVGModelObject(renderer).repaintRectInLocalCoordinatesExcludingSVGShadow();
 
-    return object->repaintRectInLocalCoordinates();
+    return renderer.repaintRectInLocalCoordinates();
 }
 
-LayoutRect SVGRenderSupport::clippedOverflowRectForRepaint(const RenderObject* object, const RenderLayerModelObject* repaintContainer)
+LayoutRect SVGRenderSupport::clippedOverflowRectForRepaint(const RenderElement& renderer, const RenderLayerModelObject* repaintContainer)
 {
     // Return early for any cases where we don't actually paint
-    if (object->style().visibility() != VISIBLE && !object->enclosingLayer()->hasVisibleContent())
+    if (renderer.style().visibility() != VISIBLE && !renderer.enclosingLayer()->hasVisibleContent())
         return LayoutRect();
 
     // Pass our local paint rect to computeRectForRepaint() which will
     // map to parent coords and recurse up the parent chain.
-    FloatRect repaintRect = repaintRectForRendererInLocalCoordinatesExcludingSVGShadow(object);
-    const SVGRenderStyle& svgStyle = object->style().svgStyle();
+    FloatRect repaintRect = repaintRectForRendererInLocalCoordinatesExcludingSVGShadow(renderer);
+    const SVGRenderStyle& svgStyle = renderer.style().svgStyle();
     if (const ShadowData* shadow = svgStyle.shadow())
         shadow->adjustRectForShadow(repaintRect);
-    object->computeFloatRectForRepaint(repaintContainer, repaintRect);
+    renderer.computeFloatRectForRepaint(repaintContainer, repaintRect);
     return enclosingLayoutRect(repaintRect);
 }
 
-void SVGRenderSupport::computeFloatRectForRepaint(const RenderObject* object, const RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed)
+void SVGRenderSupport::computeFloatRectForRepaint(const RenderElement& renderer, const RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed)
 {
-    const SVGRenderStyle& svgStyle = object->style().svgStyle();
+    const SVGRenderStyle& svgStyle = renderer.style().svgStyle();
     if (const ShadowData* shadow = svgStyle.shadow())
         shadow->adjustRectForShadow(repaintRect);
-    repaintRect.inflate(object->style().outlineWidth());
+    repaintRect.inflate(renderer.style().outlineWidth());
 
     // Translate to coords in our parent renderer, and then call computeFloatRectForRepaint() on our parent.
-    repaintRect = object->localToParentTransform().mapRect(repaintRect);
-    object->parent()->computeFloatRectForRepaint(repaintContainer, repaintRect, fixed);
+    repaintRect = renderer.localToParentTransform().mapRect(repaintRect);
+    renderer.parent()->computeFloatRectForRepaint(repaintContainer, repaintRect, fixed);
 }
 
-void SVGRenderSupport::mapLocalToContainer(const RenderObject* object, const RenderLayerModelObject* repaintContainer, TransformState& transformState, bool* wasFixed)
+void SVGRenderSupport::mapLocalToContainer(const RenderElement& renderer, const RenderLayerModelObject* repaintContainer, TransformState& transformState, bool* wasFixed)
 {
-    transformState.applyTransform(object->localToParentTransform());
+    transformState.applyTransform(renderer.localToParentTransform());
 
-    RenderObject* parent = object->parent();
+    ASSERT(renderer.parent());
+    auto& parent = *renderer.parent();
     
     // At the SVG/HTML boundary (aka RenderSVGRoot), we apply the localToBorderBoxTransform 
     // to map an element from SVG viewport coordinates to CSS box coordinates.
     // RenderSVGRoot's mapLocalToContainer method expects CSS box coordinates.
-    if (parent->isSVGRoot())
-        transformState.applyTransform(toRenderSVGRoot(parent)->localToBorderBoxTransform());
+    if (parent.isSVGRoot())
+        transformState.applyTransform(toRenderSVGRoot(parent).localToBorderBoxTransform());
 
     MapCoordinatesFlags mode = UseTransforms;
-    parent->mapLocalToContainer(repaintContainer, transformState, mode, wasFixed);
+    parent.mapLocalToContainer(repaintContainer, transformState, mode, wasFixed);
 }
 
-const RenderObject* SVGRenderSupport::pushMappingToContainer(const RenderObject* object, const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap)
+const RenderElement* SVGRenderSupport::pushMappingToContainer(const RenderElement& renderer, const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap)
 {
-    ASSERT_UNUSED(ancestorToStopAt, ancestorToStopAt != object);
+    ASSERT_UNUSED(ancestorToStopAt, ancestorToStopAt != &renderer);
 
-    RenderObject* parent = object->parent();
+    ASSERT(renderer.parent());
+    auto& parent = *renderer.parent();
 
     // At the SVG/HTML boundary (aka RenderSVGRoot), we apply the localToBorderBoxTransform 
     // to map an element from SVG viewport coordinates to CSS box coordinates.
     // RenderSVGRoot's mapLocalToContainer method expects CSS box coordinates.
-    if (parent->isSVGRoot()) {
-        TransformationMatrix matrix(object->localToParentTransform());
-        matrix.multiply(toRenderSVGRoot(parent)->localToBorderBoxTransform());
-        geometryMap.push(object, matrix);
+    if (parent.isSVGRoot()) {
+        TransformationMatrix matrix(renderer.localToParentTransform());
+        matrix.multiply(toRenderSVGRoot(parent).localToBorderBoxTransform());
+        geometryMap.push(&renderer, matrix);
     } else
-        geometryMap.push(object, object->localToParentTransform());
+        geometryMap.push(&renderer, renderer.localToParentTransform());
 
-    return parent;
+    return &parent;
 }
 
-bool SVGRenderSupport::checkForSVGRepaintDuringLayout(RenderObject* object)
+bool SVGRenderSupport::checkForSVGRepaintDuringLayout(const RenderElement& renderer)
 {
-    if (!object->checkForRepaintDuringLayout())
+    if (!renderer.checkForRepaintDuringLayout())
         return false;
     // When a parent container is transformed in SVG, all children will be painted automatically
     // so we are able to skip redundant repaint checks.
-    RenderObject* parent = object->parent();
+    auto parent = renderer.parent();
     return !(parent && parent->isSVGContainer() && toRenderSVGContainer(parent)->didTransformToRootUpdate());
 }
 
@@ -145,7 +146,7 @@ static inline void updateObjectBoundingBox(FloatRect& objectBoundingBox, bool& o
     objectBoundingBox.uniteEvenIfEmpty(otherBoundingBox);
 }
 
-void SVGRenderSupport::computeContainerBoundingBoxes(const RenderElement* container, FloatRect& objectBoundingBox, bool& objectBoundingBoxValid, FloatRect& strokeBoundingBox, FloatRect& repaintBoundingBox)
+void SVGRenderSupport::computeContainerBoundingBoxes(const RenderElement& container, FloatRect& objectBoundingBox, bool& objectBoundingBoxValid, FloatRect& strokeBoundingBox, FloatRect& repaintBoundingBox)
 {
     objectBoundingBox = FloatRect();
     objectBoundingBoxValid = false;
@@ -154,7 +155,7 @@ void SVGRenderSupport::computeContainerBoundingBoxes(const RenderElement* contai
     // When computing the strokeBoundingBox, we use the repaintRects of the container's children so that the container's stroke includes
     // the resources applied to the children (such as clips and filters). This allows filters applied to containers to correctly bound
     // the children, and also improves inlining of SVG content, as the stroke bound is used in that situation also.
-    for (RenderObject* current = container->firstChild(); current; current = current->nextSibling()) {
+    for (RenderObject* current = container.firstChild(); current; current = current->nextSibling()) {
         if (current->isSVGHiddenContainer())
             continue;
 
@@ -179,14 +180,14 @@ bool SVGRenderSupport::paintInfoIntersectsRepaintRect(const FloatRect& localRepa
     return localTransform.mapRect(localRepaintRect).intersects(paintInfo.rect);
 }
 
-const RenderSVGRoot* SVGRenderSupport::findTreeRootObject(const RenderObject* start)
+const RenderSVGRoot& SVGRenderSupport::findTreeRootObject(const RenderElement& start)
 {
-    while (start && !start->isSVGRoot())
-        start = start->parent();
+    auto renderer = &start;
+    while (renderer && !renderer->isSVGRoot())
+        renderer = renderer->parent();
 
-    ASSERT(start);
-    ASSERT(start->isSVGRoot());
-    return toRenderSVGRoot(start);
+    ASSERT(renderer);
+    return toRenderSVGRoot(*renderer);
 }
 
 static inline void invalidateResourcesOfChildren(RenderObject* start)
@@ -199,8 +200,9 @@ static inline void invalidateResourcesOfChildren(RenderObject* start)
         invalidateResourcesOfChildren(child);
 }
 
-static inline bool layoutSizeOfNearestViewportChanged(const RenderObject* start)
+static inline bool layoutSizeOfNearestViewportChanged(const RenderElement& renderer)
 {
+    const RenderElement* start = &renderer;
     while (start && !start->isSVGRoot() && !start->isSVGViewportContainer())
         start = start->parent();
 
@@ -212,7 +214,7 @@ static inline bool layoutSizeOfNearestViewportChanged(const RenderObject* start)
     return toRenderSVGRoot(start)->isLayoutSizeChanged();
 }
 
-bool SVGRenderSupport::transformToRootChanged(RenderObject* ancestor)
+bool SVGRenderSupport::transformToRootChanged(RenderElement* ancestor)
 {
     while (ancestor && !ancestor->isSVGRoot()) {
         if (ancestor->isSVGTransformableContainer())
@@ -225,15 +227,15 @@ bool SVGRenderSupport::transformToRootChanged(RenderObject* ancestor)
     return false;
 }
 
-void SVGRenderSupport::layoutChildren(RenderObject* start, bool selfNeedsLayout)
+void SVGRenderSupport::layoutChildren(RenderElement& start, bool selfNeedsLayout)
 {
     bool layoutSizeChanged = layoutSizeOfNearestViewportChanged(start);
-    bool transformChanged = transformToRootChanged(start);
+    bool transformChanged = transformToRootChanged(&start);
     bool hasSVGShadow = rendererHasSVGShadow(start);
-    bool needsBoundariesUpdate = start->needsBoundariesUpdate();
+    bool needsBoundariesUpdate = start.needsBoundariesUpdate();
     HashSet<RenderObject*> notlayoutedObjects;
 
-    for (RenderObject* child = start->firstChildSlow(); child; child = child->nextSibling()) {
+    for (RenderObject* child = start.firstChild(); child; child = child->nextSibling()) {
         bool needsLayout = selfNeedsLayout;
         bool childEverHadLayout = child->everHadLayout();
 
@@ -296,59 +298,57 @@ void SVGRenderSupport::layoutChildren(RenderObject* start, bool selfNeedsLayout)
         invalidateResourcesOfChildren(*it);
 }
 
-bool SVGRenderSupport::isOverflowHidden(const RenderObject* object)
+bool SVGRenderSupport::isOverflowHidden(const RenderElement& renderer)
 {
     // SVG doesn't support independent x/y overflow
-    ASSERT(object->style().overflowX() == object->style().overflowY());
+    ASSERT(renderer.style().overflowX() == renderer.style().overflowY());
 
     // OSCROLL is never set for SVG - see StyleResolver::adjustRenderStyle
-    ASSERT(object->style().overflowX() != OSCROLL);
+    ASSERT(renderer.style().overflowX() != OSCROLL);
 
     // RenderSVGRoot should never query for overflow state - it should always clip itself to the initial viewport size.
-    ASSERT(!object->isRoot());
+    ASSERT(!renderer.isRoot());
 
-    return object->style().overflowX() == OHIDDEN;
+    return renderer.style().overflowX() == OHIDDEN;
 }
 
-bool SVGRenderSupport::rendererHasSVGShadow(const RenderObject* object)
+bool SVGRenderSupport::rendererHasSVGShadow(const RenderObject& renderer)
 {
     // FIXME: Add support for RenderSVGBlock.
 
-    // FIXME: This should use a safer cast such as toRenderSVGModelObject().
-    if (object->isSVGShape() || object->isSVGImage() || object->isSVGContainer())
-        return static_cast<const RenderSVGModelObject*>(object)->hasSVGShadow();
+    if (renderer.isSVGShape() || renderer.isSVGImage() || renderer.isSVGContainer())
+        return toRenderSVGModelObject(renderer).hasSVGShadow();
 
-    if (object->isSVGRoot())
-        return toRenderSVGRoot(object)->hasSVGShadow();
+    if (renderer.isSVGRoot())
+        return toRenderSVGRoot(renderer).hasSVGShadow();
 
     return false;
 }
 
-void SVGRenderSupport::setRendererHasSVGShadow(RenderObject* object, bool hasShadow)
+void SVGRenderSupport::setRendererHasSVGShadow(RenderObject& renderer, bool hasShadow)
 {
     // FIXME: Add support for RenderSVGBlock.
 
-    // FIXME: This should use a safer cast such as toRenderSVGModelObject().
-    if (object->isSVGShape() || object->isSVGImage() || object->isSVGContainer())
-        return static_cast<RenderSVGModelObject*>(object)->setHasSVGShadow(hasShadow);
+    if (renderer.isSVGShape() || renderer.isSVGImage() || renderer.isSVGContainer()) {
+        toRenderSVGModelObject(renderer).setHasSVGShadow(hasShadow);
+        return;
+    }
 
-    if (object->isSVGRoot())
-        return static_cast<RenderSVGRoot*>(object)->setHasSVGShadow(hasShadow);
+    if (renderer.isSVGRoot())
+        toRenderSVGRoot(renderer).setHasSVGShadow(hasShadow);
 }
 
-void SVGRenderSupport::intersectRepaintRectWithShadows(const RenderObject* object, FloatRect& repaintRect)
+void SVGRenderSupport::intersectRepaintRectWithShadows(const RenderElement& renderer, FloatRect& repaintRect)
 {
     // Since -webkit-svg-shadow enables shadow drawing for its children, but its children
     // don't inherit the shadow in their SVGRenderStyle, we need to search our parents for
     // shadows in order to correctly compute our repaint rect.
 
-    ASSERT(object);
-
-    const RenderObject* currentObject = object;
+    auto currentObject = &renderer;
 
     AffineTransform localToRootTransform;
 
-    while (currentObject && rendererHasSVGShadow(currentObject)) {
+    while (currentObject && rendererHasSVGShadow(*currentObject)) {
         const RenderStyle& style = currentObject->style();
         const SVGRenderStyle& svgStyle = style.svgStyle();
         if (const ShadowData* shadow = svgStyle.shadow())
@@ -385,32 +385,30 @@ void SVGRenderSupport::intersectRepaintRectWithResources(const RenderElement& re
         repaintRect.intersect(masker->resourceBoundingBox(renderer));
 }
 
-bool SVGRenderSupport::filtersForceContainerLayout(RenderObject* object)
+bool SVGRenderSupport::filtersForceContainerLayout(const RenderElement& renderer)
 {
     // If any of this container's children need to be laid out, and a filter is applied
     // to the container, we need to repaint the entire container.
-    if (!object->normalChildNeedsLayout())
+    if (!renderer.normalChildNeedsLayout())
         return false;
 
-    SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object);
+    SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(&renderer);
     if (!resources || !resources->filter())
         return false;
 
     return true;
 }
 
-bool SVGRenderSupport::pointInClippingArea(RenderObject* object, const FloatPoint& point)
+bool SVGRenderSupport::pointInClippingArea(const RenderElement& renderer, const FloatPoint& point)
 {
-    ASSERT(object);
-
     // We just take clippers into account to determine if a point is on the node. The Specification may
     // change later and we also need to check maskers.
-    SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object);
+    SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(&renderer);
     if (!resources)
         return true;
 
     if (RenderSVGResourceClipper* clipper = resources->clipper())
-        return clipper->hitTestClipContent(object->objectBoundingBox(), point);
+        return clipper->hitTestClipContent(renderer.objectBoundingBox(), point);
 
     return true;
 }
@@ -443,15 +441,15 @@ void SVGRenderSupport::applyStrokeStyleToContext(GraphicsContext* context, const
     }
 }
 
-void SVGRenderSupport::childAdded(RenderObject* parent, RenderObject* child)
+void SVGRenderSupport::childAdded(RenderElement& parent, RenderObject& child)
 {
     SVGRenderSupport::setRendererHasSVGShadow(child, SVGRenderSupport::rendererHasSVGShadow(parent) || SVGRenderSupport::rendererHasSVGShadow(child));
 }
 
-void SVGRenderSupport::styleChanged(RenderObject* object)
+void SVGRenderSupport::styleChanged(RenderElement& renderer)
 {
-    RenderObject* parent = object->parent();
-    SVGRenderSupport::setRendererHasSVGShadow(object, (parent && SVGRenderSupport::rendererHasSVGShadow(parent)) || object->style().svgStyle().shadow());
+    auto parent = renderer.parent();
+    SVGRenderSupport::setRendererHasSVGShadow(renderer, (parent && SVGRenderSupport::rendererHasSVGShadow(*parent)) || renderer.style().svgStyle().shadow());
 }
 
 }
index 8d26441..026c14e 100644 (file)
@@ -46,48 +46,48 @@ class TransformState;
 class SVGRenderSupport {
 public:
     // Shares child layouting code between RenderSVGRoot/RenderSVG(Hidden)Container
-    static void layoutChildren(RenderObject*, bool selfNeedsLayout);
+    static void layoutChildren(RenderElement&, bool selfNeedsLayout);
 
     // Helper function determining wheter overflow is hidden
-    static bool isOverflowHidden(const RenderObject*);
+    static bool isOverflowHidden(const RenderElement&);
 
-    static void intersectRepaintRectWithShadows(const RenderObject*, FloatRect&);
+    static void intersectRepaintRectWithShadows(const RenderElement&, FloatRect&);
 
     // Calculates the repaintRect in combination with filter, clipper and masker in local coordinates.
     static void intersectRepaintRectWithResources(const RenderElement&, FloatRect&);
 
     // Determines whether a container needs to be laid out because it's filtered and a child is being laid out.
-    static bool filtersForceContainerLayout(RenderObject*);
+    static bool filtersForceContainerLayout(const RenderElement&);
 
     // Determines whether the passed point lies in a clipping area
-    static bool pointInClippingArea(RenderObject*, const FloatPoint&);
+    static bool pointInClippingArea(const RenderElement&, const FloatPoint&);
 
-    static void computeContainerBoundingBoxes(const RenderElement* container, FloatRect& objectBoundingBox, bool& objectBoundingBoxValid, FloatRect& strokeBoundingBox, FloatRect& repaintBoundingBox);
+    static void computeContainerBoundingBoxes(const RenderElement& container, FloatRect& objectBoundingBox, bool& objectBoundingBoxValid, FloatRect& strokeBoundingBox, FloatRect& repaintBoundingBox);
     static bool paintInfoIntersectsRepaintRect(const FloatRect& localRepaintRect, const AffineTransform& localTransform, const PaintInfo&);
 
     // Important functions used by nearly all SVG renderers centralizing coordinate transformations / repaint rect calculations
-    static FloatRect repaintRectForRendererInLocalCoordinatesExcludingSVGShadow(const RenderObject*);
-    static LayoutRect clippedOverflowRectForRepaint(const RenderObject*, const RenderLayerModelObject* repaintContainer);
-    static void computeFloatRectForRepaint(const RenderObject*, const RenderLayerModelObject* repaintContainer, FloatRect&, bool fixed);
-    static void mapLocalToContainer(const RenderObject*, const RenderLayerModelObject* repaintContainer, TransformState&, bool* wasFixed = 0);
-    static const RenderObject* pushMappingToContainer(const RenderObject*, const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&);
-    static bool checkForSVGRepaintDuringLayout(RenderObject*);
+    static FloatRect repaintRectForRendererInLocalCoordinatesExcludingSVGShadow(const RenderElement&);
+    static LayoutRect clippedOverflowRectForRepaint(const RenderElement&, const RenderLayerModelObject* repaintContainer);
+    static void computeFloatRectForRepaint(const RenderElement&, const RenderLayerModelObject* repaintContainer, FloatRect&, bool fixed);
+    static void mapLocalToContainer(const RenderElement&, const RenderLayerModelObject* repaintContainer, TransformState&, bool* wasFixed = 0);
+    static const RenderElement* pushMappingToContainer(const RenderElement&, const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&);
+    static bool checkForSVGRepaintDuringLayout(const RenderElement&);
 
     // Shared between SVG renderers and resources.
     static void applyStrokeStyleToContext(GraphicsContext*, const RenderStyle&, const RenderElement&);
 
     // Determines if any ancestor's transform has changed.
-    static bool transformToRootChanged(RenderObject*);
+    static bool transformToRootChanged(RenderElement*);
 
     // Helper functions to keep track of whether a renderer has an SVG shadow applied.
-    static bool rendererHasSVGShadow(const RenderObject*);
-    static void setRendererHasSVGShadow(RenderObject*, bool hasShadow);
+    static bool rendererHasSVGShadow(const RenderObject&);
+    static void setRendererHasSVGShadow(RenderObject&, bool hasShadow);
 
-    static void childAdded(RenderObject* parent, RenderObject* child);
-    static void styleChanged(RenderObject*);
+    static void childAdded(RenderElement& parent, RenderObject& child);
+    static void styleChanged(RenderElement&);
 
     // FIXME: These methods do not belong here.
-    static const RenderSVGRoot* findTreeRootObject(const RenderObject*);
+    static const RenderSVGRoot& findTreeRootObject(const RenderElement&);
 
 private:
     // This class is not constructable.