Index: ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc |
diff --git a/ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc b/ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc |
index b32dd66b9ef361932a5929f640a23fe6ec674e20..63ebe435b04104dce8af24de793c58dfb511af6a 100644 |
--- a/ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc |
+++ b/ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc |
@@ -63,18 +63,22 @@ void VirtualKeyboardTray::SetShelfAlignment(ShelfAlignment alignment) { |
// Pad button size to align with other controls in the system tray. |
const gfx::ImageSkia image = |
button_->GetImage(views::CustomButton::STATE_NORMAL); |
- int top_padding = (kTrayBarButtonWidth - image.height()) / 2; |
- int left_padding = (kTrayBarButtonWidth - image.width()) / 2; |
- int bottom_padding = kTrayBarButtonWidth - image.height() - top_padding; |
- int right_padding = kTrayBarButtonWidth - image.width() - left_padding; |
- |
- // Square up the padding if horizontally aligned. Avoid extra padding when |
- // vertically aligned as the button would violate the width constraint on the |
- // shelf. |
- if (IsHorizontalAlignment(alignment)) { |
- int additional_padding = std::max(0, top_padding - left_padding); |
- left_padding += additional_padding; |
- right_padding += additional_padding; |
+ const int size = GetTrayConstant(VIRTUAL_KEYBOARD_BUTTON_SIZE); |
+ |
+ const int top_padding = (size - image.height()) / 2; |
+ int left_padding = (size - image.width()) / 2; |
+ const int bottom_padding = size - image.height() - top_padding; |
yiyix
2016/06/27 18:39:43
size - image.height() - top_padding = (size - imag
tdanderson
2016/06/27 21:29:42
Thanks for the suggestion - I can actually do one
|
+ int right_padding = size - image.width() - left_padding; |
+ |
+ if (!ash::MaterialDesignController::IsShelfMaterial()) { |
+ // Square up the padding if horizontally aligned. Avoid extra padding when |
+ // vertically aligned as the button would violate the width constraint on |
+ // the shelf. |
+ if (IsHorizontalAlignment(alignment)) { |
+ int additional_padding = std::max(0, top_padding - left_padding); |
+ left_padding += additional_padding; |
+ right_padding += additional_padding; |
+ } |
} |
button_->SetBorder(views::Border::CreateEmptyBorder( |