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

Side by Side Diff: ui/base/ime/input_method_ibus.cc

Issue 13812013: Fix ibus-m17n crash due to wrong parameter from Chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unittests Created 7 years, 8 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
« no previous file with comments | « no previous file | ui/base/ime/input_method_ibus_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "ui/base/ime/input_method_ibus.h" 5 #include "ui/base/ime/input_method_ibus.h"
6 6
7 #include <X11/X.h> 7 #include <X11/X.h>
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 #include <X11/Xutil.h> 9 #include <X11/Xutil.h>
10 #undef FocusIn 10 #undef FocusIn
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 return; 260 return;
261 } 261 }
262 262
263 if (previous_selection_range_ == selection_range && 263 if (previous_selection_range_ == selection_range &&
264 previous_surrounding_text_ == surrounding_text) 264 previous_surrounding_text_ == surrounding_text)
265 return; 265 return;
266 266
267 previous_selection_range_ = selection_range; 267 previous_selection_range_ = selection_range;
268 previous_surrounding_text_ = surrounding_text; 268 previous_surrounding_text_ = surrounding_text;
269 269
270 // In the original meaning of SetSurroundingText is not just selection text,
271 // but currently there are no way to retrieve surrounding text in
272 // TextInputClient.
273 GetInputContextClient()->SetSurroundingText( 270 GetInputContextClient()->SetSurroundingText(
274 UTF16ToUTF8(surrounding_text), 271 UTF16ToUTF8(surrounding_text),
275 selection_range.start(), /* cursor position. */ 272 selection_range.start() - text_range.start(), // cursor position.
276 selection_range.end()); /* selection anchor position. */ 273 selection_range.end() - text_range.end()); // selection anchor position.
kinaba 2013/04/10 04:12:35 Shouldn't it be text_range.start(), not the .end()
Seigo Nonaka 2013/04/10 04:22:26 Yes, good catch! thank you very much! On 2013/04/1
277 } 274 }
278 275
279 void InputMethodIBus::CancelComposition(const TextInputClient* client) { 276 void InputMethodIBus::CancelComposition(const TextInputClient* client) {
280 if (context_focused_ && IsTextInputClientFocused(client)) 277 if (context_focused_ && IsTextInputClientFocused(client))
281 ResetContext(); 278 ResetContext();
282 } 279 }
283 280
284 std::string InputMethodIBus::GetInputLocale() { 281 std::string InputMethodIBus::GetInputLocale() {
285 // Not supported. 282 // Not supported.
286 return ""; 283 return "";
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 } 930 }
934 931
935 // Use a black thin underline by default. 932 // Use a black thin underline by default.
936 if (out_composition->underlines.empty()) { 933 if (out_composition->underlines.empty()) {
937 out_composition->underlines.push_back(CompositionUnderline( 934 out_composition->underlines.push_back(CompositionUnderline(
938 0, length, SK_ColorBLACK, false /* thick */)); 935 0, length, SK_ColorBLACK, false /* thick */));
939 } 936 }
940 } 937 }
941 938
942 } // namespace ui 939 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/base/ime/input_method_ibus_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698