| Index: Source/core/layout/svg/LayoutSVGInlineText.cpp
|
| diff --git a/Source/core/layout/svg/LayoutSVGInlineText.cpp b/Source/core/layout/svg/LayoutSVGInlineText.cpp
|
| index 69553b53f7abf9be827f39d611b7d3ff8fb6bca5..1d7f3de0befae139c91d7ab8dbe7b9ae16559575 100644
|
| --- a/Source/core/layout/svg/LayoutSVGInlineText.cpp
|
| +++ b/Source/core/layout/svg/LayoutSVGInlineText.cpp
|
| @@ -184,10 +184,13 @@ PositionWithAffinity LayoutSVGInlineText::positionForPoint(const LayoutPoint& po
|
| fragment.buildFragmentTransform(fragmentTransform);
|
| fragmentRect = fragmentTransform.mapRect(fragmentRect);
|
|
|
| - float distance = powf(fragmentRect.x() - absolutePoint.x(), 2) +
|
| - powf(fragmentRect.y() + fragmentRect.height() / 2 - absolutePoint.y(), 2);
|
| + float distance = 0;
|
| + if (!fragmentRect.contains(absolutePoint)) {
|
| + // Discard decimal point.
|
| + distance = floorf(fragmentRect.distanceFromPoint(absolutePoint));
|
| + }
|
|
|
| - if (distance < closestDistance) {
|
| + if (distance <= closestDistance) {
|
| closestDistance = distance;
|
| closestDistanceBox = textBox;
|
| closestDistanceFragment = &fragment;
|
|
|