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

Unified Diff: ash/shelf/overflow_button.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: Merge 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/shelf/overflow_button.cc
diff --git a/ash/shelf/overflow_button.cc b/ash/shelf/overflow_button.cc
index 41e1317468dcf01e7ab3cfd4d3a78abb90ec164c..913ac1fff25feb66ce589d063e6ab600f3fe7dc6 100644
--- a/ash/shelf/overflow_button.cc
+++ b/ash/shelf/overflow_button.cc
@@ -8,6 +8,7 @@
#include "ash/ash_switches.h"
#include "ash/common/material_design/material_design_controller.h"
#include "ash/common/shelf/shelf_constants.h"
+#include "ash/common/system/tray/tray_constants.h"
#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shelf/shelf_widget.h"
@@ -127,29 +128,38 @@ int OverflowButton::NonMaterialBackgroundImageId() {
gfx::Rect OverflowButton::CalculateButtonBounds() {
ShelfAlignment alignment = shelf_->alignment();
gfx::Rect bounds(GetContentsBounds());
- if (!MaterialDesignController::IsShelfMaterial()) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ if (MaterialDesignController::IsShelfMaterial()) {
+ if (shelf_->IsHorizontalAlignment()) {
+ bounds = gfx::Rect((bounds.x() + (bounds.width() - kShelfItemSizeMD) / 2),
+ bounds.y() + (bounds.height() - kShelfItemSizeMD) / 2,
+ kShelfItemSizeMD, kShelfItemSizeMD);
+ } else {
+ bounds =
+ gfx::Rect(bounds.x() + ((bounds.height() - kShelfItemSizeMD) / 2),
+ bounds.y() + (bounds.width() - kShelfItemSizeMD) / 2,
+ kShelfItemSizeMD, kShelfItemSizeMD);
+ }
+ } else {
const gfx::ImageSkia* background =
rb.GetImageNamed(NonMaterialBackgroundImageId()).ToImageSkia();
if (alignment == SHELF_ALIGNMENT_LEFT) {
- bounds = gfx::Rect(
- bounds.right() - background->width() -
- ShelfLayoutManager::kShelfItemInset,
- bounds.y() + (bounds.height() - background->height()) / 2,
- background->width(), background->height());
+ bounds =
+ gfx::Rect(bounds.right() - background->width() - kShelfItemSizeMD,
tdanderson 2016/06/10 22:54:43 Is this a typo (lines 148, 153, and 159)? You're i
yiyix 2016/06/13 18:43:54 It is a typo. Sorry.
+ bounds.y() + (bounds.height() - background->height()) / 2,
+ background->width(), background->height());
} else if (alignment == SHELF_ALIGNMENT_RIGHT) {
- bounds = gfx::Rect(
- bounds.x() + ShelfLayoutManager::kShelfItemInset,
- bounds.y() + (bounds.height() - background->height()) / 2,
- background->width(), background->height());
+ bounds =
+ gfx::Rect(bounds.x() + kShelfItemSizeMD,
+ bounds.y() + (bounds.height() - background->height()) / 2,
+ background->width(), background->height());
} else {
- bounds = gfx::Rect(
- bounds.x() + (bounds.width() - background->width()) / 2,
- bounds.y() + ShelfLayoutManager::kShelfItemInset,
- background->width(), background->height());
+ bounds =
+ gfx::Rect(bounds.x() + (bounds.width() - background->width()) / 2,
+ bounds.y() + kShelfItemSizeMD, background->width(),
+ background->height());
}
}
-
return bounds;
}

Powered by Google App Engine
This is Rietveld 408576698