private void scrollBy(int deltaX, int deltaY) { if (deltaX == 0 && deltaY == 0) return; final int scrollX = mDelegate.getContainerViewScrollX(); final int scrollY = mDelegate.getContainerViewScrollY(); final int scrollRangeX = computeMaximumHorizontalScrollOffset(); final int scrollRangeY = computeMaximumVerticalScrollOffset(); // The android.view.View.overScrollBy method is used for both scrolling and over-scrolling // which is why we use it here. mDelegate.overScrollContainerViewBy( deltaX, deltaY, scrollX, scrollY, scrollRangeX, scrollRangeY, mProcessingTouchEvent); }
// Called by the native side to attempt to scroll the container view. public void scrollContainerViewTo(int x, int y) { mNativeScrollX = x; mNativeScrollY = y; final int scrollX = mDelegate.getContainerViewScrollX(); final int scrollY = mDelegate.getContainerViewScrollY(); final int deltaX = x - scrollX; final int deltaY = y - scrollY; final int scrollRangeX = computeMaximumHorizontalScrollOffset(); final int scrollRangeY = computeMaximumVerticalScrollOffset(); // We use overScrollContainerViewBy to be compatible with WebViewClassic which used this // method for handling both over-scroll as well as in-bounds scroll. mDelegate.overScrollContainerViewBy( deltaX, deltaY, scrollX, scrollY, scrollRangeX, scrollRangeY, mProcessingTouchEvent); }