Commit 9970df42 authored by Quan Nguyen's avatar Quan Nguyen Committed by Commit Bot

cros: Fix Japanese login dropdown going off screen

This caps the line height at 20 px so that the Japanese text
doesn't make the bubble too large. It also sets the bubble
parent container to MenuContainer so the remove-user button
is clickable if there is overlap with the shelf.

Bug: 917308
Change-Id: I9cfae49c6973c5fdf8fe20374fe17c7fbe60ecee
Reviewed-on: https://chromium-review.googlesource.com/c/1405494Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Commit-Queue: Quan Nguyen <qnnguyen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#622085}
parent 5b5845ee
...@@ -56,11 +56,11 @@ constexpr SkColor kRemoveUserConfirmColor = gfx::kGoogleRedDark500; ...@@ -56,11 +56,11 @@ constexpr SkColor kRemoveUserConfirmColor = gfx::kGoogleRedDark500;
// Margin/inset of the entries for the user menu. // Margin/inset of the entries for the user menu.
constexpr int kUserMenuMarginWidth = 14; constexpr int kUserMenuMarginWidth = 14;
constexpr int kUserMenuMarginHeight = 18; constexpr int kUserMenuMarginHeight = 16;
// Distance above/below the separator. // Distance above/below the separator.
constexpr int kUserMenuMarginAroundSeparatorDp = 18; constexpr int kUserMenuMarginAroundSeparatorDp = 16;
// Distance between labels. // Distance between labels.
constexpr int kUserMenuVerticalDistanceBetweenLabelsDp = 18; constexpr int kUserMenuVerticalDistanceBetweenLabelsDp = 16;
// Margin around remove user button. // Margin around remove user button.
constexpr int kUserMenuMarginAroundRemoveUserButtonDp = 4; constexpr int kUserMenuMarginAroundRemoveUserButtonDp = 4;
...@@ -70,9 +70,14 @@ constexpr int kAnchorViewUserMenuHorizontalSpacingDp = 98; ...@@ -70,9 +70,14 @@ constexpr int kAnchorViewUserMenuHorizontalSpacingDp = 98;
// Vertical spacing between the anchor view and user menu. // Vertical spacing between the anchor view and user menu.
constexpr int kAnchorViewUserMenuVerticalSpacingDp = 4; constexpr int kAnchorViewUserMenuVerticalSpacingDp = 4;
// Maximum height per label line, so that the user menu dropdown will fit in the
// screen.
constexpr int kUserMenuLabelLineHeight = 20;
views::Label* CreateLabel(const base::string16& message, SkColor color) { views::Label* CreateLabel(const base::string16& message, SkColor color) {
views::Label* label = new views::Label(message, views::style::CONTEXT_LABEL, views::Label* label = new views::Label(message, views::style::CONTEXT_LABEL,
views::style::STYLE_PRIMARY); views::style::STYLE_PRIMARY);
label->SetLineHeight(kUserMenuLabelLineHeight);
label->SetAutoColorReadabilityEnabled(false); label->SetAutoColorReadabilityEnabled(false);
label->SetHorizontalAlignment(gfx::ALIGN_LEFT); label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label->SetEnabledColor(color); label->SetEnabledColor(color);
...@@ -140,6 +145,8 @@ class LoginUserMenuView : public LoginBaseBubbleView, ...@@ -140,6 +145,8 @@ class LoginUserMenuView : public LoginBaseBubbleView,
bubble_opener_(bubble_opener_), bubble_opener_(bubble_opener_),
on_remove_user_warning_shown_(std::move(on_remove_user_warning_shown)), on_remove_user_warning_shown_(std::move(on_remove_user_warning_shown)),
on_remove_user_requested_(std::move(on_remove_user_requested)) { on_remove_user_requested_(std::move(on_remove_user_requested)) {
set_parent_window(Shell::GetContainer(
Shell::GetPrimaryRootWindow(), kShellWindowId_SettingBubbleContainer));
// This view has content the user can interact with if the remove user // This view has content the user can interact with if the remove user
// button is displayed. // button is displayed.
set_can_activate(show_remove_user); set_can_activate(show_remove_user);
......
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