Bug 888032: Restrict favicon size to 32dp in TopBookmarksView. [r=wesj]
authorSriram Ramasubramanian <sriram@mozilla.com>
Thu, 27 Jun 2013 15:01:27 -0700
changeset 143374 e622ebfaad7415f970c60aeeba6d0df08dc8aefe
parent 143373 cfcde93a090fe02ad6d9be45cc1d37c6fcadf453
child 143375 22104d00bbdc131d564ae76165306d0f4bc2465d
push id25130
push userlrocha@mozilla.com
push dateWed, 21 Aug 2013 09:41:27 +0000
treeherdermozilla-central@b2486721572e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj
bugs888032
milestone24.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 888032: Restrict favicon size to 32dp in TopBookmarksView. [r=wesj]
mobile/android/base/home/TopBookmarksView.java
--- a/mobile/android/base/home/TopBookmarksView.java
+++ b/mobile/android/base/home/TopBookmarksView.java
@@ -1,15 +1,16 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.home;
 
+import org.mozilla.gecko.Favicons;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.ThumbnailHelper;
 import org.mozilla.gecko.db.BrowserContract.Thumbnails;
 import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.db.BrowserDB.TopSitesCursorWrapper;
 import org.mozilla.gecko.db.BrowserDB.URLColumns;
 import org.mozilla.gecko.gfx.BitmapUtils;
 import org.mozilla.gecko.home.HomePager.OnUrlOpenListener;
@@ -367,17 +368,19 @@ public class TopBookmarksView extends Gr
                 }
             }
 
             // Query the DB for favicons for the urls without thumbnails.
             for (String url : urls) {
                 if (!thumbnails.containsKey(url)) {
                     final Bitmap bitmap = BrowserDB.getFaviconForUrl(cr, url);
                     if (bitmap != null) {
-                        thumbnails.put(url, new Thumbnail(bitmap, false));
+                        // Favicons.scaleImage can return several different size favicons,
+                        // but will at least prevent this from being too large.
+                        thumbnails.put(url, new Thumbnail(Favicons.getInstance().scaleImage(bitmap), false));
                     }
                 }
             }
 
             return thumbnails;
         }
 
         @Override