Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Unified Diff: ui/views/controls/button/vector_icon_button.cc

Issue 2671443002: Make the extra padding around VectorIconButtons configurable. (Closed)
Patch Set: Resync Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/button/vector_icon_button.h ('k') | ui/views/layout/layout_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..5bbe0806f18a587218a64642f1db0c90684fee2b 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()->GetButtonMargins();
+ if (!border() && !insets.IsEmpty())
+ SetBorder(CreateEmptyBorder(insets));
UpdateImagesAndColors();
}
« no previous file with comments | « ui/views/controls/button/vector_icon_button.h ('k') | ui/views/layout/layout_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698