diff options
author | George Mount <mount@google.com> | 2013-05-01 07:55:40 -0700 |
---|---|---|
committer | George Mount <mount@google.com> | 2013-05-01 13:52:01 -0700 |
commit | 2fec4ff3dd57cda25cbcb9a009a745dd49173c0a (patch) | |
tree | 7f2cc25d129c19f92dc670391f12db2b9b0d8927 | |
parent | 3416e5ae328ef637a7f8b9f521cafa28b68947e6 (diff) | |
download | webkit-2fec4ff3dd57cda25cbcb9a009a745dd49173c0a.tar.gz |
Keep LTR selection within the text range.android-4.3_r3.1android-4.3_r3android-4.3_r2.3android-4.3_r2.2android-4.3_r2.1android-4.3_r2android-4.3_r1.1android-4.3_r1android-4.3_r0.9.1android-4.3_r0.9android-4.3.1_r1jb-mr2.0.0-releasejb-mr2.0-releasejb-mr2-release
Bug 8556162
The end caret position for LTR text can be one beyond the range
of the text. This change places the selection region back into
the text so that the proper text is selected.
Change-Id: I470ee5e3438190aab9f5fb12deca95249d9d887e
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index 497cc9a9c..6a2982320 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -4223,6 +4223,14 @@ Vector<VisibleSelection> WebViewCore::getTextRanges( VisiblePosition endSelect = visiblePositionForContentPoint(endX, endY); Position start = startSelect.deepEquivalent(); Position end = endSelect.deepEquivalent(); + if (isLtr(end)) { + // The end caret could be just to the right of the text. + endSelect = visiblePositionForContentPoint(endX - 1, endY); + Position newEnd = endSelect.deepEquivalent(); + if (!newEnd.isNull()) { + end = newEnd; + } + } Vector<VisibleSelection> ranges; if (!start.isNull() && !end.isNull()) { if (comparePositions(start, end) > 0) { |