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

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: rebase 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
« no previous file with comments | « Source/core/rendering/compositing/CompositedLayerMapping.cpp ('k') | Source/platform/geometry/DoubleSize.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/geometry/DoublePoint.h
diff --git a/Source/platform/geometry/DoublePoint.h b/Source/platform/geometry/DoublePoint.h
index 209b6d767e371b0af3d2138732c1749c9924d679..d300294c70fb28eb2d1284cf1e60b5be778d9b85 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(clampTo<int>(floor(p.x())), clampTo<int>(floor(p.y())));
« no previous file with comments | « Source/core/rendering/compositing/CompositedLayerMapping.cpp ('k') | Source/platform/geometry/DoubleSize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698