Skip to content

Commit 59f1e34

Browse files
jacobdufault-googleJacob Dufault
authored and
Jacob Dufault
committed
cros: Fix animation not displaying when switching between users
Only happens where there are 2+ users (ie, user list is used). OnImageDecoded is supposed to use the animation playback type that was set in SetAnimationEnabled. However, UpdateForUser calls SetImage which updates image_->playback() to kFirstFrameOnly. This means that OnImageDecoded cannot use image_->playback() as the playback type set by SetAnimationEnabled. [email protected] (cherry picked from commit 484a185) Bug: 894771 Change-Id: I47ac6daa1e8780e58abdabf59a7642ca4b9dcc43 Reviewed-on: https://chromium-review.googlesource.com/c/1277699 Reviewed-by: Wenzhao (Colin) Zang <[email protected]> Commit-Queue: Jacob Dufault <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#599731} Reviewed-on: https://chromium-review.googlesource.com/c/1287034 Reviewed-by: Jacob Dufault <[email protected]> Cr-Commit-Position: refs/branch-heads/3578@{#94} Cr-Branched-From: 4226ddf-refs/heads/master@{#599034}
1 parent c0225de commit 59f1e34

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

ash/login/ui/animated_rounded_image_view.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ class AnimatedRoundedImageView : public views::View {
4949
// Set playback type of the animation.
5050
void SetAnimationPlayback(Playback playback);
5151

52-
// Get the current type of animation playback.
53-
Playback playback() const { return playback_; }
54-
5552
// views::View:
5653
gfx::Size CalculatePreferredSize() const override;
5754
void OnPaint(gfx::Canvas* canvas) override;

ash/login/ui/login_user_view.cc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,11 @@ class LoginUserView::UserImage : public NonAccessibleView {
138138
}
139139

140140
void SetAnimationEnabled(bool enable) {
141+
animation_enabled_ = enable;
141142
image_->SetAnimationPlayback(
142-
enable ? AnimatedRoundedImageView::Playback::kRepeat
143-
: AnimatedRoundedImageView::Playback::kFirstFrameOnly);
143+
animation_enabled_
144+
? AnimatedRoundedImageView::Playback::kRepeat
145+
: AnimatedRoundedImageView::Playback::kFirstFrameOnly);
144146
}
145147

146148
private:
@@ -151,14 +153,16 @@ class LoginUserView::UserImage : public NonAccessibleView {
151153
return;
152154
}
153155

154-
// Don't change the playback style which was set in SetAnimationEnabled.
155156
image_->SetAnimationDecoder(
156157
std::make_unique<PassthroughAnimationDecoder>(animation),
157-
image_->playback());
158+
animation_enabled_
159+
? AnimatedRoundedImageView::Playback::kRepeat
160+
: AnimatedRoundedImageView::Playback::kFirstFrameOnly);
158161
}
159162

160163
AnimatedRoundedImageView* image_ = nullptr;
161-
int size_;
164+
int size_ = 0;
165+
bool animation_enabled_ = false;
162166

163167
base::WeakPtrFactory<UserImage> weak_factory_{this};
164168

0 commit comments

Comments
 (0)