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

Commit 58e7dc96 authored by John Reck's avatar John Reck Committed by Android Git Automerger
Browse files

am d4796461: Fix accessibility drawing

* commit 'd4796461':
  Fix accessibility drawing
parents e06938be d4796461
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ import android.webkit.WebView.PictureListener;
import android.webkit.WebViewCore.DrawData;
import android.webkit.WebViewCore.EventHub;
import android.webkit.WebViewCore.TextFieldInitData;
import android.webkit.WebViewCore.TextSelectionData;
import android.webkit.WebViewCore.TouchHighlightData;
import android.webkit.WebViewCore.WebKitHitTest;
import android.widget.AbsoluteLayout;
@@ -4211,7 +4212,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc

        // decide which adornments to draw
        int extras = DRAW_EXTRAS_NONE;
        if (!mFindIsUp && mSelectingText) {
        if (!mFindIsUp && mShowTextSelectionExtra) {
            extras = DRAW_EXTRAS_SELECTION;
        }

@@ -4535,11 +4536,13 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc

    private void startSelectingText() {
        mSelectingText = true;
        mShowTextSelectionExtra = true;
        mHandleAlphaAnimator.setIntValues(255);
        mHandleAlphaAnimator.start();
    }
    private void endSelectingText() {
        mSelectingText = false;
        mShowTextSelectionExtra = false;
        mHandleAlphaAnimator.setIntValues(0);
        mHandleAlphaAnimator.start();
    }
@@ -5312,9 +5315,6 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
                mSelectCallback.finish();
                mSelectCallback = null;
            }
            if (!mIsCaretSelection) {
                updateWebkitSelection();
            }
            invalidate(); // redraw without selection
            mAutoScrollX = 0;
            mAutoScrollY = 0;
@@ -6442,6 +6442,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
    private int mTrackballXMove = 0;
    private int mTrackballYMove = 0;
    private boolean mSelectingText = false;
    private boolean mShowTextSelectionExtra = false;
    private boolean mSelectionStarted = false;
    private static final int TRACKBALL_KEY_TIMEOUT = 1000;
    private static final int TRACKBALL_TIMEOUT = 200;
@@ -7942,6 +7943,13 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
        }
        nativeSetTextSelection(mNativeClass, data.mSelectTextPtr);

        if (data.mSelectionReason == TextSelectionData.REASON_ACCESSIBILITY_INJECTOR) {
            selectionDone();
            mShowTextSelectionExtra = true;
            invalidate();
            return;
        }

        if (data.mSelectTextPtr != 0 &&
                (data.mStart != data.mEnd ||
                (mFieldPointer == nodePointer && mFieldPointer != 0))) {
+16 −2
Original line number Diff line number Diff line
@@ -143,6 +143,7 @@ public final class WebViewCore {
    private int mHighUsageDeltaMb;

    private int mChromeCanFocusDirection;
    private int mTextSelectionChangeReason = TextSelectionData.REASON_UNKNOWN;

    // The thread name used to identify the WebCore thread and for use in
    // debugging other classes that require operation within the WebCore thread.
@@ -861,6 +862,8 @@ public final class WebViewCore {
    }

    static class TextSelectionData {
        static final int REASON_UNKNOWN = 0;
        static final int REASON_ACCESSIBILITY_INJECTOR = 1;
        public TextSelectionData(int start, int end, int selectTextPtr) {
            mStart = start;
            mEnd = end;
@@ -869,6 +872,7 @@ public final class WebViewCore {
        int mStart;
        int mEnd;
        int mSelectTextPtr;
        int mSelectionReason = TextSelectionData.REASON_UNKNOWN;
    }

    static class TouchUpData {
@@ -1544,12 +1548,16 @@ public final class WebViewCore {
                            break;

                        case MODIFY_SELECTION:
                            mTextSelectionChangeReason
                                    = TextSelectionData.REASON_ACCESSIBILITY_INJECTOR;
                            String modifiedSelectionString =
                                nativeModifySelection(mNativeClass, msg.arg1,
                                        msg.arg2);
                            mWebViewClassic.mPrivateHandler.obtainMessage(
                                    WebViewClassic.SELECTION_STRING_CHANGED,
                                    modifiedSelectionString).sendToTarget();
                            mTextSelectionChangeReason
                                    = TextSelectionData.REASON_UNKNOWN;
                            break;

                        case LISTBOX_CHOICES:
@@ -2763,13 +2771,19 @@ public final class WebViewCore {
        }
    }

    private TextSelectionData createTextSelection(int start, int end, int selPtr) {
        TextSelectionData data = new TextSelectionData(start, end, selPtr);
        data.mSelectionReason = mTextSelectionChangeReason;
        return data;
    }

    // called by JNI
    private void updateTextSelection(int pointer, int start, int end,
            int textGeneration, int selectionPtr) {
        if (mWebViewClassic != null) {
            Message.obtain(mWebViewClassic.mPrivateHandler,
                WebViewClassic.UPDATE_TEXT_SELECTION_MSG_ID, pointer, textGeneration,
                new TextSelectionData(start, end, selectionPtr)).sendToTarget();
                createTextSelection(start, end, selectionPtr)).sendToTarget();
        }
    }

@@ -2803,7 +2817,7 @@ public final class WebViewCore {
        Message.obtain(mWebViewClassic.mPrivateHandler,
                WebViewClassic.UPDATE_TEXT_SELECTION_MSG_ID,
                initData.mFieldPointer, 0,
                new TextSelectionData(start, end, selectionPtr))
                createTextSelection(start, end, selectionPtr))
                .sendToTarget();
    }