| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/common/system/status_area_widget_delegate.h" | 5 #include "ash/common/system/status_area_widget_delegate.h" |
| 6 | 6 |
| 7 #include "ash/ash_export.h" | 7 #include "ash/ash_export.h" |
| 8 #include "ash/common/focus_cycler.h" | 8 #include "ash/common/focus_cycler.h" |
| 9 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
| 10 #include "ash/common/shelf/shelf_constants.h" | 10 #include "ash/common/shelf/shelf_constants.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 views::View* child = child_at(c); | 139 views::View* child = child_at(c); |
| 140 if (!child->visible()) | 140 if (!child->visible()) |
| 141 continue; | 141 continue; |
| 142 SetBorderOnChild(child, is_child_on_edge); | 142 SetBorderOnChild(child, is_child_on_edge); |
| 143 is_child_on_edge = false; | 143 is_child_on_edge = false; |
| 144 } | 144 } |
| 145 | 145 |
| 146 views::ColumnSet* columns = layout->AddColumnSet(0); | 146 views::ColumnSet* columns = layout->AddColumnSet(0); |
| 147 | 147 |
| 148 if (IsHorizontalAlignment(alignment_)) { | 148 if (IsHorizontalAlignment(alignment_)) { |
| 149 bool is_first_visible_child = true; | |
| 150 for (int c = child_count() - 1; c >= 0; --c) { | 149 for (int c = child_count() - 1; c >= 0; --c) { |
| 151 views::View* child = child_at(c); | 150 views::View* child = child_at(c); |
| 152 if (!child->visible()) | 151 if (!child->visible()) |
| 153 continue; | 152 continue; |
| 154 if (!is_first_visible_child) | |
| 155 columns->AddPaddingColumn(0, GetTrayConstant(TRAY_SPACING)); | |
| 156 is_first_visible_child = false; | |
| 157 columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, | 153 columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, |
| 158 0, /* resize percent */ | 154 0, /* resize percent */ |
| 159 views::GridLayout::USE_PREF, 0, 0); | 155 views::GridLayout::USE_PREF, 0, 0); |
| 160 } | 156 } |
| 161 layout->StartRow(0, 0); | 157 layout->StartRow(0, 0); |
| 162 for (int c = child_count() - 1; c >= 0; --c) { | 158 for (int c = child_count() - 1; c >= 0; --c) { |
| 163 views::View* child = child_at(c); | 159 views::View* child = child_at(c); |
| 164 if (child->visible()) | 160 if (child->visible()) |
| 165 layout->AddView(child); | 161 layout->AddView(child); |
| 166 } | 162 } |
| 167 } else { | 163 } else { |
| 168 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, | 164 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, |
| 169 0, /* resize percent */ | 165 0, /* resize percent */ |
| 170 views::GridLayout::USE_PREF, 0, 0); | 166 views::GridLayout::USE_PREF, 0, 0); |
| 171 bool is_first_visible_child = true; | |
| 172 for (int c = child_count() - 1; c >= 0; --c) { | 167 for (int c = child_count() - 1; c >= 0; --c) { |
| 173 views::View* child = child_at(c); | 168 views::View* child = child_at(c); |
| 174 if (!child->visible()) | 169 if (!child->visible()) |
| 175 continue; | 170 continue; |
| 176 if (!is_first_visible_child) | |
| 177 layout->AddPaddingRow(0, GetTrayConstant(TRAY_SPACING)); | |
| 178 is_first_visible_child = false; | |
| 179 layout->StartRow(0, 0); | 171 layout->StartRow(0, 0); |
| 180 layout->AddView(child); | 172 layout->AddView(child); |
| 181 } | 173 } |
| 182 } | 174 } |
| 183 | 175 |
| 184 layer()->GetAnimator()->StopAnimating(); | 176 layer()->GetAnimator()->StopAnimating(); |
| 185 StatusAreaWidgetDelegateAnimationSettings settings(layer()); | 177 StatusAreaWidgetDelegateAnimationSettings settings(layer()); |
| 186 | 178 |
| 187 Layout(); | 179 Layout(); |
| 188 UpdateWidgetSize(); | 180 UpdateWidgetSize(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 } | 240 } |
| 249 child->SetBorder( | 241 child->SetBorder( |
| 250 views::CreateEmptyBorder(top_edge, left_edge, bottom_edge, right_edge)); | 242 views::CreateEmptyBorder(top_edge, left_edge, bottom_edge, right_edge)); |
| 251 // Layout on |child| needs to be updated based on new border value before | 243 // Layout on |child| needs to be updated based on new border value before |
| 252 // displaying; otherwise |child| will be showing with old border size. | 244 // displaying; otherwise |child| will be showing with old border size. |
| 253 // Fix for crbug.com/623438. | 245 // Fix for crbug.com/623438. |
| 254 child->Layout(); | 246 child->Layout(); |
| 255 } | 247 } |
| 256 | 248 |
| 257 } // namespace ash | 249 } // namespace ash |
| OLD | NEW |