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

Commit 2cdee233 authored by Cary Clark's avatar Cary Clark
Browse files

make select all, copy text public but hidden

For keyboard accelerators, add public interfaces
to copy text and select all.

bug:3270434
Change-Id: I4a38b95a373dcf73575f66fe13b082205d2423ce
parent 49945c0f
Loading
Loading
Loading
Loading
+18 −4
Original line number Original line Diff line number Diff line
@@ -3846,6 +3846,13 @@ public class WebView extends AbsoluteLayout
    public boolean selectText() {
    public boolean selectText() {
        int x = viewToContentX((int) mLastTouchX + mScrollX);
        int x = viewToContentX((int) mLastTouchX + mScrollX);
        int y = viewToContentY((int) mLastTouchY + mScrollY);
        int y = viewToContentY((int) mLastTouchY + mScrollY);
        return selectText(x, y);
    }

    /**
     * Select the word at the indicated content coordinates.
     */
    boolean selectText(int x, int y) {
        if (!setUpSelect()) {
        if (!setUpSelect()) {
            return false;
            return false;
        }
        }
@@ -4808,12 +4815,16 @@ public class WebView extends AbsoluteLayout


    /**
    /**
     * Select all of the text in this WebView.
     * Select all of the text in this WebView.
     *
     * @hide pending API council approval.
     */
     */
    void selectAll() {
    public void selectAll() {
        if (0 == mNativeClass) return; // client isn't initialized
        if (0 == mNativeClass) return; // client isn't initialized
        if (inFullScreenMode()) return;
        if (inFullScreenMode()) return;
        if (!mSelectingText && !setUpSelect()) {
        if (!mSelectingText) {
            return;
            // retrieve a point somewhere within the text
            Point select = nativeSelectableText();
            if (!selectText(select.x, select.y)) return;
        }
        }
        nativeSelectAll();
        nativeSelectAll();
        mDrawSelectionPointer = false;
        mDrawSelectionPointer = false;
@@ -4842,8 +4853,10 @@ public class WebView extends AbsoluteLayout


    /**
    /**
     * Copy the selection to the clipboard
     * Copy the selection to the clipboard
     *
     * @hide pending API council approval.
     */
     */
    boolean copySelection() {
    public boolean copySelection() {
        boolean copiedSomething = false;
        boolean copiedSomething = false;
        String selection = getSelection();
        String selection = getSelection();
        if (selection != "") {
        if (selection != "") {
@@ -8049,6 +8062,7 @@ public class WebView extends AbsoluteLayout
    private native void     nativeRecordButtons(boolean focused,
    private native void     nativeRecordButtons(boolean focused,
            boolean pressed, boolean invalidate);
            boolean pressed, boolean invalidate);
    private native void     nativeResetSelection();
    private native void     nativeResetSelection();
    private native Point    nativeSelectableText();
    private native void     nativeSelectAll();
    private native void     nativeSelectAll();
    private native void     nativeSelectBestAt(Rect rect);
    private native void     nativeSelectBestAt(Rect rect);
    private native int      nativeSelectionX();
    private native int      nativeSelectionX();