summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2012-04-11 16:03:52 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-04-11 16:03:52 -0700
commit8266295cc837f73c2bcfbcca3f8b330d4991fc0e (patch)
tree7c746380be98c4b9eb29d323f6d17e2528b01fe5 /Source
parente277b19cbb1c0f76e2dd6b9c77c9875628496393 (diff)
parent3d7cd084287f1dbc9fee600bf72af88c588a6429 (diff)
downloadexternal_webkit-8266295cc837f73c2bcfbcca3f8b330d4991fc0e.zip
external_webkit-8266295cc837f73c2bcfbcca3f8b330d4991fc0e.tar.gz
external_webkit-8266295cc837f73c2bcfbcca3f8b330d4991fc0e.tar.bz2
Merge "New touch input support"
Diffstat (limited to 'Source')
-rw-r--r--Source/WebKit/android/jni/WebCoreFrameBridge.cpp1
-rw-r--r--Source/WebKit/android/jni/WebCoreFrameBridge.h8
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp29
-rw-r--r--Source/WebKit/android/jni/WebViewCore.h5
4 files changed, 30 insertions, 13 deletions
diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
index d0f3830..7a2971a 100644
--- a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -316,7 +316,6 @@ WebFrame::WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page*
ALOG_ASSERT(mJavaFrame->mAutoLogin, "Could not find method autoLogin");
mUserAgent = WTF::String();
- mUserInitiatedAction = false;
mBlockNetworkLoads = false;
m_renderSkins = 0;
}
diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.h b/Source/WebKit/android/jni/WebCoreFrameBridge.h
index 13f99af..30c1d83 100644
--- a/Source/WebKit/android/jni/WebCoreFrameBridge.h
+++ b/Source/WebKit/android/jni/WebCoreFrameBridge.h
@@ -128,13 +128,6 @@ class WebFrame : public WebCoreRefObject {
// application.
void autoLogin(const std::string& loginHeader);
- /**
- * When the user initiates a click, we set mUserInitiatedAction to true.
- * If a load happens due to this click, then we ask the application if it wants
- * to override the load. Otherwise, we attempt to load the resource internally.
- */
- void setUserInitiatedAction(bool userInitiatedAction) { mUserInitiatedAction = userInitiatedAction; }
-
WebCore::Page* page() const { return mPage; }
// Currently used only by the chrome net stack. A similar field is used by
@@ -163,7 +156,6 @@ class WebFrame : public WebCoreRefObject {
WebCore::Page* mPage;
WTF::String mUserAgent;
bool mBlockNetworkLoads;
- bool mUserInitiatedAction;
WebCore::RenderSkinAndroid* m_renderSkins;
};
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp
index 212bd38..bf87668 100644
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -3264,6 +3264,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.
@@ -3291,15 +3308,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());
@@ -3309,7 +3323,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);
@@ -4657,6 +4670,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)
{
@@ -5078,6 +5097,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;",
diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h
index d3f0e18..00b4bda 100644
--- a/Source/WebKit/android/jni/WebViewCore.h
+++ b/Source/WebKit/android/jni/WebViewCore.h
@@ -350,6 +350,11 @@ namespace android {
WebCore::Node* node, int x, int y);
/**
+ * Clicks the mouse at its current location
+ */
+ bool performMouseClick();
+
+ /**
* Sets the index of the label from a popup
*/
void popupReply(int index);