Skip to content

Commit a068e2f

Browse files
Gilles DebunneAndroid Git Automerger
authored andcommitted
am 4eec98e: Merge "Text handles do not handle scroll correctly" into ics-mr0
* commit '4eec98edee3d6eb516e30a7151da13fd726f93a9': Text handles do not handle scroll correctly
2 parents 58ba1b6 + 4eec98e commit a068e2f

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
@@ -9484,8 +9484,8 @@ public boolean isVisible(int positionX, int positionY) {
94849484
return false;
94859485
}
94869486

9487-
int posX = mPositionX + positionX - getScrollX();
9488-
int posY = mPositionY + positionY - getScrollY();
9487+
int posX = mPositionX + positionX;
9488+
int posY = mPositionY + positionY;
94899489

94909490
// Offset by 1 to take into account 0.5 and int rounding around getPrimaryHorizontal.
94919491
return posX >= clip.left - 1 && posX <= clip.right + 1 &&
@@ -9496,7 +9496,8 @@ public boolean isOffsetVisible(int offset) {
94969496
final int line = mLayout.getLineForOffset(offset);
94979497
final int lineBottom = mLayout.getLineBottom(line);
94989498
final int primaryHorizontal = (int) mLayout.getPrimaryHorizontal(offset);
9499-
return isVisible(primaryHorizontal, lineBottom);
9499+
return isVisible(primaryHorizontal + viewportToContentHorizontalOffset(),
9500+
lineBottom + viewportToContentVerticalOffset());
95009501
}
95019502

95029503
public void onScrollChanged() {
@@ -10643,7 +10644,7 @@ protected void positionAtCursorOffset(int offset, boolean parentScrolled) {
1064310644
mPositionX = (int) (mLayout.getPrimaryHorizontal(offset) - 0.5f - mHotspotX);
1064410645
mPositionY = mLayout.getLineBottom(line);
1064510646

10646-
// Take TextView's padding into account.
10647+
// Take TextView's padding and scroll into account.
1064710648
mPositionX += viewportToContentHorizontalOffset();
1064810649
mPositionY += viewportToContentVerticalOffset();
1064910650

0 commit comments

Comments
 (0)