Chromium Code Reviews| Index: ui/views/controls/menu/menu_separator_views.cc |
| diff --git a/ui/views/controls/menu/menu_separator_views.cc b/ui/views/controls/menu/menu_separator_views.cc |
| index 61ec07d4bd12a2f3318c175e64823ddaf7ce17cc..a754068a1337b4ce9c4c5c320296d4ef3cdc35bd 100644 |
| --- a/ui/views/controls/menu/menu_separator_views.cc |
| +++ b/ui/views/controls/menu/menu_separator_views.cc |
| @@ -18,14 +18,42 @@ const int kSeparatorHeight = 1; |
| namespace views { |
| void MenuSeparator::OnPaint(gfx::Canvas* canvas) { |
| - canvas->FillRect(gfx::Rect(0, height() / 2, width(), kSeparatorHeight), |
| - ui::NativeTheme::instance()->GetSystemColor( |
| - ui::NativeTheme::kColorId_MenuSeparatorColor)); |
| + if (type_ == ui::UPPER_SEPARATOR) { |
| + canvas->FillRect(gfx::Rect(0, 0, width(), kSeparatorHeight), |
| + ui::NativeTheme::instance()->GetSystemColor( |
|
sky
2012/08/21 19:36:29
Since all branches get the color, move it earlier
Mr4D (OOO till 08-26)
2012/08/21 21:34:54
Not done it that way since that would have read th
|
| + ui::NativeTheme::kColorId_MenuSeparatorColor)); |
| + } else if (type_ == ui::LOWER_SEPARATOR) { |
| + canvas->FillRect(gfx::Rect(0, |
| + height() - kSeparatorHeight, |
| + width(), |
| + kSeparatorHeight), |
| + ui::NativeTheme::instance()->GetSystemColor( |
| + ui::NativeTheme::kColorId_MenuSeparatorColor)); |
| + } else if (type_ != ui::SPACING_SEPARATOR) { |
| + canvas->FillRect(gfx::Rect(0, height() / 2, width(), kSeparatorHeight), |
| + ui::NativeTheme::instance()->GetSystemColor( |
| + ui::NativeTheme::kColorId_MenuSeparatorColor)); |
| + } |
| } |
| gfx::Size MenuSeparator::GetPreferredSize() { |
| + int height = MenuConfig::instance().separator_height; |
| + switch(type_) { |
| + case ui::SPACING_SEPARATOR: |
| + height = MenuConfig::instance().separator_spacing_height; |
| + break; |
| + case ui::LOWER_SEPARATOR: |
| + height = MenuConfig::instance().separator_lower_height; |
| + break; |
| + case ui::UPPER_SEPARATOR: |
| + height = MenuConfig::instance().separator_upper_height; |
| + break; |
| + default: |
| + height = MenuConfig::instance().separator_height; |
| + break; |
| + } |
| return gfx::Size(10, // Just in case we're the only item in a menu. |
| - MenuConfig::instance().separator_height); |
| + height); |
| } |
| } // namespace views |