Commit 77932dee authored by Matthew Porter's avatar Matthew Porter Committed by Chromium LUCI CQ

Have Tab Hover animations align with system settings

This change adds a check for the system animation setting prior to
animating.  This ensures when users explicitly opt into having no
animations, that we honor that preference.

Change-Id: I2a63a9ea40566932005a3e32b8ee061d9fc879a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2617199Reviewed-by: default avatarCaroline Rising <corising@chromium.org>
Commit-Queue: Matthew Porter <matt.porter@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#841585}
parent 28c852e2
......@@ -616,7 +616,9 @@ void TabHoverCardBubbleView::UpdateAndShow(Tab* tab) {
if (GetWidget()->IsVisible())
++hover_cards_seen_count_;
if (GetWidget()->IsVisible() && !disable_animations_for_testing_) {
const bool animations_enabled = gfx::Animation::ShouldRenderRichAnimation();
if (GetWidget()->IsVisible() && !disable_animations_for_testing_ &&
animations_enabled) {
slide_animation_delegate_->AnimateToAnchorView(tab);
} else {
if (!anchor_view_set)
......@@ -628,7 +630,8 @@ void TabHoverCardBubbleView::UpdateAndShow(Tab* tab) {
}
if (!GetWidget()->IsVisible()) {
if (disable_animations_for_testing_ || show_immediately) {
if (disable_animations_for_testing_ || show_immediately ||
!animations_enabled) {
GetWidget()->SetOpacity(1.0f);
GetWidget()->Show();
} else {
......@@ -652,7 +655,8 @@ void TabHoverCardBubbleView::FadeOutToHide() {
thumbnail_observation_->Observe(nullptr);
slide_animation_delegate_->StopAnimation();
last_visible_timestamp_ = base::TimeTicks::Now();
if (disable_animations_for_testing_) {
if (disable_animations_for_testing_ ||
!gfx::Animation::ShouldRenderRichAnimation()) {
GetWidget()->Hide();
} else {
fade_animation_delegate_->FadeOut();
......
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