Commit 7f45a688 authored by varkha@chromium.org's avatar varkha@chromium.org

Stops animations when removing a window from its parent.

This prevents overwriting target bounds when reparenting layers during animation. In snapped scenario we snap a window (with a call to WindowState::OnWMEvent in WorkspaceWindowResizer::CompleteDrag()) which starts animation and then immediately reparent it (back to workspace in DockedWindowResizer::MaybeReparentWindowOnDragCompletion). Stopping (completing) BOUNDS animation allows the child window to honor previously set target bounds and keep them when it gets reparented.

BUG=364517, 366993
TEST=aura_unittests --gtest_filter=WindowTest.RootWindowSetWhenReparenting

Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=266115

Review URL: https://codereview.chromium.org/241983003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266451 0039d316-1c4b-4281-b951-d872f2087c98
parent 2c8e137a
......@@ -108,6 +108,7 @@ class DesktopBackgroundControllerTest : public test::AshTestBase {
Shell::GetPrimaryRootWindowController()
->animating_wallpaper_controller()
->GetController(false);
EXPECT_TRUE(!!controller);
ASSERT_NO_FATAL_FAILURE(RunAnimationForWidget(controller->widget()));
}
......@@ -179,8 +180,7 @@ TEST_F(DesktopBackgroundControllerTest, ControllerOwnership) {
// Test for crbug.com/149043 "Unlock screen, no launcher appears". Ensure we
// move all desktop views if there are more than one.
// Disabled for crbug.com/366993
TEST_F(DesktopBackgroundControllerTest, DISABLED_BackgroundMovementDuringUnlock) {
TEST_F(DesktopBackgroundControllerTest, BackgroundMovementDuringUnlock) {
// We cannot short-circuit animations for this test.
ui::ScopedAnimationDurationScaleMode normal_duration_mode(
ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
......
......@@ -1007,10 +1007,6 @@ Window* Window::GetWindowForPoint(const gfx::Point& local_point,
}
void Window::RemoveChildImpl(Window* child, Window* new_parent) {
// Stop (and complete) an ongoing animation to make sure bounds are updated
// before updating the layers bounds again.
if (child->layer() && child->layer()->GetAnimator())
child->layer()->GetAnimator()->StopAnimating();
if (layout_manager_)
layout_manager_->OnWillRemoveWindowFromLayout(child);
FOR_EACH_OBSERVER(WindowObserver, observers_, OnWillRemoveWindow(child));
......
......@@ -164,6 +164,12 @@ void Layer::Add(Layer* child) {
}
void Layer::Remove(Layer* child) {
// Current bounds are used to calculate offsets when layers are reparented.
// Stop (and complete) an ongoing animation to update the bounds immediately.
if (child->GetAnimator()) {
child->GetAnimator()->StopAnimatingProperty(
ui::LayerAnimationElement::BOUNDS);
}
std::vector<Layer*>::iterator i =
std::find(children_.begin(), children_.end(), child);
DCHECK(i != children_.end());
......
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