mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
removing lowsrc support. bug 92453. r=jag sr=attinasi
This commit is contained in:
parent
967ae55864
commit
3f7d7f9384
@ -205,7 +205,6 @@ HTML_ATOM(legend, "legend")
|
||||
HTML_ATOM(legendContentPseudo, ":legend-content")
|
||||
HTML_ATOM(length, "length")
|
||||
HTML_ATOM(longdesc, "longdesc")
|
||||
HTML_ATOM(lowsrc, "lowsrc")
|
||||
HTML_ATOM(map, "map")
|
||||
HTML_ATOM(marginheight, "marginheight")
|
||||
HTML_ATOM(marginwidth, "marginwidth")
|
||||
|
@ -252,7 +252,6 @@ nsHTMLImageElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, LowSrc, lowsrc)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Name, name)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Align, align)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Alt, alt)
|
||||
@ -260,7 +259,6 @@ NS_IMPL_INT_ATTR(nsHTMLImageElement, Border, border)
|
||||
NS_IMPL_INT_ATTR(nsHTMLImageElement, Hspace, hspace)
|
||||
NS_IMPL_BOOL_ATTR(nsHTMLImageElement, IsMap, ismap)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, LongDesc, longdesc)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Lowsrc, lowsrc)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, UseMap, usemap)
|
||||
NS_IMPL_INT_ATTR(nsHTMLImageElement, Vspace, vspace)
|
||||
|
||||
|
@ -205,7 +205,6 @@ HTML_ATOM(legend, "legend")
|
||||
HTML_ATOM(legendContentPseudo, ":legend-content")
|
||||
HTML_ATOM(length, "length")
|
||||
HTML_ATOM(longdesc, "longdesc")
|
||||
HTML_ATOM(lowsrc, "lowsrc")
|
||||
HTML_ATOM(map, "map")
|
||||
HTML_ATOM(marginheight, "marginheight")
|
||||
HTML_ATOM(marginwidth, "marginwidth")
|
||||
|
@ -1024,7 +1024,6 @@ nsWebBrowserPersist::OnWalkDOMNode(nsIDOMNode *aNode, PRBool *aAbort)
|
||||
if (nodeAsImage)
|
||||
{
|
||||
StoreURIAttribute(aNode, "src");
|
||||
StoreURIAttribute(aNode, "lowsrc");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1134,7 +1133,6 @@ nsWebBrowserPersist::CloneNodeWithFixedUpURIAttributes(
|
||||
aNodeIn->CloneNode(PR_FALSE, aNodeOut);
|
||||
FixupAnchor(*aNodeOut);
|
||||
FixupNodeAttribute(*aNodeOut, "src");
|
||||
FixupNodeAttribute(*aNodeOut, "lowsrc");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -139,12 +139,9 @@ nsImageFrame::GetImageLoad(imgIRequest *aRequest)
|
||||
return 0;
|
||||
else if (aRequest == mLoads[1].mRequest)
|
||||
return 1;
|
||||
else if (aRequest == mLoads[2].mRequest)
|
||||
return 2;
|
||||
|
||||
NS_ASSERTION((aRequest == mLoads[0].mRequest &&
|
||||
aRequest == mLoads[1].mRequest &&
|
||||
aRequest == mLoads[2].mRequest), "Failure to figure out which imgIRequest this is!");
|
||||
aRequest == mLoads[1].mRequest), "Failure to figure out which imgIRequest this is!");
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -226,7 +223,7 @@ nsImageFrame::Destroy(nsIPresContext* aPresContext)
|
||||
NS_RELEASE(mImageMap);
|
||||
}
|
||||
|
||||
for (int i=0; i != 3; ++i) {
|
||||
for (int i=0; i != 2; ++i) {
|
||||
if (mLoads[i].mRequest) {
|
||||
mLoads[i].mRequest->Cancel(NS_ERROR_FAILURE);
|
||||
mLoads[i].mRequest = nsnull;
|
||||
@ -270,16 +267,6 @@ nsImageFrame::Init(nsIPresContext* aPresContext,
|
||||
NS_IF_RELEASE(tag);
|
||||
}
|
||||
|
||||
nsAutoString lowSrc;
|
||||
nsresult lowSrcResult;
|
||||
lowSrcResult = mContent->GetAttr(kNameSpaceID_HTML, nsHTMLAtoms::lowsrc, lowSrc);
|
||||
|
||||
// Set the image loader's source URL and base URL
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == lowSrcResult && !lowSrc.IsEmpty()) {
|
||||
mLoads[1].mRequest = do_CreateInstance("@mozilla.org/image/request;1");
|
||||
LoadImage(lowSrc, aPresContext, mLoads[1].mRequest);
|
||||
}
|
||||
|
||||
mInitialLoadCompleted = PR_FALSE;
|
||||
mCanSendLoadEvent = PR_TRUE;
|
||||
|
||||
@ -557,13 +544,13 @@ NS_IMETHODIMP nsImageFrame::OnStopDecode(imgIRequest *aRequest, nsIPresContext *
|
||||
mLoads[0].mRequest->Cancel(NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
mLoads[0].mRequest = mLoads[2].mRequest;
|
||||
mLoads[0].mIntrinsicSize = mLoads[2].mIntrinsicSize;
|
||||
mLoads[0].mRequest = mLoads[1].mRequest;
|
||||
mLoads[0].mIntrinsicSize = mLoads[1].mIntrinsicSize;
|
||||
// XXX i don't think we always want to set this.
|
||||
mLoads[0].mTransform = mLoads[2].mTransform;
|
||||
mLoads[0].mTransform = mLoads[1].mTransform;
|
||||
struct ImageLoad *load= &mLoads[0];
|
||||
|
||||
mLoads[2].mRequest = nsnull;
|
||||
mLoads[1].mRequest = nsnull;
|
||||
|
||||
if (!mSizeConstrained && (mLoads[0].mIntrinsicSize != mIntrinsicSize)) {
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
@ -582,28 +569,18 @@ NS_IMETHODIMP nsImageFrame::OnStopDecode(imgIRequest *aRequest, nsIPresContext *
|
||||
}
|
||||
|
||||
} else {
|
||||
mLoads[2].mRequest = nsnull;
|
||||
mLoads[1].mRequest = nsnull;
|
||||
}
|
||||
|
||||
} else if (NS_FAILED(aStatus)) {
|
||||
PRBool lowFailed = PR_FALSE;
|
||||
PRBool imageFailed = PR_FALSE;
|
||||
|
||||
// One of the two images didn't load, which one?
|
||||
if (whichLoad == 0 || !mLoads[0].mRequest) {
|
||||
imageFailed = PR_TRUE;
|
||||
}
|
||||
|
||||
if (whichLoad == 1 || !mLoads[1].mRequest) {
|
||||
lowFailed = PR_TRUE;
|
||||
}
|
||||
|
||||
if (imageFailed && lowFailed)
|
||||
imageFailedToLoad = PR_TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// if src failed and there is no lowsrc
|
||||
// or both failed to load, then notify the PresShell
|
||||
// if src failed then notify the PresShell
|
||||
if (imageFailedToLoad && presShell) {
|
||||
if (mFailureReplace) {
|
||||
nsAutoString usemap;
|
||||
@ -1071,11 +1048,8 @@ nsImageFrame::Paint(nsIPresContext* aPresContext,
|
||||
mLoads[0].mRequest->GetImage(getter_AddRefs(imgCon));
|
||||
mLoads[0].mRequest->GetImageStatus(&loadStatus);
|
||||
}
|
||||
if (mLoads[1].mRequest) {
|
||||
mLoads[1].mRequest->GetImage(getter_AddRefs(lowImgCon));
|
||||
}
|
||||
|
||||
if (loadStatus & imgIRequest::STATUS_ERROR || !(imgCon || lowImgCon)) {
|
||||
if (loadStatus & imgIRequest::STATUS_ERROR || !imgCon) {
|
||||
// No image yet, or image load failed. Draw the alt-text and an icon
|
||||
// indicating the status
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer &&
|
||||
@ -1509,12 +1483,19 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext,
|
||||
mCanSendLoadEvent = PR_TRUE;
|
||||
}
|
||||
|
||||
if (mLoads[2].mRequest) {
|
||||
mLoads[2].mRequest->Cancel(NS_ERROR_FAILURE);
|
||||
mLoads[2].mRequest = nsnull;
|
||||
if (mLoads[1].mRequest) {
|
||||
mLoads[1].mRequest->Cancel(NS_ERROR_FAILURE);
|
||||
mLoads[1].mRequest = nsnull;
|
||||
}
|
||||
mLoads[2].mRequest = do_CreateInstance("@mozilla.org/image/request;1");
|
||||
LoadImage(newSRC, aPresContext, mLoads[2].mRequest);
|
||||
|
||||
nsCOMPtr<imgIRequest> req(do_CreateInstance("@mozilla.org/image/request;1"));
|
||||
if (!mLoads[0].mRequest) {
|
||||
mLoads[0].mRequest = req;
|
||||
} else {
|
||||
mLoads[1].mRequest = req;
|
||||
}
|
||||
|
||||
LoadImage(newSRC, aPresContext, req);
|
||||
}
|
||||
else if (nsHTMLAtoms::width == aAttribute || nsHTMLAtoms::height == aAttribute)
|
||||
{ // XXX: could check for new width == old width, and make that a no-op
|
||||
|
@ -224,11 +224,10 @@ private:
|
||||
|
||||
/**
|
||||
* 0 is the current image being displayed on the screen.
|
||||
* 1 is for the lowsrc image if any.
|
||||
* 2 is for attribute changed images.
|
||||
* when the load from 2 completes, it will replace 0.
|
||||
* 1 is for attribute changed images.
|
||||
* when the load from 1 completes, it will replace 0.
|
||||
*/
|
||||
struct ImageLoad mLoads[3];
|
||||
struct ImageLoad mLoads[2];
|
||||
|
||||
nsSize mComputedSize;
|
||||
nsSize mIntrinsicSize;
|
||||
|
@ -139,12 +139,9 @@ nsImageFrame::GetImageLoad(imgIRequest *aRequest)
|
||||
return 0;
|
||||
else if (aRequest == mLoads[1].mRequest)
|
||||
return 1;
|
||||
else if (aRequest == mLoads[2].mRequest)
|
||||
return 2;
|
||||
|
||||
NS_ASSERTION((aRequest == mLoads[0].mRequest &&
|
||||
aRequest == mLoads[1].mRequest &&
|
||||
aRequest == mLoads[2].mRequest), "Failure to figure out which imgIRequest this is!");
|
||||
aRequest == mLoads[1].mRequest), "Failure to figure out which imgIRequest this is!");
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -226,7 +223,7 @@ nsImageFrame::Destroy(nsIPresContext* aPresContext)
|
||||
NS_RELEASE(mImageMap);
|
||||
}
|
||||
|
||||
for (int i=0; i != 3; ++i) {
|
||||
for (int i=0; i != 2; ++i) {
|
||||
if (mLoads[i].mRequest) {
|
||||
mLoads[i].mRequest->Cancel(NS_ERROR_FAILURE);
|
||||
mLoads[i].mRequest = nsnull;
|
||||
@ -270,16 +267,6 @@ nsImageFrame::Init(nsIPresContext* aPresContext,
|
||||
NS_IF_RELEASE(tag);
|
||||
}
|
||||
|
||||
nsAutoString lowSrc;
|
||||
nsresult lowSrcResult;
|
||||
lowSrcResult = mContent->GetAttr(kNameSpaceID_HTML, nsHTMLAtoms::lowsrc, lowSrc);
|
||||
|
||||
// Set the image loader's source URL and base URL
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == lowSrcResult && !lowSrc.IsEmpty()) {
|
||||
mLoads[1].mRequest = do_CreateInstance("@mozilla.org/image/request;1");
|
||||
LoadImage(lowSrc, aPresContext, mLoads[1].mRequest);
|
||||
}
|
||||
|
||||
mInitialLoadCompleted = PR_FALSE;
|
||||
mCanSendLoadEvent = PR_TRUE;
|
||||
|
||||
@ -557,13 +544,13 @@ NS_IMETHODIMP nsImageFrame::OnStopDecode(imgIRequest *aRequest, nsIPresContext *
|
||||
mLoads[0].mRequest->Cancel(NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
mLoads[0].mRequest = mLoads[2].mRequest;
|
||||
mLoads[0].mIntrinsicSize = mLoads[2].mIntrinsicSize;
|
||||
mLoads[0].mRequest = mLoads[1].mRequest;
|
||||
mLoads[0].mIntrinsicSize = mLoads[1].mIntrinsicSize;
|
||||
// XXX i don't think we always want to set this.
|
||||
mLoads[0].mTransform = mLoads[2].mTransform;
|
||||
mLoads[0].mTransform = mLoads[1].mTransform;
|
||||
struct ImageLoad *load= &mLoads[0];
|
||||
|
||||
mLoads[2].mRequest = nsnull;
|
||||
mLoads[1].mRequest = nsnull;
|
||||
|
||||
if (!mSizeConstrained && (mLoads[0].mIntrinsicSize != mIntrinsicSize)) {
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
@ -582,28 +569,18 @@ NS_IMETHODIMP nsImageFrame::OnStopDecode(imgIRequest *aRequest, nsIPresContext *
|
||||
}
|
||||
|
||||
} else {
|
||||
mLoads[2].mRequest = nsnull;
|
||||
mLoads[1].mRequest = nsnull;
|
||||
}
|
||||
|
||||
} else if (NS_FAILED(aStatus)) {
|
||||
PRBool lowFailed = PR_FALSE;
|
||||
PRBool imageFailed = PR_FALSE;
|
||||
|
||||
// One of the two images didn't load, which one?
|
||||
if (whichLoad == 0 || !mLoads[0].mRequest) {
|
||||
imageFailed = PR_TRUE;
|
||||
}
|
||||
|
||||
if (whichLoad == 1 || !mLoads[1].mRequest) {
|
||||
lowFailed = PR_TRUE;
|
||||
}
|
||||
|
||||
if (imageFailed && lowFailed)
|
||||
imageFailedToLoad = PR_TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// if src failed and there is no lowsrc
|
||||
// or both failed to load, then notify the PresShell
|
||||
// if src failed then notify the PresShell
|
||||
if (imageFailedToLoad && presShell) {
|
||||
if (mFailureReplace) {
|
||||
nsAutoString usemap;
|
||||
@ -1071,11 +1048,8 @@ nsImageFrame::Paint(nsIPresContext* aPresContext,
|
||||
mLoads[0].mRequest->GetImage(getter_AddRefs(imgCon));
|
||||
mLoads[0].mRequest->GetImageStatus(&loadStatus);
|
||||
}
|
||||
if (mLoads[1].mRequest) {
|
||||
mLoads[1].mRequest->GetImage(getter_AddRefs(lowImgCon));
|
||||
}
|
||||
|
||||
if (loadStatus & imgIRequest::STATUS_ERROR || !(imgCon || lowImgCon)) {
|
||||
if (loadStatus & imgIRequest::STATUS_ERROR || !imgCon) {
|
||||
// No image yet, or image load failed. Draw the alt-text and an icon
|
||||
// indicating the status
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer &&
|
||||
@ -1509,12 +1483,19 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext,
|
||||
mCanSendLoadEvent = PR_TRUE;
|
||||
}
|
||||
|
||||
if (mLoads[2].mRequest) {
|
||||
mLoads[2].mRequest->Cancel(NS_ERROR_FAILURE);
|
||||
mLoads[2].mRequest = nsnull;
|
||||
if (mLoads[1].mRequest) {
|
||||
mLoads[1].mRequest->Cancel(NS_ERROR_FAILURE);
|
||||
mLoads[1].mRequest = nsnull;
|
||||
}
|
||||
mLoads[2].mRequest = do_CreateInstance("@mozilla.org/image/request;1");
|
||||
LoadImage(newSRC, aPresContext, mLoads[2].mRequest);
|
||||
|
||||
nsCOMPtr<imgIRequest> req(do_CreateInstance("@mozilla.org/image/request;1"));
|
||||
if (!mLoads[0].mRequest) {
|
||||
mLoads[0].mRequest = req;
|
||||
} else {
|
||||
mLoads[1].mRequest = req;
|
||||
}
|
||||
|
||||
LoadImage(newSRC, aPresContext, req);
|
||||
}
|
||||
else if (nsHTMLAtoms::width == aAttribute || nsHTMLAtoms::height == aAttribute)
|
||||
{ // XXX: could check for new width == old width, and make that a no-op
|
||||
|
@ -224,11 +224,10 @@ private:
|
||||
|
||||
/**
|
||||
* 0 is the current image being displayed on the screen.
|
||||
* 1 is for the lowsrc image if any.
|
||||
* 2 is for attribute changed images.
|
||||
* when the load from 2 completes, it will replace 0.
|
||||
* 1 is for attribute changed images.
|
||||
* when the load from 1 completes, it will replace 0.
|
||||
*/
|
||||
struct ImageLoad mLoads[3];
|
||||
struct ImageLoad mLoads[2];
|
||||
|
||||
nsSize mComputedSize;
|
||||
nsSize mIntrinsicSize;
|
||||
|
Loading…
Reference in New Issue
Block a user