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

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

Issue 1975533002: Change ui::Event::time_stamp from TimeDelta to TimeTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
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/base_event_utils.h"
10 #include "ui/events/keycodes/keyboard_codes.h" 10 #include "ui/events/keycodes/keyboard_codes.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 blink::WebGestureDevice source_device) { 163 blink::WebGestureDevice source_device) {
164 WebGestureEvent result = Build(WebInputEvent::GestureFlingStart, 164 WebGestureEvent result = Build(WebInputEvent::GestureFlingStart,
165 source_device); 165 source_device);
166 result.data.flingStart.velocityX = velocity_x; 166 result.data.flingStart.velocityX = velocity_x;
167 result.data.flingStart.velocityY = velocity_y; 167 result.data.flingStart.velocityY = velocity_y;
168 return result; 168 return result;
169 } 169 }
170 170
171 SyntheticWebTouchEvent::SyntheticWebTouchEvent() : WebTouchEvent() { 171 SyntheticWebTouchEvent::SyntheticWebTouchEvent() : WebTouchEvent() {
172 uniqueTouchEventId = ui::GetNextTouchEventId(); 172 uniqueTouchEventId = ui::GetNextTouchEventId();
173 SetTimestamp(base::TimeTicks::Now() - base::TimeTicks()); 173 SetTimestamp(base::TimeTicks::Now());
174 } 174 }
175 175
176 void SyntheticWebTouchEvent::ResetPoints() { 176 void SyntheticWebTouchEvent::ResetPoints() {
177 int point = 0; 177 int point = 0;
178 for (unsigned int i = 0; i < touchesLength; ++i) { 178 for (unsigned int i = 0; i < touchesLength; ++i) {
179 if (touches[i].state == WebTouchPoint::StateReleased) 179 if (touches[i].state == WebTouchPoint::StateReleased)
180 continue; 180 continue;
181 181
182 touches[point] = touches[i]; 182 touches[point] = touches[i];
183 touches[point].state = WebTouchPoint::StateStationary; 183 touches[point].state = WebTouchPoint::StateStationary;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 } 230 }
231 231
232 void SyntheticWebTouchEvent::CancelPoint(int index) { 232 void SyntheticWebTouchEvent::CancelPoint(int index) {
233 CHECK_GE(index, 0); 233 CHECK_GE(index, 0);
234 CHECK_LT(index, touchesLengthCap); 234 CHECK_LT(index, touchesLengthCap);
235 touches[index].state = WebTouchPoint::StateCancelled; 235 touches[index].state = WebTouchPoint::StateCancelled;
236 WebTouchEventTraits::ResetType( 236 WebTouchEventTraits::ResetType(
237 WebInputEvent::TouchCancel, timeStampSeconds, this); 237 WebInputEvent::TouchCancel, timeStampSeconds, this);
238 } 238 }
239 239
240 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { 240 void SyntheticWebTouchEvent::SetTimestamp(base::TimeTicks timestamp) {
241 timeStampSeconds = timestamp.InSecondsF(); 241 timeStampSeconds = ui::EventTimeStampToSeconds(timestamp);
242 } 242 }
243 243
244 } // namespace content 244 } // namespace content
OLDNEW
« no previous file with comments | « content/common/input/synthetic_web_input_event_builders.h ('k') | content/public/test/browser_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698