Only resize to (0,0) when we know we have no new image. Bug 270517, r+sr=dbaron

This commit is contained in:
bzbarsky%mit.edu 2005-02-04 17:39:43 +00:00
Родитель b7cf0124a5
Коммит 2438b1f0de
1 изменённых файлов: 15 добавлений и 3 удалений

Просмотреть файл

@ -332,7 +332,6 @@ nsImageBoxFrame::UpdateImage()
if (mImageRequest) {
mImageRequest->Cancel(NS_ERROR_FAILURE);
mImageRequest = nsnull;
mIntrinsicSize.SizeTo(0, 0);
}
// get the new image src
@ -370,6 +369,11 @@ nsImageBoxFrame::UpdateImage()
}
}
}
if (!mImageRequest) {
// We have no image, so size to 0
mIntrinsicSize.SizeTo(0, 0);
}
}
void
@ -610,11 +614,19 @@ NS_IMETHODIMP nsImageBoxFrame::OnStopDecode(imgIRequest *request,
nsresult aStatus,
const PRUnichar *statusArg)
{
// XXXbz this is firing DOM events possibly from inside style resolution!
// See the nsImageLoadingContent code for how this should be done
// asynchronously.
if (NS_SUCCEEDED(aStatus))
// Fire an onerror DOM event.
// Fire an onload DOM event.
FireDOMEvent(mContent, NS_IMAGE_LOAD);
else // Fire an onload DOM event.
else {
// Fire an onerror DOM event.
mIntrinsicSize.SizeTo(0, 0);
nsBoxLayoutState state(GetPresContext());
MarkDirty(state);
FireDOMEvent(mContent, NS_IMAGE_ERROR);
}
return NS_OK;
}