diff options
| author | Grace Kloba <klobag@google.com> | 2010-04-07 11:12:52 -0700 |
|---|---|---|
| committer | Grace Kloba <klobag@google.com> | 2010-04-07 20:32:01 -0700 |
| commit | 524aab57cdad19514443e52a0710d0e2b148f281 (patch) | |
| tree | 0d60ad8e54d67b9f51b96c08582d639ead63322b /core/java | |
| parent | ce59fb8b684357f2a10ab62368beeece34bc0e5d (diff) | |
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%.
This essentially reverted the CL for http://b/issue?id=2310295.
But as we honor preventDefault on touch move now,
the two sites mentioned in that bug do not have problem
even after this CL.
Fix http://b/issue?id=2574172
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/webkit/WebView.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 05263628b44c..4233af196ba6 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -4882,6 +4882,9 @@ public class WebView extends AbsoluteLayout // we will not rewrite drag code here, but we // will try fling if it applies. WebViewCore.reducePriority(); + // to get better performance, pause updating the + // picture + WebViewCore.pauseUpdatePicture(mWebViewCore); // fall through to TOUCH_DRAG_MODE } else { break; @@ -4916,8 +4919,14 @@ public class WebView extends AbsoluteLayout doFling(); 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; WebViewCore.resumePriority(); + WebViewCore.resumeUpdatePicture(mWebViewCore); break; } stopTouch(); @@ -4963,6 +4972,8 @@ public class WebView extends AbsoluteLayout private void startDrag() { WebViewCore.reducePriority(); + // to get better performance, pause updating the picture + WebViewCore.pauseUpdatePicture(mWebViewCore); if (!mDragFromTextInput) { nativeHideCursor(); } @@ -5026,6 +5037,7 @@ public class WebView extends AbsoluteLayout } if (mTouchMode == TOUCH_DRAG_MODE) { WebViewCore.resumePriority(); + WebViewCore.resumeUpdatePicture(mWebViewCore); } mPrivateHandler.removeMessages(SWITCH_TO_SHORTPRESS); mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS); @@ -5360,6 +5372,7 @@ public class WebView extends AbsoluteLayout } if ((maxX == 0 && vy == 0) || (maxY == 0 && vx == 0)) { WebViewCore.resumePriority(); + WebViewCore.resumeUpdatePicture(mWebViewCore); return; } float currentVelocity = mScroller.getCurrVelocity(); @@ -6369,6 +6382,7 @@ public class WebView extends AbsoluteLayout break; case RESUME_WEBCORE_PRIORITY: WebViewCore.resumePriority(); + WebViewCore.resumeUpdatePicture(mWebViewCore); break; case LONG_PRESS_CENTER: |
