Loading core/java/android/webkit/WebView.java +30 −3 Original line number Diff line number Diff line Loading @@ -486,6 +486,7 @@ public class WebView extends AbsoluteLayout // obj=Rect in doc coordinates static final int INVAL_RECT_MSG_ID = 26; static final int REQUEST_KEYBOARD = 27; static final int DO_MOTION_UP = 28; static final String[] HandlerDebugString = { "REMEMBER_PASSWORD", // = 1; Loading Loading @@ -514,7 +515,8 @@ public class WebView extends AbsoluteLayout "PREVENT_TOUCH_ID", // = 24; "WEBCORE_NEED_TOUCH_EVENTS", // = 25; "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, Loading Loading @@ -4852,7 +4854,23 @@ public class WebView extends AbsoluteLayout // mLastTouchX and mLastTouchY are the point in the current viewport int contentX = viewToContentX((int) mLastTouchX + mScrollX); 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) { Checkin.updateStats(mContext.getContentResolver(), Checkin.Stats.Tag.BROWSER_SNAP_CENTER, 1, 0.0); Loading Loading @@ -5097,7 +5115,7 @@ public class WebView extends AbsoluteLayout // exclude INVAL_RECT_MSG_ID since it is frequently output if (DebugFlags.WEB_VIEW && msg.what != INVAL_RECT_MSG_ID) { 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]); } if (mWebViewCore == null) { Loading Loading @@ -5443,6 +5461,11 @@ public class WebView extends AbsoluteLayout ViewConfiguration.getScrollDefaultDelay()); } break; case DO_MOTION_UP: doMotionUp(msg.arg1, msg.arg2, (Boolean) msg.obj); break; default: super.handleMessage(msg); break; Loading Loading @@ -5931,6 +5954,9 @@ public class WebView extends AbsoluteLayout nativeUpdateCachedTextfield(updatedText, mTextGeneration); } private native int nativeCacheHitFramePointer(); private native Rect nativeCacheHitNodeBounds(); private native int nativeCacheHitNodePointer(); /* package */ native void nativeClearCursor(); private native void nativeCreate(int ptr); private native int nativeCursorFramePointer(); Loading Loading @@ -5992,6 +6018,7 @@ public class WebView extends AbsoluteLayout private native int nativeMoveGeneration(); private native void nativeMoveSelection(int x, int y, boolean extendSelection); private native boolean nativePointInNavCache(int x, int y, int slop); // Like many other of our native methods, you must make sure that // mNativeClass is not null before calling this method. private native void nativeRecordButtons(boolean focused, Loading core/java/android/webkit/WebViewCore.java +33 −1 Original line number Diff line number Diff line Loading @@ -683,6 +683,14 @@ final class WebViewCore { KeyEvent mEvent; } static class MotionUpData { int mFrame; int mNode; Rect mBounds; int mX; int mY; } static class PostUrlData { String mUrl; byte[] mPostData; Loading Loading @@ -778,6 +786,7 @@ final class WebViewCore { "ON_PAUSE", // = 143 "ON_RESUME", // = 144 "FREE_MEMORY", // = 145 "VALID_NODE_BOUNDS", // = 146 }; class EventHub { Loading Loading @@ -841,6 +850,7 @@ final class WebViewCore { static final int ON_PAUSE = 143; static final int ON_RESUME = 144; static final int FREE_MEMORY = 145; static final int VALID_NODE_BOUNDS = 146; // Network-based messaging static final int CLEAR_SSL_PREF_TABLE = 150; Loading Loading @@ -893,7 +903,7 @@ final class WebViewCore { if (DebugFlags.WEB_VIEW_CORE) { Log.v(LOGTAG, (msg.what < UPDATE_FRAME_CACHE_IF_LOADING || msg.what > FREE_MEMORY ? Integer.toString(msg.what) > VALID_NODE_BOUNDS ? Integer.toString(msg.what) : HandlerDebugString[msg.what - UPDATE_FRAME_CACHE_IF_LOADING]) + " arg1=" + msg.arg1 + " arg2=" + msg.arg2 Loading Loading @@ -1289,6 +1299,20 @@ final class WebViewCore { case POPULATE_VISITED_LINKS: nativeProvideVisitedHistory((String[])msg.obj); 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; } } } }; Loading Loading @@ -1432,6 +1456,11 @@ final class WebViewCore { 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) { mEventHub.sendMessageDelayed(Message.obtain(null, what, obj), delay); } Loading Loading @@ -2275,4 +2304,7 @@ final class WebViewCore { private native void nativeResume(); private native void nativeFreeMemory(); private native void nativeFullScreenPluginHidden(int npp); private native boolean nativeValidNodeAndBounds(int frame, int node, Rect bounds); } Loading
core/java/android/webkit/WebView.java +30 −3 Original line number Diff line number Diff line Loading @@ -486,6 +486,7 @@ public class WebView extends AbsoluteLayout // obj=Rect in doc coordinates static final int INVAL_RECT_MSG_ID = 26; static final int REQUEST_KEYBOARD = 27; static final int DO_MOTION_UP = 28; static final String[] HandlerDebugString = { "REMEMBER_PASSWORD", // = 1; Loading Loading @@ -514,7 +515,8 @@ public class WebView extends AbsoluteLayout "PREVENT_TOUCH_ID", // = 24; "WEBCORE_NEED_TOUCH_EVENTS", // = 25; "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, Loading Loading @@ -4852,7 +4854,23 @@ public class WebView extends AbsoluteLayout // mLastTouchX and mLastTouchY are the point in the current viewport int contentX = viewToContentX((int) mLastTouchX + mScrollX); 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) { Checkin.updateStats(mContext.getContentResolver(), Checkin.Stats.Tag.BROWSER_SNAP_CENTER, 1, 0.0); Loading Loading @@ -5097,7 +5115,7 @@ public class WebView extends AbsoluteLayout // exclude INVAL_RECT_MSG_ID since it is frequently output if (DebugFlags.WEB_VIEW && msg.what != INVAL_RECT_MSG_ID) { 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]); } if (mWebViewCore == null) { Loading Loading @@ -5443,6 +5461,11 @@ public class WebView extends AbsoluteLayout ViewConfiguration.getScrollDefaultDelay()); } break; case DO_MOTION_UP: doMotionUp(msg.arg1, msg.arg2, (Boolean) msg.obj); break; default: super.handleMessage(msg); break; Loading Loading @@ -5931,6 +5954,9 @@ public class WebView extends AbsoluteLayout nativeUpdateCachedTextfield(updatedText, mTextGeneration); } private native int nativeCacheHitFramePointer(); private native Rect nativeCacheHitNodeBounds(); private native int nativeCacheHitNodePointer(); /* package */ native void nativeClearCursor(); private native void nativeCreate(int ptr); private native int nativeCursorFramePointer(); Loading Loading @@ -5992,6 +6018,7 @@ public class WebView extends AbsoluteLayout private native int nativeMoveGeneration(); private native void nativeMoveSelection(int x, int y, boolean extendSelection); private native boolean nativePointInNavCache(int x, int y, int slop); // Like many other of our native methods, you must make sure that // mNativeClass is not null before calling this method. private native void nativeRecordButtons(boolean focused, Loading
core/java/android/webkit/WebViewCore.java +33 −1 Original line number Diff line number Diff line Loading @@ -683,6 +683,14 @@ final class WebViewCore { KeyEvent mEvent; } static class MotionUpData { int mFrame; int mNode; Rect mBounds; int mX; int mY; } static class PostUrlData { String mUrl; byte[] mPostData; Loading Loading @@ -778,6 +786,7 @@ final class WebViewCore { "ON_PAUSE", // = 143 "ON_RESUME", // = 144 "FREE_MEMORY", // = 145 "VALID_NODE_BOUNDS", // = 146 }; class EventHub { Loading Loading @@ -841,6 +850,7 @@ final class WebViewCore { static final int ON_PAUSE = 143; static final int ON_RESUME = 144; static final int FREE_MEMORY = 145; static final int VALID_NODE_BOUNDS = 146; // Network-based messaging static final int CLEAR_SSL_PREF_TABLE = 150; Loading Loading @@ -893,7 +903,7 @@ final class WebViewCore { if (DebugFlags.WEB_VIEW_CORE) { Log.v(LOGTAG, (msg.what < UPDATE_FRAME_CACHE_IF_LOADING || msg.what > FREE_MEMORY ? Integer.toString(msg.what) > VALID_NODE_BOUNDS ? Integer.toString(msg.what) : HandlerDebugString[msg.what - UPDATE_FRAME_CACHE_IF_LOADING]) + " arg1=" + msg.arg1 + " arg2=" + msg.arg2 Loading Loading @@ -1289,6 +1299,20 @@ final class WebViewCore { case POPULATE_VISITED_LINKS: nativeProvideVisitedHistory((String[])msg.obj); 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; } } } }; Loading Loading @@ -1432,6 +1456,11 @@ final class WebViewCore { 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) { mEventHub.sendMessageDelayed(Message.obtain(null, what, obj), delay); } Loading Loading @@ -2275,4 +2304,7 @@ final class WebViewCore { private native void nativeResume(); private native void nativeFreeMemory(); private native void nativeFullScreenPluginHidden(int npp); private native boolean nativeValidNodeAndBounds(int frame, int node, Rect bounds); }