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

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

Issue 1612453002: [Refactoring] Remove squaredDistanceToClosestPoint function on LayoutSVGInlineText.cpp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | 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/LayoutSVGInlineText.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp
index 5243c2c1f326fefff3300ba8d7b4679b951cb57f..5c1719aa964e02a0943b6fcfa4f5ff03ab67ac2a 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp
@@ -58,14 +58,6 @@ static PassRefPtr<StringImpl> applySVGWhitespaceRules(PassRefPtr<StringImpl> str
return newString.release();
}
-static float squaredDistanceToClosestPoint(const FloatRect& rect, const FloatPoint& point)
-{
- FloatPoint closestPoint;
- closestPoint.setX(std::max(std::min(point.x(), rect.maxX()), rect.x()));
- closestPoint.setY(std::max(std::min(point.y(), rect.maxY()), rect.y()));
- return (point - closestPoint).diagonalLengthSquared();
-}
-
LayoutSVGInlineText::LayoutSVGInlineText(Node* n, PassRefPtr<StringImpl> string)
: LayoutText(n, applySVGWhitespaceRules(string, false))
, m_scalingFactor(1)
@@ -187,7 +179,7 @@ PositionWithAffinity LayoutSVGInlineText::positionForPoint(const LayoutPoint& po
float distance = 0;
if (!fragmentRect.contains(absolutePoint))
- distance = squaredDistanceToClosestPoint(fragmentRect, absolutePoint);
+ distance = fragmentRect.squaredDistanceTo(absolutePoint);
if (distance <= closestDistance) {
closestDistance = distance;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698