diff options
author | John Reck <jreck@google.com> | 2012-04-03 14:08:07 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2012-04-11 12:49:58 -0700 |
commit | 3d7cd084287f1dbc9fee600bf72af88c588a6429 (patch) | |
tree | 476fc13a5d4df0ffd793537fef8d7ee040d83061 /Source/WebKit/android/jni/WebViewCore.cpp | |
parent | 76088175b1505b9730f9a01f4c677641cef72e3a (diff) | |
download | external_webkit-3d7cd084287f1dbc9fee600bf72af88c588a6429.zip external_webkit-3d7cd084287f1dbc9fee600bf72af88c588a6429.tar.gz external_webkit-3d7cd084287f1dbc9fee600bf72af88c588a6429.tar.bz2 |
New touch input support
Bug: 6317798
Change-Id: Idea47af14e282b42c902c8158f08f6742ba576da
Diffstat (limited to 'Source/WebKit/android/jni/WebViewCore.cpp')
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index a4cd94f..debf249 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -3285,6 +3285,23 @@ void WebViewCore::touchUp(int touchGeneration, handleMouseClick(frame, node, false); } +bool WebViewCore::performMouseClick() +{ + WebCore::PlatformMouseEvent mouseDown(m_mousePos, m_mousePos, WebCore::LeftButton, + WebCore::MouseEventPressed, 1, false, false, false, false, + WTF::currentTime()); + // ignore the return from as it will return true if the hit point can trigger selection change + m_mainFrame->eventHandler()->handleMousePressEvent(mouseDown); + WebCore::PlatformMouseEvent mouseUp(m_mousePos, m_mousePos, WebCore::LeftButton, + WebCore::MouseEventReleased, 1, false, false, false, false, + WTF::currentTime()); + bool handled = m_mainFrame->eventHandler()->handleMouseReleaseEvent(mouseUp); + + WebCore::Node* focusNode = currentFocus(); + initializeTextInput(focusNode, false); + return handled; +} + // Check for the "x-webkit-soft-keyboard" attribute. If it is there and // set to hidden, do not show the soft keyboard. Node passed as a parameter // must not be null. @@ -3312,15 +3329,12 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node // Need to special case area tags because an image map could have an area element in the middle // so when attempting to get the default, the point chosen would be follow the wrong link. if (nodePtr->hasTagName(WebCore::HTMLNames::areaTag)) { - webFrame->setUserInitiatedAction(true); nodePtr->dispatchSimulatedClick(0, true, true); - webFrame->setUserInitiatedAction(false); return true; } } if (!valid || !framePtr) framePtr = m_mainFrame; - webFrame->setUserInitiatedAction(true); WebCore::PlatformMouseEvent mouseDown(m_mousePos, m_mousePos, WebCore::LeftButton, WebCore::MouseEventPressed, 1, false, false, false, false, WTF::currentTime()); @@ -3330,7 +3344,6 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node WebCore::MouseEventReleased, 1, false, false, false, false, WTF::currentTime()); bool handled = framePtr->eventHandler()->handleMouseReleaseEvent(mouseUp); - webFrame->setUserInitiatedAction(false); WebCore::Node* focusNode = currentFocus(); initializeTextInput(focusNode, fake); @@ -4688,6 +4701,12 @@ static void TouchUp(JNIEnv* env, jobject obj, jint nativeClass, (WebCore::Frame*) frame, (WebCore::Node*) node, x, y); } +static bool MouseClick(JNIEnv* env, jobject obj, jint nativeClass) +{ + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); + return viewImpl->performMouseClick(); +} + static jstring RetrieveHref(JNIEnv* env, jobject obj, jint nativeClass, jint x, jint y) { @@ -5109,6 +5128,8 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { (void*) HandleTouchEvent }, { "nativeTouchUp", "(IIIIII)V", (void*) TouchUp }, + { "nativeMouseClick", "(I)Z", + (void*) MouseClick }, { "nativeRetrieveHref", "(III)Ljava/lang/String;", (void*) RetrieveHref }, { "nativeRetrieveAnchorText", "(III)Ljava/lang/String;", |