SVG: Intersection/enclosure checks should use RenderElement.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Dec 2013 05:44:16 +0000 (05:44 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Dec 2013 05:44:16 +0000 (05:44 +0000)
<https://webkit.org/b/125058>

Make RenderSVGModelObject's checkIntersection() and checkEnclosure()
take RenderElement* instead of RenderObject*. They are only ever
called with SVGElement's renderers.

Reviewed by Sam Weinig.

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/svg/RenderSVGModelObject.cpp
Source/WebCore/rendering/svg/RenderSVGModelObject.h

index 74c74fb2985a0697c2d8990c34781a1c79b6176c..7aeca9c21e805d8698b2bf681e903d31ed27931b 100644 (file)
@@ -1,3 +1,14 @@
+2013-12-01  Andreas Kling  <akling@apple.com>
+
+        SVG: Intersection/enclosure checks should use RenderElement.
+        <https://webkit.org/b/125058>
+
+        Make RenderSVGModelObject's checkIntersection() and checkEnclosure()
+        take RenderElement* instead of RenderObject*. They are only ever
+        called with SVGElement's renderers.
+
+        Reviewed by Sam Weinig.
+
 2013-12-01  Andreas Kling  <akling@apple.com>
 
         Remove unreachable labels for -webkit-margin-*-collapse properties.
index 5ee337631172d2eb03922b61cff510fc41f78e0e..77bde9cb73b065b898d85835f44f32c82a5a4349 100644 (file)
@@ -155,9 +155,9 @@ static bool intersectsAllowingEmpty(const FloatRect& r, const FloatRect& other)
 
 // One of the element types that can cause graphics to be drawn onto the target canvas. Specifically: circle, ellipse,
 // image, line, path, polygon, polyline, rect, text and use.
-static bool isGraphicsElement(RenderObject* renderer)
+static bool isGraphicsElement(const RenderElement& renderer)
 {
-    return renderer->isSVGShape() || renderer->isSVGText() || renderer->isSVGImage() || renderer->node()->hasTagName(SVGNames::useTag);
+    return renderer.isSVGShape() || renderer.isSVGText() || renderer.isSVGImage() || renderer.element()->hasTagName(SVGNames::useTag);
 }
 
 // The SVG addFocusRingRects() method adds rects in local coordinates so the default absoluteFocusRingQuads
@@ -167,27 +167,27 @@ void RenderSVGModelObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads)
     quads.append(localToAbsoluteQuad(FloatQuad(repaintRectInLocalCoordinates())));
 }
     
-bool RenderSVGModelObject::checkIntersection(RenderObject* renderer, const FloatRect& rect)
+bool RenderSVGModelObject::checkIntersection(RenderElement* renderer, const FloatRect& rect)
 {
     if (!renderer || renderer->style().pointerEvents() == PE_NONE)
         return false;
-    if (!isGraphicsElement(renderer))
+    if (!isGraphicsElement(*renderer))
         return false;
     AffineTransform ctm;
-    SVGElement* svgElement = toSVGElement(renderer->node());
+    SVGElement* svgElement = toSVGElement(renderer->element());
     getElementCTM(svgElement, ctm);
     ASSERT(svgElement->renderer());
     return intersectsAllowingEmpty(rect, ctm.mapRect(svgElement->renderer()->repaintRectInLocalCoordinates()));
 }
 
-bool RenderSVGModelObject::checkEnclosure(RenderObject* renderer, const FloatRect& rect)
+bool RenderSVGModelObject::checkEnclosure(RenderElement* renderer, const FloatRect& rect)
 {
     if (!renderer || renderer->style().pointerEvents() == PE_NONE)
         return false;
-    if (!isGraphicsElement(renderer))
+    if (!isGraphicsElement(*renderer))
         return false;
     AffineTransform ctm;
-    SVGElement* svgElement = toSVGElement(renderer->node());
+    SVGElement* svgElement = toSVGElement(renderer->element());
     getElementCTM(svgElement, ctm);
     ASSERT(svgElement->renderer());
     return rect.contains(ctm.mapRect(svgElement->renderer()->repaintRectInLocalCoordinates()));
index 06fc12824e7ec9cfe565dfdba7cb5eba1081eb5d..f2486d541300e507c1397984d9cf3054fd681ef8 100644 (file)
@@ -59,8 +59,8 @@ public:
     virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE FINAL;
     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
 
-    static bool checkIntersection(RenderObject*, const FloatRect&);
-    static bool checkEnclosure(RenderObject*, const FloatRect&);
+    static bool checkIntersection(RenderElement*, const FloatRect&);
+    static bool checkEnclosure(RenderElement*, const FloatRect&);
 
     virtual FloatRect repaintRectInLocalCoordinatesExcludingSVGShadow() const { return repaintRectInLocalCoordinates(); }
     bool hasSVGShadow() const { return m_hasSVGShadow; }