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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #define INITGUID // required for GUID_PROP_INPUTSCOPE 5 #define INITGUID // required for GUID_PROP_INPUTSCOPE
6 #include "ui/base/ime/win/tsf_text_store.h" 6 #include "ui/base/ime/win/tsf_text_store.h"
7 7
8 #include <InputScope.h> 8 #include <InputScope.h>
9 #include <OleCtl.h> 9 #include <OleCtl.h>
10 10
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 } 824 }
825 825
826 void TSFTextStore::RemoveFocusedTextInputClient( 826 void TSFTextStore::RemoveFocusedTextInputClient(
827 TextInputClient* text_input_client) { 827 TextInputClient* text_input_client) {
828 if (text_input_client_ == text_input_client) { 828 if (text_input_client_ == text_input_client) {
829 window_handle_ = NULL; 829 window_handle_ = NULL;
830 text_input_client_ = NULL; 830 text_input_client_ = NULL;
831 } 831 }
832 } 832 }
833 833
834 bool TSFTextStore::CancelComposition() {
835 // There is an on-going document lock. We must not edit the text!
836 if (edit_flag_ != 0)
Seigo Nonaka 2013/06/21 08:09:53 !edit_flag?
Yohei Yukawa 2013/06/21 08:26:55 Done.
837 return false;
838
839 if (string_buffer_.empty())
840 return true;
841
842 const size_t previous_buffer_size = string_buffer_.size();
843 string_buffer_.clear();
844 committed_size_ = 0;
845 selection_.set_start(0);
846 selection_.set_end(0);
847 if (text_store_acp_sink_mask_ & TS_AS_SEL_CHANGE)
848 text_store_acp_sink_->OnSelectionChange();
849 if (text_store_acp_sink_mask_ & TS_AS_LAYOUT_CHANGE)
850 text_store_acp_sink_->OnLayoutChange(TS_LC_CHANGE, 0);
851 if (text_store_acp_sink_mask_ & TS_AS_TEXT_CHANGE) {
852 TS_TEXTCHANGE textChange = {};
853 textChange.acpStart = 0;
854 textChange.acpOldEnd = previous_buffer_size;
855 textChange.acpNewEnd = 0;
856 text_store_acp_sink_->OnTextChange(0, &textChange);
857 }
858 return true;
859 }
860
861 bool TSFTextStore::ConfirmComposition() {
862 // There is an on-going document lock. We must not edit the text!
863 if (edit_flag_ != 0)
Seigo Nonaka 2013/06/21 08:09:53 ditto
Yohei Yukawa 2013/06/21 08:26:55 Done.
864 return false;
865
866 if (string_buffer_.empty())
867 return true;
868
869 const string16& composition_text = string_buffer_.substr(committed_size_);
870 if (!composition_text.empty())
871 text_input_client_->InsertText(composition_text);
872
873 const size_t previous_buffer_size = string_buffer_.size();
874 string_buffer_.clear();
875 committed_size_ = 0;
876 selection_.set_start(0);
877 selection_.set_end(0);
878 if (text_store_acp_sink_mask_ & TS_AS_SEL_CHANGE)
879 text_store_acp_sink_->OnSelectionChange();
880 if (text_store_acp_sink_mask_ & TS_AS_LAYOUT_CHANGE)
881 text_store_acp_sink_->OnLayoutChange(TS_LC_CHANGE, 0);
882 if (text_store_acp_sink_mask_ & TS_AS_TEXT_CHANGE) {
883 TS_TEXTCHANGE textChange = {};
884 textChange.acpStart = 0;
885 textChange.acpOldEnd = previous_buffer_size;
886 textChange.acpNewEnd = 0;
887 text_store_acp_sink_->OnTextChange(0, &textChange);
888 }
889 return true;
890 }
891
834 void TSFTextStore::SendOnLayoutChange() { 892 void TSFTextStore::SendOnLayoutChange() {
835 if (text_store_acp_sink_ && (text_store_acp_sink_mask_ & TS_AS_LAYOUT_CHANGE)) 893 if (text_store_acp_sink_ && (text_store_acp_sink_mask_ & TS_AS_LAYOUT_CHANGE))
836 text_store_acp_sink_->OnLayoutChange(TS_LC_CHANGE, 0); 894 text_store_acp_sink_->OnLayoutChange(TS_LC_CHANGE, 0);
837 } 895 }
838 896
839 bool TSFTextStore::HasReadLock() const { 897 bool TSFTextStore::HasReadLock() const {
840 return (current_lock_type_ & TS_LF_READ) == TS_LF_READ; 898 return (current_lock_type_ & TS_LF_READ) == TS_LF_READ;
841 } 899 }
842 900
843 bool TSFTextStore::HasReadWriteLock() const { 901 bool TSFTextStore::HasReadWriteLock() const {
844 return (current_lock_type_ & TS_LF_READWRITE) == TS_LF_READWRITE; 902 return (current_lock_type_ & TS_LF_READWRITE) == TS_LF_READWRITE;
845 } 903 }
846 904
847 } // namespace ui 905 } // namespace ui
OLDNEW
« 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