OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.h" | 5 #include "content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/gfx/point_f.h" | 8 #include "ui/gfx/geometry/point_f.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 namespace { | 11 namespace { |
12 | 12 |
13 gfx::Vector2d FloorTowardZero(const gfx::Vector2dF& vector) { | 13 gfx::Vector2d FloorTowardZero(const gfx::Vector2dF& vector) { |
14 int x = vector.x() > 0 ? floor(vector.x()) : ceil(vector.x()); | 14 int x = vector.x() > 0 ? floor(vector.x()) : ceil(vector.x()); |
15 int y = vector.y() > 0 ? floor(vector.y()) : ceil(vector.y()); | 15 int y = vector.y() > 0 ? floor(vector.y()) : ceil(vector.y()); |
16 return gfx::Vector2d(x, y); | 16 return gfx::Vector2d(x, y); |
17 } | 17 } |
18 | 18 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 static_cast<int>(params_.distances.size())); | 261 static_cast<int>(params_.distances.size())); |
262 return current_scroll_segment_ == | 262 return current_scroll_segment_ == |
263 static_cast<int>(params_.distances.size()) - 1; | 263 static_cast<int>(params_.distances.size()) - 1; |
264 } | 264 } |
265 | 265 |
266 bool SyntheticSmoothScrollGesture::ScrollIsNoOp() const { | 266 bool SyntheticSmoothScrollGesture::ScrollIsNoOp() const { |
267 return params_.distances.size() == 0 || params_.distances[0].IsZero(); | 267 return params_.distances.size() == 0 || params_.distances[0].IsZero(); |
268 } | 268 } |
269 | 269 |
270 } // namespace content | 270 } // namespace content |
OLD | NEW |