Commit bd8a6183 authored by akling@apple.com's avatar 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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159912 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1fe3e34e
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.
......@@ -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()));
......
......@@ -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; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment