From 5702c6bb2c43c1ab733feb9c489491d16f573f69 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Fri, 22 Apr 2022 09:00:42 +0000 Subject: [PATCH] Bug 1765116. Don't ignore any potential invalidation rect from calling UpdateState in FrameAnimator::ResetAnimation. r=aosmond I added this in bug 1676990, I'm not sure why I ignored the rect return value, probably should have either asserted it was empty if I thought that or dealt with the return value. Depends on D143894 Differential Revision: https://phabricator.services.mozilla.com/D143895 --- image/FrameAnimator.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/image/FrameAnimator.cpp b/image/FrameAnimator.cpp index f79582d701f0..f21877d81abe 100644 --- a/image/FrameAnimator.cpp +++ b/image/FrameAnimator.cpp @@ -338,7 +338,17 @@ void FrameAnimator::ResetAnimation(AnimationState& aState) { // Calling Reset on the surface of the animation can cause discarding surface // providers to throw out all their frames so refresh our state. - aState.UpdateState(mImage, mSize); + OrientedIntRect rect = + OrientedIntRect::FromUnknownRect(aState.UpdateState(mImage, mSize)); + + if (!rect.IsEmpty()) { + nsCOMPtr eventTarget = do_GetMainThread(); + RefPtr image = mImage; + nsCOMPtr ev = NS_NewRunnableFunction( + "FrameAnimator::ResetAnimation", + [=]() -> void { image->NotifyProgress(NoProgress, rect); }); + eventTarget->Dispatch(ev.forget(), NS_DISPATCH_NORMAL); + } } RefreshResult FrameAnimator::RequestRefresh(AnimationState& aState,