Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c30d145 authored by George Mount's avatar George Mount
Browse files

Changes that don't map to keys sent as text changes.

 Bug 6033096

Change-Id: I61da4d398ac140fdacfdd344dc0e2885da907ce0
parent c4bec73f
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -552,13 +552,17 @@ public class WebView extends AbsoluteLayout
                        && TextUtils.regionMatches(text, 0, original, 0,
                                textLength);
            }
            boolean sendChange = false;
            if (isCharacterAdd) {
                sendCharacter(text.charAt(textLength - 1));
                sendChange = !sendCharacter(text.charAt(textLength - 1));
            } else if (isCharacterDelete) {
                sendDeleteKey();
            } else if (textLength != originalLength ||
            } else {
                sendChange = (textLength != originalLength) ||
                        !TextUtils.regionMatches(text, 0, original, 0,
                            textLength)) {
                                textLength);
            }
            if (sendChange) {
                // Send a message so that key strokes and text replacement
                // do not come out of order.
                Message replaceMessage = mPrivateHandler.obtainMessage(
@@ -572,18 +576,20 @@ public class WebView extends AbsoluteLayout
         * Send a single character to the WebView as a key down and up event.
         * @param c The character to be sent.
         */
        private void sendCharacter(char c) {
        private boolean sendCharacter(char c) {
            if (mKeyCharacterMap == null) {
                mKeyCharacterMap = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD);
            }
            char[] chars = new char[1];
            chars[0] = c;
            KeyEvent[] events = mKeyCharacterMap.getEvents(chars);
            if (events != null) {
            boolean mapsToKeyEvent = (events != null);
            if (mapsToKeyEvent) {
                for (KeyEvent event : events) {
                    sendKeyEvent(event);
                }
            }
            return mapsToKeyEvent;
        }

        /**