зеркало из https://github.com/mozilla/gecko-dev.git
Bug 837373 - Check for valid favicon before scaling it. r=mfinkle
This commit is contained in:
Родитель
58c421702e
Коммит
4bf7afcf81
|
@ -309,7 +309,7 @@ public class Favicons {
|
||||||
String storedFaviconUrl = getFaviconUrlForPageUrl(mPageUrl);
|
String storedFaviconUrl = getFaviconUrlForPageUrl(mPageUrl);
|
||||||
if (storedFaviconUrl != null && storedFaviconUrl.equals(mFaviconUrl)) {
|
if (storedFaviconUrl != null && storedFaviconUrl.equals(mFaviconUrl)) {
|
||||||
image = loadFaviconFromDb();
|
image = loadFaviconFromDb();
|
||||||
if (image != null)
|
if (image != null && image.getWidth() > 0 && image.getHeight() > 0)
|
||||||
return scaleImage(image);
|
return scaleImage(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -804,7 +804,7 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Bitmap favicon = BitmapFactory.decodeByteArray(b, 0, b.length);
|
Bitmap favicon = BitmapFactory.decodeByteArray(b, 0, b.length);
|
||||||
if (favicon == null)
|
if (favicon == null || favicon.getWidth() <= 0 || favicon.getHeight() <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
favicon = Favicons.getInstance().scaleImage(favicon);
|
favicon = Favicons.getInstance().scaleImage(favicon);
|
||||||
|
|
|
@ -89,13 +89,14 @@ abstract public class AwesomeBarTab {
|
||||||
|
|
||||||
protected void updateFavicon(ImageView faviconView, Cursor cursor) {
|
protected void updateFavicon(ImageView faviconView, Cursor cursor) {
|
||||||
byte[] b = cursor.getBlob(cursor.getColumnIndexOrThrow(URLColumns.FAVICON));
|
byte[] b = cursor.getBlob(cursor.getColumnIndexOrThrow(URLColumns.FAVICON));
|
||||||
if (b == null) {
|
Bitmap favicon = null;
|
||||||
faviconView.setImageDrawable(null);
|
if (b != null) {
|
||||||
} else {
|
|
||||||
Bitmap bitmap = BitmapFactory.decodeByteArray(b, 0, b.length);
|
Bitmap bitmap = BitmapFactory.decodeByteArray(b, 0, b.length);
|
||||||
bitmap = Favicons.getInstance().scaleImage(bitmap);
|
if (bitmap != null && bitmap.getWidth() > 0 && bitmap.getHeight() > 0) {
|
||||||
updateFavicon(faviconView, bitmap);
|
favicon = Favicons.getInstance().scaleImage(bitmap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
updateFavicon(faviconView, favicon);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateFavicon(ImageView faviconView, Bitmap bitmap) {
|
protected void updateFavicon(ImageView faviconView, Bitmap bitmap) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче