Index: third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp |
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp |
index 2b8499e5cbb77b476cd2077bb2ce117d70b12086..397cfd2c67ce7a6d59042db7cc3b0cba3d8d31ab 100644 |
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp |
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp |
@@ -296,6 +296,10 @@ RootInlineBox* LayoutSVGText::createRootInlineBox() |
bool LayoutSVGText::nodeAtFloatPoint(HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) |
{ |
+ // We only draw in the foreground phase, so we only hit-test then. |
+ if (hitTestAction != HitTestForeground) |
+ return false; |
+ |
PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_TEXT_HITTESTING, result.hitTestRequest(), style()->pointerEvents()); |
bool isVisible = (style()->visibility() == VISIBLE); |
if (isVisible || !hitRules.requireVisible) { |
@@ -306,11 +310,17 @@ bool LayoutSVGText::nodeAtFloatPoint(HitTestResult& result, const FloatPoint& po |
if (!SVGLayoutSupport::transformToUserSpaceAndCheckClipping(this, localToSVGParentTransform(), pointInParent, localPoint)) |
return false; |
- if (hitRules.canHitBoundingBox && !objectBoundingBox().contains(localPoint)) |
- return false; |
- |
HitTestLocation hitTestLocation(localPoint); |
- return LayoutBlock::nodeAtPoint(result, hitTestLocation, LayoutPoint(), hitTestAction); |
+ if (LayoutBlock::nodeAtPoint(result, hitTestLocation, LayoutPoint(), hitTestAction)) |
+ return true; |
+ |
+ // Consider the bounding box if requested. |
+ if (hitRules.canHitBoundingBox && objectBoundingBox().contains(localPoint)) { |
+ const LayoutPoint& localLayoutPoint = roundedLayoutPoint(localPoint); |
+ updateHitTestResult(result, localLayoutPoint); |
+ if (result.addNodeToListBasedTestResult(node(), localLayoutPoint) == StopHitTesting) |
+ return true; |
+ } |
} |
} |