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

Unified Diff: Source/platform/geometry/FloatRect.cpp

Issue 1072403007: Fixup a bug about SVG text selection. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Draft 13 Created 5 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 | « Source/platform/geometry/FloatRect.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/geometry/FloatRect.cpp
diff --git a/Source/platform/geometry/FloatRect.cpp b/Source/platform/geometry/FloatRect.cpp
index 98cdab70cce1fdb6c051122c630e87f386aaa4dc..37bcb8efc06c9607de52f560805ee7ec9ea8d3e6 100644
--- a/Source/platform/geometry/FloatRect.cpp
+++ b/Source/platform/geometry/FloatRect.cpp
@@ -162,6 +162,14 @@ void FloatRect::scale(float sx, float sy)
m_size.setHeight(height() * sy);
}
+float FloatRect::distanceFromPoint(const FloatPoint& p)
fs 2015/04/27 13:02:17 squaredDistance... This is probably a bit to spec
+{
+ float closestX, closestY;
fs 2015/04/27 13:02:17 If you made this a FloatPoint, you wouldn't need t
+ closestX = std::max(std::min(p.x(), maxX()), x());
+ closestY = std::max(std::min(p.y(), maxY()), y());
+ return powf(p.x() - closestX, 2) + powf(p.y() - closestY, 2);
+}
+
FloatRect unionRect(const Vector<FloatRect>& rects)
{
FloatRect result;
« no previous file with comments | « Source/platform/geometry/FloatRect.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698