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

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: 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/DoubleSize.h
diff --git a/Source/platform/geometry/DoubleSize.h b/Source/platform/geometry/DoubleSize.h
index cb68834563d26ce5a6e9288cbc3d6710b0595dec..0d96115ba5e31a9a5b02fa431b99c33df0d8d3d8 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,21 @@ inline DoubleSize& operator+=(DoubleSize& a, const DoubleSize& b)
return a;
}
+inline DoubleSize operator+(const DoubleSize& a, const IntSize& b)
Rick Byers 2014/10/02 21:44:06 are these still necessary if you have the implicit
Yufeng Shen (Slow to review) 2014/10/02 23:34:35 removed.
+{
+ return DoubleSize(a.width() + b.width(), a.height() + b.height());
+}
+
+inline DoubleSize operator+(const IntSize& 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());
+}
+
inline DoubleSize operator-(const DoubleSize& a, const DoubleSize& b)
{
return DoubleSize(a.width() - b.width(), a.height() - b.height());
@@ -47,6 +63,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(clampToInteger(floor(p.width())), clampToInteger(floor(p.height())));

Powered by Google App Engine
This is Rietveld 408576698