summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2013-05-01 15:24:08 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-05-01 15:24:08 -0700
commitf10a189dce4aae6292c15b90e102bfd2db464afb (patch)
tree7f2cc25d129c19f92dc670391f12db2b9b0d8927
parentd6d669001139891ceaa73033dc7a6abe4797ddd5 (diff)
parent2fec4ff3dd57cda25cbcb9a009a745dd49173c0a (diff)
downloadwebkit-f10a189dce4aae6292c15b90e102bfd2db464afb.tar.gz
am 2fec4ff3: Keep LTR selection within the text range.
* commit '2fec4ff3dd57cda25cbcb9a009a745dd49173c0a': Keep LTR selection within the text range.
-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) {