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

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

Issue 16901011: Support CancelCompositionText/ComfirmCompositionText in TSF (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 6 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
« ui/base/ime/win/tsf_text_store.h ('K') | « ui/base/ime/win/tsf_text_store.h ('k') | no next file » | 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 fb842bc42d58f653ebdf6449f11e44e1b1836607..cfa077556c5a50667ea309d795f910136432ee32 100644
--- a/ui/base/ime/win/tsf_text_store.cc
+++ b/ui/base/ime/win/tsf_text_store.cc
@@ -831,6 +831,64 @@ void TSFTextStore::RemoveFocusedTextInputClient(
}
}
+bool TSFTextStore::CancelComposition() {
+ // There is an on-going document lock. We must not edit the text!
+ if (edit_flag_ != 0)
Seigo Nonaka 2013/06/21 08:09:53 !edit_flag?
Yohei Yukawa 2013/06/21 08:26:55 Done.
+ return false;
+
+ if (string_buffer_.empty())
+ return true;
+
+ const size_t previous_buffer_size = string_buffer_.size();
+ string_buffer_.clear();
+ committed_size_ = 0;
+ selection_.set_start(0);
+ selection_.set_end(0);
+ if (text_store_acp_sink_mask_ & TS_AS_SEL_CHANGE)
+ text_store_acp_sink_->OnSelectionChange();
+ if (text_store_acp_sink_mask_ & TS_AS_LAYOUT_CHANGE)
+ text_store_acp_sink_->OnLayoutChange(TS_LC_CHANGE, 0);
+ if (text_store_acp_sink_mask_ & TS_AS_TEXT_CHANGE) {
+ TS_TEXTCHANGE textChange = {};
+ textChange.acpStart = 0;
+ textChange.acpOldEnd = previous_buffer_size;
+ textChange.acpNewEnd = 0;
+ text_store_acp_sink_->OnTextChange(0, &textChange);
+ }
+ return true;
+}
+
+bool TSFTextStore::ConfirmComposition() {
+ // There is an on-going document lock. We must not edit the text!
+ if (edit_flag_ != 0)
Seigo Nonaka 2013/06/21 08:09:53 ditto
Yohei Yukawa 2013/06/21 08:26:55 Done.
+ return false;
+
+ if (string_buffer_.empty())
+ return true;
+
+ const string16& composition_text = string_buffer_.substr(committed_size_);
+ if (!composition_text.empty())
+ text_input_client_->InsertText(composition_text);
+
+ const size_t previous_buffer_size = string_buffer_.size();
+ string_buffer_.clear();
+ committed_size_ = 0;
+ selection_.set_start(0);
+ selection_.set_end(0);
+ if (text_store_acp_sink_mask_ & TS_AS_SEL_CHANGE)
+ text_store_acp_sink_->OnSelectionChange();
+ if (text_store_acp_sink_mask_ & TS_AS_LAYOUT_CHANGE)
+ text_store_acp_sink_->OnLayoutChange(TS_LC_CHANGE, 0);
+ if (text_store_acp_sink_mask_ & TS_AS_TEXT_CHANGE) {
+ TS_TEXTCHANGE textChange = {};
+ textChange.acpStart = 0;
+ textChange.acpOldEnd = previous_buffer_size;
+ textChange.acpNewEnd = 0;
+ text_store_acp_sink_->OnTextChange(0, &textChange);
+ }
+ return true;
+}
+
void TSFTextStore::SendOnLayoutChange() {
if (text_store_acp_sink_ && (text_store_acp_sink_mask_ & TS_AS_LAYOUT_CHANGE))
text_store_acp_sink_->OnLayoutChange(TS_LC_CHANGE, 0);
« ui/base/ime/win/tsf_text_store.h ('K') | « ui/base/ime/win/tsf_text_store.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698