Skip to content

Commit 4eec98e

Browse files
Gilles DebunneAndroid (Google) Code Review
authored andcommitted
Merge "Text handles do not handle scroll correctly" into ics-mr0
2 parents fe9a2a5 + 93347c2 commit 4eec98e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

core/java/android/widget/TextView.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9409,8 +9409,8 @@ public boolean isVisible(int positionX, int positionY) {
94099409
return false;
94109410
}
94119411

9412-
int posX = mPositionX + positionX - getScrollX();
9413-
int posY = mPositionY + positionY - getScrollY();
9412+
int posX = mPositionX + positionX;
9413+
int posY = mPositionY + positionY;
94149414

94159415
// Offset by 1 to take into account 0.5 and int rounding around getPrimaryHorizontal.
94169416
return posX >= clip.left - 1 && posX <= clip.right + 1 &&
@@ -9421,7 +9421,8 @@ public boolean isOffsetVisible(int offset) {
94219421
final int line = mLayout.getLineForOffset(offset);
94229422
final int lineBottom = mLayout.getLineBottom(line);
94239423
final int primaryHorizontal = (int) mLayout.getPrimaryHorizontal(offset);
9424-
return isVisible(primaryHorizontal, lineBottom);
9424+
return isVisible(primaryHorizontal + viewportToContentHorizontalOffset(),
9425+
lineBottom + viewportToContentVerticalOffset());
94259426
}
94269427

94279428
public void onScrollChanged() {
@@ -10561,7 +10562,7 @@ protected void positionAtCursorOffset(int offset, boolean parentScrolled) {
1056110562
mPositionX = (int) (mLayout.getPrimaryHorizontal(offset) - 0.5f - mHotspotX);
1056210563
mPositionY = mLayout.getLineBottom(line);
1056310564

10564-
// Take TextView's padding into account.
10565+
// Take TextView's padding and scroll into account.
1056510566
mPositionX += viewportToContentHorizontalOffset();
1056610567
mPositionY += viewportToContentVerticalOffset();
1056710568

0 commit comments

Comments
 (0)