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

Unified Diff: ui/base/ime/win/tsf_text_store.cc

Issue 54173007: Change the behavior of TSFTextStore::QueryInsert() to support partial commit with Metro MS-IME. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 2 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 | « no previous file | ui/base/ime/win/tsf_text_store_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/ime/win/tsf_text_store.cc
diff --git a/ui/base/ime/win/tsf_text_store.cc b/ui/base/ime/win/tsf_text_store.cc
index 3a482031b70e7d613fbc42472839bd6ae05b8035..0ef34b5be89a56b649abc9e3a68e1d0ab4392da4 100644
--- a/ui/base/ime/win/tsf_text_store.cc
+++ b/ui/base/ime/win/tsf_text_store.cc
@@ -434,15 +434,14 @@ STDMETHODIMP TSFTextStore::QueryInsert(
ULONG text_size,
LONG* acp_result_start,
LONG* acp_result_end) {
- if (!acp_result_start || !acp_result_end)
+ if (!acp_result_start || !acp_result_end || acp_test_start > acp_test_end)
return E_INVALIDARG;
- if (!((static_cast<LONG>(committed_size_) <= acp_test_start) &&
- (acp_test_start <= acp_test_end) &&
- (acp_test_end <= static_cast<LONG>(string_buffer_.size())))) {
- return E_INVALIDARG;
- }
- *acp_result_start = acp_test_start;
- *acp_result_end = acp_test_end;
+ const LONG committed_size = static_cast<LONG>(committed_size_);
+ const LONG buffer_size = static_cast<LONG>(string_buffer_.size());
+ *acp_result_start = std::min(std::max(committed_size, acp_test_start),
+ buffer_size);
+ *acp_result_end = std::min(std::max(committed_size, acp_test_end),
+ buffer_size);
return S_OK;
}
« no previous file with comments | « no previous file | ui/base/ime/win/tsf_text_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698