Chromium Code Reviews| 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(); |