Chromium Code Reviews| Index: ui/views/controls/menu/menu_item_view_views.cc |
| diff --git a/ui/views/controls/menu/menu_item_view_views.cc b/ui/views/controls/menu/menu_item_view_views.cc |
| index 720c24e18b016eed75a32e5e51c3cec7b14e3ea4..ac3251c1c573b0427d2b2e4e5660bcf95a7d08d6 100644 |
| --- a/ui/views/controls/menu/menu_item_view_views.cc |
| +++ b/ui/views/controls/menu/menu_item_view_views.cc |
| @@ -23,7 +23,7 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { |
| bool render_selection = |
| (mode == PB_NORMAL && IsSelected() && |
| parent_menu_item_->GetSubmenu()->GetShowSelection(this) && |
| - !has_children()); |
| + NonIconChildViewsCount() == 0); |
|
msw
2012/06/28 01:56:38
nit: add parens around this conditional term.
yefimt
2012/06/28 16:53:34
Interesting, I had it before then removed to be co
msw
2012/06/28 17:40:25
Ah, right. Feel free to ignore style preference ni
|
| int icon_x = config.item_left_margin; |
| int top_margin = GetTopMargin(); |
| @@ -72,11 +72,10 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { |
| const gfx::Font& font = GetFont(); |
| int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width(); |
| int width = this->width() - item_right_margin_ - label_start_ - accel_width; |
| - gfx::Rect text_bounds(label_start_, top_margin + |
| - (available_height - font.GetHeight() + 1) / 2, width, |
| - font.GetHeight()); |
| + gfx::Rect text_bounds(label_start_, top_margin, width, available_height); |
| text_bounds.set_x(GetMirroredXForRect(text_bounds)); |
| - int flags = GetRootMenuItem()->GetDrawStringFlags(); |
| + int flags = GetRootMenuItem()->GetDrawStringFlags() | |
| + gfx::Canvas::TEXT_VALIGN_MIDDLE; |
| if (mode == PB_FOR_DRAG) |
| flags |= gfx::Canvas::NO_SUBPIXEL_RENDERING; |
| canvas->DrawStringInt(title(), font, fg_color, |
| @@ -85,23 +84,6 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { |
| PaintAccelerator(canvas); |
| - // Render the icon. |
| - if (icon_.width() > 0) { |
| - gfx::Rect icon_bounds(config.item_left_margin, |
| - top_margin + (height() - top_margin - |
| - bottom_margin - icon_.height()) / 2, |
| - icon_.width(), |
| - icon_.height()); |
| - icon_bounds.set_x(GetMirroredXForRect(icon_bounds)); |
| - if (!enabled()) { |
| - SkPaint paint; |
| - paint.setAlpha(120); |
| - canvas->DrawImageInt(icon_, icon_bounds.x(), icon_bounds.y(), paint); |
| - } else { |
| - canvas->DrawImageInt(icon_, icon_bounds.x(), icon_bounds.y()); |
| - } |
| - } |
| - |
| // Render the submenu indicator (arrow). |
| if (HasSubmenu()) { |
| gfx::Rect arrow_bounds(this->width() - config.arrow_width - |