diff options
author | Leon Scroggins <scroggo@google.com> | 2009-06-15 15:55:35 -0400 |
---|---|---|
committer | Leon Scroggins <scroggo@google.com> | 2009-06-16 09:06:56 -0400 |
commit | 90bd422df8e04c486d29c4041acf1c4cf7c3b155 (patch) | |
tree | ca5c7c0cd8dc6f98cbb1e769053456511256d2d9 /WebKit/android/nav | |
parent | 482ac963709031a88ea3db7399eabe5ed5a2fb60 (diff) | |
download | external_webkit-90bd422df8e04c486d29c4041acf1c4cf7c3b155.zip external_webkit-90bd422df8e04c486d29c4041acf1c4cf7c3b155.tar.gz external_webkit-90bd422df8e04c486d29c4041acf1c4cf7c3b155.tar.bz2 |
Changes to make the cursor blink at the correct times.
Make the blinking caret active when the user actually starts editing
text. In WebView.cpp, determine whether to disable the blinking
caret and pass that info up to the Java call. Requires a matching
change in frameworks/base. Also add some comments for clarification,
and remove duplicate calling points for functions. Also change
glue for nativeSetFocusControllerActive to reflect its new name/
function.
This change also reflects a behavioral change. If the WebView or
its window lose focus, we do not restore the blinking caret when
focus returns.
Diffstat (limited to 'WebKit/android/nav')
-rw-r--r-- | WebKit/android/nav/WebView.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp index 22b07bc..8df6e23 100644 --- a/WebKit/android/nav/WebView.cpp +++ b/WebKit/android/nav/WebView.cpp @@ -128,7 +128,7 @@ WebView(JNIEnv* env, jobject javaWebView, int viewImpl) m_javaGlue.m_clearTextEntry = GetJMethod(env, clazz, "clearTextEntry", "()V"); m_javaGlue.m_overrideLoading = GetJMethod(env, clazz, "overrideLoading", "(Ljava/lang/String;)V"); m_javaGlue.m_sendMoveMouse = GetJMethod(env, clazz, "sendMoveMouse", "(IIII)V"); - m_javaGlue.m_sendMoveMouseIfLatest = GetJMethod(env, clazz, "sendMoveMouseIfLatest", "()V"); + m_javaGlue.m_sendMoveMouseIfLatest = GetJMethod(env, clazz, "sendMoveMouseIfLatest", "(Z)V"); m_javaGlue.m_sendMotionUp = GetJMethod(env, clazz, "sendMotionUp", "(IIIIII)V"); m_javaGlue.m_getScaledMaxXScroll = GetJMethod(env, clazz, "getScaledMaxXScroll", "()I"); m_javaGlue.m_getScaledMaxYScroll = GetJMethod(env, clazz, "getScaledMaxYScroll", "()I"); @@ -710,8 +710,11 @@ bool moveCursor(int keyCode, int count, bool ignoreScroll) } bool result = false; if (cachedNode) { - root->setCursor((CachedFrame*) cachedFrame, (CachedNode*) cachedNode); - sendMoveMouseIfLatest(); + root->setCursor(const_cast<CachedFrame*>(cachedFrame), + const_cast<CachedNode*>(cachedNode)); + bool disableFocusController = cachedNode != root->currentFocus() + && cachedNode->wantsKeyEvents(); + sendMoveMouseIfLatest(disableFocusController); viewInvalidate(); } else { int docHeight = root->documentHeight(); @@ -763,18 +766,23 @@ void selectBestAt(const WebCore::IntRect& rect) { const CachedFrame* frame; int rx, ry; + bool disableFocusController = false; CachedRoot* root = getFrameCache(DontAllowNewer); const CachedNode* node = findAt(root, rect, &frame, &rx, &ry); if (!node) { DBG_NAV_LOGD("no nodes found root=%p", root); + disableFocusController = true; if (root) root->setCursor(0, 0); } else { DBG_NAV_LOGD("CachedNode:%p (%d)", node, node->index()); root->setCursor(const_cast<CachedFrame*>(frame), - const_cast<CachedNode*>(node)); + const_cast<CachedNode*>(node)); + if (!node->wantsKeyEvents()) { + disableFocusController = true; + } } - sendMoveMouseIfLatest(); + sendMoveMouseIfLatest(disableFocusController); viewInvalidate(); } @@ -1014,12 +1022,12 @@ void sendMoveMouse(WebCore::Frame* framePtr, WebCore::Node* nodePtr, int x, int checkException(env); } -void sendMoveMouseIfLatest() +void sendMoveMouseIfLatest(bool disableFocusController) { LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!"); JNIEnv* env = JSC::Bindings::getJNIEnv(); env->CallVoidMethod(m_javaGlue.object(env).get(), - m_javaGlue.m_sendMoveMouseIfLatest); + m_javaGlue.m_sendMoveMouseIfLatest, disableFocusController); checkException(env); } |