summaryrefslogtreecommitdiffstats
path: root/WebKit/android
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2011-01-25 09:23:26 -0500
committerLeon Scroggins <scroggo@google.com>2011-01-25 09:35:53 -0500
commit7cf14d751364973cc8ce88fe9b822008ef83d2a5 (patch)
treedcf21086d5ee5ec4ad5c9ec7f58dd8f048844167 /WebKit/android
parent3adf18ff68c18ee48f402c702f321c93eca82915 (diff)
downloadexternal_webkit-7cf14d751364973cc8ce88fe9b822008ef83d2a5.zip
external_webkit-7cf14d751364973cc8ce88fe9b822008ef83d2a5.tar.gz
external_webkit-7cf14d751364973cc8ce88fe9b822008ef83d2a5.tar.bz2
Use an integer to keep track of the blurring node.
Bug:3387251 Rather than storing the actual pointer to the Node, since the pointer may no longer be valid and it is only used for comparison anyway. Change-Id: Icc6aabfa66c4a40b40fb6a8673d7ad34346360b6
Diffstat (limited to 'WebKit/android')
-rw-r--r--WebKit/android/jni/WebViewCore.cpp27
-rw-r--r--WebKit/android/jni/WebViewCore.h3
2 files changed, 11 insertions, 19 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 52cdfed..1365977 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -457,7 +457,7 @@ void WebViewCore::reset(bool fromConstructor)
}
m_lastFocused = 0;
- m_blurringNode = 0;
+ m_blurringNodePointer = 0;
m_lastFocusedBounds = WebCore::IntRect(0,0,0,0);
m_focusBoundsChanged = false;
m_lastFocusedSelStart = 0;
@@ -2983,7 +2983,6 @@ static void scrollLayer(WebCore::RenderObject* renderer, WebCore::IntPoint* pos)
// in which case, 'fake' is set to true
bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* nodePtr, bool fake, int scrollY)
{
- m_lastClickWasOnTextInput = false;
bool valid = framePtr == NULL
|| CacheBuilder::validNode(m_mainFrame, framePtr, nodePtr);
WebFrame* webFrame = WebFrame::getWebFrame(m_mainFrame);
@@ -3041,11 +3040,6 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node
static_cast<RenderTextControl*>(renderer)->setScrollTop(scrollY);
else
scrollLayer(renderer, &m_mousePos);
- if (isTextInput(nodePtr)) {
- // The user clicked on a text input field. If this causes a blur event
- // on a different text input, do not hide the keyboard in formDidBlur
- m_lastClickWasOnTextInput = true;
- }
}
if (!valid || !framePtr)
framePtr = m_mainFrame;
@@ -3061,8 +3055,6 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node
bool handled = framePtr->eventHandler()->handleMouseReleaseEvent(mouseUp);
webFrame->setUserInitiatedAction(false);
- m_lastClickWasOnTextInput = false;
-
// If the user clicked on a textfield, make the focusController active
// so we show the blinking cursor.
WebCore::Node* focusNode = currentFocus();
@@ -3127,23 +3119,24 @@ void WebViewCore::popupReply(const int* array, int count)
void WebViewCore::formDidBlur(const WebCore::Node* node)
{
- // This blur is the result of clicking on a different input. Do not hide
- // the keyboard, since it will just be opened again.
- if (m_lastClickWasOnTextInput) return;
- m_blurringNode = node;
+ // If the blur is on a text input, keep track of the node so we can
+ // hide the soft keyboard when the new focus is set, if it is not a
+ // text input.
+ if (isTextInput(node))
+ m_blurringNodePointer = reinterpret_cast<int>(node);
}
void WebViewCore::focusNodeChanged(const WebCore::Node* newFocus)
{
- if (!m_blurringNode)
+ if (!m_blurringNodePointer)
return;
- if (isTextInput(m_blurringNode) && !isTextInput(newFocus)) {
+ if (!isTextInput(newFocus)) {
JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue->object(env).get(),
- m_javaGlue->m_formDidBlur, reinterpret_cast<int>(m_blurringNode));
+ m_javaGlue->m_formDidBlur, m_blurringNodePointer);
checkException(env);
}
- m_blurringNode = 0;
+ m_blurringNodePointer = 0;
}
void WebViewCore::addMessageToConsole(const WTF::String& message, unsigned int lineNumber, const WTF::String& sourceID, int msgLevel) {
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index ed67742..611ee59 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -602,8 +602,7 @@ namespace android {
WebCoreReply* m_popupReply;
WebCore::Node* m_lastFocused;
WebCore::IntRect m_lastFocusedBounds;
- bool m_lastClickWasOnTextInput;
- const WebCore::Node* m_blurringNode;
+ int m_blurringNodePointer;
int m_lastFocusedSelStart;
int m_lastFocusedSelEnd;
PictureSet m_content; // the set of pictures to draw