Commit d8c0e2d7 authored by azurewei's avatar azurewei Committed by Commit bot

Update the layout of opt-in IME menu:

1) Make the menu panel have a width of 352px, same as the system menu.
2) Move up title row label 5px.

BUG=663199
TEST=Verified on local build.

Review-Url: https://codereview.chromium.org/2540103003
Cr-Commit-Position: refs/heads/master@{#435545}
parent f1a0d5d8
......@@ -114,8 +114,8 @@ class ImeTitleView : public views::View, public views::ButtonListener {
SetLayoutManager(box_layout);
title_label_ =
new views::Label(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_IME));
title_label_->SetBorder(
views::CreateEmptyBorder(0, kMenuEdgeEffectivePadding, 0, 0));
title_label_->SetBorder(views::CreateEmptyBorder(
0, kMenuEdgeEffectivePadding, kTrayMenuBottomRowPadding, 0));
title_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
AddChildView(title_label_);
box_layout->SetFlexForView(title_label_, 1);
......@@ -324,9 +324,12 @@ ImeMenuTray::~ImeMenuTray() {
}
void ImeMenuTray::ShowImeMenuBubble() {
int minimum_menu_width = MaterialDesignController::IsSystemTrayMenuMaterial()
? kTrayMenuMinimumWidthMd
: kTrayMenuMinimumWidth;
should_block_shelf_auto_hide_ = true;
views::TrayBubbleView::InitParams init_params(
GetAnchorAlignment(), kTrayPopupMinWidth, kTrayPopupMaxWidth);
GetAnchorAlignment(), minimum_menu_width, minimum_menu_width);
init_params.can_activate = true;
init_params.close_on_deactivate = true;
......@@ -357,10 +360,10 @@ void ImeMenuTray::ShowImeMenuBubble() {
height_range.end());
} else if (current_height > height_range.end()) {
ime_list_view_->scroller()->SetFixedSize(
gfx::Size(kTrayPopupMaxWidth, height_range.end()));
gfx::Size(minimum_menu_width, height_range.end()));
} else if (current_height < height_range.start()) {
ime_list_view_->scroller()->SetFixedSize(
gfx::Size(kTrayPopupMaxWidth, height_range.start()));
gfx::Size(minimum_menu_width, height_range.start()));
}
bubble_view->AddChildView(ime_list_view_);
......
......@@ -116,10 +116,6 @@ class PaddingTrayItem : public SystemTrayItem {
} // namespace
// The minimum width of the system tray menu.
const int kMinimumSystemTrayMenuWidth = 300;
const int kMinimumSystemTrayMenuWidthMd = 352;
// Class to initialize and manage the SystemTrayBubble and TrayBubbleWrapper
// instances for a bubble.
......@@ -578,11 +574,11 @@ void SystemTray::ShowItems(const std::vector<SystemTrayItem*>& items,
full_system_tray_menu_ = items.size() > 1;
// The menu width is fixed for all languages in material design.
int menu_width = kMinimumSystemTrayMenuWidthMd;
int menu_width = kTrayMenuMinimumWidthMd;
if (!MaterialDesignController::IsSystemTrayMenuMaterial()) {
// The menu width is fixed, and it is a per language setting.
menu_width = std::max(
kMinimumSystemTrayMenuWidth,
kTrayMenuMinimumWidth,
WmShell::Get()->system_tray_delegate()->GetSystemTrayMenuWidth());
}
......
......@@ -38,6 +38,8 @@ const int kTrayLabelItemVerticalPaddingVerticalAlignment = 4;
const int kTrayMenuBottomRowPadding = 5;
const int kTrayMenuBottomRowPaddingBetweenItems = -1;
const int kTrayMenuMinimumWidth = 300;
const int kTrayMenuMinimumWidthMd = 352;
const int kTrayPopupAutoCloseDelayInSeconds = 2;
const int kTrayPopupAutoCloseDelayForTextInSeconds = 5;
......
......@@ -34,6 +34,10 @@ extern const int kTrayLabelItemVerticalPaddingVerticalAlignment;
extern const int kTrayMenuBottomRowPadding;
extern const int kTrayMenuBottomRowPaddingBetweenItems;
// The minimum width of the tray menu.
extern const int kTrayMenuMinimumWidth;
extern const int kTrayMenuMinimumWidthMd;
extern const int kTrayPopupAutoCloseDelayInSeconds;
extern const int kTrayPopupAutoCloseDelayForTextInSeconds;
extern const int kTrayPopupPaddingHorizontal;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment