Chromium Code Reviews| Index: ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc |
| diff --git a/ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc b/ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc |
| index 205af0425d2cad495d9095c1144ea94d2d697fff..20ff86cdbaf371caa91309fdc3b43b2053ec731c 100644 |
| --- a/ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc |
| +++ b/ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc |
| @@ -61,6 +61,20 @@ void VirtualKeyboardTray::SetShelfAlignment(ShelfAlignment alignment) { |
| if (alignment == shelf_alignment()) |
| return; |
| + if (!ash::MaterialDesignController::IsShelfMaterial() && |
| + IsHorizontalAlignment(alignment)) { |
| + // Pad button size to align with other controls in the system tray. |
| + const gfx::ImageSkia image = icon_->GetImage(); |
| + const int size = GetTrayConstant(VIRTUAL_KEYBOARD_BUTTON_SIZE); |
| + const int vertical_padding = (size - image.height()) / 2; |
| + int horizontal_padding = (size - image.width()) / 2; |
| + |
| + // Square up the padding if horizontally aligned. Avoid extra padding when |
| + // vertically aligned as the button would violate the width constraint on |
| + // the shelf. |
| + horizontal_padding += std::max(0, vertical_padding - horizontal_padding); |
|
James Cook
2016/08/11 20:36:54
horizontal_padding isn't used after this line
yiyix
2016/08/18 00:42:59
Sorry, I had these from merge, I did not check car
|
| + } |
| + |
| TrayBackgroundView::SetShelfAlignment(alignment); |
| SetIconBorderForShelfAlignment(); |
| } |
| @@ -98,10 +112,6 @@ void VirtualKeyboardTray::OnKeyboardBoundsChanging( |
| } |
| void VirtualKeyboardTray::SetIconBorderForShelfAlignment() { |
| - // Every time shelf alignment is updated, StatusAreaWidgetDelegate resets the |
| - // border to a non-null border. So, we need to remove it. |
| - tray_container()->SetBorder(views::Border::NullBorder()); |
|
James Cook
2016/08/11 20:36:54
Q: Are you sure this isn't needed anymore? I thoug
yiyix
2016/08/18 00:42:59
One of the change I made it to initialize the bord
|
| - |
| const gfx::ImageSkia& image = icon_->GetImage(); |
| const int size = GetTrayConstant(VIRTUAL_KEYBOARD_BUTTON_SIZE); |
| const int vertical_padding = (size - image.height()) / 2; |