Chromium Code Reviews| Index: ui/views/controls/menu/menu_item_view_win.cc |
| diff --git a/ui/views/controls/menu/menu_item_view_win.cc b/ui/views/controls/menu/menu_item_view_win.cc |
| index bca528a53efb6420c725ebb3d352c2169986dd74..f973a8f6de294c1b9aabf83fd4d6a5babcbe418d 100644 |
| --- a/ui/views/controls/menu/menu_item_view_win.cc |
| +++ b/ui/views/controls/menu/menu_item_view_win.cc |
| @@ -19,10 +19,11 @@ namespace views { |
| void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { |
| const MenuConfig& config = MenuConfig::instance(); |
| + |
| bool render_selection = |
| (mode == PB_NORMAL && IsSelected() && |
| parent_menu_item_->GetSubmenu()->GetShowSelection(this) && |
| - !has_children()); |
| + !HasNonIconChildViews()); |
| int default_sys_color; |
| int state; |
| NativeTheme::State control_state; |
| @@ -85,7 +86,11 @@ 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, width, font.GetHeight()); |
| + // To keep backward compatibility. |
| + int height = has_icon_view_ ? this->height() : font.GetHeight(); |
|
Aaron Boodman
2012/06/19 00:06:33
Can you combine the two cases by doing max(this->h
yefimt
2012/06/20 16:53:04
Done.
|
| + int flags = (has_icon_view_ ? gfx::Canvas::TEXT_VALIGN_MIDDLE : 0) | |
|
Aaron Boodman
2012/06/19 00:06:33
It seems like it would still be correct to do TEXT
yefimt
2012/06/20 16:53:04
Done.
|
| + GetRootMenuItem()->GetDrawStringFlags(); |
| + gfx::Rect text_bounds(label_start_, top_margin, width, height); |
| text_bounds.set_x(GetMirroredXForRect(text_bounds)); |
| if (mode == PB_FOR_DRAG) { |
| // With different themes, it's difficult to tell what the correct |
| @@ -94,19 +99,18 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { |
| // cases. |
| canvas->DrawStringWithHalo(title(), font, 0x00000000, 0xFFFFFFFF, |
| text_bounds.x(), text_bounds.y(), text_bounds.width(), |
| - text_bounds.height(), GetRootMenuItem()->GetDrawStringFlags()); |
| + text_bounds.height(), flags); |
| } else { |
| canvas->DrawStringInt(title(), font, fg_color, |
| text_bounds.x(), text_bounds.y(), text_bounds.width(), |
| - text_bounds.height(), |
| - GetRootMenuItem()->GetDrawStringFlags()); |
| + text_bounds.height(), flags); |
| } |
| PaintAccelerator(canvas); |
| if (icon_.width() > 0) { |
| gfx::Rect icon_bounds(config.item_left_margin, |
| - top_margin + (height() - top_margin - |
| + top_margin + (this->height() - top_margin - |
| bottom_margin - icon_.height()) / 2, |
| icon_.width(), |
| icon_.height()); |
| @@ -118,7 +122,7 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { |
| int state_id = enabled() ? MSM_NORMAL : MSM_DISABLED; |
| gfx::Rect arrow_bounds(this->width() - item_right_margin_ + |
| config.label_to_arrow_padding, 0, |
| - config.arrow_width, height()); |
| + config.arrow_width, this->height()); |
| AdjustBoundsForRTLUI(&arrow_bounds); |
| // If our sub menus open from right to left (which is the case when the |