Commit 3be8ff37 authored by Andrew Xu's avatar Andrew Xu Committed by Commit Bot

Solves the potential conflict between animation and scroll gesture

When shelf is under gesture scroll, the scroll animation to adjust the
scroll offset triggered by bounds change may conflict with the scroll
gesture. As a result, user will feel hard to scroll the shelf during
bounds animation. This CL prevents scroll animation from being started
if shelf is under gesture scroll along the main axis.

Bug: 1046568
Change-Id: Ib5d00c457e442e657d928046a4f03a43093f0a7a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2026173
Commit-Queue: Andrew Xu <andrewxu@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736203}
parent 51c1d43e
......@@ -947,8 +947,15 @@ void ScrollableShelfView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
// The changed view bounds may lead to update on the available space.
UpdateAvailableSpaceAndScroll();
// When AdjustOffset() returns true, shelf view is scrolled by animation.
if (!AdjustOffset() && old_scroll_offset != scroll_offset_)
// Avoids calling AdjustOffset() when the scrollable shelf view is
// under scroll along the main axis. Otherwise, animation will conflict with
// scroll gesture. Meanwhile, translates the shelf view
// if AdjustOffset() returns false since when AdjustOffset() returns true,
// shelf view is scrolled by animation.
const bool should_translate_shelf_view =
scroll_status_ == kAlongMainAxisScroll || !AdjustOffset();
if (should_translate_shelf_view && old_scroll_offset != scroll_offset_)
shelf_container_view_->TranslateShelfView(scroll_offset_);
}
......
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