Commit 72c75102 authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Just update the content if frame animation is already running.

This is a workaround for crbug.com/1134279, but probably better way to
handle this particular situation because the animation layer will fade out w/o
interruption and a user will see the final state.

DefaultFrameHeader.AnimateDuringAnimation

Bug: 1132276, 1126857, 1134279
Test: manual (see bug for reprostep),
Change-Id: I31c0281983f52a4d181addf8c522e1efa5eeddcf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2442378Reviewed-by: default avatarMalay Keshav <malaykeshav@chromium.org>
Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812979}
parent 3f5187ae
...@@ -279,4 +279,31 @@ TEST_F(DefaultFrameHeaderTest, ResizeAndReorderDuringAnimation) { ...@@ -279,4 +279,31 @@ TEST_F(DefaultFrameHeaderTest, ResizeAndReorderDuringAnimation) {
} }
} }
// Make sure that the animation request while animating will not
// create another animation.
TEST_F(DefaultFrameHeaderTest, AnimateDuringAnimation) {
const auto bounds = gfx::Rect(100, 100);
auto win_0 = CreateAppWindow(bounds, AppType::BROWSER);
// A frame will not animate until it is painted first.
FramePaintWaiter(win_0.get()).Wait();
auto* widget = Widget::GetWidgetForNativeWindow(win_0.get());
auto lock = widget->LockPaintAsActive();
auto win_1 = CreateAppWindow(bounds, AppType::BROWSER);
FramePaintWaiter(win_1.get()).Wait();
EXPECT_TRUE(wm::IsActiveWindow(win_1.get()));
ui::ScopedAnimationDurationScaleMode non_zero_duration_mode(
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
auto layer_bounds = win_0->layer()->bounds();
lock.reset();
win_1.reset();
EXPECT_TRUE(wm::IsActiveWindow(win_0.get()));
// Makes sure that the layer has full damaged bounds.
EXPECT_TRUE(win_0->layer()->damaged_region().Contains(layer_bounds));
}
} // namespace ash } // namespace ash
...@@ -112,7 +112,12 @@ class FrameHeader::FrameAnimatorView : public views::View, ...@@ -112,7 +112,12 @@ class FrameHeader::FrameAnimatorView : public views::View,
} }
void StartAnimation(base::TimeDelta duration) { void StartAnimation(base::TimeDelta duration) {
StopAnimation(); if (layer_owner_) {
// If animation is already running, just update the content of the new
// layer.
parent_->SchedulePaint();
return;
}
aura::Window* window = frame_header_->target_widget()->GetNativeWindow(); aura::Window* window = frame_header_->target_widget()->GetNativeWindow();
// Make sure the this view is at the bottom of root view's children. // Make sure the this view is at the bottom of root view's children.
......
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