Commit 69ded0f7 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

views: reduce checkbox and radiobutton spacing

In Harmony, the distance between these two elements is supposed
to be 3/4 of a layout unit instead of one layout unit, so:

1) Add DISTANCE_BUTTON_IMAGE_LABEL_PADDING to DistanceMetrics
2) Give it the same default value as DISTANCE_RELATED_CONTROL_HORIZONTAL
3) Add a Harmony value for the new DistanceMetric

Bug: 794480
Change-Id: Ib7106612dd2c923386cdbf30219ff37180acdedd
Reviewed-on: https://chromium-review.googlesource.com/848533Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526963}
parent f2a36667
......@@ -34,6 +34,8 @@ gfx::Insets HarmonyLayoutProvider::GetInsetsMetric(int metric) const {
int HarmonyLayoutProvider::GetDistanceMetric(int metric) const {
DCHECK_GE(metric, views::VIEWS_INSETS_MAX);
switch (metric) {
case views::DISTANCE_BUTTON_IMAGE_LABEL_PADDING:
return kHarmonyLayoutUnit * 3 / 4;
case DISTANCE_CONTENT_LIST_VERTICAL_SINGLE:
return kHarmonyLayoutUnit / 4;
case DISTANCE_CONTENT_LIST_VERTICAL_MULTI:
......
......@@ -55,7 +55,7 @@ LabelButton::LabelButton(ButtonListener* listener,
style_(STYLE_TEXTBUTTON),
border_is_themed_border_(true),
image_label_spacing_(LayoutProvider::Get()->GetDistanceMetric(
DISTANCE_RELATED_CONTROL_HORIZONTAL)),
DISTANCE_BUTTON_IMAGE_LABEL_PADDING)),
horizontal_alignment_(gfx::ALIGN_LEFT) {
SetAnimationDuration(kHoverAnimationDurationMs);
SetTextInternal(text);
......
......@@ -87,6 +87,7 @@ int LayoutProvider::GetDistanceMetric(int metric) const {
return 13;
case DistanceMetric::DISTANCE_RELATED_BUTTON_HORIZONTAL:
return 6;
case DistanceMetric::DISTANCE_BUTTON_IMAGE_LABEL_PADDING:
case DistanceMetric::DISTANCE_RELATED_CONTROL_HORIZONTAL:
return 8;
case DistanceMetric::DISTANCE_RELATED_CONTROL_VERTICAL:
......
......@@ -51,6 +51,9 @@ enum DistanceMetric {
// The default padding to add on each side of a button's label.
DISTANCE_BUTTON_HORIZONTAL_PADDING = VIEWS_DISTANCE_START,
// The default padding to use between the image and label of a button with
// both.
DISTANCE_BUTTON_IMAGE_LABEL_PADDING,
// The maximum width a button can have and still influence the sizes of
// other linked buttons. This allows short buttons to have linked widths
// without long buttons making things overly wide.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment