Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Unified Diff: third_party/WebKit/Source/core/editing/PlainTextRange.cpp

Issue 1847583003: Fix setComposingText when newCursorPosition != 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modified some C++ unit tests Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/PlainTextRange.cpp
diff --git a/third_party/WebKit/Source/core/editing/PlainTextRange.cpp b/third_party/WebKit/Source/core/editing/PlainTextRange.cpp
index 7cfb84d3ba034f28437dd9c0c45e3f34382c3cb6..46a923c76949e4a1c31cc9adb84eb6fd4e0bea50 100644
--- a/third_party/WebKit/Source/core/editing/PlainTextRange.cpp
+++ b/third_party/WebKit/Source/core/editing/PlainTextRange.cpp
@@ -148,8 +148,16 @@ EphemeralRange PlainTextRange::createRangeFor(const ContainerNode& scope, GetRan
docTextPosition += len;
}
- if (!startRangeFound)
- return EphemeralRange();
+ if (!startRangeFound) {
+ // startRangeFound = start() >= docTextPosition && start() <= docTextPosition + len.
+ // The former condition is related to the left boundary, and the latter to the right boundary.
+ // Since we assert that end()>=start()>=0, and docTextPosition==0 before the loop starts,
+ // so startRangeFound is false if and only if new cursor position exceeds the right boundary.
+ // In that case, the cursor should stay at the right boundary, because EditText, the component
+ // in Android, behaves in that way.
Changwan Ryu 2016/04/05 07:50:37 how about renaming startRangeFound as startOutOfBo
yabinh 2016/04/05 08:06:41 Acknowledged.
+ resultStart = textRunEndPosition;
+ resultEnd = textRunEndPosition;
+ }
if (length() && end() > docTextPosition) { // end() is out of bounds
resultEnd = textRunEndPosition;

Powered by Google App Engine
This is Rietveld 408576698