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

Commit 9cac3c31 authored by Leon Scroggins's avatar Leon Scroggins
Browse files

Remove the option to use shift to start selection mode.

Bug:3329956

Also ensure that keys dispatched while the WebTextView
is attached get sent to the WebTextView.

Change-Id: Icd9125a85929089a6f376b71c1cb40e885264168
parent 5c6b786e
Loading
Loading
Loading
Loading
+9 −24
Original line number Diff line number Diff line
@@ -4564,14 +4564,6 @@ public class WebView extends AbsoluteLayout
            return true;
        }

        if (keyCode == KeyEvent.KEYCODE_SHIFT_LEFT
                || keyCode == KeyEvent.KEYCODE_SHIFT_RIGHT) {
            if (!nativePageShouldHandleShiftAndArrows() && !nativeCursorWantsKeyEvents()
                    && !mSelectingText) {
                setUpSelect();
            }
        }

        if (keyCode == KeyEvent.KEYCODE_PAGE_UP) {
            if (event.hasNoModifiers()) {
                pageUp(false);
@@ -4662,12 +4654,6 @@ public class WebView extends AbsoluteLayout
            if (!wantsKeyEvents) return false;
        }

        if (keyCode != KeyEvent.KEYCODE_SHIFT_LEFT
                && keyCode != KeyEvent.KEYCODE_SHIFT_RIGHT) {
            // turn off copy select if a shift-key combo is pressed
            selectionDone();
        }

        if (getSettings().getNavDump()) {
            switch (keyCode) {
                case KeyEvent.KEYCODE_4:
@@ -4766,14 +4752,6 @@ public class WebView extends AbsoluteLayout
            return true;
        }

        if (keyCode == KeyEvent.KEYCODE_SHIFT_LEFT
                || keyCode == KeyEvent.KEYCODE_SHIFT_RIGHT) {
            if (!nativePageShouldHandleShiftAndArrows() && copySelection()) {
                selectionDone();
                return true;
            }
        }

        if (keyCode >= KeyEvent.KEYCODE_DPAD_UP
                && keyCode <= KeyEvent.KEYCODE_DPAD_RIGHT) {
            if (nativePageShouldHandleShiftAndArrows()) {
@@ -5234,7 +5212,8 @@ public class WebView extends AbsoluteLayout
        // Textfields, plugins, and contentEditable nodes need to receive the
        // shift up key even if another key was released while the shift key
        // was held down.
        if (!inEditingMode() && (mNativeClass == 0
        boolean inEditingMode = inEditingMode();
        if (!inEditingMode && (mNativeClass == 0
                || !nativePageShouldHandleShiftAndArrows())) {
            if (event.getAction() == KeyEvent.ACTION_DOWN) {
                mGotKeyDown = true;
@@ -5251,7 +5230,13 @@ public class WebView extends AbsoluteLayout
        }

        if (dispatch) {
            if (inEditingMode) {
                // Ensure that the WebTextView gets the event, even if it does
                // not currently have a bounds.
                return mWebTextView.dispatchKeyEvent(event);
            } else {
                return super.dispatchKeyEvent(event);
            }
        } else {
            // We didn't dispatch, so let something else handle the key
            return false;