summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-05 20:42:27 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-05 20:42:27 +0000
commit8780409eb4a52a1bd5430654f60f1380c7fddccb (patch)
tree5232b40dc183d0f9196bc62e2a274a28c56ce8c4
parent2fb34fe7b2b44d191422b0d1c9623ce1e9aae0b8 (diff)
downloadchromium_src-8780409eb4a52a1bd5430654f60f1380c7fddccb.zip
chromium_src-8780409eb4a52a1bd5430654f60f1380c7fddccb.tar.gz
chromium_src-8780409eb4a52a1bd5430654f60f1380c7fddccb.tar.bz2
Fix crash when using touch selection in immersive fullscreen.
The ImmersiveFullscreenController was incorrectly consuming all ET_GESTURE_SCROLL_BEGIN. This resulted in TouchSelectionControllerImpl::EditingHandleView getting ET_GESTURE_SCROLL_UPDATE but not ET_GESTURE_SCROLL_BEGIN. This CL also makes the touch selection handles hide when a user uses a gesture to hide the top-of-window views. BUG=324607 TEST=Manual, see bug Review URL: https://codereview.chromium.org/100333004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239030 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/wm/immersive_fullscreen_controller.cc12
-rw-r--r--ash/wm/immersive_fullscreen_controller_unittest.cc19
2 files changed, 21 insertions, 10 deletions
diff --git a/ash/wm/immersive_fullscreen_controller.cc b/ash/wm/immersive_fullscreen_controller.cc
index 4970f4e..28aa1dc 100644
--- a/ash/wm/immersive_fullscreen_controller.cc
+++ b/ash/wm/immersive_fullscreen_controller.cc
@@ -289,6 +289,10 @@ void ImmersiveFullscreenController::SetEnabled(bool enabled) {
// Reveal was unsuccessful. Reacquire the revealed locks if appropriate.
UpdateLocatedEventRevealedLock(NULL);
UpdateFocusRevealedLock();
+ } else {
+ // Clearing focus is important because it closes focus-related popups like
+ // the touch selection handles.
+ widget_->GetFocusManager()->ClearFocus();
}
} else {
// Stop cursor-at-top tracking.
@@ -387,7 +391,9 @@ void ImmersiveFullscreenController::OnGestureEvent(ui::GestureEvent* event) {
case ui::ET_GESTURE_SCROLL_BEGIN:
if (ShouldHandleGestureEvent(GetEventLocationInScreen(*event))) {
gesture_begun_ = true;
- event->SetHandled();
+ // Do not consume the event. Otherwise, we end up consuming all
+ // ui::ET_GESTURE_SCROLL_BEGIN events in the top-of-window views
+ // when the top-of-window views are revealed.
}
break;
case ui::ET_GESTURE_SCROLL_UPDATE:
@@ -729,8 +735,10 @@ bool ImmersiveFullscreenController::UpdateRevealedLocksForSwipe(
located_event_revealed_lock_.reset();
focus_revealed_lock_.reset();
- if (reveal_state_ == SLIDING_CLOSED || reveal_state_ == CLOSED)
+ if (reveal_state_ == SLIDING_CLOSED || reveal_state_ == CLOSED) {
+ widget_->GetFocusManager()->ClearFocus();
return true;
+ }
// Ending the reveal was unsuccessful. Reaquire the locks if appropriate.
UpdateLocatedEventRevealedLock(NULL);
diff --git a/ash/wm/immersive_fullscreen_controller_unittest.cc b/ash/wm/immersive_fullscreen_controller_unittest.cc
index ba3442b..672e976 100644
--- a/ash/wm/immersive_fullscreen_controller_unittest.cc
+++ b/ash/wm/immersive_fullscreen_controller_unittest.cc
@@ -574,9 +574,9 @@ TEST_F(ImmersiveFullscreenControllerTest, MouseHoveredWithoutMoving) {
EXPECT_FALSE(controller()->IsRevealed());
// 2) Test that if the mouse becomes hovered without moving because of a
- // reveal in ImmersiveFullscreenController::controller()->SetEnabled(true)
- // and there are no locks keeping the top-of-window views revealed, that mouse
- // hover does not prevent the top-of-window views from closing.
+ // reveal in ImmersiveFullscreenController::SetEnabled(true) and there are no
+ // locks keeping the top-of-window views revealed, that mouse hover does not
+ // prevent the top-of-window views from closing.
controller()->SetEnabled(false);
SetHovered(true);
EXPECT_FALSE(controller()->IsRevealed());
@@ -584,10 +584,9 @@ TEST_F(ImmersiveFullscreenControllerTest, MouseHoveredWithoutMoving) {
EXPECT_FALSE(controller()->IsRevealed());
// 3) Test that if the mouse becomes hovered without moving because of a
- // reveal in ImmersiveFullscreenController::controller()->SetEnabled(true)
- // and there is a lock keeping the top-of-window views revealed, that the
- // top-of-window views do not hide till the mouse moves off of the
- // top-of-window views.
+ // reveal in ImmersiveFullscreenController::SetEnabled(true) and there is a
+ // lock keeping the top-of-window views revealed, that the top-of-window views
+ // do not hide till the mouse moves off of the top-of-window views.
controller()->SetEnabled(false);
SetHovered(true);
lock.reset(controller()->GetRevealedLock(
@@ -650,7 +649,11 @@ TEST_F(ImmersiveFullscreenControllerTest, EndRevealViaGesture) {
EXPECT_TRUE(controller()->IsRevealed());
AttemptUnreveal(MODALITY_GESTURE);
EXPECT_FALSE(controller()->IsRevealed());
- top_container()->GetFocusManager()->ClearFocus();
+
+ // The top-of-window views should no longer have focus. Clearing focus is
+ // important because it closes focus-related popup windows like the touch
+ // selection handles.
+ EXPECT_FALSE(top_container()->HasFocus());
// If some other code is holding onto a lock, a gesture should not be able to
// end the reveal.