Bug 838583 - Scale favicons in the history tab. r=mfinkle
authorBrian Nicholson <bnicholson@mozilla.com>
Thu, 07 Feb 2013 22:14:06 -0800
changeset 131141 1aa612b762f3887ef9aa61195d9e04fda411218c
parent 131140 2c6da9f02606f7a02f635d99ef8cf669d3bc5c4b
child 131142 594fa394a334b47ccbecd26a4f85f99f54d25fa6
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs838583
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 838583 - Scale favicons in the history tab. r=mfinkle
dom/browser-element/BrowserElementChild.js
mobile/android/base/awesomebar/HistoryTab.java
--- a/mobile/android/base/awesomebar/HistoryTab.java
+++ b/mobile/android/base/awesomebar/HistoryTab.java
@@ -156,23 +156,25 @@ public class HistoryTab extends AwesomeB
 
             if (TextUtils.isEmpty(title))
                 title = url;
 
             viewHolder.titleView.setText(title);
             viewHolder.urlView.setText(url);
 
             byte[] b = (byte[]) historyItem.get(URLColumns.FAVICON);
+            Bitmap favicon = null;
 
-            if (b == null) {
-                viewHolder.faviconView.setImageDrawable(null);
-            } else {
+            if (b != null) {
                 Bitmap bitmap = BitmapFactory.decodeByteArray(b, 0, b.length);
-                updateFavicon(viewHolder.faviconView, bitmap);
+                if (bitmap != null && bitmap.getWidth() > 0 && bitmap.getHeight() > 0) {
+                    favicon = Favicons.getInstance().scaleImage(bitmap);
+                }
             }
+            updateFavicon(viewHolder.faviconView, favicon);
 
             Integer bookmarkId = (Integer) historyItem.get(Combined.BOOKMARK_ID);
             Integer display = (Integer) historyItem.get(Combined.DISPLAY);
 
             // The bookmark id will be 0 (null in database) when the url
             // is not a bookmark. Reading list items are irrelevant in history
             // tab. We should never show any sign or them.
             int visibility = (bookmarkId != 0 && display != Combined.DISPLAY_READER ?