Partial fix for bug 5707. We now set the title of the image to "Image: width x height pixels", where width and height are the dimensions of the image being displayed. This title is set from nsImageDocument::EndLayout() a newly added method that gets called from nsImageListener::StopRequest().

This commit is contained in:
nisheeth%netscape.com 1999-07-07 07:31:24 +00:00
Родитель 7612a810e6
Коммит 9a9455daeb
2 изменённых файлов: 70 добавлений и 0 удалений

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

@ -65,6 +65,15 @@ public:
nsresult CreateSyntheticDocument();
nsresult StartImageLoad(nsIURI* aURL, nsIStreamListener*& aListener);
#ifdef NECKO
nsresult EndLayout(nsISupports *ctxt,
nsresult status,
const PRUnichar *errorMsg);
#else
nsresult EndLayout(nsIURI* aURL,
nsresult aStatus,
const PRUnichar* aMsg);
#endif
void StartLayout();
@ -182,8 +191,10 @@ ImageListener::OnStopRequest(nsIURI* aURL, nsresult aStatus,
return NS_ERROR_FAILURE;
}
#ifdef NECKO
mDocument->EndLayout(ctxt, status, errorMsg);
return mNextStream->OnStopRequest(ctxt, status, errorMsg);
#else
mDocument->EndLayout(aURL, aStatus, aMsg);
return mNextStream->OnStopRequest(aURL, aStatus, aMsg);
#endif
}
@ -402,3 +413,27 @@ nsImageDocument::StartLayout()
}
}
}
nsresult
#ifdef NECKO
nsImageDocument::EndLayout(nsISupports *ctxt,
nsresult status,
const PRUnichar *errorMsg)
#else
nsImageDocument::EndLayout(nsIURI* aURL,
nsresult aStatus,
const PRUnichar* aMsg)
#endif
{
nsString titleStr = "Image ";
if (mImageRequest) {
PRUint32 width, height;
mImageRequest->GetNaturalDimensions(&width, &height);
titleStr.Append((PRInt32)width);
titleStr.Append("x");
titleStr.Append((PRInt32)height);
titleStr.Append(" pixels ");
}
SetTitle(titleStr);
return NS_OK;
}

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

@ -65,6 +65,15 @@ public:
nsresult CreateSyntheticDocument();
nsresult StartImageLoad(nsIURI* aURL, nsIStreamListener*& aListener);
#ifdef NECKO
nsresult EndLayout(nsISupports *ctxt,
nsresult status,
const PRUnichar *errorMsg);
#else
nsresult EndLayout(nsIURI* aURL,
nsresult aStatus,
const PRUnichar* aMsg);
#endif
void StartLayout();
@ -182,8 +191,10 @@ ImageListener::OnStopRequest(nsIURI* aURL, nsresult aStatus,
return NS_ERROR_FAILURE;
}
#ifdef NECKO
mDocument->EndLayout(ctxt, status, errorMsg);
return mNextStream->OnStopRequest(ctxt, status, errorMsg);
#else
mDocument->EndLayout(aURL, aStatus, aMsg);
return mNextStream->OnStopRequest(aURL, aStatus, aMsg);
#endif
}
@ -402,3 +413,27 @@ nsImageDocument::StartLayout()
}
}
}
nsresult
#ifdef NECKO
nsImageDocument::EndLayout(nsISupports *ctxt,
nsresult status,
const PRUnichar *errorMsg)
#else
nsImageDocument::EndLayout(nsIURI* aURL,
nsresult aStatus,
const PRUnichar* aMsg)
#endif
{
nsString titleStr = "Image ";
if (mImageRequest) {
PRUint32 width, height;
mImageRequest->GetNaturalDimensions(&width, &height);
titleStr.Append((PRInt32)width);
titleStr.Append("x");
titleStr.Append((PRInt32)height);
titleStr.Append(" pixels ");
}
SetTitle(titleStr);
return NS_OK;
}