Only resize to (0,0) when we know we have no new image. Bug 270517, r+sr=dbaron
git-svn-id: svn://10.0.0.236/trunk@168800 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user