Index: content/browser/android/content_view_core_impl.cc |
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc |
index dd9bab868ac8c7921370b381c6b292f95a86996b..8e317fd53403bf80fb526ad7721a31a097c0734e 100644 |
--- a/content/browser/android/content_view_core_impl.cc |
+++ b/content/browser/android/content_view_core_impl.cc |
@@ -1066,6 +1066,31 @@ void ContentViewCoreImpl::FlingCancel(JNIEnv* env, jobject obj, jlong time_ms) { |
SendGestureEvent(event); |
} |
+void ContentViewCoreImpl::SmoothScrollStart(JNIEnv* env, |
+ jobject obj, |
+ jlong time_ms, |
+ float start_x, |
+ float start_y, |
+ float dx, |
+ float dy, |
+ jlong duration_ms) { |
+ WebGestureEvent event = MakeGestureEvent(WebInputEvent::GestureFlingStart, |
+ time_ms, start_x, start_y); |
+ event.data.flingStart.isSmoothScroll = true; |
+ event.data.flingStart.dx = dx / dpi_scale(); |
+ event.data.flingStart.dy = dy / dpi_scale(); |
+ event.data.flingStart.durationMs = duration_ms; |
+ event.data.flingStart.targetViewport = true; |
+ |
+ // Velocities are not used for computing the smooth scroll animation curve. |
+ // But they are included here anyways because zero-velocity fling results in |
+ // GestureScrollEnd immediately. |
+ event.data.flingStart.velocityX = dx / dpi_scale() / time_ms * 1000; |
+ event.data.flingStart.velocityY = dy / dpi_scale() / time_ms * 1000; |
+ |
+ SendGestureEvent(event); |
+} |
+ |
void ContentViewCoreImpl::SingleTap(JNIEnv* env, jobject obj, jlong time_ms, |
jfloat x, jfloat y) { |
// Tap gestures should always be preceded by a TapDown, ensuring consistency |