Loading core/java/android/webkit/WebViewClassic.java +22 −0 Original line number Diff line number Diff line Loading @@ -7593,6 +7593,8 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc case UPDATE_CONTENT_BOUNDS: mEditTextContentBounds.set((Rect) msg.obj); nativeMapLayerRect(mNativeClass, mEditTextLayerId, mEditTextContentBounds); break; case SCROLL_EDIT_TEXT: Loading @@ -7619,6 +7621,26 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc public Context getContext() { return WebViewClassic.this.getContext(); } @Override public boolean shouldInterceptTouchEvent(MotionEvent event) { if (!mSelectingText) { return false; } ensureSelectionHandles(); int y = Math.round(event.getY() - getTitleHeight() + getScrollY()); int x = Math.round(event.getX() + getScrollX()); boolean isPressingHandle; if (mIsCaretSelection) { isPressingHandle = mSelectHandleCenter.getBounds() .contains(x, y); } else { isPressingHandle = mSelectHandleLeft.getBounds().contains(x, y) || mSelectHandleRight.getBounds().contains(x, y); } return isPressingHandle; } } private void setHitTestTypeFromUrl(String url) { Loading core/java/android/webkit/WebViewInputDispatcher.java +16 −6 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.os.Looper; import android.os.Message; import android.os.SystemClock; import android.util.Log; import android.view.InputDevice; import android.view.MotionEvent; import android.view.ViewConfiguration; Loading Loading @@ -314,13 +313,15 @@ final class WebViewInputDispatcher { return false; } if (mPostSendTouchEventsToWebKit && mPostDoNotSendTouchEventsToWebKitUntilNextGesture && action == MotionEvent.ACTION_DOWN) { if (action == MotionEvent.ACTION_DOWN && mPostSendTouchEventsToWebKit) { if (mUiCallbacks.shouldInterceptTouchEvent(eventToEnqueue)) { mPostDoNotSendTouchEventsToWebKitUntilNextGesture = true; } else if (mPostDoNotSendTouchEventsToWebKitUntilNextGesture) { // Recover from a previous web kit timeout. mPostDoNotSendTouchEventsToWebKitUntilNextGesture = false; } } } // Copy the event because we need to retain ownership. if (eventToEnqueue == event) { Loading Loading @@ -949,6 +950,15 @@ final class WebViewInputDispatcher { * @param flags The event's dispatch flags. */ public void dispatchUiEvent(MotionEvent event, int eventType, int flags); /** * Asks the UI thread whether this touch event stream should be * intercepted based on the touch down event. * @param event The touch down event. * @return true if the UI stream wants the touch stream without going * through webkit or false otherwise. */ public boolean shouldInterceptTouchEvent(MotionEvent event); } /* Implemented by {@link WebViewCore} to perform operations on the web kit thread. */ Loading Loading
core/java/android/webkit/WebViewClassic.java +22 −0 Original line number Diff line number Diff line Loading @@ -7593,6 +7593,8 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc case UPDATE_CONTENT_BOUNDS: mEditTextContentBounds.set((Rect) msg.obj); nativeMapLayerRect(mNativeClass, mEditTextLayerId, mEditTextContentBounds); break; case SCROLL_EDIT_TEXT: Loading @@ -7619,6 +7621,26 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc public Context getContext() { return WebViewClassic.this.getContext(); } @Override public boolean shouldInterceptTouchEvent(MotionEvent event) { if (!mSelectingText) { return false; } ensureSelectionHandles(); int y = Math.round(event.getY() - getTitleHeight() + getScrollY()); int x = Math.round(event.getX() + getScrollX()); boolean isPressingHandle; if (mIsCaretSelection) { isPressingHandle = mSelectHandleCenter.getBounds() .contains(x, y); } else { isPressingHandle = mSelectHandleLeft.getBounds().contains(x, y) || mSelectHandleRight.getBounds().contains(x, y); } return isPressingHandle; } } private void setHitTestTypeFromUrl(String url) { Loading
core/java/android/webkit/WebViewInputDispatcher.java +16 −6 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.os.Looper; import android.os.Message; import android.os.SystemClock; import android.util.Log; import android.view.InputDevice; import android.view.MotionEvent; import android.view.ViewConfiguration; Loading Loading @@ -314,13 +313,15 @@ final class WebViewInputDispatcher { return false; } if (mPostSendTouchEventsToWebKit && mPostDoNotSendTouchEventsToWebKitUntilNextGesture && action == MotionEvent.ACTION_DOWN) { if (action == MotionEvent.ACTION_DOWN && mPostSendTouchEventsToWebKit) { if (mUiCallbacks.shouldInterceptTouchEvent(eventToEnqueue)) { mPostDoNotSendTouchEventsToWebKitUntilNextGesture = true; } else if (mPostDoNotSendTouchEventsToWebKitUntilNextGesture) { // Recover from a previous web kit timeout. mPostDoNotSendTouchEventsToWebKitUntilNextGesture = false; } } } // Copy the event because we need to retain ownership. if (eventToEnqueue == event) { Loading Loading @@ -949,6 +950,15 @@ final class WebViewInputDispatcher { * @param flags The event's dispatch flags. */ public void dispatchUiEvent(MotionEvent event, int eventType, int flags); /** * Asks the UI thread whether this touch event stream should be * intercepted based on the touch down event. * @param event The touch down event. * @return true if the UI stream wants the touch stream without going * through webkit or false otherwise. */ public boolean shouldInterceptTouchEvent(MotionEvent event); } /* Implemented by {@link WebViewCore} to perform operations on the web kit thread. */ Loading