Bug 716140 - Explicitly record whether an image is animated. r=seth
--- a/image/src/imgStatusTracker.cpp
+++ b/image/src/imgStatusTracker.cpp
@@ -382,22 +382,18 @@ imgStatusTracker::SyncNotify(imgRequestP
// least one frame) then send OnFrameUpdate.
if (!r.IsEmpty())
proxy->OnFrameUpdate(&r);
if (mState & stateFrameStopped)
proxy->OnStopFrame();
// OnImageIsAnimated
- bool isAnimated = false;
-
- nsresult rv = mImage->GetAnimated(&isAnimated);
- if (NS_SUCCEEDED(rv) && isAnimated) {
+ if (mState & stateImageIsAnimated)
proxy->OnImageIsAnimated();
- }
}
if (mState & stateDecodeStopped) {
NS_ABORT_IF_FALSE(mImage, "stopped decoding without ever having an image?");
proxy->OnStopDecode();
}
if (mState & stateRequestStopped) {
@@ -563,48 +559,46 @@ imgStatusTracker::RecordDiscard()
// Clear the status bits we no longer deserve.
uint32_t statusBitsToClear = imgIRequest::STATUS_DECODE_STARTED |
imgIRequest::STATUS_FRAME_COMPLETE |
imgIRequest::STATUS_DECODE_COMPLETE;
mImageStatus &= ~statusBitsToClear;
}
void
+imgStatusTracker::SendDiscard(imgRequestProxy* aProxy)
+{
+ if (!aProxy->NotificationsDeferred())
+ aProxy->OnDiscard();
+}
+
+
+void
imgStatusTracker::RecordUnlockedDraw()
{
NS_ABORT_IF_FALSE(mImage,
"RecordUnlockedDraw called before we have an Image");
}
void
+imgStatusTracker::RecordImageIsAnimated()
+{
+ NS_ABORT_IF_FALSE(mImage,
+ "RecordImageIsAnimated called before we have an Image");
+ mImageStatus |= stateImageIsAnimated;
+}
+
+void
imgStatusTracker::SendImageIsAnimated(imgRequestProxy* aProxy)
{
if (!aProxy->NotificationsDeferred())
aProxy->OnImageIsAnimated();
}
void
-imgStatusTracker::RecordImageIsAnimated()
-{
- NS_ABORT_IF_FALSE(mImage,
- "RecordImageIsAnimated called before we have an Image");
- // No bookkeeping necessary here - once decoding is complete, GetAnimated()
- // will accurately return that this is an animated image. Until that time,
- // the OnImageIsAnimated notification is the only indication an observer
- // will have that an image has more than 1 frame.
-}
-
-void
-imgStatusTracker::SendDiscard(imgRequestProxy* aProxy)
-{
- if (!aProxy->NotificationsDeferred())
- aProxy->OnDiscard();
-}
-
-void
imgStatusTracker::SendUnlockedDraw(imgRequestProxy* aProxy)
{
if (!aProxy->NotificationsDeferred())
aProxy->OnUnlockedDraw();
}
void
imgStatusTracker::RecordFrameChanged(const nsIntRect* aDirtyRect)
--- a/image/src/imgStatusTracker.h
+++ b/image/src/imgStatusTracker.h
@@ -30,17 +30,18 @@ class Image;
enum {
stateRequestStarted = 1u << 0,
stateHasSize = 1u << 1,
stateDecodeStarted = 1u << 2,
stateDecodeStopped = 1u << 3,
stateFrameStopped = 1u << 4,
stateRequestStopped = 1u << 5,
- stateBlockingOnload = 1u << 6
+ stateBlockingOnload = 1u << 6,
+ stateImageIsAnimated = 1u << 7
};
/*
* The image status tracker is a class that encapsulates all the loading and
* decoding status about an Image, and makes it possible to send notifications
* to imgRequestProxys, both synchronously (i.e., the status now) and
* asynchronously (the status later).
*