From 91f41286e33b387859e4841711f3054bcf75c748 Mon Sep 17 00:00:00 2001 From: John Reck Date: Thu, 24 May 2012 14:31:43 -0700 Subject: Support skipping a touch stream due to lack of handlers Bug: 6317798 Change-Id: I8c4cd3bf4c538aff202ed0e3f84982fb112936a1 --- Source/WebKit/android/jni/WebViewCore.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'Source/WebKit/android/jni/WebViewCore.cpp') diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index 9d81edc..3d86761 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -178,6 +178,9 @@ FILE* gRenderTreeFile = 0; // prerenders #define PRERENDER_AFTER_SCROLL_DELAY 750 +#define TOUCH_FLAG_HIT_HANDLER 0x1 +#define TOUCH_FLAG_PREVENT_DEFAULT 0x2 + //////////////////////////////////////////////////////////////////////////////////////////////// namespace android { @@ -3185,9 +3188,9 @@ GraphicsLayerAndroid* WebViewCore::graphicsRootLayer() const } #endif -bool WebViewCore::handleTouchEvent(int action, Vector& ids, Vector& points, int actionIndex, int metaState) +int WebViewCore::handleTouchEvent(int action, Vector& ids, Vector& points, int actionIndex, int metaState) { - bool preventDefault = false; + int flags = 0; #if USE(ACCELERATED_COMPOSITING) GraphicsLayerAndroid* rootLayer = graphicsRootLayer(); @@ -3251,14 +3254,17 @@ bool WebViewCore::handleTouchEvent(int action, Vector& ids, VectoreventHandler()->handleTouchEvent(te); + if (m_mainFrame->eventHandler()->handleTouchEvent(te)) + flags |= TOUCH_FLAG_PREVENT_DEFAULT; + if (te.hitTouchHandler()) + flags |= TOUCH_FLAG_HIT_HANDLER; #endif #if USE(ACCELERATED_COMPOSITING) if (rootLayer) rootLayer->pauseDisplay(false); #endif - return preventDefault; + return flags; } bool WebViewCore::performMouseClick() @@ -4596,7 +4602,7 @@ static jstring FindAddress(JNIEnv* env, jobject obj, jstring addr, return ret; } -static jboolean HandleTouchEvent(JNIEnv* env, jobject obj, jint nativeClass, +static jint HandleTouchEvent(JNIEnv* env, jobject obj, jint nativeClass, jint action, jintArray idArray, jintArray xArray, jintArray yArray, jint count, jint actionIndex, jint metaState) { @@ -5037,7 +5043,7 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { (void*) SaveDocumentState }, { "nativeFindAddress", "(Ljava/lang/String;Z)Ljava/lang/String;", (void*) FindAddress }, - { "nativeHandleTouchEvent", "(II[I[I[IIII)Z", + { "nativeHandleTouchEvent", "(II[I[I[IIII)I", (void*) HandleTouchEvent }, { "nativeMouseClick", "(I)Z", (void*) MouseClick }, -- cgit v1.1