am 3f73549b: Merge "For performance reason, we choose to block the picture update during drag and fling. For sites like nytimes.com, there is a JavaScript constantly updating the content. If we don\'t block the live update during drag/fling, frame rate can drop by 30%.

Merge commit '3f73549bc8a776a417bd185b72d3636e7f4ba7b6' into froyo-plus-aosp

* commit '3f73549bc8a776a417bd185b72d3636e7f4ba7b6':
  For performance reason, we choose to block the picture
This commit is contained in:
Grace Kloba
2010-04-08 14:08:35 -07:00
committed by Android Git Automerger

View File

@@ -4882,6 +4882,9 @@ public class WebView extends AbsoluteLayout
// we will not rewrite drag code here, but we // we will not rewrite drag code here, but we
// will try fling if it applies. // will try fling if it applies.
WebViewCore.reducePriority(); WebViewCore.reducePriority();
// to get better performance, pause updating the
// picture
WebViewCore.pauseUpdatePicture(mWebViewCore);
// fall through to TOUCH_DRAG_MODE // fall through to TOUCH_DRAG_MODE
} else { } else {
break; break;
@@ -4916,8 +4919,14 @@ public class WebView extends AbsoluteLayout
doFling(); doFling();
break; break;
} }
// fall through
case TOUCH_DRAG_START_MODE:
// TOUCH_DRAG_START_MODE should not happen for the real
// device as we almost certain will get a MOVE. But this
// is possible on emulator.
mLastVelocity = 0; mLastVelocity = 0;
WebViewCore.resumePriority(); WebViewCore.resumePriority();
WebViewCore.resumeUpdatePicture(mWebViewCore);
break; break;
} }
stopTouch(); stopTouch();
@@ -4963,6 +4972,8 @@ public class WebView extends AbsoluteLayout
private void startDrag() { private void startDrag() {
WebViewCore.reducePriority(); WebViewCore.reducePriority();
// to get better performance, pause updating the picture
WebViewCore.pauseUpdatePicture(mWebViewCore);
if (!mDragFromTextInput) { if (!mDragFromTextInput) {
nativeHideCursor(); nativeHideCursor();
} }
@@ -5026,6 +5037,7 @@ public class WebView extends AbsoluteLayout
} }
if (mTouchMode == TOUCH_DRAG_MODE) { if (mTouchMode == TOUCH_DRAG_MODE) {
WebViewCore.resumePriority(); WebViewCore.resumePriority();
WebViewCore.resumeUpdatePicture(mWebViewCore);
} }
mPrivateHandler.removeMessages(SWITCH_TO_SHORTPRESS); mPrivateHandler.removeMessages(SWITCH_TO_SHORTPRESS);
mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS); mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS);
@@ -5360,6 +5372,7 @@ public class WebView extends AbsoluteLayout
} }
if ((maxX == 0 && vy == 0) || (maxY == 0 && vx == 0)) { if ((maxX == 0 && vy == 0) || (maxY == 0 && vx == 0)) {
WebViewCore.resumePriority(); WebViewCore.resumePriority();
WebViewCore.resumeUpdatePicture(mWebViewCore);
return; return;
} }
float currentVelocity = mScroller.getCurrVelocity(); float currentVelocity = mScroller.getCurrVelocity();
@@ -6369,6 +6382,7 @@ public class WebView extends AbsoluteLayout
break; break;
case RESUME_WEBCORE_PRIORITY: case RESUME_WEBCORE_PRIORITY:
WebViewCore.resumePriority(); WebViewCore.resumePriority();
WebViewCore.resumeUpdatePicture(mWebViewCore);
break; break;
case LONG_PRESS_CENTER: case LONG_PRESS_CENTER: