summaryrefslogtreecommitdiffstats
path: root/core/java/android/webkit/WebView.java
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-10-13 13:23:29 +0100
committerBen Murdoch <benm@google.com>2011-10-13 13:23:29 +0100
commitfd8d3dede2f3d1b22e1c69d4c14d392d0aa2b2ab (patch)
treefa73a0bcc2ccf5f1dfa25a6cbd4e99a8049aae23 /core/java/android/webkit/WebView.java
parent7a3ba4d732d5ce394aab9783e4099b2e71f1903f (diff)
downloadframeworks_base-fd8d3dede2f3d1b22e1c69d4c14d392d0aa2b2ab.zip
frameworks_base-fd8d3dede2f3d1b22e1c69d4c14d392d0aa2b2ab.tar.gz
frameworks_base-fd8d3dede2f3d1b22e1c69d4c14d392d0aa2b2ab.tar.bz2
Don't redraw when not scrolling, even if finger is held down.
Signal the native side that we are not scrolling when a drag is held motionless to stop screen updates. Additionally, in the case that a drag is being held motionless, send a timed message to keep the scroll bars on screen otherwise they fade in and out, again causing repaints that shouldn't be necessary. Bug: 5440335 Change-Id: I94db0323879885fa48924b41d29e8af03e3b5e7f
Diffstat (limited to 'core/java/android/webkit/WebView.java')
-rw-r--r--core/java/android/webkit/WebView.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 9648cd0..7220f13 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -4492,6 +4492,9 @@ public class WebView extends AbsoluteLayout
if (mHeldMotionless == MOTIONLESS_FALSE) {
mPrivateHandler.sendMessageDelayed(mPrivateHandler
.obtainMessage(DRAG_HELD_MOTIONLESS), MOTIONLESS_TIME);
+ mPrivateHandler.sendMessageDelayed(mPrivateHandler
+ .obtainMessage(AWAKEN_SCROLL_BARS),
+ ViewConfiguration.getScrollDefaultDelay());
mHeldMotionless = MOTIONLESS_PENDING;
}
}
@@ -5989,6 +5992,7 @@ public class WebView extends AbsoluteLayout
mTouchMode = TOUCH_DRAG_START_MODE;
mConfirmMove = true;
mPrivateHandler.removeMessages(RESUME_WEBCORE_PRIORITY);
+ nativeSetIsScrolling(false);
} else if (mPrivateHandler.hasMessages(RELEASE_SINGLE_TAP)) {
mPrivateHandler.removeMessages(RELEASE_SINGLE_TAP);
if (USE_WEBKIT_RINGS || getSettings().supportTouchOnly()) {
@@ -6271,9 +6275,16 @@ public class WebView extends AbsoluteLayout
}
mLastTouchX = x;
mLastTouchY = y;
- if ((deltaX | deltaY) != 0) {
+
+ if (deltaX * deltaX + deltaY * deltaY > mTouchSlopSquare) {
mHeldMotionless = MOTIONLESS_FALSE;
+ nativeSetIsScrolling(true);
+ } else {
+ mHeldMotionless = MOTIONLESS_TRUE;
+ nativeSetIsScrolling(false);
+ keepScrollBarsVisible = true;
}
+
mLastTouchTime = eventTime;
}
@@ -6289,9 +6300,15 @@ public class WebView extends AbsoluteLayout
// keep the scrollbar on the screen even there is no scroll
awakenScrollBars(ViewConfiguration.getScrollDefaultDelay(),
false);
+ // Post a message so that we'll keep them alive while we're not scrolling.
+ mPrivateHandler.sendMessageDelayed(mPrivateHandler
+ .obtainMessage(AWAKEN_SCROLL_BARS),
+ ViewConfiguration.getScrollDefaultDelay());
// return false to indicate that we can't pan out of the
// view space
return !done;
+ } else {
+ mPrivateHandler.removeMessages(AWAKEN_SCROLL_BARS);
}
break;
}