diff options
| author | Leon Scroggins <scroggo@google.com> | 2009-06-26 14:23:05 -0400 |
|---|---|---|
| committer | Leon Scroggins <scroggo@google.com> | 2009-06-26 15:26:52 -0400 |
| commit | af20123d135af00dd2762754671d88e4d52122c8 (patch) | |
| tree | d125931cd3d37ba152e3f613269082c7b9b1f59c /WebKit | |
| parent | c6e6c5df58bb3affa6188cf88839c0086ed6e6ff (diff) | |
| download | external_webkit-af20123d135af00dd2762754671d88e4d52122c8.zip external_webkit-af20123d135af00dd2762754671d88e4d52122c8.tar.gz external_webkit-af20123d135af00dd2762754671d88e4d52122c8.tar.bz2 | |
Make clicking the trackball on a <select> element work.
Optionally pass a frame and node pointer to nativeClick, since
the hit testing does not find the HTMLSelectElement node. Also
change the signature of nativeClick to return void, since
we never use the return value. Requires a change in
frameworks/base.
Diffstat (limited to 'WebKit')
| -rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 33 | ||||
| -rw-r--r-- | WebKit/android/jni/WebViewCore.h | 4 |
2 files changed, 19 insertions, 18 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index f491ccb..11576be 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -1657,20 +1657,20 @@ bool WebViewCore::key(int keyCode, UChar32 unichar, int repeatCount, bool isShif } // For when the user clicks the trackball -bool WebViewCore::click() { - bool keyHandled = false; - WebCore::IntPoint pt = m_mousePos; - pt.move(m_scrollOffsetX, m_scrollOffsetY); - WebCore::HitTestResult hitTestResult = m_mainFrame->eventHandler()-> - hitTestResultAtPoint(pt, false); - WebCore::Node* focusNode = hitTestResult.innerNode(); - DBG_NAV_LOGD("m_mousePos=(%d,%d) m_scrollOffset=(%d,%d) pt=(%d,%d)" - " focusNode=%p", m_mousePos.x(), m_mousePos.y(), - m_scrollOffsetX, m_scrollOffsetY, pt.x(), pt.y(), focusNode); - if (focusNode) { - keyHandled = handleMouseClick(focusNode->document()->frame(), focusNode); +void WebViewCore::click(WebCore::Frame* frame, WebCore::Node* node) { + if (!node) { + WebCore::IntPoint pt = m_mousePos; + pt.move(m_scrollOffsetX, m_scrollOffsetY); + WebCore::HitTestResult hitTestResult = m_mainFrame->eventHandler()-> + hitTestResultAtPoint(pt, false); + node = hitTestResult.innerNode(); + frame = node->document()->frame(); + DBG_NAV_LOGD("m_mousePos=(%d,%d) m_scrollOffset=(%d,%d) pt=(%d,%d)" + " node=%p", m_mousePos.x(), m_mousePos.y(), + m_scrollOffsetX, m_scrollOffsetY, pt.x(), pt.y(), node); } - return keyHandled; + if (node) + handleMouseClick(frame, node); } bool WebViewCore::handleTouchEvent(int action, int x, int y) @@ -2042,7 +2042,7 @@ static jboolean Key(JNIEnv *env, jobject obj, jint keyCode, jint unichar, return viewImpl->key(keyCode, unichar, repeatCount, isShift, isAlt, isDown); } -static jboolean Click(JNIEnv *env, jobject obj) +static void Click(JNIEnv *env, jobject obj, int framePtr, int nodePtr) { #ifdef ANDROID_INSTRUMENT TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); @@ -2050,7 +2050,8 @@ static jboolean Click(JNIEnv *env, jobject obj) WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in Click"); - return viewImpl->click(); + viewImpl->click(reinterpret_cast<WebCore::Frame*>(framePtr), + reinterpret_cast<WebCore::Node*>(nodePtr)); } static void DeleteSelection(JNIEnv *env, jobject obj, jint start, jint end) @@ -2481,7 +2482,7 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { (void*) DrawContent } , { "nativeKey", "(IIIZZZ)Z", (void*) Key }, - { "nativeClick", "()Z", + { "nativeClick", "(II)V", (void*) Click }, { "nativePictureReady", "()Z", (void*) PictureReady } , diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index 04a78e2..b9fff87 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -214,9 +214,9 @@ namespace android { bool key(int keyCode, UChar32 unichar, int repeatCount, bool isShift, bool isAlt, bool isDown); /** - * Handle (mouse) click event from Java + * Handle (trackball) click event from Java */ - bool click(); + void click(WebCore::Frame* frame, WebCore::Node* node); /** * Handle touch event |
