Index: content/browser/renderer_host/input/synthetic_gesture_target_aura.cc |
diff --git a/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc b/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc |
index 38ff88081c216fc6179b9e6941292ca63f755ae7..975227a3a8b0f508ea7744ad489f94c76a9a3f72 100644 |
--- a/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc |
+++ b/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc |
@@ -17,6 +17,7 @@ |
using blink::WebTouchEvent; |
using blink::WebMouseWheelEvent; |
+using blink::WebGestureEvent; |
namespace content { |
@@ -65,9 +66,11 @@ void SyntheticGestureTargetAura::DispatchWebTouchEventToPlatform( |
void SyntheticGestureTargetAura::DispatchWebMouseWheelEventToPlatform( |
const blink::WebMouseWheelEvent& web_wheel, |
const ui::LatencyInfo&) { |
+ base::TimeTicks timestamp = |
+ ui::EventTimeStampFromSeconds(web_wheel.timeStampSeconds()); |
ui::MouseWheelEvent wheel_event( |
gfx::Vector2d(web_wheel.deltaX, web_wheel.deltaY), gfx::Point(), |
- gfx::Point(), ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); |
+ gfx::Point(), timestamp, ui::EF_NONE, ui::EF_NONE); |
gfx::PointF location(web_wheel.x * device_scale_factor_, |
web_wheel.y * device_scale_factor_); |
wheel_event.set_location_f(location); |
@@ -162,6 +165,34 @@ void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform( |
return; |
} |
+void SyntheticGestureTargetAura::DispatchTouchpadGestureFlingStartToPlatform( |
tdresser
2017/03/21 19:20:02
Comment that this aligns with the Chrome OS model
sahel
2017/03/22 14:43:24
Done.
|
+ const blink::WebGestureEvent& web_gesture, |
+ const ui::LatencyInfo& latency_info) { |
+ DCHECK_EQ(web_gesture.type(), blink::WebInputEvent::GestureFlingStart); |
+ |
+ float velocity_x = web_gesture.data.flingStart.velocityX; |
+ float velocity_y = web_gesture.data.flingStart.velocityY; |
+ DCHECK(velocity_x || velocity_y); |
+ |
+ base::TimeTicks timestamp = |
+ ui::EventTimeStampFromSeconds(web_gesture.timeStampSeconds()); |
+ ui::ScrollEvent fling_event(ui::ET_SCROLL_FLING_START, gfx::Point(), |
+ timestamp, ui::EF_NONE, velocity_x, velocity_y, |
+ velocity_x, velocity_y, |
+ 2); // finger_count |
+ gfx::PointF location(web_gesture.x * device_scale_factor_, |
+ web_gesture.y * device_scale_factor_); |
+ fling_event.set_location_f(location); |
+ fling_event.set_root_location_f(location); |
+ |
+ aura::Window* window = GetWindow(); |
+ fling_event.ConvertLocationToTarget(window, window->GetRootWindow()); |
+ ui::EventDispatchDetails details = |
+ window->GetHost()->event_processor()->OnEventFromSource(&fling_event); |
+ if (details.dispatcher_destroyed) |
+ return; |
+} |
+ |
SyntheticGestureParams::GestureSourceType |
SyntheticGestureTargetAura::GetDefaultSyntheticGestureSourceType() const { |
return SyntheticGestureParams::TOUCH_INPUT; |