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

Unified Diff: ash/common/shelf/overflow_button.cc

Issue 2579463002: Fix layout of launcher and overflow buttons in Ash MD shelf (Closed)
Patch Set: Created 4 years 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
« ash/common/shelf/app_list_button.cc ('K') | « ash/common/shelf/app_list_button.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/shelf/overflow_button.cc
diff --git a/ash/common/shelf/overflow_button.cc b/ash/common/shelf/overflow_button.cc
index 7d63c2e243f536984bf8490c320b031ef0393f76..4a0907813cf2240a71c1184b777aeb6d49d6a73e 100644
--- a/ash/common/shelf/overflow_button.cc
+++ b/ash/common/shelf/overflow_button.cc
@@ -174,15 +174,12 @@ gfx::Rect OverflowButton::CalculateButtonBounds() const {
gfx::Rect bounds(GetContentsBounds());
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
oshima 2016/12/14 21:28:41 unrelated, but you can move this to else block.
tdanderson 2016/12/14 21:45:07 Done.
if (MaterialDesignController::IsShelfMaterial()) {
oshima 2016/12/14 21:28:41 just add quick comment saying "align to the top"
tdanderson 2016/12/14 21:45:07 Done.
- const int width_offset = (bounds.width() - kOverflowButtonSize) / 2;
- const int height_offset = (bounds.height() - kOverflowButtonSize) / 2;
- if (IsHorizontalAlignment(alignment)) {
- bounds = gfx::Rect(bounds.x() + width_offset, bounds.y() + height_offset,
- kOverflowButtonSize, kOverflowButtonSize);
- } else {
- bounds = gfx::Rect(bounds.x() + height_offset, bounds.y() + width_offset,
- kOverflowButtonSize, kOverflowButtonSize);
- }
+ const int inset = (GetShelfConstant(SHELF_SIZE) - kOverflowButtonSize) / 2;
+ const int x = alignment == SHELF_ALIGNMENT_LEFT
+ ? bounds.right() - inset - kOverflowButtonSize
+ : bounds.x() + inset;
+ bounds = gfx::Rect(x, bounds.y() + inset, kOverflowButtonSize,
+ kOverflowButtonSize);
} else {
const gfx::ImageSkia* background =
rb.GetImageNamed(NonMaterialBackgroundImageId()).ToImageSkia();
« ash/common/shelf/app_list_button.cc ('K') | « ash/common/shelf/app_list_button.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698