Commit e1508c61 authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

Stop unexpected animation during CLEAR_ALL_STACKED

Clear all notification animation consists of two phases:
CLEAR_ALL_STACKED and CLEAR_ALL_VISIBLE.

During CLEAR_ALL_STACKED phase, only the counter at the top should
animate, so each notification should not move even though
GetCurrentValue() might not return 1.0.
See the bug for detail.

TEST=UnifiedMessageListViewTest.ClearAllWithStackingNotifications
BUG=908782

Change-Id: I24f369753cc17ad761d85c654743504a07e9e148
Reviewed-on: https://chromium-review.googlesource.com/c/1352111Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611510}
parent 223ddbf6
......@@ -485,6 +485,11 @@ void UnifiedMessageListView::UpdateClearAllAnimation() {
DeleteRemovedNotifications();
UpdateBounds();
start_height_ = ideal_height_;
for (int i = 0; i < child_count(); ++i) {
auto* view = GetContainer(i);
view->set_start_bounds(view->ideal_bounds());
}
PreferredSizeChanged();
state_ = State::CLEAR_ALL_STACKED;
......
......@@ -443,8 +443,10 @@ TEST_F(UnifiedMessageListViewTest, ClearAllWithStackingNotifications) {
message_list_view()->set_stacked_notification_count(1);
int previous_height = message_list_view()->GetPreferredSize().height();
gfx::Rect previous_bounds = GetMessageViewBounds(1);
AnimateToMiddle();
EXPECT_EQ(previous_height, message_list_view()->GetPreferredSize().height());
EXPECT_EQ(previous_bounds, GetMessageViewBounds(1));
AnimateToEnd();
EXPECT_EQ(1, message_list_view()->child_count());
......@@ -455,7 +457,7 @@ TEST_F(UnifiedMessageListViewTest, ClearAllWithStackingNotifications) {
AnimateToEnd();
EXPECT_EQ(1, message_list_view()->child_count());
gfx::Rect previous_bounds = GetMessageViewBounds(0);
previous_bounds = GetMessageViewBounds(0);
AnimateToMiddle();
EXPECT_LT(previous_bounds.x(), GetMessageViewBounds(0).x());
AnimateToEnd();
......
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