virtual void Notify(int32_t aType, const nsIntRect* aRect = nullptr) override { if (!mImage) { // We've already finished observing the last image we were given. return; } if (aType == imgINotificationObserver::FRAME_COMPLETE) { FinishObserving(); } }
virtual void OnLoadComplete(bool aLastPart) override { if (!mImage) { // We've already finished observing the last image we were given. return; } // If there's already an error, we may never get a FRAME_COMPLETE // notification, so go ahead and notify our owner right away. nsRefPtr<ProgressTracker> tracker = mImage->GetProgressTracker(); if (tracker->GetProgress() & FLAG_HAS_ERROR) { FinishObserving(); } }
virtual void OnLoadComplete(bool aLastPart) override { if (!mImage) { // We've already finished observing the last image we were given. return; } // Retrieve the image's intrinsic size. int32_t width = 0; int32_t height = 0; mImage->GetWidth(&width); mImage->GetHeight(&height); // Request decoding at the intrinsic size. mImage->RequestDecodeForSize(IntSize(width, height), imgIContainer::DECODE_FLAGS_DEFAULT); // If there's already an error, we may never get a FRAME_COMPLETE // notification, so go ahead and notify our owner right away. RefPtr<ProgressTracker> tracker = mImage->GetProgressTracker(); if (tracker->GetProgress() & FLAG_HAS_ERROR) { FinishObserving(); } }