diff options
author | skyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-27 05:51:31 +0000 |
---|---|---|
committer | skyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-27 05:51:31 +0000 |
commit | 2449b5d8c45b9dc28b08dfe6284504f243bc1274 (patch) | |
tree | ed03ac3a56df53fb507e337a340c91c8da32562a /content | |
parent | 8d2a9a32d0d09d09abf561bea48e97e436f84609 (diff) | |
download | chromium_src-2449b5d8c45b9dc28b08dfe6284504f243bc1274.zip chromium_src-2449b5d8c45b9dc28b08dfe6284504f243bc1274.tar.gz chromium_src-2449b5d8c45b9dc28b08dfe6284504f243bc1274.tar.bz2 |
[Android] Don't send touch events to JS during pinch/scroll
If a page has touch event handlers, the browser sends all touch events
to the renderer and only acts on them if the events were not consumed by
the custom handler. This can lead to poor performance if the main
renderer thread is busy doing other work -- such as page/layer layout
calculation -- when a touch event arrives. In such a situation touch
event processing is delayed until the work is completed, increasing
perceived latency.
This patch implements a workaround by canceling the stream of touch
events to the renderer when a scroll/pinch gesture has started. If a
scroll/pinch gesture is active, it means the JavaScript did not consume
any of the touch events leading to the gesture. The assumption here is
that the JavaScript will also ignore all further touch events, so we can
avoid sending them in the first place.
This same workaround was also implemented in the M18-based release for
Chrome for Android.
BUG=162644
Review URL: https://chromiumcodereview.appspot.com/12089014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179083 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java index 34aa403..60a2a0b 100644 --- a/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java +++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java @@ -727,7 +727,7 @@ class ContentViewGestureHandler implements LongPressDelegate { TouchPoint[] pts = new TouchPoint[event.getPointerCount()]; int type = TouchPoint.createTouchPoints(event, pts); boolean forwarded = false; - if (type != TouchPoint.CONVERSION_ERROR) { + if (type != TouchPoint.CONVERSION_ERROR && !mNativeScrolling && !mPinchInProgress) { forwarded = mMotionEventDelegate.sendTouchEvent(event.getEventTime(), type, pts); mTouchCancelEventSent = false; } else if (!mTouchCancelEventSent) { |