Chromium Code Reviews| 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 4730d24d0e56f12a720531eed954a2d94f89543f..1aeab73ff8014338408329eaa0236b51e2fc8f37 100644 |
| --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java |
| +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java |
| @@ -117,6 +117,7 @@ public class AwContents { |
| private InterceptNavigationDelegateImpl mInterceptNavigationDelegate; |
| private InternalAccessDelegate mInternalAccessAdapter; |
| private final AwLayoutSizer mLayoutSizer; |
| + private final AwScrollOffsetManager mScrollOffsetManager; |
| private AwZoomControls mZoomControls; |
| // This can be accessed on any thread after construction. See AwContentsIoThreadClient. |
| private final AwSettings mSettings; |
| @@ -277,6 +278,30 @@ public class AwContents { |
| } |
| //-------------------------------------------------------------------------------------------- |
| + private class AwScrollOffsetManagerDelegate implements AwScrollOffsetManager.Delegate { |
| + @Override |
| + public boolean scrollContainerViewTo(int xPix, int yPix) { |
| + mContainerView.scrollTo(xPix, yPix); |
| + return (xPix == mContainerView.getScrollX() && yPix == mContainerView.getScrollY()); |
| + } |
| + |
| + @Override |
| + public void scrollNativeTo(int xCss, int yCss) { |
| + nativeScrollTo(mNativeAwContents, xCss, yCss); |
| + } |
| + |
| + @Override |
| + public int getContainerViewScrollXPix() { |
| + return mContainerView.getScrollX(); |
| + } |
| + |
| + @Override |
| + public int getContainerViewScrollYPix() { |
| + return mContainerView.getScrollY(); |
| + } |
| + } |
| + |
| + //-------------------------------------------------------------------------------------------- |
| private class AwPinchGestureStateListener implements ContentViewCore.PinchGestureStateListener { |
| @Override |
| public void onPinchGestureStart() { |
| @@ -387,6 +412,8 @@ public class AwContents { |
| mDefaultVideoPosterRequestHandler = new DefaultVideoPosterRequestHandler(mContentsClient); |
| mSettings.setDefaultVideoPosterURL( |
| mDefaultVideoPosterRequestHandler.getDefaultVideoPosterURL()); |
| + mScrollOffsetManager = new AwScrollOffsetManager(new AwScrollOffsetManagerDelegate(), |
|
joth
2013/06/18 03:19:50
is this thing intended to be injectable now (this
mkosiba (inactive)
2013/06/18 18:09:25
maybe later, why?
joth
2013/06/19 05:34:45
no problem, just wanted to understand the separati
|
| + mDIPScale); |
| } |
| // Only valid within updatePhysicalBackingSizeIfNeeded(). |
| @@ -487,6 +514,13 @@ public class AwContents { |
| return (int) Math.ceil(mContentViewCore.getContentWidthCss()); |
| } |
| + /** |
| + * Called by the embedder when the scroll offset of the containing view has changed. |
| + */ |
| + public void onContainerViewScrollChanged(int l, int t, int oldl, int oldt) { |
| + mScrollOffsetManager.onContainerViewScrollChanged(l, t); |
| + } |
| + |
| public Picture capturePicture() { |
| return nativeCapturePicture(mNativeAwContents); |
| } |
| @@ -1370,6 +1404,11 @@ public class AwContents { |
| mLayoutSizer.onPageScaleChanged(pageScaleFactor); |
| } |
| + @CalledByNative |
| + private void scrollContainerViewTo(int xCss, int yCss) { |
| + mScrollOffsetManager.scrollContainerViewTo(xCss, yCss); |
| + } |
| + |
| // ------------------------------------------------------------------------------------------- |
| // Helper methods |
| // ------------------------------------------------------------------------------------------- |
| @@ -1447,7 +1486,7 @@ public class AwContents { |
| private native void nativeAddVisitedLinks(int nativeAwContents, String[] visitedLinks); |
| private native boolean nativeOnDraw(int nativeAwContents, Canvas canvas, |
| - boolean isHardwareAccelerated, int scrollX, int ScrollY, |
| + boolean isHardwareAccelerated, int scrollXPix, int ScrollYPix, |
| int clipLeft, int clipTop, int clipRight, int clipBottom); |
| private native void nativeFindAllAsync(int nativeAwContents, String searchString); |
| private native void nativeFindNext(int nativeAwContents, boolean forward); |
| @@ -1460,6 +1499,7 @@ public class AwContents { |
| private native void nativeUpdateLastHitTestData(int nativeAwContents); |
| private native void nativeOnSizeChanged(int nativeAwContents, int w, int h, int ow, int oh); |
| + private native void nativeScrollTo(int nativeAwContents, int x, int y); |
| private native void nativeSetWindowViewVisibility(int nativeAwContents, boolean windowVisible, |
| boolean viewVisible); |
| private native void nativeOnAttachedToWindow(int nativeAwContents, int w, int h); |