bug 9796 r=timeless sr=tor a=asa

Viewing bad images gives bad feedback
This commit is contained in:
cbiesinger%web.de 2002-03-28 21:12:15 +00:00
Родитель a304e4bd02
Коммит 2cd5793471
2 изменённых файлов: 19 добавлений и 1 удалений

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

@ -21,6 +21,7 @@
*
* Contributor(s):
* Morten Nilsen <morten@nilsen.com>
* Christian Biesinger <cbiesinger@web.de>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -398,7 +399,21 @@ nsImageDocument::CreateSyntheticDocument()
nsHTMLValue val(src_string);
image->SetHTMLAttribute(nsHTMLAtoms::src, val, PR_FALSE);
image->SetHTMLAttribute(nsHTMLAtoms::alt, val, PR_FALSE);
// Create a stringbundle for localized error message
nsCOMPtr<nsIStringBundle> bundle;
nsCOMPtr<nsIStringBundleService> stringService =
do_GetService(kStringBundleServiceCID, &rv);
if (NS_SUCCEEDED(rv) && stringService)
rv = stringService->CreateBundle(NSIMAGEDOCUMENT_PROPERTIES_URI, getter_AddRefs(bundle));
if (NS_SUCCEEDED(rv) && bundle) {
const PRUnichar* formatString[1] = { src_string.get() };
nsXPIDLString errorMsg;
rv = bundle->FormatStringFromName(NS_LITERAL_STRING("InvalidImage").get(), formatString, 1, getter_Copies(errorMsg));
nsHTMLValue errorText(errorMsg);
image->SetHTMLAttribute(nsHTMLAtoms::alt, errorText, PR_FALSE);
}
root->AppendChildTo(body, PR_FALSE, PR_FALSE);
center->AppendChildTo(image, PR_FALSE, PR_FALSE);

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

@ -18,6 +18,7 @@
# Contributor(s):
# Blake Ross <blakeross@telocity.com> (Original Author)
# Morten Nilsen <morten@nilsen.com>
# Christian Biesinger <cbiesinger@web.de>
#LOCALIZATION NOTE (ImageTitleWithDimensionsAndFile): first %S is filename, second %S is type, third %S is width and fourth %S is height
#LOCALIZATION NOTE (ImageTitleWithoutDimensions): first %S is filename, second %S is type
@ -27,3 +28,5 @@ ImageTitleWithDimensionsAndFile=%S (%S Image, %Sx%S pixels)
ImageTitleWithoutDimensions=%S (%S Image)
ImageTitleWithDimensions=(%S Image, %Sx%S pixels)
ImageTitleWithNeitherDimensionsNorFile=(%S Image)
InvalidImage=The image \u201c%S\u201d cannot be displayed, because it contains errors.