Commit e41bbad7 authored by Vladislav Kaznacheev's avatar Vladislav Kaznacheev Committed by Commit Bot

Fix double app icon when dragging app to shelf

When an app is being dragged from app list to shelf,
a new shelf item is created and made hidden by setting
its size to (0,0). It is supposed to stay at this size
until the drag is complete.

However, if a drag started very soon after some other shelf
manipulation (e.g. drag leaving the shelf and re-entering quickly),
it is possible for AnimateToIdealBounds to be called asynchronously.
The hidden item's bounds will be animated to full size, resulting
in a visible icon.

This CL makes AnimateToIdealBounds ignore shelf items with (0,0) size.

Bug: 985631
Test: manual
Change-Id: Ieb23beb6ecf635ae60613f5f6217219f7963999b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1862507
Commit-Queue: Vladislav Kaznacheev <kaznacheev@chromium.org>
Reviewed-by: default avatarManu Cornet <manucornet@chromium.org>
Auto-Submit: Vladislav Kaznacheev <kaznacheev@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706148}
parent bc890abe
......@@ -1521,6 +1521,8 @@ void ShelfView::AnimateToIdealBounds() {
for (int i = 0; i < view_model_->view_size(); ++i) {
View* view = view_model_->view_at(i);
if (view->size() == gfx::Size())
continue; // Do not animate a hidden item (see StartDrag)
bounds_animator_->AnimateViewTo(view, view_model_->ideal_bounds(i));
// Now that the item animation starts, we have to make sure that the
// padding of the first gets properly transferred to the new first item.
......
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