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

Commit 3ccd3655 authored by Leon Scroggins's avatar Leon Scroggins
Browse files

Fix a WebView longpress bug.

Longpressing on a WebView while the WebTextView is up calls
WebTextView::performLongPress().  This used to be fine, but now
we may still leave the WebTextView up while the user is longpressing
on something else.  Check to ensure that the focus is the same
as the cursor before calling WebTextView's version.  Also,
send a click if the user longpresses on a different WebTextView,
so it will now behave appropriately.  Requires a change in
external/webkit.

Also remove a duplicate check for inEditingMode().
parent 8cdad889
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -2505,6 +2505,14 @@ public class WebView extends AbsoluteLayout

    @Override
    public boolean performLongClick() {
        if (mNativeClass != 0 && nativeCursorIsTextInput()) {
            // Send the click so that the textfield is in focus
            // FIXME: When we start respecting changes to the native textfield's
            // selection, need to make sure that this does not change it.
            mWebViewCore.sendMessage(EventHub.CLICK, nativeCursorFramePointer(),
                    nativeCursorNodePointer());
            rebuildWebTextView();
        }
        if (inEditingMode()) {
            return mWebTextView.performLongClick();
        } else {
@@ -3484,11 +3492,9 @@ public class WebView extends AbsoluteLayout

    public void onChildViewRemoved(View p, View child) {
        if (child == this) {
            if (inEditingMode()) {
            clearTextEntry();
        }
    }
    }

    /**
     * @deprecated WebView should not have implemented
@@ -4025,9 +4031,10 @@ public class WebView extends AbsoluteLayout
        if (ev.getAction() == MotionEvent.ACTION_DOWN) {
            mPrivateHandler.removeMessages(SWITCH_TO_CLICK);
            mTrackballDown = true;
            if (mNativeClass != 0) {
                nativeRecordButtons(hasFocus() && hasWindowFocus(), true, true);
            if (mNativeClass == 0) {
                return false;
            }
            nativeRecordButtons(hasFocus() && hasWindowFocus(), true, true);
            if (time - mLastCursorTime <= TRACKBALL_TIMEOUT
                    && !mLastCursorBounds.equals(nativeGetCursorRingBounds())) {
                nativeSelectBestAt(mLastCursorBounds);