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

Unified Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp

Issue 1870983002: Only hit-test SVG <text> foreground (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test fixup Created 4 years, 8 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 | « third_party/WebKit/LayoutTests/svg/hittest/text-small-font-size-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+ }
}
}
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/hittest/text-small-font-size-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698