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

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
« no previous file with comments | « ash/shelf/overflow_bubble_view.cc ('k') | ash/shelf/shelf_button.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/overflow_button.cc
diff --git a/ash/shelf/overflow_button.cc b/ash/shelf/overflow_button.cc
index a63f1f52a9ec33f805b1d4ab3aed68152e0e2854..965cf6f0ab569ddba0a28aaf0ec153a86b9427c8 100644
--- a/ash/shelf/overflow_button.cc
+++ b/ash/shelf/overflow_button.cc
@@ -8,6 +8,7 @@
#include "ash/common/ash_constants.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() - kShelfItemInset,
+ 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() + kShelfItemInset,
+ 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() + kShelfItemInset, background->width(),
+ background->height());
}
}
-
return bounds;
}
« no previous file with comments | « ash/shelf/overflow_bubble_view.cc ('k') | ash/shelf/shelf_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698