Commit e4538f26 authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

chromeos: get app-list reorder animations working again

As part of https://chromium-review.googlesource.com/c/chromium/src/+/1547051
InvalidateLayout() was changed to result in a Layout() at a later date. This
means there may be an additional Layout() called. AppsGridView cancels any
animations if Layout() is called. Currently, an async layout is being
triggered as part of preparing for the animation. Which means the reorder
animation is canceled. The fix is to explicitly force a layout (which makes
the pending layout do nothing) and further ignore the layout call.

BUG=949713
TEST=see steps in bug.

Change-Id: I9aa887e4e49b182a2912a6c599fa26618429e1d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1562372Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#649643}
parent 9e68cbfa
...@@ -705,6 +705,15 @@ void AppsGridView::EndDrag(bool cancel) { ...@@ -705,6 +705,15 @@ void AppsGridView::EndDrag(bool cancel) {
SetAsFolderDroppingTarget(drop_target_, false); SetAsFolderDroppingTarget(drop_target_, false);
ClearDragState(); ClearDragState();
UpdatePaging(); UpdatePaging();
{
// Normally Layout() cancels any animations. At this point there may be a
// pending Layout(), force it now so that one isn't triggered part way
// through the animation. Further, ignore this layout so that the position
// isn't reset.
DCHECK(!ignore_layout_);
base::AutoReset<bool> auto_reset(&ignore_layout_, true);
GetWidget()->LayoutRootViewIfNecessary();
}
AnimateToIdealBounds(); AnimateToIdealBounds();
if (!cancel && !folder_delegate_) if (!cancel && !folder_delegate_)
view_structure_.SaveToMetadata(); view_structure_.SaveToMetadata();
...@@ -896,6 +905,9 @@ const char* AppsGridView::GetClassName() const { ...@@ -896,6 +905,9 @@ const char* AppsGridView::GetClassName() const {
} }
void AppsGridView::Layout() { void AppsGridView::Layout() {
if (ignore_layout_)
return;
if (bounds_animator_.IsAnimating()) if (bounds_animator_.IsAnimating())
bounds_animator_.Cancel(); bounds_animator_.Cancel();
......
...@@ -795,6 +795,9 @@ class APP_LIST_EXPORT AppsGridView : public views::View, ...@@ -795,6 +795,9 @@ class APP_LIST_EXPORT AppsGridView : public views::View,
GhostImageView* current_ghost_view_ = nullptr; GhostImageView* current_ghost_view_ = nullptr;
GhostImageView* last_ghost_view_ = nullptr; GhostImageView* last_ghost_view_ = nullptr;
// If true, Layout() does nothing. See where set for details.
bool ignore_layout_ = false;
// Records the presentation time for apps grid dragging. // Records the presentation time for apps grid dragging.
std::unique_ptr<ash::PresentationTimeRecorder> presentation_time_recorder_; std::unique_ptr<ash::PresentationTimeRecorder> presentation_time_recorder_;
......
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