diff options
author | Derek Sollenberger <djsollen@google.com> | 2010-08-06 11:50:49 -0400 |
---|---|---|
committer | Derek Sollenberger <djsollen@google.com> | 2010-08-06 14:05:15 -0400 |
commit | ff0f973442d22ba6bb1231fb6e97e5f3051a7f48 (patch) | |
tree | 139bd390f1ae10b9e91079ddd207c11fffa2ec0c /core | |
parent | 604b1e506808f4afaccf38c2db41417f0e9e2e07 (diff) | |
download | frameworks_base-ff0f973442d22ba6bb1231fb6e97e5f3051a7f48.zip frameworks_base-ff0f973442d22ba6bb1231fb6e97e5f3051a7f48.tar.gz frameworks_base-ff0f973442d22ba6bb1231fb6e97e5f3051a7f48.tar.bz2 |
Support complex characters in plugins.
Complex characters like chinese are sent via the onKeyMultiple()
callback. The WebView passes these characters to Webkit so that
non-text inputs (e.g. plugins) can process them.
Change-Id: I159c4a404c195b60cc7f63ef4bff0aa80db96c3f
http://b/2900114
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/webkit/WebView.java | 13 | ||||
-rw-r--r-- | core/java/android/webkit/WebViewCore.java | 13 |
2 files changed, 23 insertions, 3 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 37f1f68..d1b0902 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -3762,6 +3762,19 @@ public class WebView extends AbsoluteLayout private boolean mGotCenterDown = false; @Override + public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) { + // send complex characters to webkit for use by JS and plugins + if (keyCode == KeyEvent.KEYCODE_UNKNOWN && event.getCharacters() != null) { + // pass the key to DOM + mWebViewCore.sendMessage(EventHub.KEY_DOWN, event); + mWebViewCore.sendMessage(EventHub.KEY_UP, event); + // return true as DOM handles the key + return true; + } + return false; + } + + @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (DebugFlags.WEB_VIEW) { Log.v(LOGTAG, "keyDown at " + System.currentTimeMillis() diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index 21af570..3c28c94 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -1627,9 +1627,16 @@ final class WebViewCore { + evt); } int keyCode = evt.getKeyCode(); - if (!nativeKey(keyCode, evt.getUnicodeChar(), - evt.getRepeatCount(), evt.isShiftPressed(), evt.isAltPressed(), - evt.isSymPressed(), + int unicodeChar = evt.getUnicodeChar(); + + if (keyCode == KeyEvent.KEYCODE_UNKNOWN && evt.getCharacters() != null + && evt.getCharacters().length() > 0) { + // we should only receive individual complex characters + unicodeChar = evt.getCharacters().codePointAt(0); + } + + if (!nativeKey(keyCode, unicodeChar, evt.getRepeatCount(), evt.isShiftPressed(), + evt.isAltPressed(), evt.isSymPressed(), isDown) && keyCode != KeyEvent.KEYCODE_ENTER) { if (keyCode >= KeyEvent.KEYCODE_DPAD_UP && keyCode <= KeyEvent.KEYCODE_DPAD_RIGHT) { |