Commit 65c31478 authored by Ahmed Mehfooz's avatar Ahmed Mehfooz Committed by Commit Bot

Add sizing changes for Refactored MessageCenter

We do not need any bottom inset for the separate message center bubble.
Also, need to clip scroller height based on clear all button visibility.

Bug: 958020
Change-Id: Ie4f0966f2de97f841cf975fcc7810c82761b2de2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1730091
Commit-Queue: Ahmed Mehfooz <amehfooz@chromium.org>
Reviewed-by: default avatarTim Song <tengs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683669}
parent 5a2d9b62
...@@ -51,9 +51,13 @@ class ScrollerContentsView : public views::View { ...@@ -51,9 +51,13 @@ class ScrollerContentsView : public views::View {
public: public:
ScrollerContentsView(UnifiedMessageListView* message_list_view, ScrollerContentsView(UnifiedMessageListView* message_list_view,
views::ButtonListener* listener) { views::ButtonListener* listener) {
int bottom_padding = features::IsUnifiedMessageCenterRefactorEnabled()
? 0
: kUnifiedNotificationCenterSpacing;
auto* contents_layout = SetLayoutManager(std::make_unique<views::BoxLayout>( auto* contents_layout = SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical, views::BoxLayout::Orientation::kVertical,
gfx::Insets(0, 0, kUnifiedNotificationCenterSpacing, 0))); gfx::Insets(0, 0, bottom_padding, 0)));
contents_layout->set_cross_axis_alignment( contents_layout->set_cross_axis_alignment(
views::BoxLayout::CrossAxisAlignment::kStretch); views::BoxLayout::CrossAxisAlignment::kStretch);
AddChildView(message_list_view); AddChildView(message_list_view);
...@@ -293,7 +297,10 @@ UnifiedMessageCenterView::~UnifiedMessageCenterView() { ...@@ -293,7 +297,10 @@ UnifiedMessageCenterView::~UnifiedMessageCenterView() {
} }
void UnifiedMessageCenterView::SetMaxHeight(int max_height) { void UnifiedMessageCenterView::SetMaxHeight(int max_height) {
scroller_->ClipHeightTo(0, max_height); int max_scroller_height = max_height;
if (stacking_counter_->GetVisible())
max_scroller_height -= kStackingNotificationCounterHeight;
scroller_->ClipHeightTo(0, max_scroller_height);
} }
void UnifiedMessageCenterView::SetAvailableHeight(int available_height) { void UnifiedMessageCenterView::SetAvailableHeight(int available_height) {
...@@ -313,6 +320,10 @@ void UnifiedMessageCenterView::OnNotificationSlidOut() { ...@@ -313,6 +320,10 @@ void UnifiedMessageCenterView::OnNotificationSlidOut() {
void UnifiedMessageCenterView::ListPreferredSizeChanged() { void UnifiedMessageCenterView::ListPreferredSizeChanged() {
UpdateVisibility(); UpdateVisibility();
PreferredSizeChanged(); PreferredSizeChanged();
if (features::IsUnifiedMessageCenterRefactorEnabled())
SetMaxHeight(available_height_);
Layout(); Layout();
if (GetWidget() && !GetWidget()->IsClosed()) if (GetWidget() && !GetWidget()->IsClosed())
......
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