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); |