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

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

Issue 411613002: [SVG] Reject hit-test queries when the element has a singular transform (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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
Index: Source/core/rendering/svg/RenderSVGRoot.cpp
diff --git a/Source/core/rendering/svg/RenderSVGRoot.cpp b/Source/core/rendering/svg/RenderSVGRoot.cpp
index c570efefd0ae8908dec836ab08c28cf22ffc16c6..6d554622faaed5e156de2f4ac828c7b9af446eee 100644
--- a/Source/core/rendering/svg/RenderSVGRoot.cpp
+++ b/Source/core/rendering/svg/RenderSVGRoot.cpp
@@ -425,14 +425,17 @@ bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
// Only test SVG content if the point is in our content box.
// FIXME: This should be an intersection when rect-based hit tests are supported by nodeAtFloatPoint.
if (contentBoxRect().contains(pointInBorderBox)) {
- FloatPoint localPoint = localToParentTransform().inverse().mapPoint(FloatPoint(pointInParent));
-
- for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
- // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet.
- if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) {
- updateHitTestResult(result, pointInBorderBox);
- if (!result.addNodeToRectBasedTestResult(child->node(), request, locationInContainer))
- return true;
+ const AffineTransform& localToParentTransform = this->localToParentTransform();
+ if (localToParentTransform.isInvertible()) {
+ FloatPoint localPoint = localToParentTransform.inverse().mapPoint(FloatPoint(pointInParent));
+
+ for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
+ // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet.
+ if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) {
+ updateHitTestResult(result, pointInBorderBox);
+ if (!result.addNodeToRectBasedTestResult(child->node(), request, locationInContainer))
+ return true;
+ }
}
}
}
« no previous file with comments | « Source/core/rendering/svg/RenderSVGResourceClipper.cpp ('k') | Source/core/rendering/svg/RenderSVGShape.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698