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 6f9063ad416626c859d2dd6d7cd9f9f228b7b481..7ebd205fb5a3cc737924997be92510d050edd73e 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,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, width, font.GetHeight()); |
| + int height = this->height() - GetTopMargin() - GetBottomMargin(); |
|
Aaron Boodman
2012/06/21 08:15:30
Ah, you were able to normalize the two case here,
yefimt
2012/06/22 22:14:40
Yeah, found what i was doing wrong before
On 2012/
|
| + int flags = gfx::Canvas::TEXT_VALIGN_MIDDLE | |
| + 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,31 +98,20 @@ 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 - |
| - bottom_margin - icon_.height()) / 2, |
| - icon_.width(), |
| - icon_.height()); |
| - icon_bounds.set_x(GetMirroredXForRect(icon_bounds)); |
| - canvas->DrawImageInt(icon_, icon_bounds.x(), icon_bounds.y()); |
| - } |
| - |
| if (HasSubmenu()) { |
| 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 |