diff options
| author | 2012-02-15 18:04:16 -0800 | |
|---|---|---|
| committer | 2012-02-15 18:04:16 -0800 | |
| commit | d22bf4b09a819a342e87ac5c2ac881cda31e8e27 (patch) | |
| tree | 4c9fd74c969b652f8651367c04ae721fdffd1c9d | |
| parent | e83b83fe20aa89f9bf730bb07006890f6c65e89c (diff) | |
| parent | 9b24dad746718df41f6260e36f2e824868896d02 (diff) | |
Merge "Initial support for keyboard navigation"
| -rw-r--r-- | core/java/android/webkit/WebView.java | 56 | ||||
| -rw-r--r-- | core/java/android/webkit/WebViewCore.java | 13 |
2 files changed, 38 insertions, 31 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 9d56b048d049..e0f4f59c8a89 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -5592,7 +5592,7 @@ public class WebView extends AbsoluteLayout return false; } - if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) { + if (isEnterActionKey(keyCode)) { switchOutDrawHistory(); boolean wantsKeyEvents = nativeCursorNodePointer() == 0 || nativeCursorWantsKeyEvents(); @@ -5741,33 +5741,35 @@ public class WebView extends AbsoluteLayout return true; // discard press if copy in progress } - // perform the single click - Rect visibleRect = sendOurVisibleRect(); - // Note that sendOurVisibleRect calls viewToContent, so the - // coordinates should be in content coordinates. - if (!nativeCursorIntersects(visibleRect)) { - return false; - } - WebViewCore.CursorData data = cursorData(); - mWebViewCore.sendMessage(EventHub.SET_MOVE_MOUSE, data); - playSoundEffect(SoundEffectConstants.CLICK); - if (nativeCursorIsTextInput()) { - rebuildWebTextView(); - centerKeyPressOnTextField(); - if (inEditingMode()) { - mWebTextView.setDefaultSelection(); + if (!sDisableNavcache) { + // perform the single click + Rect visibleRect = sendOurVisibleRect(); + // Note that sendOurVisibleRect calls viewToContent, so the + // coordinates should be in content coordinates. + if (!nativeCursorIntersects(visibleRect)) { + return false; + } + WebViewCore.CursorData data = cursorData(); + mWebViewCore.sendMessage(EventHub.SET_MOVE_MOUSE, data); + playSoundEffect(SoundEffectConstants.CLICK); + if (nativeCursorIsTextInput()) { + rebuildWebTextView(); + centerKeyPressOnTextField(); + if (inEditingMode()) { + mWebTextView.setDefaultSelection(); + } + return true; + } + clearTextEntry(); + nativeShowCursorTimed(); + if (mCallbackProxy.uiOverrideUrlLoading(nativeCursorText())) { + return true; + } + if (nativeCursorNodePointer() != 0 && !nativeCursorWantsKeyEvents()) { + mWebViewCore.sendMessage(EventHub.CLICK, data.mFrame, + nativeCursorNodePointer()); + return true; } - return true; - } - clearTextEntry(); - nativeShowCursorTimed(); - if (mCallbackProxy.uiOverrideUrlLoading(nativeCursorText())) { - return true; - } - if (nativeCursorNodePointer() != 0 && !nativeCursorWantsKeyEvents()) { - mWebViewCore.sendMessage(EventHub.CLICK, data.mFrame, - nativeCursorNodePointer()); - return true; } } diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index e1c7ee88a64e..b6c5612c7e6d 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -334,6 +334,15 @@ public final class WebViewCore { } /** + * Called by JNI when the focus node changed. + */ + private void focusNodeChanged(WebKitHitTest hitTest) { + if (mWebView == null) return; + mWebView.mPrivateHandler.obtainMessage(WebView.HIT_TEST_RESULT, hitTest) + .sendToTarget(); + } + + /** * Called by JNI. Open a file chooser to upload a file. * @param acceptType The value of the 'accept' attribute of the * input tag associated with this file picker. @@ -615,7 +624,6 @@ public final class WebViewCore { int x, int y); private native String nativeRetrieveImageSource(int nativeClass, int x, int y); - private native void nativeStopPaintingCaret(int nativeClass); private native void nativeTouchUp(int nativeClass, int touchGeneration, int framePtr, int nodePtr, int x, int y); @@ -1539,9 +1547,6 @@ public final class WebViewCore { nativeMoveMouseIfLatest(mNativeClass, cData.mMoveGeneration, cData.mFrame, cData.mX, cData.mY); - if (msg.arg1 == 1) { - nativeStopPaintingCaret(mNativeClass); - } break; case REQUEST_CURSOR_HREF: { |