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 42b43106c7861847092ca29d19443a0b0cdce726..ac000eb31a19b5f7f0edcb290517f44ea7e6e658 100644 |
--- a/content/browser/renderer_host/input/touch_emulator.cc |
+++ b/content/browser/renderer_host/input/touch_emulator.cc |
@@ -316,7 +316,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; |
@@ -361,6 +361,16 @@ bool TouchEmulator::FillTouchEventAndPoint(const WebMouseEvent& mouse_event) { |
WebTouchEventTraits::ResetTypeAndTouchStates( |
eventType, mouse_event.timeStampSeconds, &touch_event_); |
+ // On some platforms mouse event's timestamp does not necessarily relate to |
+ // the system time at all, so use base::TimeTicks::HighResNow() if possible, |
+ // or base::TimeTicks::Now() otherwise. |
+ base::TimeTicks now; |
+ if (base::TimeTicks::IsHighResNowFastAndReliable()) |
+ now = base::TimeTicks::HighResNow(); |
+ else |
+ now = base::TimeTicks::Now(); |
+ touch_event_.timeStampSeconds = (now - base::TimeTicks()).InSecondsF(); |
+ |
WebTouchPoint& point = touch_event_.touches[0]; |
point.id = 0; |
point.radiusX = point.radiusY = 1.f; |