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

Unified Diff: ash/shelf/overflow_button.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: split shelf and tray constants 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_button.h ('k') | ash/system/chromeos/session/logout_button_tray.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 45130f723213c5343beea48cfee63971836ffb84..e51bfd2b3a45d72852ae1cf4d0b76100bbf4967c 100644
--- a/ash/shelf/overflow_button.cc
+++ b/ash/shelf/overflow_button.cc
@@ -8,7 +8,6 @@
#include "ash/common/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/ink_drop_button_listener.h"
#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_layout_manager.h"
@@ -81,18 +80,18 @@ void OverflowButton::PaintBackground(gfx::Canvas* canvas,
// TODO(bruthig|tdanderson): The background should be changed using a
// fade in/out animation.
- const int kCornerRadius = 2;
-
SkPaint background_paint;
background_paint.setFlags(SkPaint::kAntiAlias_Flag);
background_paint.setColor(background_color);
- canvas->DrawRoundRect(bounds, kCornerRadius, background_paint);
+ canvas->DrawRoundRect(bounds, kOverflowButtonCornerRadius,
+ background_paint);
if (shelf_->IsShowingOverflowBubble()) {
SkPaint highlight_paint;
highlight_paint.setFlags(SkPaint::kAntiAlias_Flag);
highlight_paint.setColor(kShelfButtonActivatedHighlightColor);
- canvas->DrawRoundRect(bounds, kCornerRadius, highlight_paint);
+ canvas->DrawRoundRect(bounds, kOverflowButtonCornerRadius,
+ highlight_paint);
}
} else {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
@@ -144,15 +143,14 @@ gfx::Rect OverflowButton::CalculateButtonBounds() {
gfx::Rect bounds(GetContentsBounds());
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
if (MaterialDesignController::IsShelfMaterial()) {
+ const int width_offset = (bounds.width() - kOverflowButtonSize) / 2;
+ const int height_offset = (bounds.height() - kOverflowButtonSize) / 2;
if (shelf_->IsHorizontalAlignment()) {
- bounds = gfx::Rect((bounds.x() + (bounds.width() - kShelfItemSizeMD) / 2),
- bounds.y() + (bounds.height() - kShelfItemSizeMD) / 2,
- kShelfItemSizeMD, kShelfItemSizeMD);
+ bounds = gfx::Rect(bounds.x() + width_offset, bounds.y() + height_offset,
+ kOverflowButtonSize, kOverflowButtonSize);
} else {
- bounds =
- gfx::Rect(bounds.x() + ((bounds.height() - kShelfItemSizeMD) / 2),
- bounds.y() + (bounds.width() - kShelfItemSizeMD) / 2,
- kShelfItemSizeMD, kShelfItemSizeMD);
+ bounds = gfx::Rect(bounds.x() + height_offset, bounds.y() + width_offset,
+ kOverflowButtonSize, kOverflowButtonSize);
}
} else {
const gfx::ImageSkia* background =
« no previous file with comments | « ash/shelf/overflow_button.h ('k') | ash/system/chromeos/session/logout_button_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698