Chromium Code Reviews| 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..af0f6ad581580dee25577ad611034eda6e79f1fe 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); |
|
bokan
2017/03/10 14:41:57
Is this change related?
sahel
2017/03/10 21:51:41
Yes, it is. It used to use eventTimeForNow instead
bokan
2017/03/13 13:43:13
Acknowledged.
|
| gfx::PointF location(web_wheel.x * device_scale_factor_, |
| web_wheel.y * device_scale_factor_); |
| wheel_event.set_location_f(location); |
| @@ -162,6 +165,40 @@ void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform( |
| return; |
| } |
| +void SyntheticGestureTargetAura::DispatchTouchpadGestureFlingStartToPlatform( |
| + const blink::WebGestureEvent& web_gesture, |
| + const ui::LatencyInfo& latency_info) { |
| + DCHECK_EQ(web_gesture.type(), blink::WebInputEvent::GestureFlingStart); |
| + |
| + if (web_gesture.type() != blink::WebInputEvent::GestureFlingStart) |
|
bokan
2017/03/10 14:41:57
The style guide prohibits handing a failed DCHECK:
sahel
2017/03/10 21:51:41
Done.
|
| + return; |
| + |
| + float velocity_x = web_gesture.data.flingStart.velocityX; |
| + float velocity_y = web_gesture.data.flingStart.velocityY; |
| + DCHECK(velocity_x || velocity_y); |
| + |
| + if (!velocity_x && !velocity_y) |
| + return; |
| + |
| + 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; |