summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2013-05-01 07:55:40 -0700
committerGeorge Mount <mount@google.com>2013-05-01 13:52:01 -0700
commit2fec4ff3dd57cda25cbcb9a009a745dd49173c0a (patch)
tree7f2cc25d129c19f92dc670391f12db2b9b0d8927
parent3416e5ae328ef637a7f8b9f521cafa28b68947e6 (diff)
downloadwebkit-2fec4ff3dd57cda25cbcb9a009a745dd49173c0a.tar.gz
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.cpp8
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) {