Index: views/controls/menu/menu_item_view.cc |
diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc |
index 3ff7f2b7e2eed01ff1a6d2d855b76e302b47aa88..9d7b24b4c2133ac1d383097f54351efbaef4939a 100644 |
--- a/views/controls/menu/menu_item_view.cc |
+++ b/views/controls/menu/menu_item_view.cc |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -456,7 +456,7 @@ void MenuItemView::Layout() { |
int MenuItemView::GetAcceleratorTextWidth() { |
string16 text = GetAcceleratorText(); |
- return text.empty() ? 0 : MenuConfig::instance().font.GetStringWidth(text); |
+ return text.empty() ? 0 : GetFont().GetStringWidth(text); |
} |
MenuItemView::MenuItemView(MenuItemView* parent, |
@@ -584,6 +584,15 @@ int MenuItemView::GetDrawStringFlags() { |
return flags; |
} |
+const gfx::Font& MenuItemView::GetFont() { |
+ // Check for item-specific font. |
+ const MenuDelegate* delegate = GetDelegate(); |
+ if (delegate) |
+ return delegate->GetLabelFont(GetCommand()); |
+ else |
+ return MenuConfig::instance().font; |
+} |
+ |
void MenuItemView::AddEmptyMenus() { |
DCHECK(HasSubmenu()); |
if (!submenu_->has_children()) { |
@@ -623,7 +632,7 @@ void MenuItemView::PaintAccelerator(gfx::Canvas* canvas) { |
if (accel_text.empty()) |
return; |
- const gfx::Font& font = MenuConfig::instance().font; |
+ const gfx::Font& font = GetFont(); |
int available_height = height() - GetTopMargin() - GetBottomMargin(); |
int max_accel_width = |
parent_menu_item_->GetSubmenu()->max_accelerator_width(); |