Index: ui/gfx/geometry/scroll_offset.cc |
diff --git a/ui/gfx/geometry/scroll_offset.cc b/ui/gfx/geometry/scroll_offset.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..dfd3d41b159cf6a29dd926ee4a500c7e86b5158f |
--- /dev/null |
+++ b/ui/gfx/geometry/scroll_offset.cc |
@@ -0,0 +1,29 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "ui/gfx/geometry/scroll_offset.h" |
+ |
+#include "base/strings/stringprintf.h" |
+ |
+namespace gfx { |
+ |
+std::string ScrollOffset::ToString() const { |
danakj
2014/09/27 00:00:44
nit: move to bottom like it is ordered in .cc
Yufeng Shen (Slow to review)
2014/09/29 19:27:34
with the 3 methods below moved into .cc, the order
|
+ return base::StringPrintf("[%lf %lf]", x_, y_); |
+} |
+ |
+bool ScrollOffset::IsZero() const { |
danakj
2014/09/27 00:00:44
these 3 method are all trivial, can you move them
Yufeng Shen (Slow to review)
2014/09/29 19:27:34
Done.
|
+ return x_ == 0 && y_ == 0; |
+} |
+ |
+void ScrollOffset::Add(const ScrollOffset& other) { |
+ x_ += other.x_; |
+ y_ += other.y_; |
+} |
+ |
+void ScrollOffset::Subtract(const ScrollOffset& other) { |
+ x_ -= other.x_; |
+ y_ -= other.y_; |
+} |
+ |
+} // namespace gfx |