Commit 29fa932b authored by Quan Nguyen's avatar Quan Nguyen Committed by Commit Bot

cros: Ensure login bubbles are clickable when overlapping with shelf and virtual keyboard

Bug: 884668
Change-Id: I16dd2c5b0156bf1490b57acd4185c1d80d193a67
Reviewed-on: https://chromium-review.googlesource.com/c/1330206Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Commit-Queue: Quan Nguyen <qnnguyen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607771}
parent ad21cca2
...@@ -26,6 +26,10 @@ constexpr int kBubbleBottomMarginDp = 18; ...@@ -26,6 +26,10 @@ constexpr int kBubbleBottomMarginDp = 18;
} // namespace } // namespace
LoginBaseBubbleView::LoginBaseBubbleView(views::View* anchor_view) LoginBaseBubbleView::LoginBaseBubbleView(views::View* anchor_view)
: LoginBaseBubbleView(anchor_view, nullptr) {}
LoginBaseBubbleView::LoginBaseBubbleView(views::View* anchor_view,
aura::Window* parent_window)
: BubbleDialogDelegateView(anchor_view, views::BubbleBorder::NONE) { : BubbleDialogDelegateView(anchor_view, views::BubbleBorder::NONE) {
set_margins(gfx::Insets(kBubbleTopMarginDp, kBubbleHorizontalMarginDp, set_margins(gfx::Insets(kBubbleTopMarginDp, kBubbleHorizontalMarginDp,
kBubbleBottomMarginDp, kBubbleHorizontalMarginDp)); kBubbleBottomMarginDp, kBubbleHorizontalMarginDp));
...@@ -36,6 +40,8 @@ LoginBaseBubbleView::LoginBaseBubbleView(views::View* anchor_view) ...@@ -36,6 +40,8 @@ LoginBaseBubbleView::LoginBaseBubbleView(views::View* anchor_view)
// Layer rendering is needed for animation. // Layer rendering is needed for animation.
SetPaintToLayer(); SetPaintToLayer();
layer()->SetFillsBoundsOpaquely(false); layer()->SetFillsBoundsOpaquely(false);
set_parent_window(parent_window);
} }
LoginBaseBubbleView::~LoginBaseBubbleView() = default; LoginBaseBubbleView::~LoginBaseBubbleView() = default;
...@@ -43,15 +49,13 @@ LoginBaseBubbleView::~LoginBaseBubbleView() = default; ...@@ -43,15 +49,13 @@ LoginBaseBubbleView::~LoginBaseBubbleView() = default;
void LoginBaseBubbleView::OnBeforeBubbleWidgetInit( void LoginBaseBubbleView::OnBeforeBubbleWidgetInit(
views::Widget::InitParams* params, views::Widget::InitParams* params,
views::Widget* widget) const { views::Widget* widget) const {
// Login bubbles must always be associated with the lock screen container, // This case only gets called if the bubble has no anchor and no parent
// otherwise they may not show up as other containers are hidden. // container was specified. In this case, the parent container should default
// // to MenuContainer, so that login bubbles are visible over the shelf and
// params->parent may be already set if the bubble has an anchor view. // virtual keyboard. Shell may be null in tests.
// Shell may be null in tests.
if (!params->parent && Shell::HasInstance()) { if (!params->parent && Shell::HasInstance()) {
params->parent = Shell::GetContainer(Shell::GetPrimaryRootWindow(), params->parent = Shell::GetContainer(Shell::GetPrimaryRootWindow(),
kShellWindowId_LockScreenContainer); kShellWindowId_MenuContainer);
} }
} }
......
...@@ -14,7 +14,11 @@ namespace ash { ...@@ -14,7 +14,11 @@ namespace ash {
// Base bubble view for login screen bubbles. // Base bubble view for login screen bubbles.
class ASH_EXPORT LoginBaseBubbleView : public views::BubbleDialogDelegateView { class ASH_EXPORT LoginBaseBubbleView : public views::BubbleDialogDelegateView {
public: public:
// Without specifying a parent_window, the bubble will default to being in the
// same container as anchor_view.
explicit LoginBaseBubbleView(views::View* anchor_view); explicit LoginBaseBubbleView(views::View* anchor_view);
explicit LoginBaseBubbleView(views::View* anchor_view,
gfx::NativeView parent_window);
~LoginBaseBubbleView() override; ~LoginBaseBubbleView() override;
// views::BubbleDialogDelegateView: // views::BubbleDialogDelegateView:
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "ash/login/ui/non_accessible_view.h" #include "ash/login/ui/non_accessible_view.h"
#include "ash/login/ui/views_utils.h" #include "ash/login/ui/views_utils.h"
#include "ash/public/cpp/ash_constants.h" #include "ash/public/cpp/ash_constants.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/resources/vector_icons/vector_icons.h" #include "ash/resources/vector_icons/vector_icons.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h" #include "ash/strings/grit/ash_strings.h"
...@@ -93,8 +94,10 @@ views::Label* CreateLabel(const base::string16& message, SkColor color) { ...@@ -93,8 +94,10 @@ views::Label* CreateLabel(const base::string16& message, SkColor color) {
class LoginErrorBubbleView : public LoginBaseBubbleView { class LoginErrorBubbleView : public LoginBaseBubbleView {
public: public:
LoginErrorBubbleView(views::View* content, views::View* anchor_view) LoginErrorBubbleView(views::View* content,
: LoginBaseBubbleView(anchor_view) { views::View* anchor_view,
aura::Window* container)
: LoginBaseBubbleView(anchor_view, container) {
set_anchor_view_insets( set_anchor_view_insets(
gfx::Insets(kAnchorViewErrorBubbleVerticalSpacingDp, 0)); gfx::Insets(kAnchorViewErrorBubbleVerticalSpacingDp, 0));
...@@ -445,7 +448,9 @@ void LoginBubble::ShowErrorBubble(views::View* content, ...@@ -445,7 +448,9 @@ void LoginBubble::ShowErrorBubble(views::View* content,
CloseImmediately(); CloseImmediately();
flags_ = flags; flags_ = flags;
bubble_view_ = new LoginErrorBubbleView(content, anchor_view); aura::Window* menu_container = Shell::GetContainer(
Shell::GetPrimaryRootWindow(), kShellWindowId_MenuContainer);
bubble_view_ = new LoginErrorBubbleView(content, anchor_view, menu_container);
Show(); Show();
} }
......
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