am aac5066d: Merge "Add intercept path for UI touch handling." into jb-dev
* commit 'aac5066dbf17987887dc46d90df1ce465d0c4c50': Add intercept path for UI touch handling.
This commit is contained in:
@@ -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:
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -314,11 +313,13 @@ final class WebViewInputDispatcher {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mPostSendTouchEventsToWebKit
|
||||
&& mPostDoNotSendTouchEventsToWebKitUntilNextGesture
|
||||
&& action == MotionEvent.ACTION_DOWN) {
|
||||
// Recover from a previous web kit timeout.
|
||||
mPostDoNotSendTouchEventsToWebKitUntilNextGesture = false;
|
||||
if (action == MotionEvent.ACTION_DOWN && mPostSendTouchEventsToWebKit) {
|
||||
if (mUiCallbacks.shouldInterceptTouchEvent(eventToEnqueue)) {
|
||||
mPostDoNotSendTouchEventsToWebKitUntilNextGesture = true;
|
||||
} else if (mPostDoNotSendTouchEventsToWebKitUntilNextGesture) {
|
||||
// Recover from a previous web kit timeout.
|
||||
mPostDoNotSendTouchEventsToWebKitUntilNextGesture = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user