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

Side by Side Diff: chrome/browser/renderer_host/gtk_im_context_wrapper.cc

Issue 5372001: [cros] Fix two issues related to gtk im context support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update according to review feedback. Created 10 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/renderer_host/render_widget_host_view_gtk.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/renderer_host/gtk_im_context_wrapper.h" 5 #include "chrome/browser/renderer_host/gtk_im_context_wrapper.h"
6 6
7 #include <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 #include <gdk/gdkkeysyms.h> 8 #include <gdk/gdkkeysyms.h>
9 #include <gtk/gtk.h> 9 #include <gtk/gtk.h>
10 #include <algorithm> 10 #include <algorithm>
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 // handler, which will send commit text to webkit later. Otherwise, 448 // handler, which will send commit text to webkit later. Otherwise,
449 // we need send it here. 449 // we need send it here.
450 // It's possible that commit signal is fired without a key event, for 450 // It's possible that commit signal is fired without a key event, for
451 // example when user input via a voice or handwriting recognition software. 451 // example when user input via a voice or handwriting recognition software.
452 // In this case, the text must be committed directly. 452 // In this case, the text must be committed directly.
453 if (!is_in_key_event_handler_ && host_view_->GetRenderWidgetHost()) 453 if (!is_in_key_event_handler_ && host_view_->GetRenderWidgetHost())
454 host_view_->GetRenderWidgetHost()->ImeConfirmComposition(text); 454 host_view_->GetRenderWidgetHost()->ImeConfirmComposition(text);
455 } 455 }
456 456
457 void GtkIMContextWrapper::HandlePreeditStart() { 457 void GtkIMContextWrapper::HandlePreeditStart() {
458 // Ignore preedit related signals triggered by CancelComposition() method.
459 if (suppress_next_commit_)
460 return;
458 is_composing_text_ = true; 461 is_composing_text_ = true;
459 } 462 }
460 463
461 void GtkIMContextWrapper::HandlePreeditChanged(const gchar* text, 464 void GtkIMContextWrapper::HandlePreeditChanged(const gchar* text,
462 PangoAttrList* attrs, 465 PangoAttrList* attrs,
463 int cursor_position) { 466 int cursor_position) {
464 suppress_next_commit_ = false; 467 // Ignore preedit related signals triggered by CancelComposition() method.
468 if (suppress_next_commit_)
469 return;
470
465 // Don't set is_preedit_changed_ to false if there is no change, because 471 // Don't set is_preedit_changed_ to false if there is no change, because
466 // this handler might be called multiple times with the same data. 472 // this handler might be called multiple times with the same data.
467 is_preedit_changed_ = true; 473 is_preedit_changed_ = true;
468 preedit_text_.clear(); 474 preedit_text_.clear();
469 preedit_underlines_.clear(); 475 preedit_underlines_.clear();
470 preedit_selection_start_ = 0; 476 preedit_selection_start_ = 0;
471 preedit_selection_end_ = 0; 477 preedit_selection_end_ = 0;
472 478
473 ExtractCompositionInfo(text, attrs, cursor_position, &preedit_text_, 479 ExtractCompositionInfo(text, attrs, cursor_position, &preedit_text_,
474 &preedit_underlines_, &preedit_selection_start_, 480 &preedit_underlines_, &preedit_selection_start_,
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 } while (pango_attr_iterator_next(iter)); 651 } while (pango_attr_iterator_next(iter));
646 pango_attr_iterator_destroy(iter); 652 pango_attr_iterator_destroy(iter);
647 } 653 }
648 654
649 // Use a black thin underline by default. 655 // Use a black thin underline by default.
650 if (underlines->empty()) { 656 if (underlines->empty()) {
651 underlines->push_back( 657 underlines->push_back(
652 WebKit::WebCompositionUnderline(0, length, SK_ColorBLACK, false)); 658 WebKit::WebCompositionUnderline(0, length, SK_ColorBLACK, false));
653 } 659 }
654 } 660 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/renderer_host/render_widget_host_view_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698