summaryrefslogtreecommitdiffstats
path: root/android_webview
diff options
context:
space:
mode:
authorboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-13 10:04:06 +0000
committerboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-13 10:04:06 +0000
commitb21e38eefffd748a2907892d7475193e2cda90ad (patch)
tree1bd4e0567e5a80cec6b6764fe63e51094948686f /android_webview
parent1cd3137196a6e66f2b5ac957f9a9a0c6244cf818 (diff)
downloadchromium_src-b21e38eefffd748a2907892d7475193e2cda90ad.zip
chromium_src-b21e38eefffd748a2907892d7475193e2cda90ad.tar.gz
chromium_src-b21e38eefffd748a2907892d7475193e2cda90ad.tar.bz2
Add touch event methods to AwContents
They simply call out directly to ContentViewCore counterparts, except onTouchEvent which also triggers hit test. BUG= Review URL: https://chromiumcodereview.appspot.com/11366208 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167348 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
-rw-r--r--android_webview/java/src/org/chromium/android_webview/AwContents.java46
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/WebKitHitTestTest.java2
2 files changed, 33 insertions, 15 deletions
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index c5e38c3..db92f07 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -398,20 +398,6 @@ public class AwContents {
}
/**
- * This should be called from the onTouchEvent of the view.
- */
- public void considerMotionEventForHitTest(MotionEvent event) {
- if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
- int actionIndex = event.getActionIndex();
-
- // Note this will trigger IPC back to browser even if nothing is hit.
- nativeRequestNewHitTestDataAt(mNativeAwContents,
- Math.round(event.getX(actionIndex)),
- Math.round(event.getY(actionIndex)));
- }
- }
-
- /**
* Method to return all hit test values relevant to public WebView API.
* Note that this expose more data than needed for WebView.getHitTestResult.
*/
@@ -451,6 +437,38 @@ public class AwContents {
msg.sendToTarget();
}
+ /**
+ * @see android.webkit.WebView#onTouchEvent()
+ */
+ public boolean onTouchEvent(MotionEvent event) {
+ boolean rv = mContentViewCore.onTouchEvent(event);
+
+ if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
+ int actionIndex = event.getActionIndex();
+
+ // Note this will trigger IPC back to browser even if nothing is hit.
+ nativeRequestNewHitTestDataAt(mNativeAwContents,
+ Math.round(event.getX(actionIndex)),
+ Math.round(event.getY(actionIndex)));
+ }
+
+ return rv;
+ }
+
+ /**
+ * @see android.webkit.WebView#onHoverEvent()
+ */
+ public boolean onHoverEvent(MotionEvent event) {
+ return mContentViewCore.onHoverEvent(event);
+ }
+
+ /**
+ * @see android.webkit.WebView#onGenericMotionEvent()
+ */
+ public boolean onGenericMotionEvent(MotionEvent event) {
+ return mContentViewCore.onGenericMotionEvent(event);
+ }
+
//--------------------------------------------------------------------------------------------
// Methods called from native via JNI
//--------------------------------------------------------------------------------------------
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/WebKitHitTestTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/WebKitHitTestTest.java
index 1abf4f7..a71103a4 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/WebKitHitTestTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/WebKitHitTestTest.java
@@ -74,7 +74,7 @@ public class WebKitHitTestTest extends AndroidWebViewTestBase {
@Override
public void run() {
long eventTime = SystemClock.uptimeMillis();
- mAwContents.considerMotionEventForHitTest(MotionEvent.obtain(
+ mAwContents.onTouchEvent(MotionEvent.obtain(
eventTime, eventTime, MotionEvent.ACTION_DOWN,
(float)(mTestView.getRight() - mTestView.getLeft()) / 2,
(float)(mTestView.getBottom() - mTestView.getTop()) / 2,