Commit d44fb6eb authored by Darren Shen's avatar Darren Shen Committed by Commit Bot

ime: Allow setComposingRange to take start/end in any order.

Android API [1] allows it, so we should too.

[1] https://developer.android.com/reference/android/view/inputmethod/InputConnection#setComposingRegion(int,%20int)

Bug: b/170796179
Change-Id: Iabb31d34e56f46a3b05dd53324b19169af0a53fe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2483943Reviewed-by: default avatarKeith Lee <keithlee@chromium.org>
Commit-Queue: Darren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819241}
parent a4399191
......@@ -599,7 +599,7 @@
"type": "integer"
},
"end": {
"description": "The ending index of the composing range, in bytes.",
"description": "The ending index of the composing range, in bytes. The order of the start and end index does not matter.",
"type": "integer"
},
"segments": {
......
......@@ -379,7 +379,8 @@ bool InputMethodChromeOS::SetComposingRange(
if (IsTextInputTypeNone())
return false;
const gfx::Range composition_range(start, end);
const auto ordered_range = std::minmax(start, end);
const gfx::Range composition_range(ordered_range.first, ordered_range.second);
// If we have pending key events, then delay the operation until
// |ProcessKeyEventPostIME|. Otherwise, process it immediately.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment