mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 791571: Keep track of whether or not an <img> is blocking onload to handle insertion/removal from the document. r=bz
This commit is contained in:
parent
923f1139b2
commit
5113ae2462
@ -574,6 +574,10 @@ nsImageLoadingContent::BlockOnload(imgIRequest* aRequest)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_ASSERTION(!(mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD),
|
||||
"Double BlockOnload!?");
|
||||
mCurrentRequestFlags |= REQUEST_BLOCKS_ONLOAD;
|
||||
|
||||
nsIDocument* doc = GetOurCurrentDoc();
|
||||
if (doc) {
|
||||
doc->BlockOnload();
|
||||
@ -589,6 +593,10 @@ nsImageLoadingContent::UnblockOnload(imgIRequest* aRequest)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_ASSERTION(mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD,
|
||||
"Double UnblockOnload!?");
|
||||
mCurrentRequestFlags &= ~REQUEST_BLOCKS_ONLOAD;
|
||||
|
||||
nsIDocument* doc = GetOurCurrentDoc();
|
||||
if (doc) {
|
||||
doc->UnblockOnload(false);
|
||||
@ -1167,6 +1175,9 @@ nsImageLoadingContent::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
aDocument->AddImage(mCurrentRequest);
|
||||
if (mPendingRequestFlags & REQUEST_SHOULD_BE_TRACKED)
|
||||
aDocument->AddImage(mPendingRequest);
|
||||
|
||||
if (mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD)
|
||||
aDocument->BlockOnload();
|
||||
}
|
||||
|
||||
void
|
||||
@ -1186,6 +1197,9 @@ nsImageLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
doc->RemoveImage(mCurrentRequest);
|
||||
if (mPendingRequestFlags & REQUEST_SHOULD_BE_TRACKED)
|
||||
doc->RemoveImage(mPendingRequest);
|
||||
|
||||
if (mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD)
|
||||
doc->UnblockOnload(false);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -325,7 +325,9 @@ protected:
|
||||
REQUEST_NEEDS_ANIMATION_RESET = 0x00000001U,
|
||||
// Set if the request should be tracked. This is true if the request is
|
||||
// not tracked iff this node is not in the document.
|
||||
REQUEST_SHOULD_BE_TRACKED = 0x00000002U
|
||||
REQUEST_SHOULD_BE_TRACKED = 0x00000002U,
|
||||
// Set if the request is blocking onload.
|
||||
REQUEST_BLOCKS_ONLOAD = 0x00000004U
|
||||
};
|
||||
|
||||
// If the image was blocked or if there was an error loading, it's nice to
|
||||
|
Loading…
Reference in New Issue
Block a user