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

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: Addressing comments 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, 270 // Here SetSurroundingText accepts relative position of |surrounding_text|, so
271 // but currently there are no way to retrieve surrounding text in 271 // we have to convert |selection_range| from node coordinates to
272 // TextInputClient. 272 // |surrounding_text| coordinates.
273 GetInputContextClient()->SetSurroundingText( 273 GetInputContextClient()->SetSurroundingText(
274 UTF16ToUTF8(surrounding_text), 274 UTF16ToUTF8(surrounding_text),
275 selection_range.start(), /* cursor position. */ 275 selection_range.start() - text_range.start(),
276 selection_range.end()); /* selection anchor position. */ 276 selection_range.end() - text_range.start());
277 } 277 }
278 278
279 void InputMethodIBus::CancelComposition(const TextInputClient* client) { 279 void InputMethodIBus::CancelComposition(const TextInputClient* client) {
280 if (context_focused_ && IsTextInputClientFocused(client)) 280 if (context_focused_ && IsTextInputClientFocused(client))
281 ResetContext(); 281 ResetContext();
282 } 282 }
283 283
284 std::string InputMethodIBus::GetInputLocale() { 284 std::string InputMethodIBus::GetInputLocale() {
285 // Not supported. 285 // Not supported.
286 return ""; 286 return "";
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 } 933 }
934 934
935 // Use a black thin underline by default. 935 // Use a black thin underline by default.
936 if (out_composition->underlines.empty()) { 936 if (out_composition->underlines.empty()) {
937 out_composition->underlines.push_back(CompositionUnderline( 937 out_composition->underlines.push_back(CompositionUnderline(
938 0, length, SK_ColorBLACK, false /* thick */)); 938 0, length, SK_ColorBLACK, false /* thick */));
939 } 939 }
940 } 940 }
941 941
942 } // namespace ui 942 } // 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