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

Side by Side Diff: content/common/input/synthetic_web_input_event_builders.cc

Issue 306483003: Prepare for Unified Gesture Recognizer landing in Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix non-monotonic timestamps Created 6 years, 6 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 | Annotate | Revision Log
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/keycodes/keyboard_codes.h" 9 #include "ui/events/keycodes/keyboard_codes.h"
10 10
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 float velocity_x, 140 float velocity_x,
141 float velocity_y, 141 float velocity_y,
142 WebGestureEvent::SourceDevice source_device) { 142 WebGestureEvent::SourceDevice source_device) {
143 WebGestureEvent result = Build(WebInputEvent::GestureFlingStart, 143 WebGestureEvent result = Build(WebInputEvent::GestureFlingStart,
144 source_device); 144 source_device);
145 result.data.flingStart.velocityX = velocity_x; 145 result.data.flingStart.velocityX = velocity_x;
146 result.data.flingStart.velocityY = velocity_y; 146 result.data.flingStart.velocityY = velocity_y;
147 return result; 147 return result;
148 } 148 }
149 149
150 SyntheticWebTouchEvent::SyntheticWebTouchEvent() : WebTouchEvent() {} 150 SyntheticWebTouchEvent::SyntheticWebTouchEvent() : WebTouchEvent() {
151 SetTimestamp(base::TimeTicks::Now() - base::TimeTicks());
152 }
151 153
152 void SyntheticWebTouchEvent::ResetPoints() { 154 void SyntheticWebTouchEvent::ResetPoints() {
153 int point = 0; 155 int point = 0;
154 for (unsigned int i = 0; i < touchesLength; ++i) { 156 for (unsigned int i = 0; i < touchesLength; ++i) {
155 if (touches[i].state == WebTouchPoint::StateReleased) 157 if (touches[i].state == WebTouchPoint::StateReleased)
156 continue; 158 continue;
157 159
158 touches[point] = touches[i]; 160 touches[point] = touches[i];
159 touches[point].state = WebTouchPoint::StateStationary; 161 touches[point].state = WebTouchPoint::StateStationary;
160 ++point; 162 ++point;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 touches[index].state = WebTouchPoint::StateCancelled; 202 touches[index].state = WebTouchPoint::StateCancelled;
201 WebTouchEventTraits::ResetType( 203 WebTouchEventTraits::ResetType(
202 WebInputEvent::TouchCancel, timeStampSeconds, this); 204 WebInputEvent::TouchCancel, timeStampSeconds, this);
203 } 205 }
204 206
205 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { 207 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) {
206 timeStampSeconds = timestamp.InSecondsF(); 208 timeStampSeconds = timestamp.InSecondsF();
207 } 209 }
208 210
209 } // namespace content 211 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698