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

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

Issue 584503005: Make scroll offset type of float in cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use ScrollOffset instead of vector2dF for scroll offset Created 6 years, 3 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: 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..297997db9a0547b553afd28fe727049fb8de2f86
--- /dev/null
+++ b/ui/gfx/geometry/scroll_offset.cc
@@ -0,0 +1,23 @@
+// 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"
+
+namespace gfx {
+
+bool ScrollOffset::IsZero() const {
+ 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

Powered by Google App Engine
This is Rietveld 408576698