am 1cb97eed: check to see if nav cache is up to date on tap
Merge commit '1cb97eed566014e36a7c2a0b487ec132b7d45e6c' into eclair-mr2-plus-aosp * commit '1cb97eed566014e36a7c2a0b487ec132b7d45e6c': check to see if nav cache is up to date on tap
This commit is contained in:
@@ -486,6 +486,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
// obj=Rect in doc coordinates
|
// obj=Rect in doc coordinates
|
||||||
static final int INVAL_RECT_MSG_ID = 26;
|
static final int INVAL_RECT_MSG_ID = 26;
|
||||||
static final int REQUEST_KEYBOARD = 27;
|
static final int REQUEST_KEYBOARD = 27;
|
||||||
|
static final int DO_MOTION_UP = 28;
|
||||||
|
|
||||||
static final String[] HandlerDebugString = {
|
static final String[] HandlerDebugString = {
|
||||||
"REMEMBER_PASSWORD", // = 1;
|
"REMEMBER_PASSWORD", // = 1;
|
||||||
@@ -514,7 +515,8 @@ public class WebView extends AbsoluteLayout
|
|||||||
"PREVENT_TOUCH_ID", // = 24;
|
"PREVENT_TOUCH_ID", // = 24;
|
||||||
"WEBCORE_NEED_TOUCH_EVENTS", // = 25;
|
"WEBCORE_NEED_TOUCH_EVENTS", // = 25;
|
||||||
"INVAL_RECT_MSG_ID", // = 26;
|
"INVAL_RECT_MSG_ID", // = 26;
|
||||||
"REQUEST_KEYBOARD" // = 27;
|
"REQUEST_KEYBOARD", // = 27;
|
||||||
|
"DO_MOTION_UP" // = 28;
|
||||||
};
|
};
|
||||||
|
|
||||||
// If the site doesn't use the viewport meta tag to specify the viewport,
|
// If the site doesn't use the viewport meta tag to specify the viewport,
|
||||||
@@ -4852,7 +4854,23 @@ public class WebView extends AbsoluteLayout
|
|||||||
// mLastTouchX and mLastTouchY are the point in the current viewport
|
// mLastTouchX and mLastTouchY are the point in the current viewport
|
||||||
int contentX = viewToContentX((int) mLastTouchX + mScrollX);
|
int contentX = viewToContentX((int) mLastTouchX + mScrollX);
|
||||||
int contentY = viewToContentY((int) mLastTouchY + mScrollY);
|
int contentY = viewToContentY((int) mLastTouchY + mScrollY);
|
||||||
if (nativeMotionUp(contentX, contentY, mNavSlop)) {
|
if (nativePointInNavCache(contentX, contentY, mNavSlop)) {
|
||||||
|
WebViewCore.MotionUpData motionUpData = new WebViewCore
|
||||||
|
.MotionUpData();
|
||||||
|
motionUpData.mFrame = nativeCacheHitFramePointer();
|
||||||
|
motionUpData.mNode = nativeCacheHitNodePointer();
|
||||||
|
motionUpData.mBounds = nativeCacheHitNodeBounds();
|
||||||
|
motionUpData.mX = contentX;
|
||||||
|
motionUpData.mY = contentY;
|
||||||
|
mWebViewCore.sendMessageAtFrontOfQueue(EventHub.VALID_NODE_BOUNDS,
|
||||||
|
motionUpData);
|
||||||
|
} else {
|
||||||
|
doMotionUp(contentX, contentY, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doMotionUp(int contentX, int contentY, boolean useNavCache) {
|
||||||
|
if (nativeMotionUp(contentX, contentY, useNavCache ? mNavSlop : 0)) {
|
||||||
if (mLogEvent) {
|
if (mLogEvent) {
|
||||||
Checkin.updateStats(mContext.getContentResolver(),
|
Checkin.updateStats(mContext.getContentResolver(),
|
||||||
Checkin.Stats.Tag.BROWSER_SNAP_CENTER, 1, 0.0);
|
Checkin.Stats.Tag.BROWSER_SNAP_CENTER, 1, 0.0);
|
||||||
@@ -5097,7 +5115,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
// exclude INVAL_RECT_MSG_ID since it is frequently output
|
// exclude INVAL_RECT_MSG_ID since it is frequently output
|
||||||
if (DebugFlags.WEB_VIEW && msg.what != INVAL_RECT_MSG_ID) {
|
if (DebugFlags.WEB_VIEW && msg.what != INVAL_RECT_MSG_ID) {
|
||||||
Log.v(LOGTAG, msg.what < REMEMBER_PASSWORD || msg.what
|
Log.v(LOGTAG, msg.what < REMEMBER_PASSWORD || msg.what
|
||||||
> REQUEST_KEYBOARD ? Integer.toString(msg.what)
|
> DO_MOTION_UP ? Integer.toString(msg.what)
|
||||||
: HandlerDebugString[msg.what - REMEMBER_PASSWORD]);
|
: HandlerDebugString[msg.what - REMEMBER_PASSWORD]);
|
||||||
}
|
}
|
||||||
if (mWebViewCore == null) {
|
if (mWebViewCore == null) {
|
||||||
@@ -5443,6 +5461,11 @@ public class WebView extends AbsoluteLayout
|
|||||||
ViewConfiguration.getScrollDefaultDelay());
|
ViewConfiguration.getScrollDefaultDelay());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DO_MOTION_UP:
|
||||||
|
doMotionUp(msg.arg1, msg.arg2, (Boolean) msg.obj);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
super.handleMessage(msg);
|
super.handleMessage(msg);
|
||||||
break;
|
break;
|
||||||
@@ -5931,6 +5954,9 @@ public class WebView extends AbsoluteLayout
|
|||||||
nativeUpdateCachedTextfield(updatedText, mTextGeneration);
|
nativeUpdateCachedTextfield(updatedText, mTextGeneration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native int nativeCacheHitFramePointer();
|
||||||
|
private native Rect nativeCacheHitNodeBounds();
|
||||||
|
private native int nativeCacheHitNodePointer();
|
||||||
/* package */ native void nativeClearCursor();
|
/* package */ native void nativeClearCursor();
|
||||||
private native void nativeCreate(int ptr);
|
private native void nativeCreate(int ptr);
|
||||||
private native int nativeCursorFramePointer();
|
private native int nativeCursorFramePointer();
|
||||||
@@ -5992,6 +6018,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
private native int nativeMoveGeneration();
|
private native int nativeMoveGeneration();
|
||||||
private native void nativeMoveSelection(int x, int y,
|
private native void nativeMoveSelection(int x, int y,
|
||||||
boolean extendSelection);
|
boolean extendSelection);
|
||||||
|
private native boolean nativePointInNavCache(int x, int y, int slop);
|
||||||
// Like many other of our native methods, you must make sure that
|
// Like many other of our native methods, you must make sure that
|
||||||
// mNativeClass is not null before calling this method.
|
// mNativeClass is not null before calling this method.
|
||||||
private native void nativeRecordButtons(boolean focused,
|
private native void nativeRecordButtons(boolean focused,
|
||||||
|
|||||||
@@ -683,6 +683,14 @@ final class WebViewCore {
|
|||||||
KeyEvent mEvent;
|
KeyEvent mEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static class MotionUpData {
|
||||||
|
int mFrame;
|
||||||
|
int mNode;
|
||||||
|
Rect mBounds;
|
||||||
|
int mX;
|
||||||
|
int mY;
|
||||||
|
}
|
||||||
|
|
||||||
static class PostUrlData {
|
static class PostUrlData {
|
||||||
String mUrl;
|
String mUrl;
|
||||||
byte[] mPostData;
|
byte[] mPostData;
|
||||||
@@ -778,6 +786,7 @@ final class WebViewCore {
|
|||||||
"ON_PAUSE", // = 143
|
"ON_PAUSE", // = 143
|
||||||
"ON_RESUME", // = 144
|
"ON_RESUME", // = 144
|
||||||
"FREE_MEMORY", // = 145
|
"FREE_MEMORY", // = 145
|
||||||
|
"VALID_NODE_BOUNDS", // = 146
|
||||||
};
|
};
|
||||||
|
|
||||||
class EventHub {
|
class EventHub {
|
||||||
@@ -841,6 +850,7 @@ final class WebViewCore {
|
|||||||
static final int ON_PAUSE = 143;
|
static final int ON_PAUSE = 143;
|
||||||
static final int ON_RESUME = 144;
|
static final int ON_RESUME = 144;
|
||||||
static final int FREE_MEMORY = 145;
|
static final int FREE_MEMORY = 145;
|
||||||
|
static final int VALID_NODE_BOUNDS = 146;
|
||||||
|
|
||||||
// Network-based messaging
|
// Network-based messaging
|
||||||
static final int CLEAR_SSL_PREF_TABLE = 150;
|
static final int CLEAR_SSL_PREF_TABLE = 150;
|
||||||
@@ -893,7 +903,7 @@ final class WebViewCore {
|
|||||||
if (DebugFlags.WEB_VIEW_CORE) {
|
if (DebugFlags.WEB_VIEW_CORE) {
|
||||||
Log.v(LOGTAG, (msg.what < UPDATE_FRAME_CACHE_IF_LOADING
|
Log.v(LOGTAG, (msg.what < UPDATE_FRAME_CACHE_IF_LOADING
|
||||||
|| msg.what
|
|| msg.what
|
||||||
> FREE_MEMORY ? Integer.toString(msg.what)
|
> VALID_NODE_BOUNDS ? Integer.toString(msg.what)
|
||||||
: HandlerDebugString[msg.what
|
: HandlerDebugString[msg.what
|
||||||
- UPDATE_FRAME_CACHE_IF_LOADING])
|
- UPDATE_FRAME_CACHE_IF_LOADING])
|
||||||
+ " arg1=" + msg.arg1 + " arg2=" + msg.arg2
|
+ " arg1=" + msg.arg1 + " arg2=" + msg.arg2
|
||||||
@@ -1289,6 +1299,20 @@ final class WebViewCore {
|
|||||||
case POPULATE_VISITED_LINKS:
|
case POPULATE_VISITED_LINKS:
|
||||||
nativeProvideVisitedHistory((String[])msg.obj);
|
nativeProvideVisitedHistory((String[])msg.obj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VALID_NODE_BOUNDS: {
|
||||||
|
MotionUpData motionUpData = (MotionUpData) msg.obj;
|
||||||
|
boolean result = nativeValidNodeAndBounds(
|
||||||
|
motionUpData.mFrame, motionUpData.mNode,
|
||||||
|
motionUpData.mBounds);
|
||||||
|
Message message = mWebView.mPrivateHandler
|
||||||
|
.obtainMessage(WebView.DO_MOTION_UP,
|
||||||
|
motionUpData.mX, motionUpData.mY,
|
||||||
|
new Boolean(result));
|
||||||
|
mWebView.mPrivateHandler.sendMessageAtFrontOfQueue(
|
||||||
|
message);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1432,6 +1456,11 @@ final class WebViewCore {
|
|||||||
mEventHub.sendMessage(Message.obtain(null, what, arg1, arg2, obj));
|
mEventHub.sendMessage(Message.obtain(null, what, arg1, arg2, obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sendMessageAtFrontOfQueue(int what, Object obj) {
|
||||||
|
mEventHub.sendMessageAtFrontOfQueue(Message.obtain(
|
||||||
|
null, what, obj));
|
||||||
|
}
|
||||||
|
|
||||||
void sendMessageDelayed(int what, Object obj, long delay) {
|
void sendMessageDelayed(int what, Object obj, long delay) {
|
||||||
mEventHub.sendMessageDelayed(Message.obtain(null, what, obj), delay);
|
mEventHub.sendMessageDelayed(Message.obtain(null, what, obj), delay);
|
||||||
}
|
}
|
||||||
@@ -2275,4 +2304,7 @@ final class WebViewCore {
|
|||||||
private native void nativeResume();
|
private native void nativeResume();
|
||||||
private native void nativeFreeMemory();
|
private native void nativeFreeMemory();
|
||||||
private native void nativeFullScreenPluginHidden(int npp);
|
private native void nativeFullScreenPluginHidden(int npp);
|
||||||
|
private native boolean nativeValidNodeAndBounds(int frame, int node,
|
||||||
|
Rect bounds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user