Commit f3f1873a authored by Jihwan Marc Kim's avatar Jihwan Marc Kim Committed by Commit Bot

[Autofill Views] Replace 24px with a more semantic constant.

In fixing crbug.com/876291, a constant was introduced to ensure
the primary and secondary text doest not run together.

Replace this fetched from |chrome_layout_provider.h|.

Bug: 876364
Change-Id: I1273b706c05a722d95954f5bde3adb0787833bf9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1646686Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Reviewed-by: default avatarAllen Bauer <kylixrd@chromium.org>
Reviewed-by: default avatarTommy Martino <tmartino@chromium.org>
Reviewed-by: default avatarFabio Tirelo <ftirelo@chromium.org>
Commit-Queue: Fabio Tirelo <ftirelo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#669688}
parent 970bf2d5
...@@ -32,10 +32,6 @@ class AutofillPopupBaseView : public views::WidgetDelegateView, ...@@ -32,10 +32,6 @@ class AutofillPopupBaseView : public views::WidgetDelegateView,
// doesn't look too close to the element. // doesn't look too close to the element.
static const int kElementBorderPadding = 1; static const int kElementBorderPadding = 1;
// Horizontal spacing between value and description in the row.
// TODO(crbug.com/876364): Replace this with a global constant.
static const int kValueLabelPadding = 24;
static int GetCornerRadius(); static int GetCornerRadius();
// Get colors used throughout various popup UIs, based on the current native // Get colors used throughout various popup UIs, based on the current native
......
...@@ -646,8 +646,10 @@ void AutofillPopupFooterView::CreateContent() { ...@@ -646,8 +646,10 @@ void AutofillPopupFooterView::CreateContent() {
auto value_label = CreateValueLabel(); auto value_label = CreateValueLabel();
AddChildView(std::move(value_label)); AddChildView(std::move(value_label));
AddSpacerWithSize(AutofillPopupBaseView::kValueLabelPadding, AddSpacerWithSize(
/*resize=*/true, layout_manager); ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_BETWEEN_PRIMARY_AND_SECONDARY_LABELS_HORIZONTAL),
/*resize=*/true, layout_manager);
if (!icon.isNull() && !use_leading_icon) { if (!icon.isNull() && !use_leading_icon) {
AddSpacerWithSize(GetHorizontalMargin(), /*resize=*/false, layout_manager); AddSpacerWithSize(GetHorizontalMargin(), /*resize=*/false, layout_manager);
......
...@@ -163,6 +163,8 @@ int ChromeLayoutProvider::GetDistanceMetric(int metric) const { ...@@ -163,6 +163,8 @@ int ChromeLayoutProvider::GetDistanceMetric(int metric) const {
return kMediumSnapPoint; return kMediumSnapPoint;
case DISTANCE_LARGE_MODAL_DIALOG_PREFERRED_WIDTH: case DISTANCE_LARGE_MODAL_DIALOG_PREFERRED_WIDTH:
return kLargeSnapPoint; return kLargeSnapPoint;
case DISTANCE_BETWEEN_PRIMARY_AND_SECONDARY_LABELS_HORIZONTAL:
return 24;
default: default:
return LayoutProvider::GetDistanceMetric(metric); return LayoutProvider::GetDistanceMetric(metric);
} }
......
...@@ -69,6 +69,8 @@ enum ChromeDistanceMetric { ...@@ -69,6 +69,8 @@ enum ChromeDistanceMetric {
// Width of a bubble unless the content is too wide to make that // Width of a bubble unless the content is too wide to make that
// feasible. // feasible.
DISTANCE_BUBBLE_PREFERRED_WIDTH, DISTANCE_BUBBLE_PREFERRED_WIDTH,
// Horizontal spacing between value and description in the row.
DISTANCE_BETWEEN_PRIMARY_AND_SECONDARY_LABELS_HORIZONTAL
}; };
class ChromeLayoutProvider : public views::LayoutProvider { class ChromeLayoutProvider : public views::LayoutProvider {
......
...@@ -83,8 +83,10 @@ class PasswordGenerationPopupViewViews::GeneratedPasswordBox ...@@ -83,8 +83,10 @@ class PasswordGenerationPopupViewViews::GeneratedPasswordBox
column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER,
0 /* resize_percent */, views::GridLayout::USE_PREF, 0 /* resize_percent */, views::GridLayout::USE_PREF,
0, 0); 0, 0);
column_set->AddPaddingColumn(0 /* resize_percent */, column_set->AddPaddingColumn(
AutofillPopupBaseView::kValueLabelPadding); 0 /* resize_percent */,
ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_BETWEEN_PRIMARY_AND_SECONDARY_LABELS_HORIZONTAL));
column_set->AddColumn(views::GridLayout::TRAILING, column_set->AddColumn(views::GridLayout::TRAILING,
views::GridLayout::CENTER, 1.0 /* resize_percent */, views::GridLayout::CENTER, 1.0 /* resize_percent */,
views::GridLayout::USE_PREF, 0, 0); views::GridLayout::USE_PREF, 0, 0);
......
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