From 5964e2682f6d392d82752c0760deb30633059a47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Bostr=C3=B6m?= Date: Tue, 4 Dec 2018 19:19:49 +0000 Subject: [PATCH] Reset tab-icon animations for loading -> waiting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevents showing earlier favicon from the earlier page load that did not finish (was still at loading). Also allows the favicon of the new page load to fade in. Bug: chromium:907642, chromium:910848 Change-Id: I65fb44b7f432d5a0f4cd484f5a497f9b8a327c62 Reviewed-on: https://chromium-review.googlesource.com/c/1361282 Reviewed-by: Sidney San Martín Commit-Queue: Peter Boström Cr-Commit-Position: refs/heads/master@{#613631} --- chrome/browser/ui/views/tabs/tab_icon.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/chrome/browser/ui/views/tabs/tab_icon.cc b/chrome/browser/ui/views/tabs/tab_icon.cc index 133d1b47e03edc..515abc887049e4 100644 --- a/chrome/browser/ui/views/tabs/tab_icon.cc +++ b/chrome/browser/ui/views/tabs/tab_icon.cc @@ -475,8 +475,10 @@ void TabIcon::SetNetworkState(TabNetworkState network_state, bool was_animated = NetworkStateIsAnimated(old_state); bool is_animated = NetworkStateIsAnimated(network_state_); - if (!was_animated && is_animated) { - // Reset all animations. + // If we either start animating (or from loading to waiting), reset all + // animations. + if ((!was_animated && is_animated) || + network_state_ == TabNetworkState::kWaiting) { last_animation_update_time_ = clock_->NowTicks(); pending_animation_state_ = LoadingAnimationState(); pending_animation_state_.favicon_fade_in_progress.reset();