diff options
author | Huahui Wu <hwu@google.com> | 2011-01-13 15:57:11 -0800 |
---|---|---|
committer | Huahui Wu <hwu@google.com> | 2011-01-13 16:43:58 -0800 |
commit | 4ac825dd95a2c0a351748f85f8fcae2d7968c94d (patch) | |
tree | 63996d2d1f80a3bc937d5808c874093d4d7b3342 | |
parent | 36d976165f994e4071601d8824987f25a0a8da07 (diff) | |
download | external_webkit-4ac825dd95a2c0a351748f85f8fcae2d7968c94d.zip external_webkit-4ac825dd95a2c0a351748f85f8fcae2d7968c94d.tar.gz external_webkit-4ac825dd95a2c0a351748f85f8fcae2d7968c94d.tar.bz2 |
b/3133123 Pass touch point ids to WebKit
This is the CL in WebKit side and it needs the framwork CL:
https://android-git.corp.google.com/g/#change,89630
Notice some changes touch open source WebKit's code, so b/3351313 is filed
to keep track of that.
Change-Id: I0ac5d75c4a90f14afeb2e3fc2dc5b1c437c631f8
-rw-r--r-- | WebCore/platform/PlatformTouchEvent.h | 3 | ||||
-rw-r--r-- | WebCore/platform/android/PlatformTouchEventAndroid.cpp | 6 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 14 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.h | 2 |
4 files changed, 16 insertions, 9 deletions
diff --git a/WebCore/platform/PlatformTouchEvent.h b/WebCore/platform/PlatformTouchEvent.h index 84ed910..e93c00e 100644 --- a/WebCore/platform/PlatformTouchEvent.h +++ b/WebCore/platform/PlatformTouchEvent.h @@ -66,7 +66,8 @@ public: #if PLATFORM(QT) PlatformTouchEvent(QTouchEvent*); #elif PLATFORM(ANDROID) - PlatformTouchEvent(const Vector<IntPoint>&, TouchEventType, PlatformTouchPoint::State, int metaState); + // Changes in next line is in ANDROID but waiting to upstream to WebKit. TODO: upstream it. + PlatformTouchEvent(const Vector<int>&, const Vector<IntPoint>&, TouchEventType, PlatformTouchPoint::State, int metaState); #elif PLATFORM(BREWMP) PlatformTouchEvent(AEEEvent, uint16 wParam, uint32 dwParam); #endif diff --git a/WebCore/platform/android/PlatformTouchEventAndroid.cpp b/WebCore/platform/android/PlatformTouchEventAndroid.cpp index 8b3d285..957fc54 100644 --- a/WebCore/platform/android/PlatformTouchEventAndroid.cpp +++ b/WebCore/platform/android/PlatformTouchEventAndroid.cpp @@ -37,13 +37,15 @@ enum AndroidMetaKeyState { META_SYM_ON = 0x04 }; -PlatformTouchEvent::PlatformTouchEvent(const Vector<IntPoint>& windowPoints, TouchEventType type, PlatformTouchPoint::State state, int metaState) +// Changes in next line is in ANDROID but waiting to upstream to WebKit. TODO: upstream it. +PlatformTouchEvent::PlatformTouchEvent(const Vector<int>& ids, const Vector<IntPoint>& windowPoints, TouchEventType type, PlatformTouchPoint::State state, int metaState) : m_type(type) , m_metaKey(false) { m_touchPoints.reserveCapacity(windowPoints.size()); for (unsigned c = 0; c < windowPoints.size(); c++) - m_touchPoints.append(PlatformTouchPoint(c, windowPoints[c], state)); + // Changes in next line is in ANDROID but waiting to upstream to WebKit. TODO: upstream it. + m_touchPoints.append(PlatformTouchPoint(ids[c], windowPoints[c], state)); m_altKey = metaState & META_ALT_ON; m_shiftKey = metaState & META_SHIFT_ON; diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index f7f1058..902ab96 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -2784,7 +2784,7 @@ GraphicsLayerAndroid* WebViewCore::graphicsRootLayer() const } #endif -bool WebViewCore::handleTouchEvent(int action, Vector<IntPoint>& points, int metaState) +bool WebViewCore::handleTouchEvent(int action, Vector<int>& ids, Vector<IntPoint>& points, int metaState) { bool preventDefault = false; @@ -2835,7 +2835,7 @@ bool WebViewCore::handleTouchEvent(int action, Vector<IntPoint>& points, int met points[c].setX(points[c].x() - m_scrollOffsetX); points[c].setY(points[c].y() - m_scrollOffsetY); } - WebCore::PlatformTouchEvent te(points, type, touchState, metaState); + WebCore::PlatformTouchEvent te(ids, points, type, touchState, metaState); preventDefault = m_mainFrame->eventHandler()->handleTouchEvent(te); #endif @@ -3756,7 +3756,7 @@ static jstring FindAddress(JNIEnv *env, jobject obj, jstring addr, return ret; } -static jboolean HandleTouchEvent(JNIEnv *env, jobject obj, jint action, +static jboolean HandleTouchEvent(JNIEnv *env, jobject obj, jint action, jintArray idArray, jintArray xArray, jintArray yArray, jint count, jint metaState) { #ifdef ANDROID_INSTRUMENT @@ -3764,17 +3764,21 @@ static jboolean HandleTouchEvent(JNIEnv *env, jobject obj, jint action, #endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); + jint* ptrIdArray = env->GetIntArrayElements(idArray, 0); jint* ptrXArray = env->GetIntArrayElements(xArray, 0); jint* ptrYArray = env->GetIntArrayElements(yArray, 0); + Vector<int> ids(count); Vector<IntPoint> points(count); for (int c = 0; c < count; c++) { + ids[c] = ptrIdArray[c]; points[c].setX(ptrXArray[c]); points[c].setY(ptrYArray[c]); } + env->ReleaseIntArrayElements(idArray, ptrIdArray, JNI_ABORT); env->ReleaseIntArrayElements(xArray, ptrXArray, JNI_ABORT); env->ReleaseIntArrayElements(yArray, ptrYArray, JNI_ABORT); - return viewImpl->handleTouchEvent(action, points, metaState); + return viewImpl->handleTouchEvent(action, ids, points, metaState); } static void TouchUp(JNIEnv *env, jobject obj, jint touchGeneration, @@ -4200,7 +4204,7 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { (void*) SaveDocumentState }, { "nativeFindAddress", "(Ljava/lang/String;Z)Ljava/lang/String;", (void*) FindAddress }, - { "nativeHandleTouchEvent", "(I[I[III)Z", + { "nativeHandleTouchEvent", "(I[I[I[III)Z", (void*) HandleTouchEvent }, { "nativeTouchUp", "(IIIII)V", (void*) TouchUp }, diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index fa474ce..698b711 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -332,7 +332,7 @@ namespace android { /** * Handle touch event */ - bool handleTouchEvent(int action, Vector<IntPoint>& points, int metaState); + bool handleTouchEvent(int action, Vector<int>& ids, Vector<IntPoint>& points, int metaState); /** * Handle motionUp event from the UI thread (called touchUp in the |