Index: content/renderer/input/input_handler_proxy.cc |
diff --git a/content/renderer/input/input_handler_proxy.cc b/content/renderer/input/input_handler_proxy.cc |
index 232d8b7baf0528718f311b80e80f1d6a53620035..6ff4900d630bef5c52b34d0f854027cb13b77f90 100644 |
--- a/content/renderer/input/input_handler_proxy.cc |
+++ b/content/renderer/input/input_handler_proxy.cc |
@@ -229,6 +229,27 @@ InputHandlerProxy::HandleInputEventWithLatencyInfo( |
return disposition; |
} |
+blink::WebGestureCurve* InputHandlerProxy::CreateAnimationCurve( |
+ const blink::WebGestureEvent& gesture_event) { |
+ blink::WebGestureCurve* fling_curve; |
+ if (gesture_event.data.flingStart.isSmoothScroll) { |
+ const float start_x = gesture_event.x; |
+ const float start_y = gesture_event.y; |
+ const float dx = gesture_event.data.flingStart.dx; |
+ const float dy = gesture_event.data.flingStart.dy; |
+ const long duration_ms = gesture_event.data.flingStart.durationMs; |
+ fling_curve = client_->CreateSmoothScrollAnimationCurve( |
+ gesture_event.sourceDevice, start_x, start_y, dx, dy, duration_ms); |
+ } else { |
+ const float vx = gesture_event.data.flingStart.velocityX; |
+ const float vy = gesture_event.data.flingStart.velocityY; |
+ fling_curve = client_->CreateFlingAnimationCurve( |
+ gesture_event.sourceDevice, WebFloatPoint(vx, vy), blink::WebSize()); |
+ } |
+ |
+ return fling_curve; |
+} |
+ |
InputHandlerProxy::EventDisposition InputHandlerProxy::HandleInputEvent( |
const WebInputEvent& event) { |
DCHECK(input_handler_); |
@@ -521,10 +542,9 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureFlingStart( |
const float vy = gesture_event.data.flingStart.velocityY; |
current_fling_velocity_ = gfx::Vector2dF(vx, vy); |
DCHECK(!current_fling_velocity_.IsZero()); |
- fling_curve_.reset(client_->CreateFlingAnimationCurve( |
- gesture_event.sourceDevice, |
- WebFloatPoint(vx, vy), |
- blink::WebSize())); |
+ |
+ fling_curve_.reset(CreateAnimationCurve(gesture_event)); |
+ |
disallow_horizontal_fling_scroll_ = !vx; |
disallow_vertical_fling_scroll_ = !vy; |
TRACE_EVENT_ASYNC_BEGIN2("input", |
@@ -696,10 +716,7 @@ bool InputHandlerProxy::FilterInputEventForFlingBoosting( |
disallow_horizontal_fling_scroll_ = !velocity.x; |
disallow_vertical_fling_scroll_ = !velocity.y; |
last_fling_boost_event_ = WebGestureEvent(); |
- fling_curve_.reset(client_->CreateFlingAnimationCurve( |
- gesture_event.sourceDevice, |
- velocity, |
- blink::WebSize())); |
+ fling_curve_.reset(CreateAnimationCurve(gesture_event)); |
fling_parameters_.startTime = gesture_event.timeStampSeconds; |
fling_parameters_.delta = velocity; |
fling_parameters_.point = WebPoint(gesture_event.x, gesture_event.y); |