Bug 964187. When the frame for an image is destroyed remove it from the list of visible images. r=mats

This prevents us from holding onto the image but also doesn't create any more chance that it will be discarded if the frame comes back right away (ie a frame reconstruct, or moving it around in the DOM tree).
This commit is contained in:
Timothy Nikkel 2014-04-15 00:24:01 -05:00
parent a83e221e77
commit 1dc0090222

View File

@ -466,14 +466,15 @@ nsImageLoadingContent::FrameDestroyed(nsIFrame* aFrame)
mFrameCreateCalled = false;
// We need to make sure that our image request is deregistered.
nsPresContext* presContext = GetFramePresContext();
if (mCurrentRequest) {
nsLayoutUtils::DeregisterImageRequest(GetFramePresContext(),
nsLayoutUtils::DeregisterImageRequest(presContext,
mCurrentRequest,
&mCurrentRequestRegistered);
}
if (mPendingRequest) {
nsLayoutUtils::DeregisterImageRequest(GetFramePresContext(),
nsLayoutUtils::DeregisterImageRequest(presContext,
mPendingRequest,
&mPendingRequestRegistered);
}
@ -481,6 +482,11 @@ nsImageLoadingContent::FrameDestroyed(nsIFrame* aFrame)
UntrackImage(mCurrentRequest);
UntrackImage(mPendingRequest);
nsIPresShell* presShell = presContext ? presContext->PresShell() : nullptr;
if (presShell) {
presShell->RemoveImageFromVisibleList(this);
}
if (aFrame->HasAnyStateBits(NS_FRAME_IN_POPUP)) {
// We assume all images in popups are visible, so this decrement balances
// out the increment in FrameCreated above.