OSDN Git Service

Stay in layer scroll if nothing to scroll
authorJohn Reck <jreck@google.com>
Thu, 7 Jun 2012 21:45:34 +0000 (14:45 -0700)
committerJohn Reck <jreck@google.com>
Thu, 7 Jun 2012 21:45:34 +0000 (14:45 -0700)
 Bug: 6628376
 The issue here is that contentX & contentY can both be 0 if we are scrolling
 slowly enough as they are adjusted by the page's scale and can thus round down.
 However, this would result in us falling out of layer drag mode even though
 we haven't tried to scroll past the edge of the layer. Detect this case, and
 stay in layer scroll mode.

Change-Id: I3c655d0d03e8f89887abbe718bd24699c133ee1a

core/java/android/webkit/WebViewClassic.java

index d1da53b..1d2cd43 100644 (file)
@@ -6224,8 +6224,9 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
                 final int resultY = Math.max(0,
                         Math.min(mScrollingLayerRect.top + contentY, maxY));
 
-                if (resultX != mScrollingLayerRect.left ||
-                        resultY != mScrollingLayerRect.top) {
+                if (resultX != mScrollingLayerRect.left
+                        || resultY != mScrollingLayerRect.top
+                        || (contentX | contentY) == 0) {
                     // In case we switched to dragging the page.
                     mTouchMode = TOUCH_DRAG_LAYER_MODE;
                     deltaX = contentX;