diff options
author | glevin <glevin@chromium.org> | 2015-02-02 12:49:54 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-02 20:51:45 +0000 |
commit | be66ae8726e1cc4f24cbab90095a107b790d1ea6 (patch) | |
tree | 8de02c1eff9731ac1f0ff2194e08e272ffd37f8e /ash/shelf/shelf_button.cc | |
parent | df23a283e29d290328ae37b248904a312127e8bd (diff) | |
download | chromium_src-be66ae8726e1cc4f24cbab90095a107b790d1ea6.zip chromium_src-be66ae8726e1cc4f24cbab90095a107b790d1ea6.tar.gz chromium_src-be66ae8726e1cc4f24cbab90095a107b790d1ea6.tar.bz2 |
Fix truncated shelf icons
BUG=336298
App icons on shelf are being truncated. The current code is trying to fit
icon + shadow in a space only big enough for the icon.
Review URL: https://codereview.chromium.org/885713006
Cr-Commit-Position: refs/heads/master@{#314185}
Diffstat (limited to 'ash/shelf/shelf_button.cc')
-rw-r--r-- | ash/shelf/shelf_button.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/ash/shelf/shelf_button.cc b/ash/shelf/shelf_button.cc index a070fe5..06c69d2 100644 --- a/ash/shelf/shelf_button.cc +++ b/ash/shelf/shelf_button.cc @@ -405,11 +405,16 @@ void ShelfButton::Layout() { icon_width = button_bounds.width() - (x_offset + kBarSize); } - icon_view_->SetBoundsRect(gfx::Rect( - button_bounds.x() + x_offset, - button_bounds.y() + y_offset, - icon_width, - icon_height)); + // Expand bounds to include shadows. + gfx::Insets insets_shadows = gfx::ShadowValue::GetMargin(icon_shadows_); + // Adjust offsets to center icon, not icon + shadow. + x_offset += (insets_shadows.left() - insets_shadows.right()) / 2; + y_offset += (insets_shadows.top() - insets_shadows.bottom()) / 2; + gfx::Rect icon_view_bounds = + gfx::Rect(button_bounds.x() + x_offset, button_bounds.y() + y_offset, + icon_width, icon_height); + icon_view_bounds.Inset(insets_shadows); + icon_view_->SetBoundsRect(icon_view_bounds); // Icon size has been incorrect when running // PanelLayoutManagerTest.PanelAlignmentSecondDisplay on valgrind bot, see |