Fixed selectionEnd for TextArea with text end in newline.
Previous to this CL, hitting CTRL-A inside a TextArea containing text that ends with a newline would cause the selectionEnd property to be incorrect. selectionEnd returns a number that's 1 pass the end of text. This is because TextControl automatically inserts an BRElement at the end when the last child is a carriage return. And the inserted node is taken into consideration when calculating the selection range. The fix is to ignore this last child if it's a BRElement. Tested with carriage return inserted into the beginning, middle and end of text to make sure there's no regression. Bug: 882614 Change-Id: Idc7a1f098556fc74b89f3041e3f5f35e127eed78 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1838549Reviewed-by:Mason Freed <masonfreed@chromium.org> Reviewed-by:
Kent Tamura <tkent@chromium.org> Commit-Queue: Yu Han <yuzhehan@chromium.org> Cr-Commit-Position: refs/heads/master@{#704486}
Showing
Please register or sign in to comment