summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 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;",
diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h
index 5e2bafb..a6b305b 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);