Commit bc739335 authored by Ted Choc's avatar Ted Choc Committed by Commit Bot

Add workaround to UrlBar scroll crash.

In some instances, the attempted scroll position
is beyond the length of the URL.  This crashes some
versions of Android and hangs others.  This caps the
scroll position to the text length and adds some logging
to attempt to catch this locally.

BUG=859219

Change-Id: I7859d37ede741c5ce81d85df400cbe4bea2ccdeb
Reviewed-on: https://chromium-review.googlesource.com/c/1332209Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607672}
parent 9c50e7da
...@@ -708,7 +708,12 @@ public class UrlBar extends AutocompleteEditText { ...@@ -708,7 +708,12 @@ public class UrlBar extends AutocompleteEditText {
Layout textLayout = getLayout(); Layout textLayout = getLayout();
assert getLayout().getLineCount() == 1; assert getLayout().getLineCount() == 1;
final int originEndIndex = mOriginEndIndex; final int originEndIndex = Math.min(mOriginEndIndex, url.length());
if (mOriginEndIndex > url.length()) {
// If discovered locally, please update crbug.com/859219 with the steps to reproduce.
assert false : "Attempting to scroll past the end of the URL: " + url + ", end index: "
+ mOriginEndIndex;
}
float endPointX = textLayout.getPrimaryHorizontal(originEndIndex); float endPointX = textLayout.getPrimaryHorizontal(originEndIndex);
// Compare the position offset of the last character and the character prior to determine // Compare the position offset of the last character and the character prior to determine
// the LTR-ness of the final component of the URL. // the LTR-ness of the final component of the URL.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment