Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Unified Diff: ui/views/controls/combobox/native_combobox_views.cc

Issue 9839034: views: Refactor the way we get the combo box font. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: order Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/combobox/native_combobox_views.cc
diff --git a/ui/views/controls/combobox/native_combobox_views.cc b/ui/views/controls/combobox/native_combobox_views.cc
index 95fb42890f813fcf11b535550a62fc86f324e1d7..a6e14710cf8a2d4bb067af0065fda4112661ddf0 100644
--- a/ui/views/controls/combobox/native_combobox_views.cc
+++ b/ui/views/controls/combobox/native_combobox_views.cc
@@ -160,7 +160,7 @@ void NativeComboboxViews::OnBlur() {
void NativeComboboxViews::UpdateFromModel() {
int max_width = 0;
- const gfx::Font &font = GetFont();
+ const gfx::Font& font = Combobox::GetFont();
MenuItemView* menu = new MenuItemView(this);
// MenuRunner owns |menu|.
@@ -268,11 +268,6 @@ bool NativeComboboxViews::GetAccelerator(int id, ui::Accelerator* accel) {
/////////////////////////////////////////////////////////////////
// NativeComboboxViews private methods:
-const gfx::Font& NativeComboboxViews::GetFont() const {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- return rb.GetFont(ResourceBundle::BaseFont);
-}
-
void NativeComboboxViews::AdjustBoundsForRTLUI(gfx::Rect* rect) const {
rect->set_x(GetMirroredXForRect(*rect));
}
@@ -296,7 +291,7 @@ void NativeComboboxViews::PaintText(gfx::Canvas* canvas) {
int disclosure_arrow_offset = width() - disclosure_arrow_->width()
- kDisclosureArrowLeftPadding - kDisclosureArrowRightPadding;
- const gfx::Font& font = GetFont();
+ const gfx::Font& font = Combobox::GetFont();
int text_width = font.GetStringWidth(text);
if ((text_width + insets.width()) > disclosure_arrow_offset)
text_width = disclosure_arrow_offset - insets.width();
« no previous file with comments | « ui/views/controls/combobox/native_combobox_views.h ('k') | ui/views/controls/combobox/native_combobox_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698