summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2012-05-15 16:55:45 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-05-15 16:55:45 -0700
commit7a59c5aebc5506319deea8fd40d5d308192b8052 (patch)
tree0ab5a057e632e446adec625c651082391c84fbb1 /core/java
parent2faa075ed78d39cc7783ed1d9681a5d7b2226173 (diff)
parent41f73bdf4d915305152ba2053b7523bf5f90ffa8 (diff)
downloadframeworks_base-7a59c5aebc5506319deea8fd40d5d308192b8052.zip
frameworks_base-7a59c5aebc5506319deea8fd40d5d308192b8052.tar.gz
frameworks_base-7a59c5aebc5506319deea8fd40d5d308192b8052.tar.bz2
Merge "Always do a HIT_TEST" into jb-dev
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/webkit/WebViewClassic.java26
-rw-r--r--core/java/android/webkit/WebViewCore.java23
-rw-r--r--core/java/android/webkit/WebViewInputDispatcher.java17
3 files changed, 27 insertions, 39 deletions
diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java
index ce67718..f1f3db2 100644
--- a/core/java/android/webkit/WebViewClassic.java
+++ b/core/java/android/webkit/WebViewClassic.java
@@ -1716,6 +1716,10 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
mZoomManager.updateDefaultZoomDensity(density);
}
+ /* package */ int getScaledNavSlop() {
+ return viewToContentDimension(mNavSlop);
+ }
+
/* package */ boolean onSavePassword(String schemePlusHost, String username,
String password, final Message resumeMsg) {
boolean rVal = false;
@@ -4338,10 +4342,6 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
}
private void removeTouchHighlight() {
- if (mWebViewCore != null) {
- mWebViewCore.removeMessages(EventHub.HIT_TEST);
- }
- mPrivateHandler.removeMessages(HIT_TEST_RESULT);
setTouchHighlightRects(null);
}
@@ -5816,7 +5816,6 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
switch (action) {
case MotionEvent.ACTION_DOWN: {
mConfirmMove = false;
- mInitialHitTestResult = null;
if (!mEditTextScroller.isFinished()) {
mEditTextScroller.abortAnimation();
}
@@ -5838,23 +5837,6 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
}
} else { // the normal case
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) {
EventLog.writeEvent(EventLogTags.BROWSER_DOUBLE_TAP_DURATION,
(eventTime - mLastTouchUpTime), eventTime);
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 7aa9a0b..76cd1c9 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -1143,8 +1143,6 @@ public final class WebViewCore {
static final int ADD_PACKAGE_NAME = 185;
static final int REMOVE_PACKAGE_NAME = 186;
- static final int HIT_TEST = 187;
-
// accessibility support
static final int MODIFY_SELECTION = 190;
@@ -1648,18 +1646,6 @@ public final class WebViewCore {
(Set<String>) msg.obj);
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:
setUseMockDeviceOrientation();
break;
@@ -1792,6 +1778,15 @@ public final class WebViewCore {
return false;
}
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:
return nativeMouseClick(mNativeClass);
diff --git a/core/java/android/webkit/WebViewInputDispatcher.java b/core/java/android/webkit/WebViewInputDispatcher.java
index 9328d8c..9eeb311 100644
--- a/core/java/android/webkit/WebViewInputDispatcher.java
+++ b/core/java/android/webkit/WebViewInputDispatcher.java
@@ -204,6 +204,11 @@ final class WebViewInputDispatcher {
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.
*/
public static final int FLAG_PRIVATE = 1 << 0;
@@ -499,13 +504,17 @@ final class WebViewInputDispatcher {
}
private void enqueueDoubleTapLocked(MotionEvent event) {
- unscheduleClickLocked();
- hideTapCandidateLocked();
MotionEvent eventToEnqueue = MotionEvent.obtainNoHistory(event);
DispatchEvent d = obtainDispatchEventLocked(eventToEnqueue, EVENT_TYPE_DOUBLE_TAP, 0,
mPostLastWebKitXOffset, mPostLastWebKitYOffset, mPostLastWebKitScale);
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) {
@@ -545,6 +554,7 @@ final class WebViewInputDispatcher {
mInitialDownX = event.getX();
mInitialDownY = event.getY();
scheduleShowTapHighlightLocked();
+ enqueueHitTestLocked(event);
} else if (action == MotionEvent.ACTION_UP) {
unscheduleLongPressLocked();
if (isClickCandidateLocked(event)) {
@@ -824,6 +834,7 @@ final class WebViewInputDispatcher {
case EVENT_TYPE_CLICK:
case EVENT_TYPE_HOVER:
case EVENT_TYPE_SCROLL:
+ case EVENT_TYPE_HIT_TEST:
return false;
case EVENT_TYPE_TOUCH:
return !mPostSendTouchEventsToWebKit