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

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

Issue 2696263002: Refactor ViewsDelegate and MD-ify the icon-to-text spacing for checkbox and radiobutton (Closed)
Patch Set: Reduced ViewsDelegate layout/metric functions to only two functions 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
Index: ui/views/controls/button/label_button.cc
diff --git a/ui/views/controls/button/label_button.cc b/ui/views/controls/button/label_button.cc
index 28242d0ba474901008eb4586374fe8280f0a1ef8..574325213e5df4b6c88f6e8d8df6c48e6d37e0de 100644
--- a/ui/views/controls/button/label_button.cc
+++ b/ui/views/controls/button/label_button.cc
@@ -27,13 +27,11 @@
#include "ui/views/controls/button/label_button_border.h"
#include "ui/views/painter.h"
#include "ui/views/style/platform_style.h"
+#include "ui/views/views_delegate.h"
#include "ui/views/window/dialog_delegate.h"
namespace {
-// The default spacing between the icon and text.
-const int kSpacing = 5;
-
gfx::Font::Weight GetValueBolderThan(gfx::Font::Weight weight) {
if (weight < gfx::Font::Weight::BOLD)
return gfx::Font::Weight::BOLD;
@@ -93,7 +91,8 @@ LabelButton::LabelButton(ButtonListener* listener, const base::string16& text)
is_default_(false),
style_(STYLE_TEXTBUTTON),
border_is_themed_border_(true),
- image_label_spacing_(kSpacing),
+ image_label_spacing_(ViewsDelegate::GetInstance()->GetSpacingMetric(
+ ViewsDelegate::SpacingMetric::ICON_TO_TEXT)),
horizontal_alignment_(gfx::ALIGN_LEFT) {
SetAnimationDuration(kHoverAnimationDurationMs);
SetTextInternal(text);

Powered by Google App Engine
This is Rietveld 408576698