diff options
author | mukai <mukai@chromium.org> | 2014-12-09 11:31:50 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-09 19:32:09 +0000 |
commit | 63839ef7ef0a2cf2e79befe292d12b2c06191299 (patch) | |
tree | 0f567fac8dcdb66cb07eb97019ede3316a92e9a1 /ui | |
parent | a30e1eaf6130dab71bc4db5bfea72049203b1000 (diff) | |
download | chromium_src-63839ef7ef0a2cf2e79befe292d12b2c06191299.zip chromium_src-63839ef7ef0a2cf2e79befe292d12b2c06191299.tar.gz chromium_src-63839ef7ef0a2cf2e79befe292d12b2c06191299.tar.bz2 |
Remove a condition to prevent focus on captured window.
As I commented on the issue 402272, this condition was added
to prevent fullscreen cancel when a context menu window
comes up (see crbug.com/174731 for the details). However,
that bug doesn't make sense because fullscreen isn't
cancelled anymore when another window gets the focus.
R=sky@chromium.org
TEST=manually -- see the bug line. Also this doesn't make regression on crbug.com/174731 with http://www.flashvideofactory.com/test/demofullscreen345.html
BUG=402272
Review URL: https://codereview.chromium.org/753223004
Cr-Commit-Position: refs/heads/master@{#307518}
Diffstat (limited to 'ui')
-rw-r--r-- | ui/wm/core/focus_controller.cc | 7 | ||||
-rw-r--r-- | ui/wm/core/focus_controller_unittest.cc | 28 |
2 files changed, 19 insertions, 16 deletions
diff --git a/ui/wm/core/focus_controller.cc b/ui/wm/core/focus_controller.cc index 66c6deb..722f6c8 100644 --- a/ui/wm/core/focus_controller.cc +++ b/ui/wm/core/focus_controller.cc @@ -108,13 +108,6 @@ void FocusController::FocusWindow(aura::Window* window) { return; } - // We should not be messing with the focus if the window has capture, unless - // no has focus. - if (window && (aura::client::GetCaptureWindow(window) == window) && - focused_window_) { - return; - } - // Focusing a window also activates its containing activatable window. Note // that the rules could redirect activation activation and/or focus. aura::Window* focusable = rules_->GetFocusableWindow(window); diff --git a/ui/wm/core/focus_controller_unittest.cc b/ui/wm/core/focus_controller_unittest.cc index 6cb5604..a773821 100644 --- a/ui/wm/core/focus_controller_unittest.cc +++ b/ui/wm/core/focus_controller_unittest.cc @@ -472,7 +472,7 @@ class FocusControllerTestBase : public aura::test::AuraTestBase { virtual void ShiftFocusOnActivation() {} virtual void ShiftFocusOnActivationDueToHide() {} virtual void NoShiftActiveOnActivation() {} - virtual void NoFocusChangeOnClickOnCaptureWindow() {} + virtual void FocusChangeDuringDrag() {} virtual void ChangeFocusWhenNothingFocusedAndCaptured() {} virtual void DontPassDeletedWindow() {} virtual void FocusedTextInputClient() {} @@ -752,24 +752,35 @@ class FocusControllerDirectTestBase : public FocusControllerTestBase { // from being made in response to an activation change notification. } - void NoFocusChangeOnClickOnCaptureWindow() override { + void FocusChangeDuringDrag() override { scoped_ptr<aura::client::DefaultCaptureClient> capture_client( new aura::client::DefaultCaptureClient(root_window())); - // Clicking on a window which has capture should not cause a focus change - // to the window. This test verifies whether that is indeed the case. + // Activating an inactive window during drag should activate the window. + // This emulates the behavior of tab dragging which is merged into the + // window below. ActivateWindowById(1); EXPECT_EQ(1, GetActiveWindowId()); EXPECT_EQ(1, GetFocusedWindowId()); aura::Window* w2 = root_window()->GetChildById(2); - aura::client::GetCaptureClient(root_window())->SetCapture(w2); ui::test::EventGenerator generator(root_window(), w2); - generator.ClickLeftButton(); + generator.PressLeftButton(); + aura::client::GetCaptureClient(root_window())->SetCapture(w2); + EXPECT_EQ(2, GetActiveWindowId()); + EXPECT_EQ(2, GetFocusedWindowId()); + generator.MoveMouseTo(gfx::Point(0, 0)); + // Emulate the behavior of merging a tab into an inactive window: + // transferring the mouse capture and activate the window. + aura::Window* w1 = root_window()->GetChildById(1); + aura::client::GetCaptureClient(root_window())->SetCapture(w1); + aura::client::GetActivationClient(root_window())->ActivateWindow(w1); EXPECT_EQ(1, GetActiveWindowId()); EXPECT_EQ(1, GetFocusedWindowId()); - aura::client::GetCaptureClient(root_window())->ReleaseCapture(w2); + + generator.ReleaseLeftButton(); + aura::client::GetCaptureClient(root_window())->ReleaseCapture(w1); } // Verifies focus change is honored while capture held. @@ -1256,8 +1267,7 @@ DIRECT_FOCUS_CHANGE_TESTS(ShiftFocusOnActivation); DIRECT_FOCUS_CHANGE_TESTS(ShiftFocusOnActivationDueToHide); DIRECT_FOCUS_CHANGE_TESTS(NoShiftActiveOnActivation); -// Clicking on a window which has capture should not result in a focus change. -DIRECT_FOCUS_CHANGE_TESTS(NoFocusChangeOnClickOnCaptureWindow); +FOCUS_CONTROLLER_TEST(FocusControllerApiTest, FocusChangeDuringDrag); FOCUS_CONTROLLER_TEST(FocusControllerApiTest, ChangeFocusWhenNothingFocusedAndCaptured); |