Skip to content

Commit 0966dd2

Browse files
committed
Bringing back the 'cache
Bug: 5333083 Change-Id: I9b693ad0a0d4ee2979a7dabad6575ffada962b16
1 parent 5dd1916 commit 0966dd2

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

core/java/android/webkit/WebView.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ public void onTrimMemory(int level) {
644644
private Drawable mSelectHandleLeft;
645645
private Drawable mSelectHandleRight;
646646

647-
static final boolean USE_WEBKIT_RINGS = true;
647+
static final boolean USE_WEBKIT_RINGS = false;
648648
// the color used to highlight the touch rectangles
649649
private static final int HIGHLIGHT_COLOR = 0x6633b5e5;
650650
// the round corner for the highlight path
@@ -730,6 +730,7 @@ public void onTrimMemory(int level) {
730730
static final int SELECT_AT = 135;
731731
static final int SCREEN_ON = 136;
732732
static final int ENTER_FULLSCREEN_VIDEO = 137;
733+
static final int UPDATE_SELECTION = 138;
733734

734735
private static final int FIRST_PACKAGE_MSG_ID = SCROLL_TO_MSG_ID;
735736
private static final int LAST_PACKAGE_MSG_ID = SET_TOUCH_HIGHLIGHT_RECTS;
@@ -4062,8 +4063,11 @@ private void drawContent(Canvas canvas, boolean drawRings) {
40624063
// state.
40634064
// If mNativeClass is 0, we should not reach here, so we do not
40644065
// need to check it again.
4066+
boolean pressed = (mTouchMode == TOUCH_SHORTPRESS_START_MODE
4067+
|| mTouchMode == TOUCH_INIT_MODE
4068+
|| mTouchMode == TOUCH_SHORTPRESS_MODE);
40654069
nativeRecordButtons(hasFocus() && hasWindowFocus(),
4066-
(mTouchMode == TOUCH_SHORTPRESS_START_MODE && !USE_WEBKIT_RINGS)
4070+
(pressed && !USE_WEBKIT_RINGS)
40674071
|| mTrackballDown || mGotCenterDown, false);
40684072
drawCoreAndCursorRing(canvas, mBackgroundColor,
40694073
mDrawCursorRing && drawRings);
@@ -6532,6 +6536,8 @@ private void startTouch(float x, float y, long eventTime) {
65326536
mLastTouchTime = eventTime;
65336537
mVelocityTracker = VelocityTracker.obtain();
65346538
mSnapScrollMode = SNAP_NONE;
6539+
mPrivateHandler.sendEmptyMessageDelayed(UPDATE_SELECTION,
6540+
ViewConfiguration.getTapTimeout());
65356541
}
65366542

65376543
private void startDrag() {
@@ -7194,10 +7200,15 @@ public boolean zoomOut() {
71947200
return mZoomManager.zoomOut();
71957201
}
71967202

7203+
/**
7204+
* This selects the best clickable target at mLastTouchX and mLastTouchY
7205+
* and calls showCursorTimed on the native side
7206+
*/
71977207
private void updateSelection() {
71987208
if (mNativeClass == 0) {
71997209
return;
72007210
}
7211+
mPrivateHandler.removeMessages(UPDATE_SELECTION);
72017212
// mLastTouchX and mLastTouchY are the point in the current viewport
72027213
int contentX = viewToContentX(mLastTouchX + mScrollX);
72037214
int contentY = viewToContentY(mLastTouchY + mScrollY);
@@ -7297,6 +7308,7 @@ private void doShortPress() {
72977308
return;
72987309
}
72997310
mTouchMode = TOUCH_DONE_MODE;
7311+
updateSelection();
73007312
switchOutDrawHistory();
73017313
// mLastTouchX and mLastTouchY are the point in the current viewport
73027314
int contentX = viewToContentX(mLastTouchX + mScrollX);
@@ -8187,6 +8199,14 @@ public void handleMessage(Message msg) {
81878199
SCROLL_SELECT_TEXT, SELECT_SCROLL_INTERVAL);
81888200
break;
81898201
}
8202+
case UPDATE_SELECTION: {
8203+
if (mTouchMode == TOUCH_INIT_MODE
8204+
|| mTouchMode == TOUCH_SHORTPRESS_MODE
8205+
|| mTouchMode == TOUCH_SHORTPRESS_START_MODE) {
8206+
updateSelection();
8207+
}
8208+
break;
8209+
}
81908210
case SWITCH_TO_SHORTPRESS: {
81918211
mInitialHitTestResult = null; // set by updateSelection()
81928212
if (mTouchMode == TOUCH_INIT_MODE) {

0 commit comments

Comments
 (0)