| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/autocomplete/autocomplete_edit_view_gtk.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 std::string suggestion_utf8 = UTF16ToUTF8(suggestion); | 758 std::string suggestion_utf8 = UTF16ToUTF8(suggestion); |
| 759 | 759 |
| 760 gtk_label_set_text(GTK_LABEL(instant_view_), suggestion_utf8.c_str()); | 760 gtk_label_set_text(GTK_LABEL(instant_view_), suggestion_utf8.c_str()); |
| 761 | 761 |
| 762 StopAnimation(); | 762 StopAnimation(); |
| 763 | 763 |
| 764 if (suggestion.empty()) { | 764 if (suggestion.empty()) { |
| 765 gtk_widget_hide(instant_view_); | 765 gtk_widget_hide(instant_view_); |
| 766 return; | 766 return; |
| 767 } | 767 } |
| 768 if (InstantController::IsEnabled(model_->profile(), | 768 if (InstantController::IsEnabled(model_->profile()) |
| 769 InstantController::PREDICTIVE_TYPE) | |
| 770 #if GTK_CHECK_VERSION(2, 20, 0) | 769 #if GTK_CHECK_VERSION(2, 20, 0) |
| 771 && preedit_.empty() | 770 && preedit_.empty() |
| 772 #endif | 771 #endif |
| 773 ) { | 772 ) { |
| 774 instant_animation_->set_delegate(this); | 773 instant_animation_->set_delegate(this); |
| 775 instant_animation_->Start(); | 774 instant_animation_->Start(); |
| 776 } | 775 } |
| 777 | 776 |
| 778 gtk_widget_show(instant_view_); | 777 gtk_widget_show(instant_view_); |
| 779 AdjustVerticalAlignmentOfInstantView(); | 778 AdjustVerticalAlignmentOfInstantView(); |
| (...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2218 // baseline, so we need to move the |instant_view_| down to make sure it | 2217 // baseline, so we need to move the |instant_view_| down to make sure it |
| 2219 // has the same baseline as the |text_view_|. | 2218 // has the same baseline as the |text_view_|. |
| 2220 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); | 2219 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); |
| 2221 int height; | 2220 int height; |
| 2222 pango_layout_get_size(layout, NULL, &height); | 2221 pango_layout_get_size(layout, NULL, &height); |
| 2223 PangoLayoutIter* iter = pango_layout_get_iter(layout); | 2222 PangoLayoutIter* iter = pango_layout_get_iter(layout); |
| 2224 int baseline = pango_layout_iter_get_baseline(iter); | 2223 int baseline = pango_layout_iter_get_baseline(iter); |
| 2225 pango_layout_iter_free(iter); | 2224 pango_layout_iter_free(iter); |
| 2226 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); | 2225 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); |
| 2227 } | 2226 } |
| OLD | NEW |