Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1559)

Unified Diff: Source/core/rendering/svg/RenderSVGModelObject.cpp

Issue 185333004: [SVG] Refactor getIntersectionList() and getEnclosureList() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Copyright notice update. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/svg/RenderSVGModelObject.h ('k') | Source/core/svg/SVGElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/svg/RenderSVGModelObject.cpp
diff --git a/Source/core/rendering/svg/RenderSVGModelObject.cpp b/Source/core/rendering/svg/RenderSVGModelObject.cpp
index 294dfda3eb7b48e452eeb4fa8d5f2ee7d7c20b82..4a04b5f289fead675a816d0dfd7614f05a4dc021 100644
--- a/Source/core/rendering/svg/RenderSVGModelObject.cpp
+++ b/Source/core/rendering/svg/RenderSVGModelObject.cpp
@@ -128,51 +128,6 @@ bool RenderSVGModelObject::nodeAtPoint(const HitTestRequest&, HitTestResult&, co
return false;
}
-static void getElementCTM(SVGGraphicsElement* element, AffineTransform& transform)
-{
- ASSERT(element);
- element->document().updateLayoutIgnorePendingStylesheets();
-
- SVGElement* stopAtElement = element->nearestViewportElement();
- ASSERT(stopAtElement);
-
- AffineTransform localTransform;
- Node* current = element;
-
- while (current && current->isSVGElement()) {
- SVGElement* currentElement = toSVGElement(current);
- localTransform = currentElement->renderer()->localToParentTransform();
- transform = localTransform.multiply(transform);
- // For getCTM() computation, stop at the nearest viewport element
- if (currentElement == stopAtElement)
- break;
-
- current = current->parentOrShadowHostNode();
- }
-}
-
-// FloatRect::intersects does not consider horizontal or vertical lines (because of isEmpty()).
-// So special-case handling of such lines.
-static bool intersectsAllowingEmpty(const FloatRect& r, const FloatRect& other)
-{
- if (r.isEmpty() && other.isEmpty())
- return false;
- if (r.isEmpty() && !other.isEmpty()) {
- return (other.contains(r.x(), r.y()) && !other.contains(r.maxX(), r.maxY()))
- || (!other.contains(r.x(), r.y()) && other.contains(r.maxX(), r.maxY()));
- }
- if (other.isEmpty() && !r.isEmpty())
- return intersectsAllowingEmpty(other, r);
- return r.intersects(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)
-{
- return renderer->isSVGShape() || renderer->isSVGText() || renderer->isSVGImage() || renderer->node()->hasTagName(SVGNames::useTag);
-}
-
// The SVG addFocusRingRects() method adds rects in local coordinates so the default absoluteFocusRingQuads
// returns incorrect values for SVG objects. Overriding this method provides access to the absolute bounds.
void RenderSVGModelObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads)
@@ -180,30 +135,4 @@ void RenderSVGModelObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads)
quads.append(localToAbsoluteQuad(FloatQuad(repaintRectInLocalCoordinates())));
}
-bool RenderSVGModelObject::checkIntersection(RenderObject* renderer, const FloatRect& rect)
-{
- if (!renderer || renderer->style()->pointerEvents() == PE_NONE)
- return false;
- if (!isGraphicsElement(renderer))
- return false;
- AffineTransform ctm;
- SVGGraphicsElement* svgElement = toSVGGraphicsElement(renderer->node());
- getElementCTM(svgElement, ctm);
- ASSERT(svgElement->renderer());
- return intersectsAllowingEmpty(rect, ctm.mapRect(svgElement->renderer()->repaintRectInLocalCoordinates()));
-}
-
-bool RenderSVGModelObject::checkEnclosure(RenderObject* renderer, const FloatRect& rect)
-{
- if (!renderer || renderer->style()->pointerEvents() == PE_NONE)
- return false;
- if (!isGraphicsElement(renderer))
- return false;
- AffineTransform ctm;
- SVGGraphicsElement* svgElement = toSVGGraphicsElement(renderer->node());
- getElementCTM(svgElement, ctm);
- ASSERT(svgElement->renderer());
- return rect.contains(ctm.mapRect(svgElement->renderer()->repaintRectInLocalCoordinates()));
-}
-
} // namespace WebCore
« no previous file with comments | « Source/core/rendering/svg/RenderSVGModelObject.h ('k') | Source/core/svg/SVGElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698