Ensures the slop value is fixed cross lines.

In Q, the slop is a fixed value calculated based on
TextView.getLineHeight().
In R (before this cl), the slop is a dynamic value based on the height
of the current line.

It's been confirmed as the root cause of the regression bug b/159528374.

This cl changes the slop value back to the fixed value.

Bug: 159528374
Test: Verified locally.
Change-Id: I182d22779f1c1155ae2e0b0deb0455bd270b2fd9
Merged-In: I182d22779f1c1155ae2e0b0deb0455bd270b2fd9
This commit is contained in:
Shu Chen
2020-07-17 20:13:49 +08:00
parent 316f90c927
commit 0cb53bb606

View File

@@ -6059,12 +6059,7 @@ public class Editor {
return trueLine;
}
final int lineHeight = layout.getLineBottom(prevLine) - layout.getLineTop(prevLine);
int slop = (int)(LINE_SLOP_MULTIPLIER_FOR_HANDLEVIEWS
* (layout.getLineBottom(trueLine) - layout.getLineTop(trueLine)));
slop = Math.max(mLineChangeSlopMin,
Math.min(mLineChangeSlopMax, lineHeight + slop)) - lineHeight;
slop = Math.max(0, slop);
final int slop = (int)(LINE_SLOP_MULTIPLIER_FOR_HANDLEVIEWS * mTextView.getLineHeight());
final float verticalOffset = mTextView.viewportToContentVerticalOffset();
if (trueLine > prevLine && y >= layout.getLineBottom(prevLine) + slop + verticalOffset) {