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

Unified Diff: ui/gfx/geometry/scroll_offset.h

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: Fix README.md Created 4 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 | « third_party/WebKit/Source/web/tests/WebViewTest.cpp ('k') | ui/gfx/geometry/scroll_offset.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/geometry/scroll_offset.h
diff --git a/ui/gfx/geometry/scroll_offset.h b/ui/gfx/geometry/scroll_offset.h
index f882c1b51af0d4535bd580977d68b73a30fac8de..d7aa2f97d888aa64ece7da83a2aec69a1745b645 100644
--- a/ui/gfx/geometry/scroll_offset.h
+++ b/ui/gfx/geometry/scroll_offset.h
@@ -14,18 +14,22 @@
namespace gfx {
+// TODO(szager): Reconcile terminology with blink. An 'offset' here corresponds
+// to a 'position' in blink. In blink, 'offset' means something else. See
+// third_party/WebKit/Source/core/layout/README.md for more information.
+
class GFX_EXPORT ScrollOffset {
public:
ScrollOffset() : x_(0), y_(0) {}
- ScrollOffset(double x, double y) : x_(x), y_(y) {}
+ ScrollOffset(float x, float y) : x_(x), y_(y) {}
explicit ScrollOffset(const Vector2dF& v) : x_(v.x()), y_(v.y()) {}
explicit ScrollOffset(const Vector2d& v) : x_(v.x()), y_(v.y()) {}
- double x() const { return x_; }
- void set_x(double x) { x_ = x; }
+ float x() const { return x_; }
+ void set_x(float x) { x_ = x; }
- double y() const { return y_; }
- void set_y(double y) { y_ = y; }
+ float y() const { return y_; }
+ void set_y(float y) { y_ = y; }
// True if both components are 0.
bool IsZero() const {
@@ -62,8 +66,8 @@ class GFX_EXPORT ScrollOffset {
y_ = y_ >= other.y_ ? y_ : other.y_;
}
- void Scale(double scale) { Scale(scale, scale); }
- void Scale(double x_scale, double y_scale) {
+ void Scale(float scale) { Scale(scale, scale); }
+ void Scale(float x_scale, float y_scale) {
x_ *= x_scale;
y_ *= y_scale;
}
@@ -71,8 +75,8 @@ class GFX_EXPORT ScrollOffset {
std::string ToString() const;
private:
- double x_;
- double y_;
+ float x_;
+ float y_;
};
inline bool operator==(const ScrollOffset& lhs, const ScrollOffset& rhs) {
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebViewTest.cpp ('k') | ui/gfx/geometry/scroll_offset.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698