Index: content/browser/renderer_host/input/synthetic_smooth_move_gesture.cc |
diff --git a/content/browser/renderer_host/input/synthetic_smooth_move_gesture.cc b/content/browser/renderer_host/input/synthetic_smooth_move_gesture.cc |
index 2ed8452992c33aad6f3cab3c274a059ed0cef634..c8c414ba73a76b1e69e3944d662a7048594748b1 100644 |
--- a/content/browser/renderer_host/input/synthetic_smooth_move_gesture.cc |
+++ b/content/browser/renderer_host/input/synthetic_smooth_move_gesture.cc |
@@ -38,7 +38,8 @@ const int kDefaultSpeedInPixelsPerSec = 800; |
} // namespace |
SyntheticSmoothMoveGestureParams::SyntheticSmoothMoveGestureParams() |
- : speed_in_pixels_s(kDefaultSpeedInPixelsPerSec), |
+ : velocity(gfx::Vector2dF(0, 0)), |
+ speed_in_pixels_s(kDefaultSpeedInPixelsPerSec), |
prevent_fling(true), |
add_slop(true) {} |
@@ -177,18 +178,21 @@ void SyntheticSmoothMoveGesture::ForwardMouseWheelInputEvents( |
if (!IsLastMoveSegment()) { |
current_move_segment_total_delta_discrete_ = gfx::Vector2d(); |
ComputeNextMoveSegment(); |
- ForwardMouseWheelInputEvents(timestamp, target); |
- } else { |
+ } else if (params_.prevent_fling) { |
state_ = DONE; |
+ } else { |
+ state_ = STOPPING; |
} |
} |
} break; |
+ case STOPPING: { |
+ gfx::Vector2d velocity_discrete = FloorTowardZero(params_.velocity); |
+ ForwardTouchpadFlingEvent(target, velocity_discrete, timestamp); |
+ state_ = DONE; |
+ } break; |
case SETUP: |
NOTREACHED() << "State SETUP invalid for synthetic scroll using mouse " |
"wheel input."; |
- case STOPPING: |
- NOTREACHED() << "State STOPPING invalid for synthetic scroll using mouse " |
- "wheel input."; |
case DONE: |
NOTREACHED() |
<< "State DONE invalid for synthetic scroll using mouse wheel input."; |
@@ -254,6 +258,23 @@ void SyntheticSmoothMoveGesture::ForwardMouseWheelEvent( |
target->DispatchInputEventToPlatform(mouse_wheel_event); |
} |
+void SyntheticSmoothMoveGesture::ForwardTouchpadFlingEvent( |
+ SyntheticGestureTarget* target, |
+ const gfx::Vector2dF& velocity, |
+ const base::TimeTicks& timestamp) const { |
+ blink::WebGestureEvent fling_event = |
+ SyntheticWebGestureEventBuilder::BuildFling( |
+ velocity.x(), velocity.y(), |
+ blink::WebGestureDevice::kWebGestureDeviceTouchpad); |
+ |
+ fling_event.x = current_move_segment_start_position_.x(); |
+ fling_event.y = current_move_segment_start_position_.y(); |
+ |
+ fling_event.SetTimeStampSeconds(ConvertTimestampToSeconds(timestamp)); |
+ |
+ target->DispatchInputEventToPlatform(fling_event); |
+} |
+ |
void SyntheticSmoothMoveGesture::PressPoint(SyntheticGestureTarget* target, |
const base::TimeTicks& timestamp) { |
DCHECK_EQ(current_move_segment_, 0); |