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/ui/gtk/omnibox/omnibox_popup_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/omnibox/omnibox_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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 // The size delta between the font used for the edit and the result rows. Passed | 85 // The size delta between the font used for the edit and the result rows. Passed |
86 // to gfx::Font::DeriveFont. | 86 // to gfx::Font::DeriveFont. |
87 const int kEditFontAdjust = -1; | 87 const int kEditFontAdjust = -1; |
88 | 88 |
89 // UTF-8 Left-to-right embedding. | 89 // UTF-8 Left-to-right embedding. |
90 const char* kLRE = "\xe2\x80\xaa"; | 90 const char* kLRE = "\xe2\x80\xaa"; |
91 | 91 |
92 // Return a Rect covering the whole area of |window|. | 92 // Return a Rect covering the whole area of |window|. |
93 gfx::Rect GetWindowRect(GdkWindow* window) { | 93 gfx::Rect GetWindowRect(GdkWindow* window) { |
94 gint width, height; | 94 gint width = gdk_window_get_width(window); |
95 gdk_drawable_get_size(GDK_DRAWABLE(window), &width, &height); | 95 gint height = gdk_window_get_height(window); |
96 return gfx::Rect(width, height); | 96 return gfx::Rect(width, height); |
97 } | 97 } |
98 | 98 |
99 // Return a Rect for the space for a result line. This excludes the border, | 99 // Return a Rect for the space for a result line. This excludes the border, |
100 // but includes the padding. This is the area that is colored for a selection. | 100 // but includes the padding. This is the area that is colored for a selection. |
101 gfx::Rect GetRectForLine(size_t line, int width) { | 101 gfx::Rect GetRectForLine(size_t line, int width) { |
102 return gfx::Rect(kBorderThickness, | 102 return gfx::Rect(kBorderThickness, |
103 (line * kHeightPerResult) + kBorderThickness, | 103 (line * kHeightPerResult) + kBorderThickness, |
104 width - (kBorderThickness * 2), | 104 width - (kBorderThickness * 2), |
105 kHeightPerResult); | 105 kHeightPerResult); |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 (actual_description_width / PANGO_SCALE)), | 690 (actual_description_width / PANGO_SCALE)), |
691 content_y); | 691 content_y); |
692 pango_cairo_show_layout(cr, layout_); | 692 pango_cairo_show_layout(cr, layout_); |
693 cairo_restore(cr); | 693 cairo_restore(cr); |
694 } | 694 } |
695 } | 695 } |
696 | 696 |
697 cairo_destroy(cr); | 697 cairo_destroy(cr); |
698 return TRUE; | 698 return TRUE; |
699 } | 699 } |
OLD | NEW |