Index: ui/base/ime/input_method_chromeos.cc |
diff --git a/ui/base/ime/input_method_chromeos.cc b/ui/base/ime/input_method_chromeos.cc |
index 50c77801a65b291be2ad78657079eb15bdd92221..8d9e2944d131f163c2d30e2d97907103abd5189d 100644 |
--- a/ui/base/ime/input_method_chromeos.cc |
+++ b/ui/base/ime/input_method_chromeos.cc |
@@ -554,11 +554,10 @@ |
void InputMethodChromeOS::DeleteSurroundingText(int32 offset, uint32 length) { |
if (!composition_.text.empty()) |
return; // do nothing if there is ongoing composition. |
- |
- if (GetTextInputClient()) { |
- uint32 before = offset >= 0 ? 0U : static_cast<uint32>(-1 * offset); |
- GetTextInputClient()->ExtendSelectionAndDelete(before, length - before); |
- } |
+ if (offset < 0 && static_cast<uint32>(-1 * offset) != length) |
+ return; // only preceding text can be deletable. |
+ if (GetTextInputClient()) |
+ GetTextInputClient()->ExtendSelectionAndDelete(length, 0U); |
} |
bool InputMethodChromeOS::ExecuteCharacterComposer(const ui::KeyEvent& event) { |