diff options
| author | Grace Kloba <klobag@google.com> | 2009-12-09 16:00:52 -0800 |
|---|---|---|
| committer | Jean-Baptiste Queru <jbq@google.com> | 2009-12-10 09:47:27 -0800 |
| commit | dc417b235a5d3dc193fa6a4e1884fd04428b79e2 (patch) | |
| tree | b09892444cee007d162e5696b983ce33fb000d0b /WebKit/android/jni | |
| parent | 02967298aed46eb168ef8ce30d7212e2ab0487c9 (diff) | |
| download | external_webkit-dc417b235a5d3dc193fa6a4e1884fd04428b79e2.zip external_webkit-dc417b235a5d3dc193fa6a4e1884fd04428b79e2.tar.gz external_webkit-dc417b235a5d3dc193fa6a4e1884fd04428b79e2.tar.bz2 | |
am 3d0d3fda: Enable longpress and doubletap to WebKit as touch event if it is requested.
Merge commit '3d0d3fdaa1308448b47592c03cda81c7f9e1f789' into eclair-mr2-plus-aosp
* commit '3d0d3fdaa1308448b47592c03cda81c7f9e1f789':
Enable longpress and doubletap to WebKit as touch
Diffstat (limited to 'WebKit/android/jni')
| -rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 14 | ||||
| -rw-r--r-- | WebKit/android/jni/WebViewCore.h | 2 |
2 files changed, 11 insertions, 5 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 3243db2..8542db4 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -1977,9 +1977,9 @@ void WebViewCore::click(WebCore::Frame* frame, WebCore::Node* node) { } } -bool WebViewCore::handleTouchEvent(int action, int x, int y) +int WebViewCore::handleTouchEvent(int action, int x, int y) { - bool preventDefault = false; + int preventDefault = 0; #if ENABLE(TOUCH_EVENTS) // Android WebCore::TouchEventType type = WebCore::TouchEventCancel; @@ -1996,6 +1996,12 @@ bool WebViewCore::handleTouchEvent(int action, int x, int y) case 3: // MotionEvent.ACTION_CANCEL type = WebCore::TouchEventCancel; break; + case 0x100: // WebViewCore.ACTION_LONGPRESS + type = WebCore::TouchEventLongPress; + break; + case 0x200: // WebViewCore.ACTION_DOUBLETAP + type = WebCore::TouchEventDoubleTap; + break; } WebCore::IntPoint pt(x - m_scrollOffsetX, y - m_scrollOffsetY); WebCore::PlatformTouchEvent te(pt, pt, type); @@ -2663,7 +2669,7 @@ static jstring FindAddress(JNIEnv *env, jobject obj, jstring addr, return ret; } -static jboolean HandleTouchEvent(JNIEnv *env, jobject obj, jint action, jint x, jint y) +static jint HandleTouchEvent(JNIEnv *env, jobject obj, jint action, jint x, jint y) { #ifdef ANDROID_INSTRUMENT TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); @@ -3037,7 +3043,7 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { (void*) SaveDocumentState }, { "nativeFindAddress", "(Ljava/lang/String;Z)Ljava/lang/String;", (void*) FindAddress }, - { "nativeHandleTouchEvent", "(III)Z", + { "nativeHandleTouchEvent", "(III)I", (void*) HandleTouchEvent }, { "nativeTouchUp", "(IIIII)V", (void*) TouchUp }, diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index 8a0df23..7385dac 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -277,7 +277,7 @@ namespace android { /** * Handle touch event */ - bool handleTouchEvent(int action, int x, int y); + int handleTouchEvent(int action, int x, int y); /** * Handle motionUp event from the UI thread (called touchUp in the |
