Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
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 2ebfb8e79e70afba5d5de45144274eafaf540c7d..66a26291fe59ce6481d252ebb1abd7797b83fa39 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 |
@@ -1790,34 +1790,29 @@ public class ContentViewCore |
* are overridden, so that View's mScrollX and mScrollY will be unchanged at |
* (0, 0). This is critical for drawing ContentView correctly. |
*/ |
- public void scrollBy(int xPix, int yPix) { |
- if (mNativeContentViewCore != 0) { |
- nativeScrollBy(mNativeContentViewCore, |
- SystemClock.uptimeMillis(), 0, 0, xPix, yPix); |
- } |
+ public void scrollBy(float dxPix, float dyPix) { |
jdduke (slow)
2015/05/18 21:31:53
We have to convert to float at some point anyway,
hush (inactive)
2015/05/19 00:33:23
Hi Jared,
Just making sure I understand it.
Neithe
|
+ if (mNativeContentViewCore == 0) return; |
+ if (dxPix == 0 && dyPix == 0) return; |
+ long time = SystemClock.uptimeMillis(); |
+ // It's a very real (and valid) possibility that a fling may still |
+ // be active when programatically scrolling. Cancelling the fling in |
+ // such cases ensures a consistent gesture event stream. |
+ if (mPotentiallyActiveFlingCount > 0) nativeFlingCancel(mNativeContentViewCore, time); |
+ nativeScrollBegin(mNativeContentViewCore, time, 0, 0, -dxPix, -dyPix); |
+ nativeScrollBy(mNativeContentViewCore, time, 0, 0, dxPix, dyPix); |
+ nativeScrollEnd(mNativeContentViewCore, time); |
} |
/** |
* @see View#scrollTo(int, int) |
*/ |
- public void scrollTo(int xPix, int yPix) { |
+ public void scrollTo(float xPix, float yPix) { |
if (mNativeContentViewCore == 0) return; |
final float xCurrentPix = mRenderCoordinates.getScrollXPix(); |
final float yCurrentPix = mRenderCoordinates.getScrollYPix(); |
final float dxPix = xPix - xCurrentPix; |
final float dyPix = yPix - yCurrentPix; |
- if (dxPix != 0 || dyPix != 0) { |
- long time = SystemClock.uptimeMillis(); |
- // It's a very real (and valid) possibility that a fling may still |
- // be active when programatically scrolling. Cancelling the fling in |
- // such cases ensures a consistent gesture event stream. |
- if (mPotentiallyActiveFlingCount > 0) nativeFlingCancel(mNativeContentViewCore, time); |
- nativeScrollBegin(mNativeContentViewCore, time, |
- xCurrentPix, yCurrentPix, -dxPix, -dyPix); |
- nativeScrollBy(mNativeContentViewCore, |
- time, xCurrentPix, yCurrentPix, dxPix, dyPix); |
- nativeScrollEnd(mNativeContentViewCore, time); |
- } |
+ scrollBy(dxPix, dyPix); |
} |
// NOTE: this can go away once ContentView.getScrollX() reports correct values. |