OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.android_webview; | 5 package org.chromium.android_webview; |
6 | 6 |
7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.app.Activity; | 8 import android.app.Activity; |
9 import android.content.ComponentCallbacks2; | 9 import android.content.ComponentCallbacks2; |
10 import android.content.Context; | 10 import android.content.Context; |
(...skipping 2327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2338 if (isDestroyed()) return false; | 2338 if (isDestroyed()) return false; |
2339 if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { | 2339 if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { |
2340 mSettings.setSpatialNavigationEnabled(false); | 2340 mSettings.setSpatialNavigationEnabled(false); |
2341 } | 2341 } |
2342 | 2342 |
2343 mScrollOffsetManager.setProcessingTouchEvent(true); | 2343 mScrollOffsetManager.setProcessingTouchEvent(true); |
2344 boolean rv = mContentViewCore.onTouchEvent(event); | 2344 boolean rv = mContentViewCore.onTouchEvent(event); |
2345 mScrollOffsetManager.setProcessingTouchEvent(false); | 2345 mScrollOffsetManager.setProcessingTouchEvent(false); |
2346 | 2346 |
2347 if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { | 2347 if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { |
2348 int actionIndex = event.getActionIndex(); | |
2349 | |
2350 // Note this will trigger IPC back to browser even if nothing is | 2348 // Note this will trigger IPC back to browser even if nothing is |
2351 // hit. | 2349 // hit. |
2352 nativeRequestNewHitTestDataAt(mNativeAwContents, | 2350 nativeRequestNewHitTestDataAt(mNativeAwContents, |
2353 (int) Math.round(event.getX(actionIndex) / mDIPScale), | 2351 event.getX() / (float) mDIPScale, |
2354 (int) Math.round(event.getY(actionIndex) / mDIPScale)); | 2352 event.getY() / (float) mDIPScale, |
| 2353 event.getTouchMajor() / (float) mDIPScale); |
2355 } | 2354 } |
2356 | 2355 |
2357 if (mOverScrollGlow != null) { | 2356 if (mOverScrollGlow != null) { |
2358 if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { | 2357 if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { |
2359 mOverScrollGlow.setShouldPull(true); | 2358 mOverScrollGlow.setShouldPull(true); |
2360 } else if (event.getActionMasked() == MotionEvent.ACTION_UP | 2359 } else if (event.getActionMasked() == MotionEvent.ACTION_UP |
2361 || event.getActionMasked() == MotionEvent.ACTION_CANCEL)
{ | 2360 || event.getActionMasked() == MotionEvent.ACTION_CANCEL)
{ |
2362 mOverScrollGlow.setShouldPull(false); | 2361 mOverScrollGlow.setShouldPull(false); |
2363 mOverScrollGlow.releaseAll(); | 2362 mOverScrollGlow.releaseAll(); |
2364 } | 2363 } |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2558 private native boolean nativeOnDraw(long nativeAwContents, Canvas canvas, | 2557 private native boolean nativeOnDraw(long nativeAwContents, Canvas canvas, |
2559 boolean isHardwareAccelerated, int scrollX, int scrollY, | 2558 boolean isHardwareAccelerated, int scrollX, int scrollY, |
2560 int visibleLeft, int visibleTop, int visibleRight, int visibleBottom
); | 2559 int visibleLeft, int visibleTop, int visibleRight, int visibleBottom
); |
2561 private native void nativeFindAllAsync(long nativeAwContents, String searchS
tring); | 2560 private native void nativeFindAllAsync(long nativeAwContents, String searchS
tring); |
2562 private native void nativeFindNext(long nativeAwContents, boolean forward); | 2561 private native void nativeFindNext(long nativeAwContents, boolean forward); |
2563 private native void nativeClearMatches(long nativeAwContents); | 2562 private native void nativeClearMatches(long nativeAwContents); |
2564 private native void nativeClearCache(long nativeAwContents, boolean includeD
iskFiles); | 2563 private native void nativeClearCache(long nativeAwContents, boolean includeD
iskFiles); |
2565 private native byte[] nativeGetCertificate(long nativeAwContents); | 2564 private native byte[] nativeGetCertificate(long nativeAwContents); |
2566 | 2565 |
2567 // Coordinates in desity independent pixels. | 2566 // Coordinates in desity independent pixels. |
2568 private native void nativeRequestNewHitTestDataAt(long nativeAwContents, int
x, int y); | 2567 private native void nativeRequestNewHitTestDataAt(long nativeAwContents, flo
at x, float y, |
| 2568 float touchMajor); |
2569 private native void nativeUpdateLastHitTestData(long nativeAwContents); | 2569 private native void nativeUpdateLastHitTestData(long nativeAwContents); |
2570 | 2570 |
2571 private native void nativeOnSizeChanged(long nativeAwContents, int w, int h,
int ow, int oh); | 2571 private native void nativeOnSizeChanged(long nativeAwContents, int w, int h,
int ow, int oh); |
2572 private native void nativeScrollTo(long nativeAwContents, int x, int y); | 2572 private native void nativeScrollTo(long nativeAwContents, int x, int y); |
2573 private native void nativeSetViewVisibility(long nativeAwContents, boolean v
isible); | 2573 private native void nativeSetViewVisibility(long nativeAwContents, boolean v
isible); |
2574 private native void nativeSetWindowVisibility(long nativeAwContents, boolean
visible); | 2574 private native void nativeSetWindowVisibility(long nativeAwContents, boolean
visible); |
2575 private native void nativeSetIsPaused(long nativeAwContents, boolean paused)
; | 2575 private native void nativeSetIsPaused(long nativeAwContents, boolean paused)
; |
2576 private native void nativeOnAttachedToWindow(long nativeAwContents, int w, i
nt h); | 2576 private native void nativeOnAttachedToWindow(long nativeAwContents, int w, i
nt h); |
2577 private static native void nativeOnDetachedFromWindow(long nativeAwContents)
; | 2577 private static native void nativeOnDetachedFromWindow(long nativeAwContents)
; |
2578 private native void nativeSetDipScale(long nativeAwContents, float dipScale)
; | 2578 private native void nativeSetDipScale(long nativeAwContents, float dipScale)
; |
(...skipping 20 matching lines...) Expand all Loading... |
2599 | 2599 |
2600 private native void nativeSetJsOnlineProperty(long nativeAwContents, boolean
networkUp); | 2600 private native void nativeSetJsOnlineProperty(long nativeAwContents, boolean
networkUp); |
2601 | 2601 |
2602 private native void nativeTrimMemory(long nativeAwContents, int level, boole
an visible); | 2602 private native void nativeTrimMemory(long nativeAwContents, int level, boole
an visible); |
2603 | 2603 |
2604 private native void nativeCreatePdfExporter(long nativeAwContents, AwPdfExpo
rter awPdfExporter); | 2604 private native void nativeCreatePdfExporter(long nativeAwContents, AwPdfExpo
rter awPdfExporter); |
2605 | 2605 |
2606 private native void nativePreauthorizePermission(long nativeAwContents, Stri
ng origin, | 2606 private native void nativePreauthorizePermission(long nativeAwContents, Stri
ng origin, |
2607 long resources); | 2607 long resources); |
2608 } | 2608 } |
OLD | NEW |