Commit 9d1d60bd authored by sky@chromium.org's avatar sky@chromium.org

Fixes bug in MultiWindowResizeController where it wasn't removing

observers properly if the resizer stayed visible after a resize.

BUG=139227
TEST=covered by unit tests
R=ben@chromium.org


Review URL: https://chromiumcodereview.appspot.com/10830148

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149756 0039d316-1c4b-4281-b951-d872f2087c98
parent 133ddca5
......@@ -399,6 +399,7 @@ void MultiWindowResizeController::StartResize(
ConvertPointFromScreen(windows_.window2->parent(), &location_in_parent);
std::vector<aura::Window*> windows;
windows.push_back(windows_.window2);
DCHECK(windows_.other_windows.empty());
FindWindowsTouching(windows_.window2, windows_.direction,
&windows_.other_windows);
for (size_t i = 0; i < windows_.other_windows.size(); ++i) {
......@@ -433,8 +434,16 @@ void MultiWindowResizeController::CompleteResize(int event_flags) {
// Mouse may still be over resizer, if not hide.
gfx::Point screen_loc = gfx::Screen::GetCursorScreenPoint();
if (!resize_widget_->GetWindowBoundsInScreen().Contains(screen_loc))
if (!resize_widget_->GetWindowBoundsInScreen().Contains(screen_loc)) {
Hide();
} else {
// If the mouse is over the resizer we need to remove observers on any of
// the |other_windows|. If we start another resize we'll recalculate the
// |other_windows| and invoke AddObserver() as necessary.
for (size_t i = 0; i < windows_.other_windows.size(); ++i)
windows_.other_windows[i]->RemoveObserver(this);
windows_.other_windows.clear();
}
}
void MultiWindowResizeController::CancelResize() {
......
......@@ -246,7 +246,12 @@ TEST_F(MultiWindowResizeControllerTest, Three) {
generator.MoveMouseTo(bounds.x() + 11, bounds.y() + 10);
EXPECT_TRUE(HasTarget(w3.get()));
}
// Release the mouse. The resizer should still be visible and a subsequent
// press should not trigger a DCHECK.
generator.ReleaseLeftButton();
EXPECT_TRUE(IsShowing());
generator.PressLeftButton();
}
} // namespace internal
} // namespace ash
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