Skip to content

Commit

Permalink
Revert "System modal dialog should block shelf/status/system tray."
Browse files Browse the repository at this point in the history
This reverts commit ca8f384.

Reason for revert: Breaks event propagation to shelf buttons in login
screen when GAIA screen for adding a new user is shown (the dialog is
currently a system modal dialog).

Original change's description:
> System modal dialog should block shelf/status/system tray.
>
> Bug: 914133
> Test: covered by unit tests. Also tested manually, including OOBE.
> Change-Id: I6bbb76092aecbca8c378d050187c958bc8fa9450
> Reviewed-on: https://chromium-review.googlesource.com/c/1396794
> Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
> Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#620401}

TBR=oshima@chromium.org,stevenjb@chromium.org,jamescook@chromium.org

Bug: 914133, 935995
Change-Id: If92888dc4b8714d3764ed257085c44e1dd874289
Reviewed-on: https://chromium-review.googlesource.com/c/1497194
Reviewed-by: Jacob Dufault <jdufault@chromium.org>
Commit-Queue: Tony De Luna <tonydeluna@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636973}
  • Loading branch information
Tony de Luna authored and Commit Bot committed Mar 1, 2019
1 parent 76037ee commit a860e1a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 54 deletions.
17 changes: 1 addition & 16 deletions ash/root_window_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,6 @@
namespace ash {
namespace {

bool IsInShelfContainer(aura::Window* container) {
if (!container)
return false;
int id = container->id();
if (id == ash::kShellWindowId_StatusContainer ||
id == ash::kShellWindowId_ShelfContainer ||
id == ash::kShellWindowId_ShelfBubbleContainer) {
return true;
}
return IsInShelfContainer(container->parent());
}

bool IsWindowAboveContainer(aura::Window* window,
aura::Window* blocking_container) {
std::vector<aura::Window*> target_path;
Expand Down Expand Up @@ -486,9 +474,6 @@ bool RootWindowController::CanWindowReceiveEvents(aura::Window* window) {
if (modal_container && modal_container->Contains(window))
return modal_layout_manager->IsPartOfActiveModalWindow(window);

if (IsInShelfContainer(window->parent()))
return false;

return true;
}

Expand Down Expand Up @@ -977,7 +962,7 @@ void RootWindowController::CreateContainers() {
new AccessibilityPanelLayoutManager());

aura::Window* virtual_keyboard_parent_container = CreateContainer(
kShellWindowId_ImeWindowParentContainer, "ImeWindowParentContainer",
kShellWindowId_ImeWindowParentContainer, "VirtualKeyboardParentContainer",
lock_screen_related_containers);
wm::SetSnapsChildrenToPhysicalPixelBoundary(
virtual_keyboard_parent_container);
Expand Down
34 changes: 0 additions & 34 deletions ash/wm/system_modal_container_layout_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -324,32 +324,14 @@ TEST_F(SystemModalContainerLayoutManagerTest, EventFocusContainers) {
e1.ClickLeftButton();
EXPECT_EQ(1, main_delegate->mouse_presses());

EventTestWindow* status_delegate = new EventTestWindow(false);
std::unique_ptr<aura::Window> status(
status_delegate->OpenTestWindowWithParent(
Shell::GetPrimaryRootWindowController()->GetContainer(
ash::kShellWindowId_StatusContainer)));
status->SetBounds(main->bounds());

// Make sure that status window can receive event.
e1.ClickLeftButton();
EXPECT_EQ(1, status_delegate->mouse_presses());

// Create a modal window for the main window and verify that the main window
// no longer receives mouse events.
EventTestWindow* transient_delegate = new EventTestWindow(true);
aura::Window* transient =
transient_delegate->OpenTestWindowWithParent(main.get());
EXPECT_TRUE(wm::IsActiveWindow(transient));
e1.ClickLeftButton();

EXPECT_EQ(0, transient_delegate->mouse_presses());
EXPECT_EQ(1, status_delegate->mouse_presses());

status->Hide();
e1.ClickLeftButton();
EXPECT_EQ(1, transient_delegate->mouse_presses());
EXPECT_EQ(1, status_delegate->mouse_presses());

for (int block_reason = FIRST_BLOCK_REASON;
block_reason < NUMBER_OF_BLOCK_REASONS; ++block_reason) {
Expand All @@ -364,11 +346,9 @@ TEST_F(SystemModalContainerLayoutManagerTest, EventFocusContainers) {
// BlockUserSession could change the workspace size. Make sure |lock| has
// the same bounds as |main| so that |lock| gets the generated mouse events.
lock->SetBounds(main->bounds());

EXPECT_TRUE(wm::IsActiveWindow(lock.get()));
e1.ClickLeftButton();
EXPECT_EQ(1, lock_delegate->mouse_presses());
EXPECT_EQ(1, status_delegate->mouse_presses());

// Make sure that a modal container created by the lock screen can still
// receive mouse events.
Expand All @@ -377,25 +357,11 @@ TEST_F(SystemModalContainerLayoutManagerTest, EventFocusContainers) {
lock_modal_delegate->OpenTestWindowWithParent(lock.get());
EXPECT_TRUE(wm::IsActiveWindow(lock_modal));
e1.ClickLeftButton();

// Verify that none of the other containers received any more mouse presses.
EXPECT_EQ(1, lock_modal_delegate->mouse_presses());
EXPECT_EQ(1, lock_delegate->mouse_presses());
EXPECT_EQ(1, status_delegate->mouse_presses());
EXPECT_EQ(1, main_delegate->mouse_presses());
EXPECT_EQ(1, transient_delegate->mouse_presses());

// Showing status will block events.
status->Show();
e1.ClickLeftButton();

// Verify that none of the other containers received any more mouse presses.
EXPECT_EQ(1, lock_modal_delegate->mouse_presses());
EXPECT_EQ(1, lock_delegate->mouse_presses());
EXPECT_EQ(1, status_delegate->mouse_presses());
EXPECT_EQ(1, main_delegate->mouse_presses());
EXPECT_EQ(1, transient_delegate->mouse_presses());
status->Hide();

// Close |lock| before unlocking so that Shell::OnLockStateChanged does
// not DCHECK on finding a system modal in Lock layer when unlocked.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,15 @@ void CandidateWindowControllerImpl::InitCandidateWindowView() {
gfx::NativeView parent = nullptr;

// NOTE: CandidateWindowView takes care of the mash (window-service) case.
// Use VirtualKeyboardContainer so that it works even with a system modal
// dialog.
if (!features::IsUsingWindowService()) {
aura::Window* active_window = ash::wm::GetActiveWindow();
parent = ash::Shell::GetContainer(
active_window ? active_window->GetRootWindow()
: ash::Shell::GetRootWindowForNewWindows(),
ash::kShellWindowId_VirtualKeyboardContainer);
ash::kShellWindowId_SettingBubbleContainer);
}
candidate_window_view_ = new ui::ime::CandidateWindowView(
parent, ash::kShellWindowId_VirtualKeyboardContainer);
parent, ash::kShellWindowId_SettingBubbleContainer);
candidate_window_view_->AddObserver(this);
candidate_window_view_->SetCursorBounds(cursor_bounds_, composition_head_);
views::Widget* widget = candidate_window_view_->InitWidget();
Expand Down

0 comments on commit a860e1a

Please sign in to comment.