Bug 1170680 - Do not add non-animated images to the visible list in response to UNLOCKED_DRAW. r=tn

This commit is contained in:
Seth Fowler 2015-06-02 18:29:50 -07:00
parent d8aaae69e5
commit f733fb66a3
2 changed files with 29 additions and 1 deletions

View File

@ -302,6 +302,25 @@ nsImageLoadingContent::OnLoadComplete(imgIRequest* aRequest, nsresult aStatus)
return NS_OK;
}
static bool
ImageIsAnimated(imgIRequest* aRequest)
{
if (!aRequest) {
return false;
}
nsCOMPtr<imgIContainer> image;
if (NS_SUCCEEDED(aRequest->GetImage(getter_AddRefs(image)))) {
bool isAnimated = false;
nsresult rv = image->GetAnimated(&isAnimated);
if (NS_SUCCEEDED(rv) && isAnimated) {
return true;
}
}
return false;
}
void
nsImageLoadingContent::OnUnlockedDraw()
{
@ -310,6 +329,15 @@ nsImageLoadingContent::OnUnlockedDraw()
return;
}
// It's OK for non-animated images to wait until the next image visibility
// update to become locked. (And that's preferable, since in the case of
// scrolling it keeps memory usage minimal.) For animated images, though, we
// want to mark them visible right away so we can call
// IncrementAnimationConsumers() on them and they'll start animating.
if (!ImageIsAnimated(mCurrentRequest) && !ImageIsAnimated(mPendingRequest)) {
return;
}
nsPresContext* presContext = GetFramePresContext();
if (!presContext)
return;

View File

@ -1,4 +1,4 @@
== bug-364968.html bug-364968-ref.html
random == bug-364968.html bug-364968-ref.html
== bug-463204.html bug-463204-ref.html
fails-if(Android&&AndroidVersion<15&&AndroidVersion!=10) == canvas-outside-document.html canvas-inside-document.html
== mozsetimageelement-01.html mozsetimageelement-01-ref.html