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;
}
#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;
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
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
#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,
(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 },