| OLD | NEW |
| 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/autocomplete/autocomplete_popup_view_gtk.h" | 5 #include "chrome/browser/autocomplete/autocomplete_popup_view_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 // doing RTL or anything yet, so it shouldn't be important now. | 278 // doing RTL or anything yet, so it shouldn't be important now. |
| 279 layout_ = gtk_widget_create_pango_layout(window_, NULL); | 279 layout_ = gtk_widget_create_pango_layout(window_, NULL); |
| 280 // We don't want the layout of search results depending on their language. | 280 // We don't want the layout of search results depending on their language. |
| 281 pango_layout_set_auto_dir(layout_, FALSE); | 281 pango_layout_set_auto_dir(layout_, FALSE); |
| 282 // We always ellipsize when drawing our text runs. | 282 // We always ellipsize when drawing our text runs. |
| 283 pango_layout_set_ellipsize(layout_, PANGO_ELLIPSIZE_END); | 283 pango_layout_set_ellipsize(layout_, PANGO_ELLIPSIZE_END); |
| 284 // TODO(deanm): We might want to eventually follow what Windows does and | 284 // TODO(deanm): We might want to eventually follow what Windows does and |
| 285 // plumb a gfx::Font through. This is because popup windows have a | 285 // plumb a gfx::Font through. This is because popup windows have a |
| 286 // different font size, although we could just derive that font here. | 286 // different font size, although we could just derive that font here. |
| 287 // For now, force the font size. | 287 // For now, force the font size. |
| 288 gfx::Font font = gfx::Font::CreateFont( | 288 gfx::Font font(gfx::Font().GetFontName(), |
| 289 gfx::Font().FontName(), browser_defaults::kAutocompletePopupFontSize); | 289 browser_defaults::kAutocompletePopupFontSize); |
| 290 PangoFontDescription* pfd = gfx::Font::PangoFontFromGfxFont(font); | 290 PangoFontDescription* pfd = font.GetNativeFont(); |
| 291 pango_layout_set_font_description(layout_, pfd); | 291 pango_layout_set_font_description(layout_, pfd); |
| 292 pango_font_description_free(pfd); | 292 pango_font_description_free(pfd); |
| 293 | 293 |
| 294 gtk_widget_add_events(window_, GDK_BUTTON_MOTION_MASK | | 294 gtk_widget_add_events(window_, GDK_BUTTON_MOTION_MASK | |
| 295 GDK_POINTER_MOTION_MASK | | 295 GDK_POINTER_MOTION_MASK | |
| 296 GDK_BUTTON_PRESS_MASK | | 296 GDK_BUTTON_PRESS_MASK | |
| 297 GDK_BUTTON_RELEASE_MASK); | 297 GDK_BUTTON_RELEASE_MASK); |
| 298 g_signal_connect(window_, "motion-notify-event", | 298 g_signal_connect(window_, "motion-notify-event", |
| 299 G_CALLBACK(&HandleMotionThunk), this); | 299 G_CALLBACK(&HandleMotionThunk), this); |
| 300 g_signal_connect(window_, "button-press-event", | 300 g_signal_connect(window_, "button-press-event", |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 (text_width - actual_content_width - | 648 (text_width - actual_content_width - |
| 649 (actual_description_width / PANGO_SCALE)), | 649 (actual_description_width / PANGO_SCALE)), |
| 650 content_y, layout_); | 650 content_y, layout_); |
| 651 } | 651 } |
| 652 } | 652 } |
| 653 | 653 |
| 654 g_object_unref(gc); | 654 g_object_unref(gc); |
| 655 | 655 |
| 656 return TRUE; | 656 return TRUE; |
| 657 } | 657 } |
| OLD | NEW |