0

[Merge to M-135] ash: fix zero width FocusModeSoundsView header

FocusModeSoundsView's header becomes zero width due to a fix for
b/393133611 where IconLabelSliderButtons's preferred width is overridden
to zero. This CL fixes the header by stretching the header's children to
take full width.

(cherry picked from commit cc974d0295)

Bug: 402456595, 400028865
Change-Id: If52917dbb3fa7261593763db9bce4c7771bd6a21
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6354128
Commit-Queue: Keren Zhu <kerenzhu@chromium.org>
Reviewed-by: Richard Chui <richui@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1433726}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6369859
Commit-Queue: Richard Chui <richui@chromium.org>
Reviewed-by: Keren Zhu <kerenzhu@chromium.org>
Cr-Commit-Position: refs/branch-heads/7049@{#945}
Cr-Branched-From: 2dab7846d0951a552bdc4f350dad497f986e6fed-refs/heads/main@{#1427262}
This commit is contained in:
Keren Zhu
2025-03-18 14:53:09 -07:00
committed by Chromium LUCI CQ
parent 8ab8593273
commit 201a6ed85b

@ -48,7 +48,7 @@ namespace {
constexpr auto kDisconnectedContainerMargins = gfx::Insets::TLBR(8, 0, 0, 0);
constexpr auto kSoundViewBottomPadding = 22;
constexpr auto kSoundTabSliderInsets = gfx::Insets::VH(16, 0);
constexpr auto kSoundTabSliderInsets = gfx::Insets::VH(16, 24);
constexpr auto kFocusSoundsLabelInsets = gfx::Insets::VH(18, 24);
constexpr int kNonPremiumChildViewsSpacing = 16;
@ -408,6 +408,16 @@ void FocusModeSoundsView::CreateHeader(
auto* sounds_container_header =
AddChildView(std::make_unique<views::BoxLayoutView>());
// Stretch children views to take full width. This is needed because otherwise
// TabSlider's preferred width will become zero.
// TODO(crbug.com/400028865): this should be no longer needed once Label's
// preferred size respects its eliding mode.
sounds_container_header->SetOrientation(
views::BoxLayout::Orientation::kVertical);
sounds_container_header->SetCrossAxisAlignment(
views::BoxLayout::CrossAxisAlignment::kStretch);
sounds_container_header->SetInsideBorderInsets(
contains_youtube_music ? kSoundTabSliderInsets : kFocusSoundsLabelInsets);
sounds_container_header->SetMainAxisAlignment(