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

Unified Diff: Source/platform/geometry/DoublePoint.h

Issue 610423004: Preserve fractional scroll offset for JS scrolling API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
Index: Source/platform/geometry/DoublePoint.h
diff --git a/Source/platform/geometry/DoublePoint.h b/Source/platform/geometry/DoublePoint.h
index 7757161248067de85aa79b62eb6d6d1420b8fec7..f7f79736d38a153ced68640a76b04f31f3c4b15d 100644
--- a/Source/platform/geometry/DoublePoint.h
+++ b/Source/platform/geometry/DoublePoint.h
@@ -23,17 +23,22 @@ public:
, m_y(y)
{
}
- explicit DoublePoint(const IntPoint& p)
+ DoublePoint(const IntPoint& p)
: m_x(p.x())
, m_y(p.y())
{
}
- explicit DoublePoint(const FloatPoint& p)
+ DoublePoint(const FloatPoint& p)
: m_x(p.x())
, m_y(p.y())
{
}
+ explicit DoublePoint(const DoubleSize& size)
+ : m_x(size.width()), m_y(size.height())
+ {
+ }
+
DoublePoint expandedTo(int x, int y) const
{
return DoublePoint(m_x > x ? m_x : x, m_y > y ? m_y : y);
@@ -61,11 +66,21 @@ inline bool operator!=(const DoublePoint& a, const DoublePoint& b)
return a.x() != b.x() || a.y() != b.y();
}
+inline DoublePoint operator+(const DoublePoint& a, const DoubleSize& b)
+{
+ return DoublePoint(a.x() + b.width(), a.y() + b.height());
+}
+
inline DoubleSize operator-(const DoublePoint& a, const DoublePoint& b)
{
return DoubleSize(a.x() - b.x(), a.y() - b.y());
}
+inline DoublePoint operator-(const DoublePoint& a)
+{
+ return DoublePoint(-a.x(), -a.y());
+}
+
inline IntPoint flooredIntPoint(const DoublePoint& p)
{
return IntPoint(clampToInteger(floor(p.x())), clampToInteger(floor(p.y())));

Powered by Google App Engine
This is Rietveld 408576698