Commit 50e89659 authored by Xiaoqian Dai's avatar Xiaoqian Dai Committed by Commit Bot

Put the previous snapped window in splitview back in overview.

To be consistent with tablet splitview behavior, we decided to do the
same when in overview dragging an overview window to snap to a position
that already has a snapped window in place: the previous snapped window
will be put back into overview.

Bug:991695
TEST: SplitViewOverviewSessionInClamshellTest.BasicFunctionalitiesTest

Change-Id: I3411fff3257146bdcd6b4344206a7bbb1fbd6340
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1765444
Commit-Queue: Xiaoqian Dai <xdai@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#690976}
parent bd41f630
...@@ -4553,7 +4553,7 @@ TEST_F(SplitViewOverviewSessionInClamshellTest, BasicFunctionalitiesTest) { ...@@ -4553,7 +4553,7 @@ TEST_F(SplitViewOverviewSessionInClamshellTest, BasicFunctionalitiesTest) {
// 4. Test if one window is snapped, the other windows are showing in // 4. Test if one window is snapped, the other windows are showing in
// overview, we can drag another window in overview to snap in splitview, and // overview, we can drag another window in overview to snap in splitview, and
// the previous snapped window will not be put back into overview. // the previous snapped window will be put back into overview.
std::unique_ptr<aura::Window> window4(CreateWindow(bounds)); std::unique_ptr<aura::Window> window4(CreateWindow(bounds));
ToggleOverview(); ToggleOverview();
overview_item1 = GetOverviewItemForWindow(window1.get()); overview_item1 = GetOverviewItemForWindow(window1.get());
...@@ -4564,7 +4564,7 @@ TEST_F(SplitViewOverviewSessionInClamshellTest, BasicFunctionalitiesTest) { ...@@ -4564,7 +4564,7 @@ TEST_F(SplitViewOverviewSessionInClamshellTest, BasicFunctionalitiesTest) {
DragWindowTo(overview_item3, gfx::PointF(0, 0)); DragWindowTo(overview_item3, gfx::PointF(0, 0));
EXPECT_FALSE(overview_controller()->overview_session()->IsWindowInOverview( EXPECT_FALSE(overview_controller()->overview_session()->IsWindowInOverview(
window3.get())); window3.get()));
EXPECT_FALSE(overview_controller()->overview_session()->IsWindowInOverview( EXPECT_TRUE(overview_controller()->overview_session()->IsWindowInOverview(
window1.get())); window1.get()));
EXPECT_EQ(window_state1->GetStateType(), WindowStateType::kLeftSnapped); EXPECT_EQ(window_state1->GetStateType(), WindowStateType::kLeftSnapped);
EXPECT_EQ(WindowState::Get(window3.get())->GetStateType(), EXPECT_EQ(WindowState::Get(window3.get())->GetStateType(),
......
...@@ -382,29 +382,28 @@ void SplitViewController::SnapWindow(aura::Window* window, ...@@ -382,29 +382,28 @@ void SplitViewController::SnapWindow(aura::Window* window,
} }
StartObserving(window); StartObserving(window);
if (split_view_type_ == SplitViewType::kTabletType) { // Insert the previous snapped window to overview if overview is active.
// Insert the previous snapped window to overview if overview is active. if (previous_snapped_window && GetOverviewSession()) {
if (previous_snapped_window && GetOverviewSession()) { InsertWindowToOverview(previous_snapped_window);
InsertWindowToOverview(previous_snapped_window); // Ensure that the close icon will fade in. This part is redundant for
// Ensure that the close icon will fade in. This part is redundant for // dragging from overview, but necessary for dragging from the top. For
// dragging from overview, but necessary for dragging from the top. For // dragging from overview, |OverviewItem::OnSelectorItemDragEnded| will be
// dragging from overview, |OverviewItem::OnSelectorItemDragEnded| will be // called on all overview items including the |previous_snapped_window|
// called on all overview items including the |previous_snapped_window| // item anyway, whereas for dragging from the top,
// item anyway, whereas for dragging from the top, // |OverviewItem::OnSelectorItemDragEnded| already was called on all
// |OverviewItem::OnSelectorItemDragEnded| already was called on all // overview items and |previous_snapped_window| was not yet among them.
// overview items and |previous_snapped_window| was not yet among them. GetOverviewSession()
GetOverviewSession() ->GetOverviewItemForWindow(previous_snapped_window)
->GetOverviewItemForWindow(previous_snapped_window) ->OnSelectorItemDragEnded(/*snap=*/true);
->OnSelectorItemDragEnded(/*snap=*/true); }
}
// Update the divider position and window bounds before snapping a new // Update the divider position and window bounds before snapping a new
// window. Since the minimum size of |window| maybe larger than currently // window. Since the minimum size of |window| maybe larger than currently
// bounds in |snap_position|. // bounds in |snap_position|.
if (state_ != SplitViewState::kNoSnap) { if (state_ != SplitViewState::kNoSnap &&
divider_position_ = GetClosestFixedDividerPosition(); split_view_type_ == SplitViewType::kTabletType) {
UpdateSnappedWindowsAndDividerBounds(); divider_position_ = GetClosestFixedDividerPosition();
} UpdateSnappedWindowsAndDividerBounds();
} }
// Disable the bounds change animation for a to-be-snapped window if the // Disable the bounds change animation for a to-be-snapped window if the
......
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