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

Unified Diff: Source/platform/geometry/DoubleSize.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/platform/geometry/DoublePoint.h ('k') | Source/platform/scroll/ScrollView.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/geometry/DoubleSize.h
diff --git a/Source/platform/geometry/DoubleSize.h b/Source/platform/geometry/DoubleSize.h
index ec03eee75645e368be354d3b0b5585c73b9f1ac9..52ee7a907e0f089058f458e896055350e2944f43 100644
--- a/Source/platform/geometry/DoubleSize.h
+++ b/Source/platform/geometry/DoubleSize.h
@@ -15,6 +15,7 @@ class PLATFORM_EXPORT DoubleSize {
public:
DoubleSize() : m_width(0), m_height(0) { }
DoubleSize(double width, double height) : m_width(width), m_height(height) { }
+ DoubleSize(const IntSize& p) : m_width(p.width()), m_height(p.height()) { }
double width() const { return m_width; }
double height() const { return m_height; }
@@ -37,6 +38,11 @@ inline DoubleSize& operator+=(DoubleSize& a, const DoubleSize& b)
return a;
}
+inline DoubleSize operator+(const DoubleSize& a, const DoubleSize& b)
+{
+ return DoubleSize(a.width() + b.width(), a.height() + b.height());
+}
+
inline DoubleSize operator-(const DoubleSize& a, const DoubleSize& b)
{
return DoubleSize(a.width() - b.width(), a.height() - b.height());
@@ -47,6 +53,11 @@ inline bool operator==(const DoubleSize& a, const DoubleSize& b)
return a.width() == b.width() && a.height() == b.height();
}
+inline bool operator!=(const DoubleSize& a, const DoubleSize& b)
+{
+ return a.width() != b.width() || a.height() != b.height();
+}
+
inline IntSize flooredIntSize(const DoubleSize& p)
{
return IntSize(clampTo<int>(floor(p.width())), clampTo<int>(floor(p.height())));
« no previous file with comments | « Source/platform/geometry/DoublePoint.h ('k') | Source/platform/scroll/ScrollView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698