Commit 2efec3cd authored by Thomas Tangl's avatar Thomas Tangl Committed by Commit Bot

[profile-menu] Match spacing with mocks

Mocks:
https://gallery.googleplex.com/projects/MCHbtQVoQ2HCZS4C13RU2slZ/files/MCEJu8Y2hyDScSRec_gUtrkQDjJvcy3ALJI

Bug: 1017241
Change-Id: I4a06b95fb6d93de04c3c031674ef7f422da99bd4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1879917
Commit-Queue: Thomas Tangl <tangltom@chromium.org>
Commit-Queue: Ramin Halavati <rhalavati@chromium.org>
Auto-Submit: Thomas Tangl <tangltom@chromium.org>
Reviewed-by: default avatarRamin Halavati <rhalavati@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709456}
parent f7bcc2ea
...@@ -54,7 +54,7 @@ constexpr int kMenuWidth = 288; ...@@ -54,7 +54,7 @@ constexpr int kMenuWidth = 288;
constexpr int kIconSize = 16; constexpr int kIconSize = 16;
constexpr int kIdentityImageSize = 64; constexpr int kIdentityImageSize = 64;
constexpr int kMaxImageSize = kIdentityImageSize; constexpr int kMaxImageSize = kIdentityImageSize;
constexpr int kDefaultVerticalMargin = 12; constexpr int kDefaultVerticalMargin = 8;
// If the bubble is too large to fit on the screen, it still needs to be at // If the bubble is too large to fit on the screen, it still needs to be at
// least this tall to show one row. // least this tall to show one row.
...@@ -278,7 +278,7 @@ void ProfileMenuViewBase::SetIdentityInfo(const gfx::ImageSkia& image, ...@@ -278,7 +278,7 @@ void ProfileMenuViewBase::SetIdentityInfo(const gfx::ImageSkia& image,
constexpr int kTopMargin = kMenuEdgeMargin; constexpr int kTopMargin = kMenuEdgeMargin;
constexpr int kBottomMargin = kDefaultVerticalMargin; constexpr int kBottomMargin = kDefaultVerticalMargin;
constexpr int kHorizontalMargin = kMenuEdgeMargin; constexpr int kHorizontalMargin = kMenuEdgeMargin;
constexpr int kImageBottomMargin = 8; constexpr int kImageBottomMargin = kDefaultVerticalMargin;
constexpr int kBadgeSize = 16; constexpr int kBadgeSize = 16;
constexpr int kBadgePadding = 1; constexpr int kBadgePadding = 1;
const SkColor kBadgeBackgroundColor = GetNativeTheme()->GetSystemColor( const SkColor kBadgeBackgroundColor = GetNativeTheme()->GetSystemColor(
...@@ -332,14 +332,14 @@ void ProfileMenuViewBase::SetSyncInfo(const gfx::ImageSkia& icon, ...@@ -332,14 +332,14 @@ void ProfileMenuViewBase::SetSyncInfo(const gfx::ImageSkia& icon,
const int kDescriptionIconSpacing = const int kDescriptionIconSpacing =
ChromeLayoutProvider::Get()->GetDistanceMetric( ChromeLayoutProvider::Get()->GetDistanceMetric(
views::DISTANCE_RELATED_LABEL_HORIZONTAL); views::DISTANCE_RELATED_LABEL_HORIZONTAL);
constexpr int kInsidePadding = 12;
constexpr int kBorderThickness = 1; constexpr int kBorderThickness = 1;
const int kBorderCornerRadius = const int kBorderCornerRadius =
views::LayoutProvider::Get()->GetCornerRadiusMetric(views::EMPHASIS_HIGH); views::LayoutProvider::Get()->GetCornerRadiusMetric(views::EMPHASIS_HIGH);
sync_info_container_->RemoveAllChildViews(/*delete_children=*/true); sync_info_container_->RemoveAllChildViews(/*delete_children=*/true);
sync_info_container_->SetLayoutManager(std::make_unique<views::BoxLayout>( sync_info_container_->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical, gfx::Insets(), views::BoxLayout::Orientation::kVertical, gfx::Insets(), kInsidePadding));
kDefaultVerticalMargin));
if (description.empty()) { if (description.empty()) {
views::Button* button = views::Button* button =
...@@ -353,7 +353,7 @@ void ProfileMenuViewBase::SetSyncInfo(const gfx::ImageSkia& icon, ...@@ -353,7 +353,7 @@ void ProfileMenuViewBase::SetSyncInfo(const gfx::ImageSkia& icon,
sync_info_container_->SetBorder(views::CreatePaddedBorder( sync_info_container_->SetBorder(views::CreatePaddedBorder(
views::CreateRoundedRectBorder(kBorderThickness, kBorderCornerRadius, views::CreateRoundedRectBorder(kBorderThickness, kBorderCornerRadius,
GetDefaultSeparatorColor()), GetDefaultSeparatorColor()),
/*padding=*/gfx::Insets(kDefaultVerticalMargin, kMenuEdgeMargin))); gfx::Insets(kInsidePadding)));
sync_info_container_->SetProperty( sync_info_container_->SetProperty(
views::kMarginsKey, gfx::Insets(kDefaultVerticalMargin, kMenuEdgeMargin)); views::kMarginsKey, gfx::Insets(kDefaultVerticalMargin, kMenuEdgeMargin));
...@@ -397,15 +397,17 @@ void ProfileMenuViewBase::AddShortcutFeatureButton( ...@@ -397,15 +397,17 @@ void ProfileMenuViewBase::AddShortcutFeatureButton(
const gfx::ImageSkia& icon, const gfx::ImageSkia& icon,
const base::string16& text, const base::string16& text,
base::RepeatingClosure action) { base::RepeatingClosure action) {
constexpr int kBottomMargin = 8; const int kButtonSpacing = ChromeLayoutProvider::Get()->GetDistanceMetric(
constexpr int kButtonSpacing = 6; views::DISTANCE_RELATED_BUTTON_HORIZONTAL);
// Initialize layout if this is the first time a button is added. // Initialize layout if this is the first time a button is added.
if (!shortcut_features_container_->GetLayoutManager()) { if (!shortcut_features_container_->GetLayoutManager()) {
views::BoxLayout* layout = shortcut_features_container_->SetLayoutManager( views::BoxLayout* layout = shortcut_features_container_->SetLayoutManager(
std::make_unique<views::BoxLayout>( std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kHorizontal, views::BoxLayout::Orientation::kHorizontal,
gfx::Insets(0, 0, kBottomMargin, 0), kButtonSpacing)); gfx::Insets(/*top=*/kDefaultVerticalMargin / 2, 0,
/*bottom=*/kMenuEdgeMargin, 0),
kButtonSpacing));
layout->set_main_axis_alignment( layout->set_main_axis_alignment(
views::BoxLayout::MainAxisAlignment::kCenter); views::BoxLayout::MainAxisAlignment::kCenter);
} }
...@@ -437,15 +439,13 @@ void ProfileMenuViewBase::AddFeatureButton(const gfx::ImageSkia& icon, ...@@ -437,15 +439,13 @@ void ProfileMenuViewBase::AddFeatureButton(const gfx::ImageSkia& icon,
void ProfileMenuViewBase::SetProfileManagementHeading( void ProfileMenuViewBase::SetProfileManagementHeading(
const base::string16& heading) { const base::string16& heading) {
constexpr int kSeparatorMargins = 4;
// Add separator before heading. // Add separator before heading.
profile_mgmt_separator_container_->RemoveAllChildViews( profile_mgmt_separator_container_->RemoveAllChildViews(
/*delete_children=*/true); /*delete_children=*/true);
profile_mgmt_separator_container_->SetLayoutManager( profile_mgmt_separator_container_->SetLayoutManager(
std::make_unique<views::FillLayout>()); std::make_unique<views::FillLayout>());
profile_mgmt_separator_container_->SetBorder(views::CreateEmptyBorder( profile_mgmt_separator_container_->SetBorder(views::CreateEmptyBorder(
gfx::Insets(kSeparatorMargins, /*horizontal=*/0))); gfx::Insets(kDefaultVerticalMargin, /*horizontal=*/0)));
profile_mgmt_separator_container_->AddChildView( profile_mgmt_separator_container_->AddChildView(
std::make_unique<views::Separator>()); std::make_unique<views::Separator>());
......
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