Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Unified Diff: ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc

Issue 2147143002: [Chrome OS MD] Draw a 1px separator between 2 tray items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698