Index: third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp |
diff --git a/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp b/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp |
index 66d287986f29ced709aa9921a2c9eb06808c8df6..372d0fb7ae1b94c193b1f92ae17901a5e9850f26 100644 |
--- a/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp |
+++ b/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp |
@@ -264,12 +264,24 @@ bool SVGInlineTextBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& |
LayoutPoint boxOrigin(x(), y()); |
boxOrigin.moveBy(accumulatedOffset); |
LayoutRect rect(boxOrigin, size()); |
- // FIXME: both calls to rawValue() below is temporary and should be removed once the transition |
- // to LayoutUnit-based types is complete (crbug.com/321237) |
if (locationInContainer.intersects(rect)) { |
- lineLayoutItem().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset)); |
- if (!result.addNodeToListBasedTestResult(lineLayoutItem().node(), locationInContainer, rect)) |
- return true; |
+ LineLayoutSVGInlineText lineLayoutItem = LineLayoutSVGInlineText(this->lineLayoutItem()); |
+ ASSERT(lineLayoutItem.scalingFactor()); |
+ float baseline = lineLayoutItem.scaledFont().fontMetrics().floatAscent() / lineLayoutItem.scalingFactor(); |
+ |
+ AffineTransform fragmentTransform; |
+ for (const auto& fragment : m_textFragments) { |
+ FloatQuad fragmentQuad(FloatRect(fragment.x, fragment.y - baseline, fragment.width, fragment.height)); |
+ fragment.buildFragmentTransform(fragmentTransform); |
+ if (!fragmentTransform.isIdentity()) |
+ fragmentQuad = fragmentTransform.mapQuad(fragmentQuad); |
+ |
+ if (fragmentQuad.containsPoint(FloatPoint(locationInContainer.point()))) { |
+ lineLayoutItem.updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset)); |
+ if (!result.addNodeToListBasedTestResult(lineLayoutItem.node(), locationInContainer, rect)) |
+ return true; |
+ } |
+ } |
} |
} |
} |