Chromium Code Reviews| Index: ash/shelf/overflow_button.cc |
| diff --git a/ash/shelf/overflow_button.cc b/ash/shelf/overflow_button.cc |
| index b1292771fb1467402e1b8578f00bb1f5b923088e..b6326ab143057791d86b9746f93e708768e1555f 100644 |
| --- a/ash/shelf/overflow_button.cc |
| +++ b/ash/shelf/overflow_button.cc |
| @@ -5,6 +5,7 @@ |
| #include "ash/shelf/overflow_button.h" |
| #include "ash/ash_switches.h" |
| +#include "ash/material_design/material_design_controller.h" |
| #include "ash/shelf/shelf.h" |
| #include "ash/shelf/shelf_layout_manager.h" |
| #include "ash/shelf/shelf_widget.h" |
| @@ -93,22 +94,37 @@ void OverflowButton::OnPaint(gfx::Canvas* canvas) { |
| const gfx::ImageSkia* background = |
| rb.GetImageNamed(background_image_id).ToImageSkia(); |
| wm::ShelfAlignment alignment = shelf_->alignment(); |
| - if (alignment == wm::SHELF_ALIGNMENT_LEFT) { |
| - bounds = gfx::Rect( |
| - bounds.right() - background->width() - |
| - ShelfLayoutManager::kShelfItemInset, |
| - bounds.y() + (bounds.height() - background->height()) / 2, |
| - background->width(), background->height()); |
| - } else if (alignment == wm::SHELF_ALIGNMENT_RIGHT) { |
| - bounds = gfx::Rect( |
| - bounds.x() + ShelfLayoutManager::kShelfItemInset, |
| - bounds.y() + (bounds.height() - background->height()) / 2, |
| - background->width(), background->height()); |
| + |
| + if (MaterialDesignController::IsShelfMaterial()) { |
| + // SHELF_ALIGNMENT_LEFT and SHELF_ALIGNMENT_RIGHT |
|
tdanderson
2016/06/03 19:25:23
Same comments as in AppListButton: remove comments
yiyix
2016/06/10 19:26:04
Done.
|
| + if (!shelf_->IsHorizontalAlignment()) { |
| + bounds = |
| + gfx::Rect(bounds.x() + ((bounds.width() - background->width()) / 2), |
| + bounds.y() + (bounds.height() - background->height()) / 2, |
| + background->width(), background->height()); |
| + } else { // SHELF_ALIGNMENT_BOTTOM |
| + bounds = |
| + gfx::Rect((bounds.x() + (bounds.width() - background->width()) / 2), |
| + 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()); |
| + if (alignment == wm::SHELF_ALIGNMENT_LEFT) { |
| + bounds = |
| + gfx::Rect(bounds.right() - background->width() - kShelfItemInset, |
| + bounds.y() + (bounds.height() - background->height()) / 2, |
| + background->width(), background->height()); |
| + } else if (alignment == wm::SHELF_ALIGNMENT_RIGHT) { |
| + 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() + kShelfItemInset, background->width(), |
| + background->height()); |
| + } |
| } |
| canvas->DrawImageInt(*background, bounds.x(), bounds.y()); |