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

Side by Side Diff: content/common/input/synthetic_web_input_event_builders.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, 7 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 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/common/input/synthetic_web_input_event_builders.h" 5 #include "content/common/input/synthetic_web_input_event_builders.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/common/input/web_touch_event_traits.h" 8 #include "content/common/input/web_touch_event_traits.h"
9 #include "ui/events/base_event_utils.h"
9 #include "ui/events/keycodes/keyboard_codes.h" 10 #include "ui/events/keycodes/keyboard_codes.h"
10 11
11 namespace content { 12 namespace content {
12 13
13 using blink::WebInputEvent; 14 using blink::WebInputEvent;
14 using blink::WebKeyboardEvent; 15 using blink::WebKeyboardEvent;
15 using blink::WebGestureEvent; 16 using blink::WebGestureEvent;
16 using blink::WebMouseEvent; 17 using blink::WebMouseEvent;
17 using blink::WebMouseWheelEvent; 18 using blink::WebMouseWheelEvent;
18 using blink::WebTouchEvent; 19 using blink::WebTouchEvent;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 float velocity_y, 144 float velocity_y,
144 blink::WebGestureDevice source_device) { 145 blink::WebGestureDevice source_device) {
145 WebGestureEvent result = Build(WebInputEvent::GestureFlingStart, 146 WebGestureEvent result = Build(WebInputEvent::GestureFlingStart,
146 source_device); 147 source_device);
147 result.data.flingStart.velocityX = velocity_x; 148 result.data.flingStart.velocityX = velocity_x;
148 result.data.flingStart.velocityY = velocity_y; 149 result.data.flingStart.velocityY = velocity_y;
149 return result; 150 return result;
150 } 151 }
151 152
152 SyntheticWebTouchEvent::SyntheticWebTouchEvent() : WebTouchEvent() { 153 SyntheticWebTouchEvent::SyntheticWebTouchEvent() : WebTouchEvent() {
154 uniqueTouchEventId = ui::GetNextTouchEventId();
153 SetTimestamp(base::TimeTicks::Now() - base::TimeTicks()); 155 SetTimestamp(base::TimeTicks::Now() - base::TimeTicks());
154 } 156 }
155 157
156 void SyntheticWebTouchEvent::ResetPoints() { 158 void SyntheticWebTouchEvent::ResetPoints() {
157 int point = 0; 159 int point = 0;
158 for (unsigned int i = 0; i < touchesLength; ++i) { 160 for (unsigned int i = 0; i < touchesLength; ++i) {
159 if (touches[i].state == WebTouchPoint::StateReleased) 161 if (touches[i].state == WebTouchPoint::StateReleased)
160 continue; 162 continue;
161 163
162 touches[point] = touches[i]; 164 touches[point] = touches[i];
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 touches[index].state = WebTouchPoint::StateCancelled; 215 touches[index].state = WebTouchPoint::StateCancelled;
214 WebTouchEventTraits::ResetType( 216 WebTouchEventTraits::ResetType(
215 WebInputEvent::TouchCancel, timeStampSeconds, this); 217 WebInputEvent::TouchCancel, timeStampSeconds, this);
216 } 218 }
217 219
218 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { 220 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) {
219 timeStampSeconds = timestamp.InSecondsF(); 221 timeStampSeconds = timestamp.InSecondsF();
220 } 222 }
221 223
222 } // namespace content 224 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/web_input_event_util_unittest.cc ('k') | content/common/input/web_input_event_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698