| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/omnibox/omnibox_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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 enter_was_inserted_(false), | 205 enter_was_inserted_(false), |
| 206 selection_suggested_(false), | 206 selection_suggested_(false), |
| 207 delete_was_pressed_(false), | 207 delete_was_pressed_(false), |
| 208 delete_at_end_pressed_(false), | 208 delete_at_end_pressed_(false), |
| 209 handling_key_press_(false), | 209 handling_key_press_(false), |
| 210 content_maybe_changed_by_key_press_(false), | 210 content_maybe_changed_by_key_press_(false), |
| 211 update_popup_without_focus_(false), | 211 update_popup_without_focus_(false), |
| 212 supports_pre_edit_(!gtk_check_version(2, 20, 0)), | 212 supports_pre_edit_(!gtk_check_version(2, 20, 0)), |
| 213 pre_edit_size_before_change_(0), | 213 pre_edit_size_before_change_(0), |
| 214 going_to_focus_(NULL) { | 214 going_to_focus_(NULL) { |
| 215 popup_view_.reset( | 215 OmniboxPopupViewGtk* view = new OmniboxPopupViewGtk( |
| 216 new OmniboxPopupViewGtk | 216 GetFont(), this, model(), location_bar); |
| 217 (GetFont(), this, model(), location_bar)); | 217 view->Init(); |
| 218 popup_view_.reset(view); |
| 218 } | 219 } |
| 219 | 220 |
| 220 OmniboxViewGtk::~OmniboxViewGtk() { | 221 OmniboxViewGtk::~OmniboxViewGtk() { |
| 221 // Explicitly teardown members which have a reference to us. Just to be safe | 222 // Explicitly teardown members which have a reference to us. Just to be safe |
| 222 // we want them to be destroyed before destroying any other internal state. | 223 // we want them to be destroyed before destroying any other internal state. |
| 223 popup_view_.reset(); | 224 popup_view_.reset(); |
| 224 | 225 |
| 225 // We own our widget and TextView related objects. | 226 // We own our widget and TextView related objects. |
| 226 if (alignment_.get()) { // Init() has been called. | 227 if (alignment_.get()) { // Init() has been called. |
| 227 alignment_.Destroy(); | 228 alignment_.Destroy(); |
| (...skipping 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2146 void OmniboxViewGtk::AdjustVerticalAlignmentOfGrayTextView() { | 2147 void OmniboxViewGtk::AdjustVerticalAlignmentOfGrayTextView() { |
| 2147 // By default, GtkTextView layouts an anchored child widget just above the | 2148 // By default, GtkTextView layouts an anchored child widget just above the |
| 2148 // baseline, so we need to move the |gray_text_view_| down to make sure it | 2149 // baseline, so we need to move the |gray_text_view_| down to make sure it |
| 2149 // has the same baseline as the |text_view_|. | 2150 // has the same baseline as the |text_view_|. |
| 2150 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(gray_text_view_)); | 2151 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(gray_text_view_)); |
| 2151 int height; | 2152 int height; |
| 2152 pango_layout_get_size(layout, NULL, &height); | 2153 pango_layout_get_size(layout, NULL, &height); |
| 2153 int baseline = pango_layout_get_baseline(layout); | 2154 int baseline = pango_layout_get_baseline(layout); |
| 2154 g_object_set(gray_text_anchor_tag_, "rise", baseline - height, NULL); | 2155 g_object_set(gray_text_anchor_tag_, "rise", baseline - height, NULL); |
| 2155 } | 2156 } |
| OLD | NEW |