Fixed a problem where loading an image into second browser window was not updating the dimensions. Also added temporary code to put the image type in the title, even though the image type is not really accurate yet. b=24478 r=dcone

git-svn-id: svn://10.0.0.236/trunk@63177 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
attinasi%netscape.com
2000-03-16 22:58:12 +00:00
parent f4df672a66
commit 71ee99d1fa
2 changed files with 52 additions and 12 deletions

View File

@@ -74,8 +74,8 @@ public:
void StartLayout();
nsIImageRequest* mImageRequest;
nscolor mBlack;
nsIImageRequest* mImageRequest;
nscolor mBlack;
};
//----------------------------------------------------------------------
@@ -131,10 +131,13 @@ NS_IMETHODIMP
ImageListener::OnStopRequest(nsIChannel* channel, nsISupports *ctxt,
nsresult status, const PRUnichar *errorMsg)
{
if(mDocument){
mDocument->EndLayout(ctxt, status, errorMsg);
}
if (nsnull == mNextStream) {
return NS_ERROR_FAILURE;
}
mDocument->EndLayout(ctxt, status, errorMsg);
return mNextStream->OnStopRequest(channel, ctxt, status, errorMsg);
}
@@ -338,10 +341,27 @@ nsImageDocument::EndLayout(nsISupports *ctxt,
nsresult nsImageDocument::UpdateTitle( void )
{
nsString titleStr;
// get the title from the Document (in case there was a previously set title )
GetTitle( titleStr );
// XXX TEMPORARY XXX
// We want to display the image type, however there is no way to right now
// so instead we just get the image-extension
// - get the URL interface, get the extension, convert to upper-case
// Unless the Imagerequest or Image can tell us the type this is the best we can do.
nsIURL *pURL=nsnull;
if(NS_SUCCEEDED(mDocumentURL->QueryInterface(nsIURL::GetIID(),(void **)&pURL))){
char *pExtension=nsnull;
pURL->GetFileExtension(&pExtension);
if(pExtension){
nsString strExt(pExtension);
strExt.ToUpperCase();
titleStr.Append(strExt);
nsCRT::free(pExtension);
pExtension=nsnull;
}
NS_IF_RELEASE(pURL);
}
// append the image information...
titleStr.Append( "Image" );
titleStr.Append( " Image" );
if (mImageRequest) {
PRUint32 width, height;
mImageRequest->GetNaturalDimensions(&width, &height);