Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1106)

Unified Diff: content/browser/android/content_view_core_impl.cc

Issue 1251323002: Plumb smooth scrolling in Chromium compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698