зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
7612a810e6
Коммит
9a9455daeb
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче