Chromium Code Reviews| Index: ui/views/controls/menu/menu_scroll_view_container.cc |
| diff --git a/ui/views/controls/menu/menu_scroll_view_container.cc b/ui/views/controls/menu/menu_scroll_view_container.cc |
| index 1dedb82790be9e412c1e2b30ac2a4768b0236a9d..47d2f56307bcdb6c057e02be3345e07c16ac43dc 100644 |
| --- a/ui/views/controls/menu/menu_scroll_view_container.cc |
| +++ b/ui/views/controls/menu/menu_scroll_view_container.cc |
| @@ -26,6 +26,8 @@ namespace views { |
| namespace { |
| +static const int kBorderPaddingDueToRoundedCorners = 1; |
| + |
| // MenuScrollButton ------------------------------------------------------------ |
| // MenuScrollButton is used for the scroll buttons when not all menu items fit |
| @@ -179,7 +181,8 @@ MenuScrollViewContainer::MenuScrollViewContainer(SubmenuView* content_view) |
| set_border(views::Border::CreateBorderPainter( |
| new views::RoundRectPainter( |
| ui::NativeTheme::instance()->GetSystemColor( |
| - ui::NativeTheme::kColorId_MenuBorderColor)), |
| + ui::NativeTheme::kColorId_MenuBorderColor), |
| + menu_config.corner_radius), |
| gfx::Insets(menu_config.menu_vertical_border_size, |
| menu_config.menu_horizontal_border_size, |
| menu_config.menu_vertical_border_size, |
| @@ -201,6 +204,8 @@ void MenuScrollViewContainer::OnPaintBackground(gfx::Canvas* canvas) { |
| gfx::Rect bounds(0, 0, width(), height()); |
| NativeTheme::ExtraParams extra; |
| + const MenuConfig& menu_config = content_view_->GetMenuItem()->GetMenuConfig(); |
| + extra.menu_background.corner_radius = menu_config.corner_radius; |
| GetNativeTheme()->Paint(canvas->sk_canvas(), |
| NativeTheme::kMenuPopupBackground, NativeTheme::kNormal, bounds, extra); |
| } |
| @@ -251,6 +256,18 @@ void MenuScrollViewContainer::GetAccessibleState( |
| state->state = ui::AccessibilityTypes::STATE_FOCUSED; |
| } |
| +gfx::Insets MenuScrollViewContainer::GetInsets() const { |
| + gfx::Insets insets = View::GetInsets(); |
|
sky
2013/01/25 20:30:24
Shouldn't this come from the border installed arou
varunjain
2013/01/25 22:57:29
Done.
|
| + const MenuConfig& menu_config = content_view_->GetMenuItem()->GetMenuConfig(); |
| + if (menu_config.corner_radius > 0) { |
| + insets += gfx::Insets(kBorderPaddingDueToRoundedCorners, |
| + kBorderPaddingDueToRoundedCorners, |
| + kBorderPaddingDueToRoundedCorners, |
| + kBorderPaddingDueToRoundedCorners); |
| + } |
| + return insets; |
| +} |
| + |
| void MenuScrollViewContainer::OnBoundsChanged( |
| const gfx::Rect& previous_bounds) { |
| gfx::Size content_pref = scroll_view_->GetContents()->GetPreferredSize(); |