Skip to content

Commit 2210fff

Browse files
jreckAndroid (Google) Code Review
authored andcommitted
Merge "Bringing back the 'cache"
2 parents c630eb6 + 0966dd2 commit 2210fff

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);
@@ -6531,6 +6535,8 @@ private void startTouch(float x, float y, long eventTime) {
65316535
mLastTouchTime = eventTime;
65326536
mVelocityTracker = VelocityTracker.obtain();
65336537
mSnapScrollMode = SNAP_NONE;
6538+
mPrivateHandler.sendEmptyMessageDelayed(UPDATE_SELECTION,
6539+
ViewConfiguration.getTapTimeout());
65346540
}
65356541

65366542
private void startDrag() {
@@ -7193,10 +7199,15 @@ public boolean zoomOut() {
71937199
return mZoomManager.zoomOut();
71947200
}
71957201

7202+
/**
7203+
* This selects the best clickable target at mLastTouchX and mLastTouchY
7204+
* and calls showCursorTimed on the native side
7205+
*/
71967206
private void updateSelection() {
71977207
if (mNativeClass == 0) {
71987208
return;
71997209
}
7210+
mPrivateHandler.removeMessages(UPDATE_SELECTION);
72007211
// mLastTouchX and mLastTouchY are the point in the current viewport
72017212
int contentX = viewToContentX(mLastTouchX + mScrollX);
72027213
int contentY = viewToContentY(mLastTouchY + mScrollY);
@@ -7296,6 +7307,7 @@ private void doShortPress() {
72967307
return;
72977308
}
72987309
mTouchMode = TOUCH_DONE_MODE;
7310+
updateSelection();
72997311
switchOutDrawHistory();
73007312
// mLastTouchX and mLastTouchY are the point in the current viewport
73017313
int contentX = viewToContentX(mLastTouchX + mScrollX);
@@ -8186,6 +8198,14 @@ public void handleMessage(Message msg) {
81868198
SCROLL_SELECT_TEXT, SELECT_SCROLL_INTERVAL);
81878199
break;
81888200
}
8201+
case UPDATE_SELECTION: {
8202+
if (mTouchMode == TOUCH_INIT_MODE
8203+
|| mTouchMode == TOUCH_SHORTPRESS_MODE
8204+
|| mTouchMode == TOUCH_SHORTPRESS_START_MODE) {
8205+
updateSelection();
8206+
}
8207+
break;
8208+
}
81898209
case SWITCH_TO_SHORTPRESS: {
81908210
mInitialHitTestResult = null; // set by updateSelection()
81918211
if (mTouchMode == TOUCH_INIT_MODE) {

0 commit comments

Comments
 (0)