Add new renderer for SVGRectElement.
[WebKit.git] / Source / WebCore / rendering / svg / SVGRenderSupport.cpp
index 4933608..142dce7 100644 (file)
 
 namespace WebCore {
 
-IntRect SVGRenderSupport::clippedOverflowRectForRepaint(RenderObject* object, RenderBoxModelObject* repaintContainer)
+LayoutRect SVGRenderSupport::clippedOverflowRectForRepaint(const RenderObject* object, RenderBoxModelObject* repaintContainer)
 {
     // Return early for any cases where we don't actually paint
     if (object->style()->visibility() != VISIBLE && !object->enclosingLayer()->hasVisibleContent())
-        return IntRect();
+        return LayoutRect();
 
     // Pass our local paint rect to computeRectForRepaint() which will
     // map to parent coords and recurse up the parent chain.
-    IntRect repaintRect = enclosingIntRect(object->repaintRectInLocalCoordinates());
+    LayoutRect repaintRect = enclosingLayoutRect(object->repaintRectInLocalCoordinates());
     object->computeRectForRepaint(repaintContainer, repaintRect);
     return repaintRect;
 }
 
-void SVGRenderSupport::computeRectForRepaint(RenderObject* object, RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
+void SVGRenderSupport::computeRectForRepaint(const RenderObject* object, RenderBoxModelObject* repaintContainer, LayoutRect& repaintRect, bool fixed)
 {
     const SVGRenderStyle* svgStyle = object->style()->svgStyle();
     if (const ShadowData* shadow = svgStyle->shadow())
@@ -70,18 +70,15 @@ void SVGRenderSupport::computeRectForRepaint(RenderObject* object, RenderBoxMode
     object->parent()->computeRectForRepaint(repaintContainer, repaintRect, fixed);
 }
 
-void SVGRenderSupport::mapLocalToContainer(const RenderObject* object, RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, bool* wasFixed)
+void SVGRenderSupport::mapLocalToContainer(const RenderObject* object, RenderBoxModelObject* repaintContainer, TransformState& transformState, bool* wasFixed)
 {
-    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.
     transformState.applyTransform(object->localToParentTransform());
-    object->parent()->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, wasFixed);
+    object->parent()->mapLocalToContainer(repaintContainer, false, true, transformState, wasFixed);
 }
 
 bool SVGRenderSupport::prepareToRenderSVGContent(RenderObject* object, PaintInfo& paintInfo)
 {
     ASSERT(object);
-
     RenderStyle* style = object->style();
     ASSERT(style);
 
@@ -153,7 +150,7 @@ void SVGRenderSupport::finishRenderSVGContent(RenderObject* object, PaintInfo& p
     SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object);
     if (resources) {
         if (RenderSVGResourceFilter* filter = resources->filter()) {
-            filter->postApplyResource(object, paintInfo.context, ApplyToDefaultMode, /* path */0);
+            filter->postApplyResource(static_cast<RenderSVGShape*>(object), paintInfo.context, ApplyToDefaultMode, 0, 0);
             paintInfo.context = savedContext;
         }
     }
@@ -225,9 +222,9 @@ void SVGRenderSupport::layoutChildren(RenderObject* start, bool selfNeedsLayout)
             // When selfNeedsLayout is false and the layout size changed, we have to check whether this child uses relative lengths
             if (SVGElement* element = child->node()->isSVGElement() ? static_cast<SVGElement*>(child->node()) : 0) {
                 if (element->isStyled() && static_cast<SVGStyledElement*>(element)->hasRelativeLengths()) {
-                    // When the layout size changed and when using relative values tell the RenderSVGPath to update its Path object
-                    if (child->isSVGPath())
-                        toRenderSVGPath(child)->setNeedsPathUpdate();
+                    // When the layout size changed and when using relative values tell the RenderSVGShape to update its shape object
+                    if (child->isSVGShape())
+                        toRenderSVGShape(child)->setNeedsShapeUpdate();
 
                     needsLayout = true;
                 }