Commit 1112e023 authored by Quan Nguyen's avatar Quan Nguyen Committed by Commit Bot

Move user menu back into the work area if it extends too far down.

Also shifts the user menu right in this case so that the dropdown arrow
remains visible.

Bug: 861791
Change-Id: I65b0be969c1f15936ce3b86df5bae4eb7c200ed6
Reviewed-on: https://chromium-review.googlesource.com/1129847Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Commit-Queue: Quan Nguyen <qnnguyen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573482}
parent 6582ce09
......@@ -320,6 +320,7 @@ class LoginUserMenuView : public LoginBaseBubbleView,
SetSize(GetPreferredSize());
SizeToContents();
Layout();
EnsureWidgetInWorkArea();
if (on_remove_user_warning_shown_)
std::move(on_remove_user_warning_shown_).Run();
return;
......@@ -333,6 +334,26 @@ class LoginUserMenuView : public LoginBaseBubbleView,
std::move(on_remove_user_requested_).Run();
}
void EnsureWidgetInWorkArea() {
const int view_bottom = GetBoundsInScreen().bottom();
const int work_area_bottom =
display::Screen::GetScreen()
->GetDisplayNearestWindow(GetWidget()->GetNativeWindow())
.work_area()
.bottom();
if (work_area_bottom >= view_bottom)
return;
// If the bubble extends into the shelf, move the bubble up so that the
// bottom edge just touches the top of the shelf. Also shift the bubble
// right so that the anchor (arrow) remains visible.
set_anchor_view_insets(anchor_view_insets().Offset(gfx::Vector2d(
GetAnchorView()->GetBoundsInScreen().right() - GetBoundsInScreen().x(),
work_area_bottom - view_bottom)));
OnAnchorBoundsChanged();
}
views::View* remove_user_button() { return remove_user_button_; }
views::View* remove_user_confirm_data() { return remove_user_confirm_data_; }
......
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