OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/android/content_view_core_impl.h" | 5 #include "content/browser/android/content_view_core_impl.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 event.data.scrollUpdate.deltaY = -dy / GetDpiScale(); | 1175 event.data.scrollUpdate.deltaY = -dy / GetDpiScale(); |
1176 | 1176 |
1177 SendGestureEvent(event); | 1177 SendGestureEvent(event); |
1178 } | 1178 } |
1179 | 1179 |
1180 void ContentViewCoreImpl::FlingStart(JNIEnv* env, jobject obj, jlong time_ms, | 1180 void ContentViewCoreImpl::FlingStart(JNIEnv* env, jobject obj, jlong time_ms, |
1181 jfloat x, jfloat y, jfloat vx, jfloat vy) { | 1181 jfloat x, jfloat y, jfloat vx, jfloat vy) { |
1182 WebGestureEvent event = MakeGestureEvent( | 1182 WebGestureEvent event = MakeGestureEvent( |
1183 WebInputEvent::GestureFlingStart, time_ms, x, y); | 1183 WebInputEvent::GestureFlingStart, time_ms, x, y); |
1184 | 1184 |
1185 // Velocity should not be scaled by DIP since that interacts poorly with the | 1185 event.data.flingStart.velocityX = vx / GetDpiScale(); |
1186 // deceleration constants. The DIP scaling is done on the renderer. | 1186 event.data.flingStart.velocityY = vy / GetDpiScale(); |
1187 event.data.flingStart.velocityX = vx; | |
1188 event.data.flingStart.velocityY = vy; | |
1189 | 1187 |
1190 SendGestureEvent(event); | 1188 SendGestureEvent(event); |
1191 } | 1189 } |
1192 | 1190 |
1193 void ContentViewCoreImpl::FlingCancel(JNIEnv* env, jobject obj, jlong time_ms) { | 1191 void ContentViewCoreImpl::FlingCancel(JNIEnv* env, jobject obj, jlong time_ms) { |
1194 WebGestureEvent event = MakeGestureEvent( | 1192 WebGestureEvent event = MakeGestureEvent( |
1195 WebInputEvent::GestureFlingCancel, time_ms, 0, 0); | 1193 WebInputEvent::GestureFlingCancel, time_ms, 0, 0); |
1196 SendGestureEvent(event); | 1194 SendGestureEvent(event); |
1197 } | 1195 } |
1198 | 1196 |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1863 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1861 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1864 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1862 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1865 return reinterpret_cast<intptr_t>(view); | 1863 return reinterpret_cast<intptr_t>(view); |
1866 } | 1864 } |
1867 | 1865 |
1868 bool RegisterContentViewCore(JNIEnv* env) { | 1866 bool RegisterContentViewCore(JNIEnv* env) { |
1869 return RegisterNativesImpl(env); | 1867 return RegisterNativesImpl(env); |
1870 } | 1868 } |
1871 | 1869 |
1872 } // namespace content | 1870 } // namespace content |
OLD | NEW |