Commit b87db175 authored by Avery Musbach's avatar Avery Musbach Committed by Commit Bot

overview: Fix GetGridBoundsInScreenForSplitview

The present CL modifies GetGridBoundsInScreenForSplitview so that it
uses the correct split view controller when on an external display.

SplitViewOverviewSessionInClamshellTestMultiDisplayOnly.Dragging

Test: ash_unittests
Bug: 1019221
Change-Id: Ibba4867a342d6a4057e7bb724fbd24b0dae85d77
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1887837
Commit-Queue: Avery Musbach <amusbach@chromium.org>
Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710575}
parent 4f0689b5
......@@ -5445,8 +5445,10 @@ TEST_P(SplitViewOverviewSessionInClamshellTestMultiDisplayOnly, Dragging) {
std::unique_ptr<aura::Window> window1 = CreateTestWindow(bounds_within_root2);
std::unique_ptr<aura::Window> window2 = CreateTestWindow(bounds_within_root2);
ToggleOverview();
OverviewItem* item1 = GetOverviewItemForWindow(window1.get());
OverviewItem* item2 = GetOverviewItemForWindow(window2.get());
OverviewGrid* grid_on_root2 =
overview_session()->GetGridWithRootWindow(root_windows[1]);
OverviewItem* item1 = grid_on_root2->GetOverviewItemContaining(window1.get());
OverviewItem* item2 = grid_on_root2->GetOverviewItemContaining(window2.get());
SplitViewController* split_view_controller =
SplitViewController::Get(root_windows[1]);
SplitViewDragIndicators* indicators =
......@@ -5460,6 +5462,9 @@ TEST_P(SplitViewOverviewSessionInClamshellTestMultiDisplayOnly, Dragging) {
overview_session()->Drag(item1, right_snap_point);
EXPECT_EQ(IndicatorState::kPreviewAreaRight,
indicators->current_indicator_state());
EXPECT_EQ(SplitViewController::Get(root_windows[1])
->GetSnappedWindowBoundsInScreen(SplitViewController::LEFT),
grid_on_root2->bounds());
overview_session()->CompleteDrag(item1, right_snap_point);
EXPECT_EQ(SplitViewController::State::kRightSnapped,
split_view_controller->state());
......
......@@ -224,8 +224,7 @@ void MaximizeIfSnapped(aura::Window* window) {
gfx::Rect GetGridBoundsInScreenForSplitview(
aura::Window* window,
base::Optional<IndicatorState> indicator_state) {
auto* split_view_controller =
SplitViewController::Get(Shell::GetPrimaryRootWindow());
auto* split_view_controller = SplitViewController::Get(window);
auto state = split_view_controller->state();
// If we are in splitview mode already just use the given state, otherwise
......
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