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

Commit 2210fff4 authored by John Reck's avatar John Reck Committed by Android (Google) Code Review
Browse files

Merge "Bringing back the 'cache"

parents c630eb6a 0966dd22
Loading
Loading
Loading
Loading
+22 −2
Original line number Original line Diff line number Diff line
@@ -644,7 +644,7 @@ public class WebView extends AbsoluteLayout
    private Drawable mSelectHandleLeft;
    private Drawable mSelectHandleLeft;
    private Drawable mSelectHandleRight;
    private Drawable mSelectHandleRight;


    static final boolean USE_WEBKIT_RINGS = true;
    static final boolean USE_WEBKIT_RINGS = false;
    // the color used to highlight the touch rectangles
    // the color used to highlight the touch rectangles
    private static final int HIGHLIGHT_COLOR = 0x6633b5e5;
    private static final int HIGHLIGHT_COLOR = 0x6633b5e5;
    // the round corner for the highlight path
    // the round corner for the highlight path
@@ -730,6 +730,7 @@ public class WebView extends AbsoluteLayout
    static final int SELECT_AT                          = 135;
    static final int SELECT_AT                          = 135;
    static final int SCREEN_ON                          = 136;
    static final int SCREEN_ON                          = 136;
    static final int ENTER_FULLSCREEN_VIDEO             = 137;
    static final int ENTER_FULLSCREEN_VIDEO             = 137;
    static final int UPDATE_SELECTION                   = 138;


    private static final int FIRST_PACKAGE_MSG_ID = SCROLL_TO_MSG_ID;
    private static final int FIRST_PACKAGE_MSG_ID = SCROLL_TO_MSG_ID;
    private static final int LAST_PACKAGE_MSG_ID = SET_TOUCH_HIGHLIGHT_RECTS;
    private static final int LAST_PACKAGE_MSG_ID = SET_TOUCH_HIGHLIGHT_RECTS;
@@ -4062,8 +4063,11 @@ public class WebView extends AbsoluteLayout
        // state.
        // state.
        // If mNativeClass is 0, we should not reach here, so we do not
        // If mNativeClass is 0, we should not reach here, so we do not
        // need to check it again.
        // need to check it again.
        boolean pressed = (mTouchMode == TOUCH_SHORTPRESS_START_MODE
                || mTouchMode == TOUCH_INIT_MODE
                || mTouchMode == TOUCH_SHORTPRESS_MODE);
        nativeRecordButtons(hasFocus() && hasWindowFocus(),
        nativeRecordButtons(hasFocus() && hasWindowFocus(),
                (mTouchMode == TOUCH_SHORTPRESS_START_MODE && !USE_WEBKIT_RINGS)
                (pressed && !USE_WEBKIT_RINGS)
                || mTrackballDown || mGotCenterDown, false);
                || mTrackballDown || mGotCenterDown, false);
        drawCoreAndCursorRing(canvas, mBackgroundColor,
        drawCoreAndCursorRing(canvas, mBackgroundColor,
                mDrawCursorRing && drawRings);
                mDrawCursorRing && drawRings);
@@ -6531,6 +6535,8 @@ public class WebView extends AbsoluteLayout
        mLastTouchTime = eventTime;
        mLastTouchTime = eventTime;
        mVelocityTracker = VelocityTracker.obtain();
        mVelocityTracker = VelocityTracker.obtain();
        mSnapScrollMode = SNAP_NONE;
        mSnapScrollMode = SNAP_NONE;
        mPrivateHandler.sendEmptyMessageDelayed(UPDATE_SELECTION,
                ViewConfiguration.getTapTimeout());
    }
    }


    private void startDrag() {
    private void startDrag() {
@@ -7193,10 +7199,15 @@ public class WebView extends AbsoluteLayout
        return mZoomManager.zoomOut();
        return mZoomManager.zoomOut();
    }
    }


    /**
     * This selects the best clickable target at mLastTouchX and mLastTouchY
     * and calls showCursorTimed on the native side
     */
    private void updateSelection() {
    private void updateSelection() {
        if (mNativeClass == 0) {
        if (mNativeClass == 0) {
            return;
            return;
        }
        }
        mPrivateHandler.removeMessages(UPDATE_SELECTION);
        // mLastTouchX and mLastTouchY are the point in the current viewport
        // mLastTouchX and mLastTouchY are the point in the current viewport
        int contentX = viewToContentX(mLastTouchX + mScrollX);
        int contentX = viewToContentX(mLastTouchX + mScrollX);
        int contentY = viewToContentY(mLastTouchY + mScrollY);
        int contentY = viewToContentY(mLastTouchY + mScrollY);
@@ -7296,6 +7307,7 @@ public class WebView extends AbsoluteLayout
            return;
            return;
        }
        }
        mTouchMode = TOUCH_DONE_MODE;
        mTouchMode = TOUCH_DONE_MODE;
        updateSelection();
        switchOutDrawHistory();
        switchOutDrawHistory();
        // mLastTouchX and mLastTouchY are the point in the current viewport
        // mLastTouchX and mLastTouchY are the point in the current viewport
        int contentX = viewToContentX(mLastTouchX + mScrollX);
        int contentX = viewToContentX(mLastTouchX + mScrollX);
@@ -8186,6 +8198,14 @@ public class WebView extends AbsoluteLayout
                            SCROLL_SELECT_TEXT, SELECT_SCROLL_INTERVAL);
                            SCROLL_SELECT_TEXT, SELECT_SCROLL_INTERVAL);
                    break;
                    break;
                }
                }
                case UPDATE_SELECTION: {
                    if (mTouchMode == TOUCH_INIT_MODE
                            || mTouchMode == TOUCH_SHORTPRESS_MODE
                            || mTouchMode == TOUCH_SHORTPRESS_START_MODE) {
                        updateSelection();
                    }
                    break;
                }
                case SWITCH_TO_SHORTPRESS: {
                case SWITCH_TO_SHORTPRESS: {
                    mInitialHitTestResult = null; // set by updateSelection()
                    mInitialHitTestResult = null; // set by updateSelection()
                    if (mTouchMode == TOUCH_INIT_MODE) {
                    if (mTouchMode == TOUCH_INIT_MODE) {