@@ -3735,7 +3735,7 @@ public void computeScroll() {
37353735 private void scrollLayerTo (int x , int y ) {
37363736 int dx = mScrollingLayerRect .left - x ;
37373737 int dy = mScrollingLayerRect .top - y ;
3738- if (dx == 0 && dy == 0 ) {
3738+ if (( dx == 0 && dy == 0 ) || mNativeClass == 0 ) {
37393739 return ;
37403740 }
37413741 if (mSelectingText ) {
@@ -3756,7 +3756,7 @@ private void scrollLayerTo(int x, int y) {
37563756 mEditTextContentBounds .offset (dx , dy );
37573757 mAutoCompletePopup .resetRect ();
37583758 }
3759- nativeScrollLayer (mCurrentScrollingLayerId , x , y );
3759+ nativeScrollLayer (mNativeClass , mCurrentScrollingLayerId , x , y );
37603760 mScrollingLayerRect .left = x ;
37613761 mScrollingLayerRect .top = y ;
37623762 mWebViewCore .sendMessage (WebViewCore .EventHub .SCROLL_LAYER , mCurrentScrollingLayerId ,
@@ -5699,10 +5699,13 @@ void onPinchToZoomAnimationEnd(ScaleGestureDetector detector) {
56995699 // See if there is a layer at x, y and switch to TOUCH_DRAG_LAYER_MODE if a
57005700 // layer is found.
57015701 private void startScrollingLayer (float x , float y ) {
5702+ if (mNativeClass == 0 )
5703+ return ;
5704+
57025705 int contentX = viewToContentX ((int ) x + getScrollX ());
57035706 int contentY = viewToContentY ((int ) y + getScrollY ());
5704- mCurrentScrollingLayerId = nativeScrollableLayer (contentX , contentY ,
5705- mScrollingLayerRect , mScrollingLayerBounds );
5707+ mCurrentScrollingLayerId = nativeScrollableLayer (mNativeClass ,
5708+ contentX , contentY , mScrollingLayerRect , mScrollingLayerBounds );
57065709 if (mCurrentScrollingLayerId != 0 ) {
57075710 mTouchMode = TOUCH_DRAG_LAYER_MODE ;
57085711 }
@@ -5808,8 +5811,12 @@ private void handleTouchEventCommon(MotionEvent event, int action, int x, int y)
58085811 data .mX = contentX ;
58095812 data .mY = contentY ;
58105813 data .mNativeLayerRect = new Rect ();
5811- data .mNativeLayer = nativeScrollableLayer (
5812- contentX , contentY , data .mNativeLayerRect , null );
5814+ if (mNativeClass != 0 ) {
5815+ data .mNativeLayer = nativeScrollableLayer (mNativeClass ,
5816+ contentX , contentY , data .mNativeLayerRect , null );
5817+ } else {
5818+ data .mNativeLayer = 0 ;
5819+ }
58135820 data .mSlop = viewToContentDimension (mNavSlop );
58145821 removeTouchHighlight ();
58155822 if (!mBlockWebkitViewMessages ) {
@@ -8608,16 +8615,17 @@ private native boolean nativeSetBaseLayer(int nativeInstance,
86088615 private native void nativeUseHardwareAccelSkia (boolean enabled );
86098616
86108617 // Returns a pointer to the scrollable LayerAndroid at the given point.
8611- private native int nativeScrollableLayer (int x , int y , Rect scrollRect ,
8618+ private native int nativeScrollableLayer (int nativeInstance , int x , int y , Rect scrollRect ,
86128619 Rect scrollBounds );
86138620 /**
86148621 * Scroll the specified layer.
8622+ * @param nativeInstance Native WebView instance
86158623 * @param layer Id of the layer to scroll, as determined by nativeScrollableLayer.
86168624 * @param newX Destination x position to which to scroll.
86178625 * @param newY Destination y position to which to scroll.
86188626 * @return True if the layer is successfully scrolled.
86198627 */
8620- private native boolean nativeScrollLayer (int layer , int newX , int newY );
8628+ private native boolean nativeScrollLayer (int nativeInstance , int layer , int newX , int newY );
86218629 private native void nativeSetIsScrolling (boolean isScrolling );
86228630 private native int nativeGetBackgroundColor ();
86238631 native boolean nativeSetProperty (String key , String value );
0 commit comments