Chromium Code Reviews| Index: ui/views/controls/button/vector_icon_button.cc |
| diff --git a/ui/views/controls/button/vector_icon_button.cc b/ui/views/controls/button/vector_icon_button.cc |
| index c3e1ba2b684548a673a7d3b1f16b6af532f51a8e..79c62ff5d9afd8d01d444cedf42cb36e1875bc3b 100644 |
| --- a/ui/views/controls/button/vector_icon_button.cc |
| +++ b/ui/views/controls/button/vector_icon_button.cc |
| @@ -8,19 +8,15 @@ |
| #include "ui/gfx/color_utils.h" |
| #include "ui/gfx/paint_vector_icon.h" |
| #include "ui/gfx/vector_icons_public.h" |
| +#include "ui/views/animation/ink_drop_highlight.h" |
| +#include "ui/views/animation/ink_drop_ripple.h" |
| #include "ui/views/border.h" |
| #include "ui/views/controls/button/vector_icon_button_delegate.h" |
| #include "ui/views/painter.h" |
| +#include "ui/views/views_delegate.h" |
| namespace views { |
| -namespace { |
| - |
| -// Extra space around the buttons to increase their event target size. |
| -const int kButtonExtraTouchSize = 4; |
| - |
| -} // namespace |
| - |
| VectorIconButton::VectorIconButton(VectorIconButtonDelegate* delegate) |
| : ImageButton(delegate), |
| delegate_(delegate), |
| @@ -55,9 +51,20 @@ void VectorIconButton::OnNativeThemeChanged(const ui::NativeTheme* theme) { |
| UpdateImagesAndColors(); |
| } |
| +std::unique_ptr<InkDropRipple> VectorIconButton::CreateInkDropRipple() const { |
| + return CreateDefaultInkDropRipple(GetLocalBounds().CenterPoint(), size()); |
| +} |
| + |
| +std::unique_ptr<InkDropHighlight> VectorIconButton::CreateInkDropHighlight() |
| + const { |
| + return CreateDefaultInkDropHighlight( |
| + gfx::RectF(GetLocalBounds()).CenterPoint(), size()); |
| +} |
| + |
| void VectorIconButton::OnSetIcon() { |
| - if (!border()) |
| - SetBorder(CreateEmptyBorder(gfx::Insets(kButtonExtraTouchSize))); |
| + const gfx::Insets insets = ViewsDelegate::GetInstance()->GetButtonPadding(); |
|
sky
2017/02/01 16:57:28
Is the plan to use GetButtonPadding in all buttons
Peter Kasting
2017/02/01 19:48:45
I think that concern is fair. I hate being so spe
|
| + if (!border() && !insets.IsEmpty()) |
| + SetBorder(CreateEmptyBorder(insets)); |
| UpdateImagesAndColors(); |
| } |