mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
fixing bug 32269 r=bryner sr=scc
This commit is contained in:
parent
2674509b8b
commit
edf413392c
@ -111,7 +111,8 @@ NS_NewImageFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
|||||||
|
|
||||||
nsImageFrame::nsImageFrame() :
|
nsImageFrame::nsImageFrame() :
|
||||||
mIntrinsicSize(0, 0),
|
mIntrinsicSize(0, 0),
|
||||||
mGotInitialReflow(PR_FALSE)
|
mGotInitialReflow(PR_FALSE),
|
||||||
|
mFailureReplace(PR_TRUE)
|
||||||
{
|
{
|
||||||
// Size is constrained if we have a width and height.
|
// Size is constrained if we have a width and height.
|
||||||
// - Set in reflow in case the attributes are changed
|
// - Set in reflow in case the attributes are changed
|
||||||
@ -380,15 +381,16 @@ NS_IMETHODIMP nsImageFrame::OnStopDecode(imgIRequest *aRequest, nsIPresContext *
|
|||||||
|
|
||||||
// if src failed and there is no lowsrc
|
// if src failed and there is no lowsrc
|
||||||
// or both failed to load, then notify the PresShell
|
// or both failed to load, then notify the PresShell
|
||||||
if (imageFailedToLoad) {
|
if (imageFailedToLoad && presShell) {
|
||||||
if (presShell) {
|
if (mFailureReplace) {
|
||||||
nsAutoString usemap;
|
nsAutoString usemap;
|
||||||
mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::usemap, usemap);
|
mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::usemap, usemap);
|
||||||
// We failed to load the image. Notify the pres shell if we aren't an image map
|
// We failed to load the image. Notify the pres shell if we aren't an image map
|
||||||
if (usemap.IsEmpty()) {
|
if (usemap.IsEmpty()) {
|
||||||
presShell->CantRenderReplacedElement(aPresContext, this);
|
presShell->CantRenderReplacedElement(aPresContext, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mFailureReplace = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// After these DOM events are fired its possible that this frame may be deleted. As a result
|
// After these DOM events are fired its possible that this frame may be deleted. As a result
|
||||||
@ -1240,7 +1242,8 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||||||
mImageRequest->GetImageStatus(&loadStatus);
|
mImageRequest->GetImageStatus(&loadStatus);
|
||||||
|
|
||||||
if (!(loadStatus & imgIRequest::STATUS_SIZE_AVAILABLE)) {
|
if (!(loadStatus & imgIRequest::STATUS_SIZE_AVAILABLE)) {
|
||||||
if (mImageRequest) {
|
if (mImageRequest) {
|
||||||
|
mFailureReplace = PR_FALSE; // don't cause a CantRenderReplacedElement call
|
||||||
mImageRequest->Cancel(NS_ERROR_FAILURE);
|
mImageRequest->Cancel(NS_ERROR_FAILURE);
|
||||||
mImageRequest = nsnull;
|
mImageRequest = nsnull;
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,9 @@ protected:
|
|||||||
PRPackedBool mSizeConstrained;
|
PRPackedBool mSizeConstrained;
|
||||||
PRPackedBool mGotInitialReflow;
|
PRPackedBool mGotInitialReflow;
|
||||||
PRPackedBool mInitialLoadCompleted;
|
PRPackedBool mInitialLoadCompleted;
|
||||||
PRPackedBool mCanSendLoadEvent;
|
PRPackedBool mCanSendLoadEvent;
|
||||||
|
|
||||||
|
PRBool mFailureReplace;
|
||||||
|
|
||||||
nsMargin mBorderPadding;
|
nsMargin mBorderPadding;
|
||||||
PRUint32 mNaturalImageWidth,
|
PRUint32 mNaturalImageWidth,
|
||||||
|
@ -111,7 +111,8 @@ NS_NewImageFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
|||||||
|
|
||||||
nsImageFrame::nsImageFrame() :
|
nsImageFrame::nsImageFrame() :
|
||||||
mIntrinsicSize(0, 0),
|
mIntrinsicSize(0, 0),
|
||||||
mGotInitialReflow(PR_FALSE)
|
mGotInitialReflow(PR_FALSE),
|
||||||
|
mFailureReplace(PR_TRUE)
|
||||||
{
|
{
|
||||||
// Size is constrained if we have a width and height.
|
// Size is constrained if we have a width and height.
|
||||||
// - Set in reflow in case the attributes are changed
|
// - Set in reflow in case the attributes are changed
|
||||||
@ -380,15 +381,16 @@ NS_IMETHODIMP nsImageFrame::OnStopDecode(imgIRequest *aRequest, nsIPresContext *
|
|||||||
|
|
||||||
// if src failed and there is no lowsrc
|
// if src failed and there is no lowsrc
|
||||||
// or both failed to load, then notify the PresShell
|
// or both failed to load, then notify the PresShell
|
||||||
if (imageFailedToLoad) {
|
if (imageFailedToLoad && presShell) {
|
||||||
if (presShell) {
|
if (mFailureReplace) {
|
||||||
nsAutoString usemap;
|
nsAutoString usemap;
|
||||||
mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::usemap, usemap);
|
mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::usemap, usemap);
|
||||||
// We failed to load the image. Notify the pres shell if we aren't an image map
|
// We failed to load the image. Notify the pres shell if we aren't an image map
|
||||||
if (usemap.IsEmpty()) {
|
if (usemap.IsEmpty()) {
|
||||||
presShell->CantRenderReplacedElement(aPresContext, this);
|
presShell->CantRenderReplacedElement(aPresContext, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mFailureReplace = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// After these DOM events are fired its possible that this frame may be deleted. As a result
|
// After these DOM events are fired its possible that this frame may be deleted. As a result
|
||||||
@ -1240,7 +1242,8 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||||||
mImageRequest->GetImageStatus(&loadStatus);
|
mImageRequest->GetImageStatus(&loadStatus);
|
||||||
|
|
||||||
if (!(loadStatus & imgIRequest::STATUS_SIZE_AVAILABLE)) {
|
if (!(loadStatus & imgIRequest::STATUS_SIZE_AVAILABLE)) {
|
||||||
if (mImageRequest) {
|
if (mImageRequest) {
|
||||||
|
mFailureReplace = PR_FALSE; // don't cause a CantRenderReplacedElement call
|
||||||
mImageRequest->Cancel(NS_ERROR_FAILURE);
|
mImageRequest->Cancel(NS_ERROR_FAILURE);
|
||||||
mImageRequest = nsnull;
|
mImageRequest = nsnull;
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,9 @@ protected:
|
|||||||
PRPackedBool mSizeConstrained;
|
PRPackedBool mSizeConstrained;
|
||||||
PRPackedBool mGotInitialReflow;
|
PRPackedBool mGotInitialReflow;
|
||||||
PRPackedBool mInitialLoadCompleted;
|
PRPackedBool mInitialLoadCompleted;
|
||||||
PRPackedBool mCanSendLoadEvent;
|
PRPackedBool mCanSendLoadEvent;
|
||||||
|
|
||||||
|
PRBool mFailureReplace;
|
||||||
|
|
||||||
nsMargin mBorderPadding;
|
nsMargin mBorderPadding;
|
||||||
PRUint32 mNaturalImageWidth,
|
PRUint32 mNaturalImageWidth,
|
||||||
|
Loading…
Reference in New Issue
Block a user