Commit 553d4117 authored by Avery Musbach's avatar Avery Musbach Committed by Commit Bot

split view: Simplify ending clamshell split view with 2 snapped windows

The present CL makes code more consistent between these two workflows:
1. There is already a window snapped in clamshell split view, and you
drag another window from overview and snap it on the other side.
2. There is only one window in overview, and you enter clamshell split
view by dragging and snapping it.

BEFORE: SplitViewController::OnWindowSnapped ends split view mode in
Workflow 1, whereas SplitViewController::OnOverviewModeEnding ends split
view mode in Workflow 2.
AFTER: SplitViewController::OnOverviewModeEnding ends split view mode in
both workflows.

Test: ash_unittests SplitViewOverviewSessionInClamshellTest.BasicFunctionalitiesTest
Change-Id: I698cb047dd2fbd69de8a6db08cfdae91961b58ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1779005
Commit-Queue: Avery Musbach <amusbach@chromium.org>
Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698970}
parent 30ac50d5
......@@ -1019,23 +1019,21 @@ void SplitViewController::OnOverviewModeEnding(
}
aura::Window* root_window = GetDefaultSnappedWindow()->GetRootWindow();
if (state_ == SplitViewState::kBothSnapped) {
// If overview is ended because of the window gets snapped, do not do
// exiting overview animation.
// If overview is ended because of a window getting snapped, suppress the
// overview exiting animation.
if (state_ == SplitViewState::kBothSnapped)
overview_session->SetWindowListNotAnimatedWhenExiting(root_window);
return;
}
// If we're in clamshell splitview mode, do not auto snap overview window
// when overview ends.
// If clamshell split view mode is active, end it and bail out.
if (split_view_type_ == SplitViewType::kClamshellType) {
EndSplitView();
return;
}
// If split view mode is active but only has one snapped window when overview
// mode is ending, retrieve the first snappable window in the overview window
// grid and snap it.
// Tablet split view mode is active. If it still only has one snapped window,
// snap the first snappable window in the overview grid on the other side.
if (state_ == SplitViewState::kBothSnapped)
return;
OverviewGrid* current_grid =
overview_session->GetGridWithRootWindow(root_window);
if (!current_grid || current_grid->empty())
......@@ -1526,12 +1524,6 @@ void SplitViewController::OnWindowSnapped(aura::Window* window) {
RestoreTransformIfApplicable(window);
UpdateSplitViewStateAndNotifyObservers();
UpdateWindowStackingAfterSnap(window);
// If there are two window snapped in clamshell mode, splitview mode is ended.
if (state_ == SplitViewState::kBothSnapped &&
split_view_type_ == SplitViewType::kClamshellType) {
EndSplitView();
}
}
void SplitViewController::OnSnappedWindowDetached(aura::Window* window,
......
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