Commit 604620a2 authored by Caroline Rising's avatar Caroline Rising Committed by Commit Bot

Fix tab hover card animation delay when moving quickly across tab strip.

When an animation is triggered while another is already in progress the animation was being stopped then restarted. This led to a 1 frame delay in the animation that was very noticeable when quickly scrubbing the tab strip. This change makes it so that the animation is never stopped and continues from where the interrupted animation left off. A linear animation also seems more fitting for this case since we are never reversing the animation.

Bug: 1017134, 1017029
Change-Id: I945f5c180c8758cc5e14d7d45ed792bc7c11ac89
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1881949Reviewed-by: default avatarDana Fried <dfried@chromium.org>
Reviewed-by: default avatarIan Vollick <vollick@chromium.org>
Commit-Queue: Caroline Rising <corising@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710420}
parent cbeb60b0
......@@ -212,8 +212,8 @@ class TabHoverCardBubbleView::WidgetSlideAnimationDelegate
TabHoverCardBubbleView* hover_card_delegate)
: AnimationDelegateViews(hover_card_delegate),
bubble_delegate_(hover_card_delegate),
slide_animation_(std::make_unique<gfx::SlideAnimation>(this)) {
slide_animation_->SetSlideDuration(base::TimeDelta::FromMilliseconds(75));
slide_animation_(std::make_unique<gfx::LinearAnimation>(this)) {
slide_animation_->SetDuration(base::TimeDelta::FromMilliseconds(75));
}
~WidgetSlideAnimationDelegate() override {}
......@@ -222,8 +222,8 @@ class TabHoverCardBubbleView::WidgetSlideAnimationDelegate
desired_anchor_view_ = desired_anchor_view;
starting_bubble_bounds_ = current_bubble_bounds_;
target_bubble_bounds_ = CalculateTargetBounds(desired_anchor_view);
slide_animation_->Reset(0);
slide_animation_->Show();
slide_animation_->SetCurrentValue(0);
slide_animation_->Start();
}
void StopAnimation() { AnimationCanceled(slide_animation_.get()); }
......@@ -272,7 +272,7 @@ class TabHoverCardBubbleView::WidgetSlideAnimationDelegate
}
TabHoverCardBubbleView* const bubble_delegate_;
std::unique_ptr<gfx::SlideAnimation> slide_animation_;
std::unique_ptr<gfx::LinearAnimation> slide_animation_;
views::View* desired_anchor_view_ = nullptr;
gfx::Rect starting_bubble_bounds_;
gfx::Rect target_bubble_bounds_;
......
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