Skip to content

Commit

Permalink
Fix home launcher freeze issue
Browse files Browse the repository at this point in the history
Changes:
Make sure to stock tracking when a window with modal dialog is shown in
HomeLauncherGestureHandler::OnPressEvent().

Bug: 897894
Change-Id: I73267f5f71b6cdab909183d30318dd6166a75e1e
Reviewed-on: https://chromium-review.googlesource.com/c/1300215
Commit-Queue: Weidong Guo <weidongg@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602951}
  • Loading branch information
Weidong Guo authored and Commit Bot committed Oct 26, 2018
1 parent c4ab78c commit b5e8522
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion ash/app_list/home_launcher_gesture_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,16 @@ bool HomeLauncherGestureHandler::OnScrollEvent(const gfx::Point& location,

bool HomeLauncherGestureHandler::OnReleaseEvent(const gfx::Point& location,
bool* out_dragged_down) {
if (!IsDragInProgress())
if (!IsDragInProgress()) {
if (window_) {
// |window_| may not be nullptr when this release event is triggered by
// opening |window_| with modal dialog in OnPressEvent(). In that case,
// just leave the |window_| in show state and stop tracking.
RemoveObserversAndStopTracking();
return true;
}
return false;
}

last_event_location_ = base::make_optional(location);
if (out_dragged_down) {
Expand Down Expand Up @@ -657,6 +665,13 @@ bool HomeLauncherGestureHandler::SetUpWindows(Mode mode, aura::Window* window) {
if (mode == Mode::kSlideDownToHide) {
ScopedAnimationDisabler disable(window_);
window_->Show();

// When |window_| has a modal dialog child, window_->Show() above would
// cancel the current gesture and trigger OnReleaseEvent() to reset
// |window_|.
if (!window_)
return false;

wm::ActivateWindow(window_);
window_->layer()->SetOpacity(1.f);
}
Expand Down

0 comments on commit b5e8522

Please sign in to comment.