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

Unified Diff: ash/system/overview/overview_button_tray.cc

Issue 2099103002: Give Ash material design tray items the correct size and layout (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for review Created 4 years, 6 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/overview/overview_button_tray.cc
diff --git a/ash/system/overview/overview_button_tray.cc b/ash/system/overview/overview_button_tray.cc
index bca2dd7aede73b18c2f6e8109b9cf925bf97ccc0..6040e38bab5d0c03db6f705750b21e5b63d91aca 100644
--- a/ash/system/overview/overview_button_tray.cc
+++ b/ash/system/overview/overview_button_tray.cc
@@ -10,6 +10,7 @@
#include "ash/common/shelf/shelf_types.h"
#include "ash/common/shelf/wm_shelf_util.h"
#include "ash/common/system/tray/system_tray_delegate.h"
+#include "ash/common/system/tray/tray_constants.h"
#include "ash/common/system/tray/tray_utils.h"
#include "ash/common/wm/overview/window_selector_controller.h"
#include "ash/common/wm_shell.h"
@@ -116,14 +117,26 @@ void OverviewButtonTray::SetShelfAlignment(ShelfAlignment alignment) {
}
void OverviewButtonTray::SetIconBorderForShelfAlignment() {
- if (IsHorizontalAlignment(shelf_alignment())) {
+ if (ash::MaterialDesignController::IsShelfMaterial()) {
+ // Pad button size to align with other controls in the system tray.
+ const gfx::ImageSkia image = icon_->GetImage();
+ const int top_padding = (kTrayItemSize - image.height()) / 2;
+ const int left_padding = (kTrayItemSize - image.width()) / 2;
+ const int bottom_padding = kTrayItemSize - image.height() - top_padding;
+ const int right_padding = kTrayItemSize - image.width() - left_padding;
+
icon_->SetBorder(views::Border::CreateEmptyBorder(
- kHorizontalShelfVerticalPadding, kHorizontalShelfHorizontalPadding,
- kHorizontalShelfVerticalPadding, kHorizontalShelfHorizontalPadding));
+ top_padding, left_padding, bottom_padding, right_padding));
} else {
- icon_->SetBorder(views::Border::CreateEmptyBorder(
- kVerticalShelfVerticalPadding, kVerticalShelfHorizontalPadding,
- kVerticalShelfVerticalPadding, kVerticalShelfHorizontalPadding));
+ if (IsHorizontalAlignment(shelf_alignment())) {
+ icon_->SetBorder(views::Border::CreateEmptyBorder(
+ kHorizontalShelfVerticalPadding, kHorizontalShelfHorizontalPadding,
+ kHorizontalShelfVerticalPadding, kHorizontalShelfHorizontalPadding));
+ } else {
+ icon_->SetBorder(views::Border::CreateEmptyBorder(
+ kVerticalShelfVerticalPadding, kVerticalShelfHorizontalPadding,
+ kVerticalShelfVerticalPadding, kVerticalShelfHorizontalPadding));
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698