OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/events/gesture_detection/mock_motion_event.h" | 5 #include "ui/events/gesture_detection/mock_motion_event.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 using base::TimeTicks; | 9 using base::TimeTicks; |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 points[0].SetPoint(x0, y0); | 47 points[0].SetPoint(x0, y0); |
48 points[1].SetPoint(x1, y1); | 48 points[1].SetPoint(x1, y1); |
49 points[2].SetPoint(x2, y2); | 49 points[2].SetPoint(x2, y2); |
50 } | 50 } |
51 | 51 |
52 MockMotionEvent::MockMotionEvent(const MockMotionEvent& other) | 52 MockMotionEvent::MockMotionEvent(const MockMotionEvent& other) |
53 : action(other.action), | 53 : action(other.action), |
54 pointer_count(other.pointer_count), | 54 pointer_count(other.pointer_count), |
55 time(other.time), | 55 time(other.time), |
56 id(other.GetId()) { | 56 id(other.GetId()) { |
57 points[0] = other.points[0]; | 57 for (size_t i = 0; i < pointer_count; ++i) |
58 points[1] = other.points[1]; | 58 points[i] = other.points[i]; |
59 } | 59 } |
60 | 60 |
61 MockMotionEvent::~MockMotionEvent() {} | 61 MockMotionEvent::~MockMotionEvent() {} |
62 | 62 |
63 MotionEvent::Action MockMotionEvent::GetAction() const { return action; } | 63 MotionEvent::Action MockMotionEvent::GetAction() const { return action; } |
64 | 64 |
65 int MockMotionEvent::GetActionIndex() const { | 65 int MockMotionEvent::GetActionIndex() const { |
66 return static_cast<int>(pointer_count) - 1; | 66 return static_cast<int>(pointer_count) - 1; |
67 } | 67 } |
68 | 68 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 163 } |
164 | 164 |
165 void MockMotionEvent::CancelPoint() { | 165 void MockMotionEvent::CancelPoint() { |
166 DCHECK_GT(pointer_count, 0U); | 166 DCHECK_GT(pointer_count, 0U); |
167 if (pointer_count > 1) | 167 if (pointer_count > 1) |
168 --pointer_count; | 168 --pointer_count; |
169 action = ACTION_CANCEL; | 169 action = ACTION_CANCEL; |
170 } | 170 } |
171 | 171 |
172 } // namespace ui | 172 } // namespace ui |
OLD | NEW |