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 34f85453501d62a86dc44d1cde338e647ba80d50..cf5a8fbbf85046bcbe1eefadf089c9af435589f7 100644 |
--- a/ui/views/controls/menu/menu_separator_views.cc |
+++ b/ui/views/controls/menu/menu_separator_views.cc |
@@ -22,32 +22,9 @@ namespace views { |
void MenuSeparator::OnPaint(gfx::Canvas* canvas) { |
OnPaintAura(canvas); |
} |
- |
-gfx::Size MenuSeparator::GetPreferredSize() const { |
- return GetPreferredSizeAura(); |
-} |
#endif |
-void MenuSeparator::OnPaintAura(gfx::Canvas* canvas) { |
- int pos = 0; |
- switch (type_) { |
- case ui::LOWER_SEPARATOR: |
- pos = height() - kSeparatorHeight; |
- break; |
- case ui::SPACING_SEPARATOR: |
- return; |
- case ui::UPPER_SEPARATOR: |
- break; |
- default: |
- pos = height() / 2; |
- break; |
- } |
- canvas->FillRect(gfx::Rect(0, pos, width(), kSeparatorHeight), |
- GetNativeTheme()->GetSystemColor( |
- ui::NativeTheme::kColorId_MenuSeparatorColor)); |
-} |
- |
-gfx::Size MenuSeparator::GetPreferredSizeAura() const { |
+gfx::Size MenuSeparator::GetPreferredSize() const { |
const MenuConfig& menu_config = parent_menu_item_->GetMenuConfig(); |
int height = menu_config.separator_height; |
switch(type_) { |
@@ -68,4 +45,28 @@ gfx::Size MenuSeparator::GetPreferredSizeAura() const { |
height); |
} |
+gfx::Rect MenuSeparator::GetPaintBounds() { |
+ int pos = 0; |
+ switch (type_) { |
+ case ui::LOWER_SEPARATOR: |
+ pos = height() - kSeparatorHeight; |
+ break; |
+ case ui::SPACING_SEPARATOR: |
+ return gfx::Rect(); |
+ case ui::UPPER_SEPARATOR: |
+ break; |
+ default: |
+ pos = height() / 2; |
+ break; |
+ } |
+ |
+ return gfx::Rect(0, pos, width(), kSeparatorHeight); |
+} |
+ |
+void MenuSeparator::OnPaintAura(gfx::Canvas* canvas) { |
+ canvas->FillRect(GetPaintBounds(), |
+ GetNativeTheme()->GetSystemColor( |
+ ui::NativeTheme::kColorId_MenuSeparatorColor)); |
+} |
+ |
} // namespace views |