| 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..3ea2812dd97f96c93b108c6a711c9255ed888dac 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,18 @@ int MenuItemView::GetDrawStringFlags() {
|
| return flags;
|
| }
|
|
|
| +const gfx::Font* MenuItemView::GetFont() {
|
| + // Check for item-specific font.
|
| + const MenuDelegate* delegate = GetDelegate();
|
| + if (delegate) {
|
| + const gfx::Font* font = delegate->GetLabelFont(GetCommand());
|
| + if (font)
|
| + return font;
|
| + }
|
| +
|
| + return &MenuConfig::instance().font;
|
| +}
|
| +
|
| void MenuItemView::AddEmptyMenus() {
|
| DCHECK(HasSubmenu());
|
| if (!submenu_->has_children()) {
|
| @@ -623,7 +635,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();
|
| @@ -638,7 +650,7 @@ void MenuItemView::PaintAccelerator(gfx::Canvas* canvas) {
|
| else
|
| flags |= gfx::Canvas::TEXT_ALIGN_RIGHT;
|
| canvas->DrawStringInt(
|
| - accel_text, font, TextButton::kDisabledColor,
|
| + accel_text, *font, TextButton::kDisabledColor,
|
| accel_bounds.x(), accel_bounds.y(), accel_bounds.width(),
|
| accel_bounds.height(), flags);
|
| }
|
|
|