diff options
author | Huahui Wu <hwu@google.com> | 2011-07-07 11:05:05 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-07-07 11:05:05 -0700 |
commit | 37c6a519f61c149038a2ddf6ac9f368bce8b1259 (patch) | |
tree | e5bcef0e76050583f69e02c46647ff925a76aaae /Source | |
parent | 26c172852dc47910de9850e9e4b6d46687c1d1f0 (diff) | |
parent | 7b306176de5c64ae37dbb93e9324dd6636c5b564 (diff) | |
download | external_webkit-37c6a519f61c149038a2ddf6ac9f368bce8b1259.zip external_webkit-37c6a519f61c149038a2ddf6ac9f368bce8b1259.tar.gz external_webkit-37c6a519f61c149038a2ddf6ac9f368bce8b1259.tar.bz2 |
Merge "b/3302378 Passes touch pressures, sizes and timestamps to Webkit"
Diffstat (limited to 'Source')
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 31 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.h | 2 |
2 files changed, 27 insertions, 6 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index 966a540..d8e2a0b 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -3102,7 +3102,7 @@ GraphicsLayerAndroid* WebViewCore::graphicsRootLayer() const } #endif -bool WebViewCore::handleTouchEvent(int action, Vector<int>& ids, Vector<IntPoint>& points, int actionIndex, int metaState) +bool WebViewCore::handleTouchEvent(int action, long eventTimeInMs, Vector<int>& ids, Vector<IntPoint>& points, Vector<float>& pressures, Vector<int>& touchMajor, Vector<int>& touchMinor, Vector<float>& orientation, int actionIndex, int metaState) { bool preventDefault = false; @@ -3175,6 +3175,9 @@ bool WebViewCore::handleTouchEvent(int action, Vector<int>& ids, Vector<IntPoint }; } + // TODO: use the pressure, size and timestamp data once WebKit is synced to + // the upstream version that has the fields for these data in Touch.h and + // PlatformTouchPoint.h. WebCore::PlatformTouchEvent te(ids, points, type, touchStates, metaState); preventDefault = m_mainFrame->eventHandler()->handleTouchEvent(te); #endif @@ -4170,8 +4173,10 @@ static jstring FindAddress(JNIEnv *env, jobject obj, jstring addr, return ret; } -static jboolean HandleTouchEvent(JNIEnv *env, jobject obj, jint action, jintArray idArray, - jintArray xArray, jintArray yArray, +static jboolean HandleTouchEvent(JNIEnv *env, jobject obj, jint action, jlong eventTimeInMs, + jintArray idArray, jintArray xArray, jintArray yArray, + jfloatArray pressureArray, jintArray touchMajorArray, + jintArray touchMinorArray, jfloatArray orientationArray, jint count, jint actionIndex, jint metaState) { #ifdef ANDROID_INSTRUMENT @@ -4182,18 +4187,34 @@ static jboolean HandleTouchEvent(JNIEnv *env, jobject obj, jint action, jintArra jint* ptrIdArray = env->GetIntArrayElements(idArray, 0); jint* ptrXArray = env->GetIntArrayElements(xArray, 0); jint* ptrYArray = env->GetIntArrayElements(yArray, 0); + jfloat* ptrPressureArray = env->GetFloatArrayElements(pressureArray, 0); + jint* ptrTouchMajorArray = env->GetIntArrayElements(touchMajorArray, 0); + jint* ptrTouchMinorArray = env->GetIntArrayElements(touchMinorArray, 0); + jfloat* ptrOrientationArray = env->GetFloatArrayElements(orientationArray, 0); Vector<int> ids(count); Vector<IntPoint> points(count); + Vector<float> pressures(count); + Vector<int> touchMajor(count); + Vector<int> touchMinor(count); + Vector<float> orientation(count); for (int c = 0; c < count; c++) { ids[c] = ptrIdArray[c]; points[c].setX(ptrXArray[c]); points[c].setY(ptrYArray[c]); + pressures[c] = ptrPressureArray[c]; + touchMajor[c] = ptrTouchMajorArray[c]; + touchMinor[c] = ptrTouchMinorArray[c]; + orientation[c] = ptrOrientationArray[c]; } env->ReleaseIntArrayElements(idArray, ptrIdArray, JNI_ABORT); env->ReleaseIntArrayElements(xArray, ptrXArray, JNI_ABORT); env->ReleaseIntArrayElements(yArray, ptrYArray, JNI_ABORT); + env->ReleaseFloatArrayElements(pressureArray, ptrPressureArray, JNI_ABORT); + env->ReleaseIntArrayElements(touchMajorArray, ptrTouchMajorArray, JNI_ABORT); + env->ReleaseIntArrayElements(touchMinorArray, ptrTouchMinorArray, JNI_ABORT); + env->ReleaseFloatArrayElements(orientationArray, ptrOrientationArray, JNI_ABORT); - return viewImpl->handleTouchEvent(action, ids, points, actionIndex, metaState); + return viewImpl->handleTouchEvent(action, eventTimeInMs, ids, points, pressures, touchMajor, touchMinor, orientation, actionIndex, metaState); } static void TouchUp(JNIEnv *env, jobject obj, jint touchGeneration, @@ -4629,7 +4650,7 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { (void*) SaveDocumentState }, { "nativeFindAddress", "(Ljava/lang/String;Z)Ljava/lang/String;", (void*) FindAddress }, - { "nativeHandleTouchEvent", "(I[I[I[IIII)Z", + { "nativeHandleTouchEvent", "(IJ[I[I[I[F[I[I[FIII)Z", (void*) HandleTouchEvent }, { "nativeTouchUp", "(IIIII)V", (void*) TouchUp }, diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h index 877f716..5a14ec7 100644 --- a/Source/WebKit/android/jni/WebViewCore.h +++ b/Source/WebKit/android/jni/WebViewCore.h @@ -328,7 +328,7 @@ namespace android { /** * Handle touch event */ - bool handleTouchEvent(int action, Vector<int>& ids, Vector<IntPoint>& points, int actionIndex, int metaState); + bool handleTouchEvent(int action, long eventTimeInMs, Vector<int>& ids, Vector<IntPoint>& points, Vector<float>& pressures, Vector<int>& touchMajor, Vector<int>& touchMinor, Vector<float>& orientation, int actionIndex, int metaState); /** * Handle motionUp event from the UI thread (called touchUp in the |