Skip to content

Commit 636da63

Browse files
adampAndroid (Google) Code Review
authored andcommitted
Merge "Fix bug 5385274 - tabs in browser can't be scrolled"
2 parents 8f84765 + f6a6c97 commit 636da63

2 files changed

Lines changed: 8 additions & 16 deletions

File tree

core/java/android/widget/HorizontalScrollView.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ public boolean onTouchEvent(MotionEvent ev) {
569569
final boolean canOverscroll = overscrollMode == OVER_SCROLL_ALWAYS ||
570570
(overscrollMode == OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0);
571571

572-
if (canOverscroll && overScrollBy(deltaX, 0, mScrollX, 0, range, 0,
572+
if (overScrollBy(deltaX, 0, mScrollX, 0, range, 0,
573573
mOverscrollDistance, 0, true)) {
574574
// Break our velocity if we hit a scroll barrier.
575575
mVelocityTracker.clear();
@@ -602,16 +602,12 @@ public boolean onTouchEvent(MotionEvent ev) {
602602
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
603603
int initialVelocity = (int) velocityTracker.getXVelocity(mActivePointerId);
604604

605-
final int right = getScrollRange();
606-
final int overscrollMode = getOverScrollMode();
607-
final boolean canOverscroll = overscrollMode == OVER_SCROLL_ALWAYS ||
608-
(overscrollMode == OVER_SCROLL_IF_CONTENT_SCROLLS && right > 0);
609-
610-
if (getChildCount() > 0 && canOverscroll) {
605+
if (getChildCount() > 0) {
611606
if ((Math.abs(initialVelocity) > mMinimumVelocity)) {
612607
fling(-initialVelocity);
613608
} else {
614-
if (mScroller.springBack(mScrollX, mScrollY, 0, right, 0, 0)) {
609+
if (mScroller.springBack(mScrollX, mScrollY, 0,
610+
getScrollRange(), 0, 0)) {
615611
invalidate();
616612
}
617613
}

core/java/android/widget/ScrollView.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ public boolean onTouchEvent(MotionEvent ev) {
583583
final boolean canOverscroll = overscrollMode == OVER_SCROLL_ALWAYS ||
584584
(overscrollMode == OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0);
585585

586-
if (canOverscroll && overScrollBy(0, deltaY, 0, mScrollY,
586+
if (overScrollBy(0, deltaY, 0, mScrollY,
587587
0, range, 0, mOverscrollDistance, true)) {
588588
// Break our velocity if we hit a scroll barrier.
589589
mVelocityTracker.clear();
@@ -616,16 +616,12 @@ public boolean onTouchEvent(MotionEvent ev) {
616616
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
617617
int initialVelocity = (int) velocityTracker.getYVelocity(mActivePointerId);
618618

619-
final int bottom = getScrollRange();
620-
final int overscrollMode = getOverScrollMode();
621-
final boolean canOverscroll = overscrollMode == OVER_SCROLL_ALWAYS ||
622-
(overscrollMode == OVER_SCROLL_IF_CONTENT_SCROLLS && bottom > 0);
623-
624-
if (getChildCount() > 0 && canOverscroll) {
619+
if (getChildCount() > 0) {
625620
if ((Math.abs(initialVelocity) > mMinimumVelocity)) {
626621
fling(-initialVelocity);
627622
} else {
628-
if (mScroller.springBack(mScrollX, mScrollY, 0, 0, 0, bottom)) {
623+
if (mScroller.springBack(mScrollX, mScrollY, 0, 0, 0,
624+
getScrollRange())) {
629625
invalidate();
630626
}
631627
}

0 commit comments

Comments
 (0)