Index: android_webview/java/src/org/chromium/android_webview/AwContents.java |
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 bd6433696783deb62c4fb9accb934faa7c257487..3ed9aec26d94ee3496b38e63060aec3033d282c7 100644 |
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java |
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java |
@@ -31,6 +31,7 @@ import android.view.inputmethod.EditorInfo; |
import android.view.inputmethod.InputConnection; |
import android.webkit.GeolocationPermissions; |
import android.webkit.ValueCallback; |
+import android.widget.OverScroller; |
import com.google.common.annotations.VisibleForTesting; |
@@ -374,10 +375,15 @@ public class AwContents { |
public int getContainerViewScrollY() { |
return mContainerView.getScrollY(); |
} |
+ |
+ @Override |
+ public void invalidate() { |
+ mContainerView.invalidate(); |
+ } |
} |
//-------------------------------------------------------------------------------------------- |
- private class AwPinchGestureStateListener implements ContentViewCore.PinchGestureStateListener { |
+ private class AwGestureStateListener implements ContentViewCore.GestureStateListener { |
@Override |
public void onPinchGestureStart() { |
// While it's possible to re-layout the view during a pinch gesture, the effect is very |
@@ -389,9 +395,20 @@ public class AwContents { |
mLayoutSizer.freezeLayoutRequests(); |
} |
+ @Override |
public void onPinchGestureEnd() { |
mLayoutSizer.unfreezeLayoutRequests(); |
} |
+ |
+ @Override |
+ public void onFlingStartGestureStart(int vx, int vy) { |
+ mScrollOffsetManager.onFlingStartGestureStart(vx, vy); |
+ } |
+ |
+ @Override |
+ public void onUnhandledFlingStartEvent() { |
+ mScrollOffsetManager.onUnhandledFlingStartEvent(); |
+ } |
} |
//-------------------------------------------------------------------------------------------- |
@@ -426,7 +443,7 @@ public class AwContents { |
private static ContentViewCore createAndInitializeContentViewCore(ViewGroup containerView, |
InternalAccessDelegate internalDispatcher, int nativeWebContents, |
- ContentViewCore.PinchGestureStateListener pinchGestureStateListener, |
+ ContentViewCore.GestureStateListener pinchGestureStateListener, |
ContentViewClient contentViewClient, |
ContentViewCore.ZoomControlsDelegate zoomControlsDelegate) { |
ContentViewCore contentViewCore = new ContentViewCore(containerView.getContext()); |
@@ -434,7 +451,7 @@ public class AwContents { |
// compositor, not because input events are delivered immediately. |
contentViewCore.initialize(containerView, internalDispatcher, nativeWebContents, null, |
ContentViewCore.INPUT_EVENTS_DELIVERED_IMMEDIATELY); |
- contentViewCore.setPinchGestureStateListener(pinchGestureStateListener); |
+ contentViewCore.setGestureStateListener(pinchGestureStateListener); |
contentViewCore.setContentViewClient(contentViewClient); |
contentViewCore.setZoomControlsDelegate(zoomControlsDelegate); |
return contentViewCore; |
@@ -481,7 +498,8 @@ public class AwContents { |
mSettings.setDefaultVideoPosterURL( |
mDefaultVideoPosterRequestHandler.getDefaultVideoPosterURL()); |
mContentsClient.setDIPScale(mDIPScale); |
- mScrollOffsetManager = new AwScrollOffsetManager(new AwScrollOffsetManagerDelegate()); |
+ mScrollOffsetManager = new AwScrollOffsetManager(new AwScrollOffsetManagerDelegate(), |
+ new OverScroller(mContainerView.getContext())); |
setOverScrollMode(mContainerView.getOverScrollMode()); |
@@ -515,7 +533,7 @@ public class AwContents { |
int nativeWebContents = nativeGetWebContents(mNativeAwContents); |
mContentViewCore = createAndInitializeContentViewCore( |
mContainerView, mInternalAccessAdapter, nativeWebContents, |
- new AwPinchGestureStateListener(), mContentsClient.getContentViewClient(), |
+ new AwGestureStateListener(), mContentsClient.getContentViewClient(), |
mZoomControls); |
nativeSetJavaPeers(mNativeAwContents, this, mWebContentsDelegate, mContentsClientBridge, |
mIoThreadClient, mInterceptNavigationDelegate); |
@@ -874,6 +892,13 @@ public class AwContents { |
} |
/** |
+ * @see View.computeScroll() |
+ */ |
+ public void computeScroll() { |
+ mScrollOffsetManager.computeScrollAndAbsorbGlow(mOverScrollGlow); |
+ } |
+ |
+ /** |
* @see View#computeHorizontalScrollRange() |
*/ |
public int computeHorizontalScrollRange() { |
@@ -1277,6 +1302,10 @@ public class AwContents { |
mOverScrollGlow.releaseAll(); |
} |
+ if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { |
+ mScrollOffsetManager.onTouchDown(); |
+ } |
+ |
return rv; |
} |
@@ -1662,7 +1691,7 @@ public class AwContents { |
mOverScrollGlow.setOverScrollDeltas(deltaX, deltaY); |
} |
- mScrollOffsetManager.overscrollBy(deltaX, deltaY); |
+ mScrollOffsetManager.overScrollBy(deltaX, deltaY); |
if (mOverScrollGlow != null && mOverScrollGlow.isAnimating()) { |
mContainerView.invalidate(); |