| 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 // MSVC++ requires this to be set before any other includes to get M_PI. | 5 // MSVC++ requires this to be set before any other includes to get M_PI. |
| 6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
| 7 | 7 |
| 8 #include "ui/events/gestures/motion_event_aura.h" | 8 #include "ui/events/gestures/motion_event_aura.h" |
| 9 | 9 |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 break; | 118 break; |
| 119 case ET_TOUCH_MOVED: | 119 case ET_TOUCH_MOVED: |
| 120 UpdateTouch(touch); | 120 UpdateTouch(touch); |
| 121 break; | 121 break; |
| 122 default: | 122 default: |
| 123 NOTREACHED(); | 123 NOTREACHED(); |
| 124 return false; | 124 return false; |
| 125 } | 125 } |
| 126 | 126 |
| 127 UpdateCachedAction(touch); | 127 UpdateCachedAction(touch); |
| 128 set_unique_event_id(touch.unique_event_id()); |
| 128 set_flags(touch.flags()); | 129 set_flags(touch.flags()); |
| 129 set_event_time(touch.time_stamp() + base::TimeTicks()); | 130 set_event_time(touch.time_stamp() + base::TimeTicks()); |
| 130 return true; | 131 return true; |
| 131 } | 132 } |
| 132 | 133 |
| 133 int MotionEventAura::GetId() const { | |
| 134 return GetPointerId(0); | |
| 135 } | |
| 136 | |
| 137 void MotionEventAura::CleanupRemovedTouchPoints(const TouchEvent& event) { | 134 void MotionEventAura::CleanupRemovedTouchPoints(const TouchEvent& event) { |
| 138 if (event.type() != ET_TOUCH_RELEASED && | 135 if (event.type() != ET_TOUCH_RELEASED && |
| 139 event.type() != ET_TOUCH_CANCELLED) { | 136 event.type() != ET_TOUCH_CANCELLED) { |
| 140 return; | 137 return; |
| 141 } | 138 } |
| 142 | 139 |
| 143 DCHECK(GetPointerCount()); | 140 DCHECK(GetPointerCount()); |
| 144 int index_to_delete = GetIndexFromId(event.touch_id()); | 141 int index_to_delete = GetIndexFromId(event.touch_id()); |
| 145 set_action_index(0); | 142 set_action_index(0); |
| 146 pointer(index_to_delete) = pointer(GetPointerCount() - 1); | 143 pointer(index_to_delete) = pointer(GetPointerCount() - 1); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 193 } |
| 197 | 194 |
| 198 int MotionEventAura::GetIndexFromId(int id) const { | 195 int MotionEventAura::GetIndexFromId(int id) const { |
| 199 int index = FindPointerIndexOfId(id); | 196 int index = FindPointerIndexOfId(id); |
| 200 DCHECK_GE(index, 0); | 197 DCHECK_GE(index, 0); |
| 201 DCHECK_LT(index, static_cast<int>(GetPointerCount())); | 198 DCHECK_LT(index, static_cast<int>(GetPointerCount())); |
| 202 return index; | 199 return index; |
| 203 } | 200 } |
| 204 | 201 |
| 205 } // namespace ui | 202 } // namespace ui |
| OLD | NEW |