diff options
author | John Reck <jreck@google.com> | 2011-11-02 10:18:12 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-11-14 16:17:54 -0800 |
commit | 83b9e1d99d85091bd4f22be0dba1e634e40a1fb7 (patch) | |
tree | 40e5e011e12c460575e85e297e0119cee2fd9c1d /core | |
parent | 030bb99814157b6424c0bf290bd2ede217b5ba77 (diff) | |
download | frameworks_base-83b9e1d99d85091bd4f22be0dba1e634e40a1fb7.zip frameworks_base-83b9e1d99d85091bd4f22be0dba1e634e40a1fb7.tar.gz frameworks_base-83b9e1d99d85091bd4f22be0dba1e634e40a1fb7.tar.bz2 |
Call onScrollChanged when scrolling layers
Bug: 5533389
Treat layer scrolling as a no-op scroll by calling
onScrollChanged with old scroll == new scroll
Change-Id: I1dc2b94b37c65bf088806b8d28be32883e3b8bee
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/webkit/WebView.java | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 7249497..ec2f55b 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -3097,10 +3097,7 @@ public class WebView extends AbsoluteLayout // Special-case layer scrolling so that we do not trigger normal scroll // updating. if (mTouchMode == TOUCH_DRAG_LAYER_MODE) { - nativeScrollLayer(mScrollingLayer, scrollX, scrollY); - mScrollingLayerRect.left = scrollX; - mScrollingLayerRect.top = scrollY; - invalidate(); + scrollLayerTo(scrollX, scrollY); return; } mInOverScrollMode = false; @@ -3603,9 +3600,7 @@ public class WebView extends AbsoluteLayout mScrollY = y; } else { // Update the layer position instead of WebView. - nativeScrollLayer(mScrollingLayer, x, y); - mScrollingLayerRect.left = x; - mScrollingLayerRect.top = y; + scrollLayerTo(x, y); } abortAnimation(); nativeSetIsScrolling(false); @@ -3624,6 +3619,17 @@ public class WebView extends AbsoluteLayout } } + private void scrollLayerTo(int x, int y) { + if (x == mScrollingLayerRect.left && y == mScrollingLayerRect.top) { + return; + } + nativeScrollLayer(mScrollingLayer, x, y); + mScrollingLayerRect.left = x; + mScrollingLayerRect.top = y; + onScrollChanged(mScrollX, mScrollY, mScrollX, mScrollY); + invalidate(); + } + private static int computeDuration(int dx, int dy) { int distance = Math.max(Math.abs(dx), Math.abs(dy)); int duration = distance * 1000 / STD_SPEED; @@ -8309,12 +8315,8 @@ public class WebView extends AbsoluteLayout if (mScrollingLayer == 0) { pinScrollBy(mAutoScrollX, mAutoScrollY, true, 0); } else { - mScrollingLayerRect.left += mAutoScrollX; - mScrollingLayerRect.top += mAutoScrollY; - nativeScrollLayer(mScrollingLayer, - mScrollingLayerRect.left, - mScrollingLayerRect.top); - invalidate(); + scrollLayerTo(mScrollingLayerRect.left + mAutoScrollX, + mScrollingLayerRect.top + mAutoScrollY); } sendEmptyMessageDelayed( SCROLL_SELECT_TEXT, SELECT_SCROLL_INTERVAL); |