[WebView] Pass non-negative values to EdgeEffect#onPull()
On Android S, EdgeEffect#onPull() won't accept negative values for |deltaDistance| param anymore. See https://developer.android.com/about/versions/12/overscroll#best-practices The lower version of Android can handle both negative values and positive values, so we can pass in absolute values on all version of Android. Test: Manually tested on Android S and Android O. Bug: b/194516649 Change-Id: I9d604ec4031c2d8a1b7064a1bf2ace3d326a599f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3098365 Reviewed-by: Bo <boliu@chromium.org> Commit-Queue: Shimi Zhang <ctzsm@chromium.org> Cr-Commit-Position: refs/heads/master@{#912434}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
edb1fc6086
commit
ab65ccda52
@ -57,7 +57,8 @@ class OverScrollGlow {
|
||||
if (maxX > 0) {
|
||||
final int pulledToX = oldX + mOverScrollDeltaX;
|
||||
if (pulledToX < 0) {
|
||||
mEdgeGlowLeft.onPull((float) mOverScrollDeltaX / mHostView.getWidth());
|
||||
// |mOverScrollDeltaX| will be negative when overscroll to the left.
|
||||
mEdgeGlowLeft.onPull((float) -mOverScrollDeltaX / mHostView.getWidth());
|
||||
if (!mEdgeGlowRight.isFinished()) {
|
||||
mEdgeGlowRight.onRelease();
|
||||
}
|
||||
@ -73,7 +74,8 @@ class OverScrollGlow {
|
||||
if (maxY > 0 || mHostView.getOverScrollMode() == View.OVER_SCROLL_ALWAYS) {
|
||||
final int pulledToY = oldY + mOverScrollDeltaY;
|
||||
if (pulledToY < 0) {
|
||||
mEdgeGlowTop.onPull((float) mOverScrollDeltaY / mHostView.getHeight());
|
||||
// |mOverScrollDeltaY| will be negative when overscroll to the top.
|
||||
mEdgeGlowTop.onPull((float) -mOverScrollDeltaY / mHostView.getHeight());
|
||||
if (!mEdgeGlowBottom.isFinished()) {
|
||||
mEdgeGlowBottom.onRelease();
|
||||
}
|
||||
|
Reference in New Issue
Block a user