0

[SharedTabGroups] Increase left inset of share icon in TabGroupHeader

Increases the padding before the tab group header icon from 2px to 6px.

With this change all cases should have the same insets all around. For
this reason, we remove the boolean parameter from
TabGroupStyle::GetInsetsForHeaderChip.

Also updates the header width calculations to include the 2 pixel padding between the attention indicator and title text / share icon.

Change-Id: I8ebeed3a6f7b19d1159a10e5e692c1acc975e2a2
Bug: 398220761
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6293465
Reviewed-by: Mickey Burks <mickeyburks@chromium.org>
Commit-Queue: Darryl James <dljames@chromium.org>
Reviewed-by: David Pennington <dpenning@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1423476}
This commit is contained in:
dljames
2025-02-21 16:15:50 -08:00
committed by Chromium LUCI CQ
parent 7529d68d0c
commit 11511736e0
3 changed files with 12 additions and 16 deletions

@ -572,7 +572,7 @@ void TabGroupHeader::CreateHeaderWithoutTitle() {
const bool should_show_attention_indicator = GetShowingAttentionIndicator();
if (should_show_attention_indicator) {
const gfx::Insets title_chip_insets =
group_style_->GetInsetsForHeaderChip(should_show_header_icon_);
group_style_->GetInsetsForHeaderChip();
const int title_chip_vertical_inset = 0;
gfx::Rect title_chip_bounds = group_style_->GetEmptyTitleChipBounds(this);
const int attention_indicator_width =
@ -580,8 +580,9 @@ void TabGroupHeader::CreateHeaderWithoutTitle() {
should_show_attention_indicator);
// The total width of the title chip includes the horizontal
// insets, the sync icon, and the attention indicator.
title_chip_bounds.set_width(sync_icon_width + attention_indicator_width +
// insets, the sync icon, and the attention indicator + its padding.
title_chip_bounds.set_width(sync_icon_width + kSyncIconPaddingFromLabel +
attention_indicator_width +
title_chip_insets.width());
title_chip_->SetBoundsRect(title_chip_bounds);
@ -635,11 +636,10 @@ void TabGroupHeader::CreateHeaderWithTitle() {
title_->GetPreferredSize(views::SizeBounds(title_->width(), {})).height();
// Width of title chip should at least be the width of an empty title chip.
const int total_content_width = sync_icon_width +
padding_between_label_sync_icon + text_width +
attention_indicator_width;
const gfx::Insets title_chip_insets =
group_style_->GetInsetsForHeaderChip(should_show_header_icon_);
const int total_content_width =
sync_icon_width + padding_between_label_sync_icon + text_width +
kSyncIconPaddingFromLabel + attention_indicator_width;
const gfx::Insets title_chip_insets = group_style_->GetInsetsForHeaderChip();
const int title_chip_width =
std::max(group_style_->GetEmptyTitleChipBounds(this).width(),
total_content_width + title_chip_insets.width());

@ -31,7 +31,6 @@ constexpr int kSyncIconWidth = 16;
constexpr int kAttentionIndicatorWidth = 8;
// The size of the empty chip.
constexpr int kEmptyChipSize = 20;
constexpr int kSyncIconLeftMargin = 2;
constexpr int kCornerRadius = 6;
constexpr int kTabGroupOverlapAdjustment = 2;
@ -100,12 +99,9 @@ std::unique_ptr<views::Background> TabGroupStyle::GetEmptyTitleChipBackground(
return views::CreateRoundedRectBackground(color, GetChipCornerRadius());
}
gfx::Insets TabGroupStyle::GetInsetsForHeaderChip(
bool should_show_sync_icon) const {
return gfx::Insets::TLBR(
kHeaderChipVerticalInset,
should_show_sync_icon ? kSyncIconLeftMargin : GetChipCornerRadius(),
kHeaderChipVerticalInset, GetChipCornerRadius());
gfx::Insets TabGroupStyle::GetInsetsForHeaderChip() const {
return gfx::Insets::TLBR(kHeaderChipVerticalInset, GetChipCornerRadius(),
kHeaderChipVerticalInset, GetChipCornerRadius());
}
int TabGroupStyle::GetHighlightPathGeneratorCornerRadius(

@ -48,7 +48,7 @@ class TabGroupStyle {
const views::View* title) const;
// Returns the insets for a header chip that has text.
virtual gfx::Insets GetInsetsForHeaderChip(bool should_show_sync_icon) const;
virtual gfx::Insets GetInsetsForHeaderChip() const;
// While calculating desired width of a tab group an adjustment value is added
// for the distance between the tab group header and the right tab.