diff options
author | ksimbili@google.com <ksimbili@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-21 00:59:20 +0000 |
---|---|---|
committer | ksimbili@google.com <ksimbili@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-21 00:59:20 +0000 |
commit | 3656164f856eed7f3462ab9b292ff42ce48827ff (patch) | |
tree | d39c963082f9a65058713fed85107de72e6f2e84 /content/public | |
parent | 2188c8d8e3529fba0ef49389e85d0b11a43fc0b7 (diff) | |
download | chromium_src-3656164f856eed7f3462ab9b292ff42ce48827ff.zip chromium_src-3656164f856eed7f3462ab9b292ff42ce48827ff.tar.gz chromium_src-3656164f856eed7f3462ab9b292ff42ce48827ff.tar.bz2 |
Expose whether a scroll is active via ContentViewCore
Track the active fling count in addition to whether touch scrolling is active.
This is useful for transient GestureStateListeners to precisely determine the
current state of scroll activity.
BUG=354599
Review URL: https://codereview.chromium.org/202253002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258481 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/public')
-rw-r--r-- | content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java index 1e20730..88f798d 100644 --- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java +++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java @@ -415,6 +415,10 @@ public class ContentViewCore // sequence, so this will also be true for the duration of a pinch gesture. private boolean mTouchScrollInProgress; + // The outstanding fling start events that hasn't got fling end yet. It may be > 1 because + // onNativeFlingStopped() is called asynchronously. + private int mPotentiallyActiveFlingCount; + private ViewAndroid mViewAndroid; private SmartClipDataListener mSmartClipDataListener = null; @@ -1203,10 +1207,15 @@ public class ContentViewCore nativeIgnoreRemainingTouchEvents(mNativeContentViewCore); } + public boolean isScrollInProgress() { + return mTouchScrollInProgress || mPotentiallyActiveFlingCount > 0; + } + @SuppressWarnings("unused") @CalledByNative private void onFlingStartEventConsumed(int vx, int vy) { mTouchScrollInProgress = false; + mPotentiallyActiveFlingCount++; temporarilyHideTextHandles(); for (mGestureStateListenersIterator.rewind(); mGestureStateListenersIterator.hasNext();) { @@ -3112,6 +3121,7 @@ public class ContentViewCore // Note that mTouchScrollInProgress should normally be false at this // point, but we reset it anyway as another failsafe. mTouchScrollInProgress = false; + if (mPotentiallyActiveFlingCount > 0) mPotentiallyActiveFlingCount--; updateGestureStateListener(GestureEventType.FLING_END); } |