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

Commit ddbda005 authored by Cary Clark's avatar Cary Clark
Browse files

pass enter key to webkit more often

If the cursor is active and on a node that doesn't want
key events, treat the enter key as a click.

Otherwise, pass key down and key up to webkit.

A companion change in external/webkit adds frames
as nodes that wants key events.

bug:3325093
Change-Id: I134d2999505925ee1e571841759cb295103b5a30
parent faba502a
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -4599,6 +4599,8 @@ public class WebView extends AbsoluteLayout

        if (isEnterActionKey(keyCode)) {
            switchOutDrawHistory();
            boolean wantsKeyEvents = nativeCursorNodePointer() == 0
                || nativeCursorWantsKeyEvents();
            if (event.getRepeatCount() == 0) {
                if (mSelectingText) {
                    return true; // discard press if copy in progress
@@ -4609,10 +4611,10 @@ public class WebView extends AbsoluteLayout
                // Already checked mNativeClass, so we do not need to check it
                // again.
                nativeRecordButtons(hasFocus() && hasWindowFocus(), true, true);
                return true;
                if (!wantsKeyEvents) return true;
            }
            // Bubble up the key event as WebView doesn't handle it
            return false;
            if (!wantsKeyEvents) return false;
        }

        if (keyCode != KeyEvent.KEYCODE_SHIFT_LEFT
@@ -4771,12 +4773,15 @@ public class WebView extends AbsoluteLayout
            }
            clearTextEntry();
            nativeShowCursorTimed();
            if (!mCallbackProxy.uiOverrideUrlLoading(nativeCursorText())) {
            if (mCallbackProxy.uiOverrideUrlLoading(nativeCursorText())) {
                return true;
            }
            if (nativeCursorNodePointer() != 0 && !nativeCursorWantsKeyEvents()) {
                mWebViewCore.sendMessage(EventHub.CLICK, data.mFrame,
                        nativeCursorNodePointer());
            }
                return true;
            }
        }

        // TODO: should we pass all the keys to DOM or check the meta tag
        if (nativeCursorWantsKeyEvents() || true) {