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

Unified Diff: ui/base/ime/input_method_chromeos.cc

Issue 868663005: Revert of Revert of Add support for deleting non preceeding surrounding text in chrome.input.ime.deleteSurroundingText (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « chrome/browser/chromeos/input_method/input_method_engine.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8d9e2944d131f163c2d30e2d97907103abd5189d..50c77801a65b291be2ad78657079eb15bdd92221 100644
--- a/ui/base/ime/input_method_chromeos.cc
+++ b/ui/base/ime/input_method_chromeos.cc
@@ -554,10 +554,11 @@
void InputMethodChromeOS::DeleteSurroundingText(int32 offset, uint32 length) {
if (!composition_.text.empty())
return; // do nothing if there is ongoing composition.
- if (offset < 0 && static_cast<uint32>(-1 * offset) != length)
- return; // only preceding text can be deletable.
- if (GetTextInputClient())
- GetTextInputClient()->ExtendSelectionAndDelete(length, 0U);
+
+ if (GetTextInputClient()) {
+ uint32 before = offset >= 0 ? 0U : static_cast<uint32>(-1 * offset);
+ GetTextInputClient()->ExtendSelectionAndDelete(before, length - before);
+ }
}
bool InputMethodChromeOS::ExecuteCharacterComposer(const ui::KeyEvent& event) {
« no previous file with comments | « chrome/browser/chromeos/input_method/input_method_engine.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698