Index: third_party/WebKit/Source/platform/geometry/FloatRect.cpp |
diff --git a/third_party/WebKit/Source/platform/geometry/FloatRect.cpp b/third_party/WebKit/Source/platform/geometry/FloatRect.cpp |
index 13c4b815ff075a05fdba414b6d9e395ed78e6e63..7b5b79a5a6c35f7c7f5115c045b985d1d322d00b 100644 |
--- a/third_party/WebKit/Source/platform/geometry/FloatRect.cpp |
+++ b/third_party/WebKit/Source/platform/geometry/FloatRect.cpp |
@@ -171,6 +171,14 @@ void FloatRect::scale(float sx, float sy) |
m_size.setHeight(height() * sy); |
} |
+float FloatRect::squaredDistanceTo(const FloatPoint& point) const |
+{ |
+ FloatPoint closestPoint; |
+ closestPoint.setX(clampTo<float>(point.x(), x(), maxX())); |
+ closestPoint.setY(clampTo<float>(point.y(), y(), maxY())); |
+ return (point - closestPoint).diagonalLengthSquared(); |
+} |
+ |
FloatRect unionRect(const Vector<FloatRect>& rects) |
{ |
FloatRect result; |