am 7a59c5ae: Merge "Always do a HIT_TEST" into jb-dev
* commit '7a59c5aebc5506319deea8fd40d5d308192b8052': Always do a HIT_TEST
This commit is contained in:
@@ -1716,6 +1716,10 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
|
|||||||
mZoomManager.updateDefaultZoomDensity(density);
|
mZoomManager.updateDefaultZoomDensity(density);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* package */ int getScaledNavSlop() {
|
||||||
|
return viewToContentDimension(mNavSlop);
|
||||||
|
}
|
||||||
|
|
||||||
/* package */ boolean onSavePassword(String schemePlusHost, String username,
|
/* package */ boolean onSavePassword(String schemePlusHost, String username,
|
||||||
String password, final Message resumeMsg) {
|
String password, final Message resumeMsg) {
|
||||||
boolean rVal = false;
|
boolean rVal = false;
|
||||||
@@ -4338,10 +4342,6 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void removeTouchHighlight() {
|
private void removeTouchHighlight() {
|
||||||
if (mWebViewCore != null) {
|
|
||||||
mWebViewCore.removeMessages(EventHub.HIT_TEST);
|
|
||||||
}
|
|
||||||
mPrivateHandler.removeMessages(HIT_TEST_RESULT);
|
|
||||||
setTouchHighlightRects(null);
|
setTouchHighlightRects(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5816,7 +5816,6 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
|
|||||||
switch (action) {
|
switch (action) {
|
||||||
case MotionEvent.ACTION_DOWN: {
|
case MotionEvent.ACTION_DOWN: {
|
||||||
mConfirmMove = false;
|
mConfirmMove = false;
|
||||||
mInitialHitTestResult = null;
|
|
||||||
if (!mEditTextScroller.isFinished()) {
|
if (!mEditTextScroller.isFinished()) {
|
||||||
mEditTextScroller.abortAnimation();
|
mEditTextScroller.abortAnimation();
|
||||||
}
|
}
|
||||||
@@ -5838,23 +5837,6 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
|
|||||||
}
|
}
|
||||||
} else { // the normal case
|
} else { // the normal case
|
||||||
mTouchMode = TOUCH_INIT_MODE;
|
mTouchMode = TOUCH_INIT_MODE;
|
||||||
// TODO: Have WebViewInputDispatch handle this
|
|
||||||
TouchHighlightData data = new TouchHighlightData();
|
|
||||||
data.mX = contentX;
|
|
||||||
data.mY = contentY;
|
|
||||||
data.mNativeLayerRect = new Rect();
|
|
||||||
if (mNativeClass != 0) {
|
|
||||||
data.mNativeLayer = nativeScrollableLayer(mNativeClass,
|
|
||||||
contentX, contentY, data.mNativeLayerRect, null);
|
|
||||||
} else {
|
|
||||||
data.mNativeLayer = 0;
|
|
||||||
}
|
|
||||||
data.mSlop = viewToContentDimension(mNavSlop);
|
|
||||||
removeTouchHighlight();
|
|
||||||
if (!mBlockWebkitViewMessages && mWebViewCore != null) {
|
|
||||||
mWebViewCore.sendMessageAtFrontOfQueue(
|
|
||||||
EventHub.HIT_TEST, data);
|
|
||||||
}
|
|
||||||
if (mLogEvent && eventTime - mLastTouchUpTime < 1000) {
|
if (mLogEvent && eventTime - mLastTouchUpTime < 1000) {
|
||||||
EventLog.writeEvent(EventLogTags.BROWSER_DOUBLE_TAP_DURATION,
|
EventLog.writeEvent(EventLogTags.BROWSER_DOUBLE_TAP_DURATION,
|
||||||
(eventTime - mLastTouchUpTime), eventTime);
|
(eventTime - mLastTouchUpTime), eventTime);
|
||||||
|
|||||||
@@ -1143,8 +1143,6 @@ public final class WebViewCore {
|
|||||||
static final int ADD_PACKAGE_NAME = 185;
|
static final int ADD_PACKAGE_NAME = 185;
|
||||||
static final int REMOVE_PACKAGE_NAME = 186;
|
static final int REMOVE_PACKAGE_NAME = 186;
|
||||||
|
|
||||||
static final int HIT_TEST = 187;
|
|
||||||
|
|
||||||
// accessibility support
|
// accessibility support
|
||||||
static final int MODIFY_SELECTION = 190;
|
static final int MODIFY_SELECTION = 190;
|
||||||
|
|
||||||
@@ -1648,18 +1646,6 @@ public final class WebViewCore {
|
|||||||
(Set<String>) msg.obj);
|
(Set<String>) msg.obj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HIT_TEST:
|
|
||||||
TouchHighlightData d = (TouchHighlightData) msg.obj;
|
|
||||||
if (d.mNativeLayer != 0) {
|
|
||||||
nativeScrollLayer(mNativeClass,
|
|
||||||
d.mNativeLayer, d.mNativeLayerRect);
|
|
||||||
}
|
|
||||||
WebKitHitTest hit = performHitTest(d.mX, d.mY, d.mSlop, true);
|
|
||||||
mWebViewClassic.mPrivateHandler.obtainMessage(
|
|
||||||
WebViewClassic.HIT_TEST_RESULT, hit)
|
|
||||||
.sendToTarget();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SET_USE_MOCK_DEVICE_ORIENTATION:
|
case SET_USE_MOCK_DEVICE_ORIENTATION:
|
||||||
setUseMockDeviceOrientation();
|
setUseMockDeviceOrientation();
|
||||||
break;
|
break;
|
||||||
@@ -1792,6 +1778,15 @@ public final class WebViewCore {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (eventType) {
|
switch (eventType) {
|
||||||
|
case WebViewInputDispatcher.EVENT_TYPE_HIT_TEST:
|
||||||
|
int x = Math.round(event.getX());
|
||||||
|
int y = Math.round(event.getY());
|
||||||
|
WebKitHitTest hit = performHitTest(x, y,
|
||||||
|
mWebViewClassic.getScaledNavSlop(), true);
|
||||||
|
mWebViewClassic.mPrivateHandler.obtainMessage(
|
||||||
|
WebViewClassic.HIT_TEST_RESULT, hit).sendToTarget();
|
||||||
|
return false;
|
||||||
|
|
||||||
case WebViewInputDispatcher.EVENT_TYPE_CLICK:
|
case WebViewInputDispatcher.EVENT_TYPE_CLICK:
|
||||||
return nativeMouseClick(mNativeClass);
|
return nativeMouseClick(mNativeClass);
|
||||||
|
|
||||||
|
|||||||
@@ -203,6 +203,11 @@ final class WebViewInputDispatcher {
|
|||||||
*/
|
*/
|
||||||
public static final int EVENT_TYPE_DOUBLE_TAP = 5;
|
public static final int EVENT_TYPE_DOUBLE_TAP = 5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event type: Indicates that a hit test should be performed
|
||||||
|
*/
|
||||||
|
public static final int EVENT_TYPE_HIT_TEST = 6;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag: This event is private to this queue. Do not forward it.
|
* Flag: This event is private to this queue. Do not forward it.
|
||||||
*/
|
*/
|
||||||
@@ -499,13 +504,17 @@ final class WebViewInputDispatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void enqueueDoubleTapLocked(MotionEvent event) {
|
private void enqueueDoubleTapLocked(MotionEvent event) {
|
||||||
unscheduleClickLocked();
|
|
||||||
hideTapCandidateLocked();
|
|
||||||
MotionEvent eventToEnqueue = MotionEvent.obtainNoHistory(event);
|
MotionEvent eventToEnqueue = MotionEvent.obtainNoHistory(event);
|
||||||
DispatchEvent d = obtainDispatchEventLocked(eventToEnqueue, EVENT_TYPE_DOUBLE_TAP, 0,
|
DispatchEvent d = obtainDispatchEventLocked(eventToEnqueue, EVENT_TYPE_DOUBLE_TAP, 0,
|
||||||
mPostLastWebKitXOffset, mPostLastWebKitYOffset, mPostLastWebKitScale);
|
mPostLastWebKitXOffset, mPostLastWebKitYOffset, mPostLastWebKitScale);
|
||||||
enqueueEventLocked(d);
|
enqueueEventLocked(d);
|
||||||
mIsDoubleTapCandidate = false;
|
}
|
||||||
|
|
||||||
|
private void enqueueHitTestLocked(MotionEvent event) {
|
||||||
|
MotionEvent eventToEnqueue = MotionEvent.obtainNoHistory(event);
|
||||||
|
DispatchEvent d = obtainDispatchEventLocked(eventToEnqueue, EVENT_TYPE_HIT_TEST, 0,
|
||||||
|
mPostLastWebKitXOffset, mPostLastWebKitYOffset, mPostLastWebKitScale);
|
||||||
|
enqueueEventLocked(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkForSlopLocked(MotionEvent event) {
|
private void checkForSlopLocked(MotionEvent event) {
|
||||||
@@ -545,6 +554,7 @@ final class WebViewInputDispatcher {
|
|||||||
mInitialDownX = event.getX();
|
mInitialDownX = event.getX();
|
||||||
mInitialDownY = event.getY();
|
mInitialDownY = event.getY();
|
||||||
scheduleShowTapHighlightLocked();
|
scheduleShowTapHighlightLocked();
|
||||||
|
enqueueHitTestLocked(event);
|
||||||
} else if (action == MotionEvent.ACTION_UP) {
|
} else if (action == MotionEvent.ACTION_UP) {
|
||||||
unscheduleLongPressLocked();
|
unscheduleLongPressLocked();
|
||||||
if (isClickCandidateLocked(event)) {
|
if (isClickCandidateLocked(event)) {
|
||||||
@@ -824,6 +834,7 @@ final class WebViewInputDispatcher {
|
|||||||
case EVENT_TYPE_CLICK:
|
case EVENT_TYPE_CLICK:
|
||||||
case EVENT_TYPE_HOVER:
|
case EVENT_TYPE_HOVER:
|
||||||
case EVENT_TYPE_SCROLL:
|
case EVENT_TYPE_SCROLL:
|
||||||
|
case EVENT_TYPE_HIT_TEST:
|
||||||
return false;
|
return false;
|
||||||
case EVENT_TYPE_TOUCH:
|
case EVENT_TYPE_TOUCH:
|
||||||
return !mPostSendTouchEventsToWebKit
|
return !mPostSendTouchEventsToWebKit
|
||||||
|
|||||||
Reference in New Issue
Block a user