Commit 25663f25 authored by Manu Cornet's avatar Manu Cornet Committed by Commit Bot

CrOS systray: Remove some more unnecessary re-layout passes

The re-layout signals trickle down when things change in the shelf
config, there is no need for components to take care of observing those
changes themselves (and it triggers gratuitous layout calls).

Bug: 1042918, 1049355, 1044306
Change-Id: I9a5cff364723aae1887bb3b8fc52714e95ebd946
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2067814Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Manu Cornet <manucornet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743711}
parent 726663d5
......@@ -351,9 +351,6 @@ void Shelf::SetAlignment(ShelfAlignment alignment) {
ShelfAlignment old_alignment = alignment_;
alignment_ = alignment;
// Check added for http://crbug.com/738011.
CHECK(status_area_widget_);
status_area_widget()->UpdateAfterShelfAlignmentChange();
tooltip_->Close();
shelf_layout_manager_->LayoutShelf();
Shell::Get()->NotifyShelfAlignmentChanged(GetWindow()->GetRootWindow(),
......
......@@ -89,7 +89,6 @@ void StatusAreaWidget::Initialize() {
for (TrayBackgroundView* tray_button : tray_buttons_)
tray_button->Initialize();
UpdateAfterShelfAlignmentChange();
UpdateAfterLoginStatusChange(
Shell::Get()->session_controller()->login_status());
......@@ -107,12 +106,6 @@ StatusAreaWidget::~StatusAreaWidget() {
Shell::Get()->session_controller()->RemoveObserver(this);
}
void StatusAreaWidget::UpdateAfterShelfAlignmentChange() {
for (TrayBackgroundView* tray_button : tray_buttons_)
tray_button->UpdateAfterShelfChange();
status_area_widget_delegate_->UpdateLayout();
}
void StatusAreaWidget::UpdateAfterLoginStatusChange(LoginStatus login_status) {
if (login_status_ == login_status)
return;
......@@ -190,6 +183,10 @@ void StatusAreaWidget::UpdateLayout(bool animate) {
if (layout_inputs_ == new_layout_inputs)
return;
for (TrayBackgroundView* tray_button : tray_buttons_)
tray_button->UpdateAfterShelfChange();
status_area_widget_delegate_->UpdateLayout();
// Having a window which is visible but does not have an opacity is an
// illegal state.
if (new_layout_inputs.opacity)
......
......@@ -53,9 +53,6 @@ class ASH_EXPORT StatusAreaWidget : public SessionObserver,
// during construction.
void Initialize();
// Update the alignment of the widget and tray views.
void UpdateAfterShelfAlignmentChange();
// Called by the client when the login status changes. Caches login_status
// and calls UpdateAfterLoginStatusChange for the system tray and the web
// notification tray.
......
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