Commit 8f12da7d authored by Avery Musbach's avatar Avery Musbach Committed by Commit Bot

overview: Disable ending overview while dragging split view divider

You shall not be able to end overview by pressing the overview button
with one finger, while dragging the split view divider with another
finger. It causes a DCHECK failure.

Test: manual
Change-Id: Ie48e19a9fe9a21e45313e16cc5a353adb9eada64
Fixed: 1052163
Bug: 1052163
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2055886
Commit-Queue: Avery Musbach <amusbach@chromium.org>
Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#741262}
parent 2e7416df
...@@ -48,6 +48,13 @@ constexpr base::TimeDelta kOcclusionPauseDurationForStart = ...@@ -48,6 +48,13 @@ constexpr base::TimeDelta kOcclusionPauseDurationForStart =
constexpr base::TimeDelta kOcclusionPauseDurationForEnd = constexpr base::TimeDelta kOcclusionPauseDurationForEnd =
base::TimeDelta::FromMilliseconds(500); base::TimeDelta::FromMilliseconds(500);
bool IsSplitViewDividerDraggedOrAnimated() {
SplitViewController* split_view_controller =
SplitViewController::Get(Shell::GetPrimaryRootWindow());
return split_view_controller->is_resizing() ||
split_view_controller->IsDividerAnimating();
}
// Returns the enter/exit type that should be used if kNormal enter/exit type // Returns the enter/exit type that should be used if kNormal enter/exit type
// was originally requested - if the overview is expected to transition to/from // was originally requested - if the overview is expected to transition to/from
// the home screen, the normal enter/exit mode is expected to be overridden by // the home screen, the normal enter/exit mode is expected to be overridden by
...@@ -448,12 +455,8 @@ void OverviewController::ToggleOverview( ...@@ -448,12 +455,8 @@ void OverviewController::ToggleOverview(
bool OverviewController::CanEnterOverview() { bool OverviewController::CanEnterOverview() {
// Prevent entering overview while the divider is dragged or animated. // Prevent entering overview while the divider is dragged or animated.
SplitViewController* split_view_controller = if (IsSplitViewDividerDraggedOrAnimated())
SplitViewController::Get(Shell::GetPrimaryRootWindow());
if (split_view_controller->is_resizing() ||
split_view_controller->IsDividerAnimating()) {
return false; return false;
}
// Don't allow a window overview if the user session is not active (e.g. // Don't allow a window overview if the user session is not active (e.g.
// locked or in user-adding screen) or a modal dialog is open or running in // locked or in user-adding screen) or a modal dialog is open or running in
...@@ -469,15 +472,15 @@ bool OverviewController::CanEnterOverview() { ...@@ -469,15 +472,15 @@ bool OverviewController::CanEnterOverview() {
bool OverviewController::CanEndOverview( bool OverviewController::CanEndOverview(
OverviewSession::EnterExitOverviewType type) { OverviewSession::EnterExitOverviewType type) {
SplitViewController* split_view_controller = // Prevent ending overview while the divider is dragged or animated.
SplitViewController::Get(Shell::GetPrimaryRootWindow()); if (IsSplitViewDividerDraggedOrAnimated())
// Prevent toggling overview during the split view divider snap animation.
if (split_view_controller->IsDividerAnimating())
return false; return false;
// Do not allow ending overview if we're in single split mode unless swiping // Do not allow ending overview if we're in single split mode unless swiping
// up from the shelf in tablet mode, or ending overview immediately without // up from the shelf in tablet mode, or ending overview immediately without
// animations. // animations.
SplitViewController* split_view_controller =
SplitViewController::Get(Shell::GetPrimaryRootWindow());
if (split_view_controller->InTabletSplitViewMode() && if (split_view_controller->InTabletSplitViewMode() &&
split_view_controller->state() != split_view_controller->state() !=
SplitViewController::State::kBothSnapped && SplitViewController::State::kBothSnapped &&
......
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