@@ -669,7 +669,7 @@ private native String nativeRetrieveImageSource(int nativeClass,
669669 int x , int y );
670670 private native boolean nativeMouseClick (int nativeClass );
671671
672- private native boolean nativeHandleTouchEvent (int nativeClass , int action ,
672+ private native int nativeHandleTouchEvent (int nativeClass , int action ,
673673 int [] idArray , int [] xArray , int [] yArray , int count ,
674674 int actionIndex , int metaState );
675675
@@ -968,6 +968,9 @@ static class TextFieldInitData {
968968 static final int ACTION_LONGPRESS = 0x100 ;
969969 static final int ACTION_DOUBLETAP = 0x200 ;
970970
971+ private static final int TOUCH_FLAG_HIT_HANDLER = 0x1 ;
972+ private static final int TOUCH_FLAG_PREVENT_DEFAULT = 0x2 ;
973+
971974 static class TouchEventData {
972975 int mAction ;
973976 int [] mIds ; // Ids of the touch points
@@ -1784,7 +1787,8 @@ public Looper getWebKitLooper() {
17841787 }
17851788
17861789 @ Override
1787- public boolean dispatchWebKitEvent (MotionEvent event , int eventType , int flags ) {
1790+ public boolean dispatchWebKitEvent (WebViewInputDispatcher dispatcher ,
1791+ MotionEvent event , int eventType , int flags ) {
17881792 if (mNativeClass == 0 ) {
17891793 return false ;
17901794 }
@@ -1811,10 +1815,16 @@ public boolean dispatchWebKitEvent(MotionEvent event, int eventType, int flags)
18111815 xArray [i ] = (int ) event .getX (i );
18121816 yArray [i ] = (int ) event .getY (i );
18131817 }
1814- return nativeHandleTouchEvent (mNativeClass ,
1818+ int touchFlags = nativeHandleTouchEvent (mNativeClass ,
18151819 event .getActionMasked (),
18161820 idArray , xArray , yArray , count ,
18171821 event .getActionIndex (), event .getMetaState ());
1822+ if (touchFlags == 0
1823+ && event .getActionMasked () != MotionEvent .ACTION_CANCEL
1824+ && (flags & WebViewInputDispatcher .FLAG_PRIVATE ) == 0 ) {
1825+ dispatcher .skipWebkitForRemainingTouchStream ();
1826+ }
1827+ return (touchFlags & TOUCH_FLAG_PREVENT_DEFAULT ) > 0 ;
18181828 }
18191829
18201830 default :
0 commit comments