| 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 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1702 } | 1702 } |
| 1703 | 1703 |
| 1704 return false; | 1704 return false; |
| 1705 } | 1705 } |
| 1706 | 1706 |
| 1707 gfx::Font OmniboxViewGtk::GetFont() { | 1707 gfx::Font OmniboxViewGtk::GetFont() { |
| 1708 if (!theme_service_->UsingNativeTheme()) { | 1708 if (!theme_service_->UsingNativeTheme()) { |
| 1709 return gfx::Font( | 1709 return gfx::Font( |
| 1710 ui::ResourceBundle::GetSharedInstance().GetFont( | 1710 ui::ResourceBundle::GetSharedInstance().GetFont( |
| 1711 ui::ResourceBundle::BaseFont).GetFontName(), | 1711 ui::ResourceBundle::BaseFont).GetFontName(), |
| 1712 popup_window_mode_ ? | 1712 browser_defaults::kOmniboxFontPixelSize); |
| 1713 browser_defaults::kAutocompleteEditFontPixelSizeInPopup : | |
| 1714 browser_defaults::kAutocompleteEditFontPixelSize); | |
| 1715 } | 1713 } |
| 1716 | 1714 |
| 1717 // If we haven't initialized the text view yet, just create a temporary one | 1715 // If we haven't initialized the text view yet, just create a temporary one |
| 1718 // whose style we can grab. | 1716 // whose style we can grab. |
| 1719 GtkWidget* widget = text_view_ ? text_view_ : gtk_text_view_new(); | 1717 GtkWidget* widget = text_view_ ? text_view_ : gtk_text_view_new(); |
| 1720 GtkStyle* gtk_style = gtk_widget_get_style(widget); | 1718 GtkStyle* gtk_style = gtk_widget_get_style(widget); |
| 1721 GtkRcStyle* rc_style = gtk_widget_get_modifier_style(widget); | 1719 GtkRcStyle* rc_style = gtk_widget_get_modifier_style(widget); |
| 1722 gfx::Font font( | 1720 gfx::Font font( |
| 1723 (rc_style && rc_style->font_desc) ? | 1721 (rc_style && rc_style->font_desc) ? |
| 1724 rc_style->font_desc : gtk_style->font_desc); | 1722 rc_style->font_desc : gtk_style->font_desc); |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2147 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() { | 2145 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() { |
| 2148 // By default, GtkTextView layouts an anchored child widget just above the | 2146 // By default, GtkTextView layouts an anchored child widget just above the |
| 2149 // baseline, so we need to move the |instant_view_| down to make sure it | 2147 // baseline, so we need to move the |instant_view_| down to make sure it |
| 2150 // has the same baseline as the |text_view_|. | 2148 // has the same baseline as the |text_view_|. |
| 2151 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); | 2149 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); |
| 2152 int height; | 2150 int height; |
| 2153 pango_layout_get_size(layout, NULL, &height); | 2151 pango_layout_get_size(layout, NULL, &height); |
| 2154 int baseline = pango_layout_get_baseline(layout); | 2152 int baseline = pango_layout_get_baseline(layout); |
| 2155 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); | 2153 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); |
| 2156 } | 2154 } |
| OLD | NEW |