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

Side by Side Diff: ui/events/gestures/motion_event_aura.cc

Issue 999423003: Set the unique_event_id when converting from TouchEvent to WebTouchEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 unified diff | Download patch
OLDNEW
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
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());
sadrul 2015/04/23 16:56:23 For multi-touch motion-events, the 'unique id' of
lanwei 2015/04/24 20:21:09 For the unique_event_id, we only use it when the g
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698