Bug 1612649 - Call UpdateImageState in SetDeferredLoad to start with not broken state for lazy load images. r=emilio

So that we can generate nsImageFrame for lazy load image elements in the first
place.

Differential Revision: https://phabricator.services.mozilla.com/D61942
This commit is contained in:
Hiroyuki Ikezoe
2020-02-15 08:45:27 +00:00
parent 639555d28e
commit 45077c0f66
9 changed files with 94 additions and 15 deletions

View File

@@ -106,6 +106,7 @@ nsImageLoadingContent::nsImageLoadingContent()
mSuppressed(false),
mNewRequestsWillNeedAnimationReset(false),
mUseUrgentStartForChannel(false),
mLazyLoading(false),
mStateChangerDepth(0),
mCurrentRequestRegistered(false),
mPendingRequestRegistered(false),
@@ -1303,9 +1304,12 @@ void nsImageLoadingContent::UpdateImageState(bool aNotify) {
} else if (mImageBlockingStatus == nsIContentPolicy::REJECT_TYPE) {
mUserDisabled = true;
} else if (!mCurrentRequest) {
// No current request means error, since we weren't disabled or suppressed
mBroken = true;
RejectDecodePromises(NS_ERROR_DOM_IMAGE_BROKEN);
if (!mLazyLoading) {
// In case of non-lazy loading, no current request means error, since we
// weren't disabled or suppressed
mBroken = true;
RejectDecodePromises(NS_ERROR_DOM_IMAGE_BROKEN);
}
} else {
uint32_t currentLoadStatus;
nsresult rv = mCurrentRequest->GetImageStatus(&currentLoadStatus);