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

Unified Diff: content/browser/renderer_host/input/touch_emulator.cc

Issue 249613002: [DevTools] Interactive test for DevTools touch emulation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable on ChromeOS too Created 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/input/touch_emulator.cc
diff --git a/content/browser/renderer_host/input/touch_emulator.cc b/content/browser/renderer_host/input/touch_emulator.cc
index bee97fb0772e38460e74df1bed6d03f01fc612c5..9068dd1e55112f78816d35f159da5be54ce1f80b 100644
--- a/content/browser/renderer_host/input/touch_emulator.cc
+++ b/content/browser/renderer_host/input/touch_emulator.cc
@@ -131,7 +131,8 @@ bool TouchEmulator::HandleMouseEvent(const WebMouseEvent& mouse_event) {
if (mouse_event.button != WebMouseEvent::ButtonLeft)
return true;
- if (mouse_event.type == WebInputEvent::MouseMove) {
+ if (mouse_event.type == WebInputEvent::MouseMove &&
+ mouse_event.timeStampSeconds) {
if (last_mouse_event_was_move_ &&
mouse_event.timeStampSeconds < last_mouse_move_timestamp_ +
kMouseMoveDropIntervalSeconds)
@@ -316,7 +317,7 @@ void TouchEmulator::PinchEnd(const WebGestureEvent& event) {
client_->ForwardGestureEvent(pinch_event_);
}
-void TouchEmulator::FillPinchEvent(const WebInputEvent& event) {
+void TouchEmulator::FillPinchEvent(const WebGestureEvent& event) {
pinch_event_.timeStampSeconds = event.timeStampSeconds;
pinch_event_.modifiers = event.modifiers;
pinch_event_.sourceDevice = blink::WebGestureEvent::Touchscreen;
@@ -362,6 +363,12 @@ bool TouchEmulator::FillTouchEventAndPoint(const WebMouseEvent& mouse_event) {
WebTouchEventTraits::ResetTypeAndTouchStates(
eventType, mouse_event.timeStampSeconds, &touch_event_);
+ if (!touch_event_.timeStampSeconds) {
+ // Gesture detector does not tolerate null timestamps generated in tests.
+ touch_event_.timeStampSeconds =
+ (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF();
+ }
+
WebTouchPoint& point = touch_event_.touches[0];
point.id = 0;
point.radiusX = point.radiusY = 1.f;
« no previous file with comments | « content/browser/renderer_host/input/touch_emulator.h ('k') | ui/events/gesture_detection/gesture_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698