Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: ash/system/status_area_widget_delegate.cc

Issue 1998933002: Update shelf spacing in Chrome OS according to the MD specs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments & Refactor border around item implementation Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 322e68dea4c9d20860b2db655afdf1a82b32a7a6..9bc289b37c6cd17fbfab373dca0a4fef8e284cde 100644
--- a/ash/system/status_area_widget_delegate.cc
+++ b/ash/system/status_area_widget_delegate.cc
@@ -1,7 +1,6 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
tdanderson 2016/06/03 19:25:23 nit: replace this blank line
yiyix 2016/06/10 19:26:05 Done.
#include "ash/system/status_area_widget_delegate.h"
#include "ash/ash_export.h"
@@ -114,14 +113,20 @@ void StatusAreaWidgetDelegate::UpdateLayout() {
SetLayoutManager(layout);
views::ColumnSet* columns = layout->AddColumnSet(0);
+ bool is_first_visible_child = true;
bruthig 2016/06/03 20:18:17 I think keeping this variable in the tightest scop
yiyix 2016/06/10 19:26:04 Done.
if (wm::IsHorizontalAlignment(alignment_)) {
- bool is_first_visible_child = true;
- for (int c = 0; c < child_count(); ++c) {
+ for (int c = child_count() - 1; c >= 0; --c) {
views::View* child = child_at(c);
if (!child->visible())
continue;
- if (!is_first_visible_child)
- columns->AddPaddingColumn(0, kTraySpacing);
+ if (!is_first_visible_child) {
+ // If the overview Button is visible, then do not add the additional
bruthig 2016/06/03 20:18:17 I agree this needs a comment, but the 'why' is mor
yiyix 2016/06/10 19:26:05 I will add some explanation for the new approach t
+ // empty padding row to the left side to the overview button; otherwise,
+ // add the empty padding to separate items.
+ if (!((child_at(kOverviewButtonIndex)->visible()) &&
bruthig 2016/06/03 20:18:17 I think you have an set of extra brackets around '
yiyix 2016/06/10 19:26:05 You are right! I didn't notice it!
+ c == kOverviewButtonIndex))
+ columns->AddPaddingColumn(0, GetTrayConstant(TRAY_SPACING));
tdanderson 2016/06/03 19:25:23 nit: use {}
yiyix 2016/06/10 19:26:04 Done.
+ }
is_first_visible_child = false;
columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL,
0, /* resize percent */
@@ -133,6 +138,7 @@ void StatusAreaWidgetDelegate::UpdateLayout() {
if (child->visible())
layout->AddView(child);
}
+
tdanderson 2016/06/03 19:25:23 nit: remove blank line
yiyix 2016/06/10 19:26:04 Done.
} else {
columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER,
0, /* resize percent */
@@ -142,8 +148,11 @@ void StatusAreaWidgetDelegate::UpdateLayout() {
views::View* child = child_at(c);
if (!child->visible())
continue;
- if (!is_first_visible_child)
- layout->AddPaddingRow(0, kTraySpacing);
+ if (!is_first_visible_child) {
+ if (!((child_at(kOverviewButtonIndex)->visible()) &&
+ c == kOverviewButtonIndex))
+ layout->AddPaddingRow(0, GetTrayConstant(TRAY_SPACING));
tdanderson 2016/06/03 19:25:24 nit: use {} since the if + boolean condition takes
+ }
is_first_visible_child = false;
layout->StartRow(0, 0);
layout->AddView(child);

Powered by Google App Engine
This is Rietveld 408576698