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

Commit 49cc3d98 authored by George Mount's avatar George Mount Committed by Android (Google) Code Review
Browse files

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

parents 77d9ee4d 3c30d145
Loading
Loading
Loading
Loading
+12 −6
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;
        }

        /**