| Index: ash/system/status_area_widget_delegate.cc
|
| diff --git a/ash/system/status_area_widget_delegate.cc b/ash/system/status_area_widget_delegate.cc
|
| index f4a7b5ab79d080ef2e53a2454074f56ccf7b8d59..92a8c71730c30bc8a3c6cc580fa590463a4c49b1 100644
|
| --- a/ash/system/status_area_widget_delegate.cc
|
| +++ b/ash/system/status_area_widget_delegate.cc
|
| @@ -83,25 +83,38 @@ void StatusAreaWidgetDelegate::UpdateLayout() {
|
| views::ColumnSet* columns = layout->AddColumnSet(0);
|
| if (alignment_ == SHELF_ALIGNMENT_BOTTOM ||
|
| alignment_ == SHELF_ALIGNMENT_TOP) {
|
| + bool is_first_visible_child = true;
|
| for (int c = 0; c < child_count(); ++c) {
|
| - if (c != 0)
|
| + views::View* child = child_at(c);
|
| + if (!child->visible())
|
| + continue;
|
| + if (!is_first_visible_child)
|
| columns->AddPaddingColumn(0, kTraySpacing);
|
| + is_first_visible_child = false;
|
| columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL,
|
| 0, /* resize percent */
|
| views::GridLayout::USE_PREF, 0, 0);
|
| }
|
| layout->StartRow(0, 0);
|
| - for (int c = child_count() - 1; c >= 0; --c)
|
| - layout->AddView(child_at(c));
|
| + for (int c = child_count() - 1; c >= 0; --c) {
|
| + views::View* child = child_at(c);
|
| + if (child->visible())
|
| + layout->AddView(child);
|
| + }
|
| } else {
|
| columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER,
|
| 0, /* resize percent */
|
| views::GridLayout::USE_PREF, 0, 0);
|
| + bool is_first_visible_child = true;
|
| for (int c = child_count() - 1; c >= 0; --c) {
|
| - if (c != child_count() - 1)
|
| + views::View* child = child_at(c);
|
| + if (!child->visible())
|
| + continue;
|
| + if (!is_first_visible_child)
|
| layout->AddPaddingRow(0, kTraySpacing);
|
| + is_first_visible_child = false;
|
| layout->StartRow(0, 0);
|
| - layout->AddView(child_at(c));
|
| + layout->AddView(child);
|
| }
|
| }
|
| Layout();
|
| @@ -113,6 +126,10 @@ void StatusAreaWidgetDelegate::ChildPreferredSizeChanged(View* child) {
|
| UpdateWidgetSize();
|
| }
|
|
|
| +void StatusAreaWidgetDelegate::ChildVisibilityChanged(View* child) {
|
| + UpdateLayout();
|
| +}
|
| +
|
| void StatusAreaWidgetDelegate::UpdateWidgetSize() {
|
| if (GetWidget())
|
| GetWidget()->SetSize(GetPreferredSize());
|
|
|