Bug 1254663 - Approach 2: scale all favicons to the same size before caching r?sebastian draft
authorAndrzej Hunt <ahunt@mozilla.com>
Tue, 24 May 2016 14:04:46 -0700
changeset 374099 701042633d4eb66f75926525a6031481960da345
parent 374098 70f62991bd7fe59a664dd6cf4f620ec91721938b
child 522545 fc2adf7cf06783844385b8df99056c767de42f1c
push id19923
push userahunt@mozilla.com
push dateWed, 01 Jun 2016 19:52:03 +0000
reviewerssebastian
bugs1254663
milestone49.0a1
Bug 1254663 - Approach 2: scale all favicons to the same size before caching r?sebastian This is equivalent to the previous 2 commits: instead of scaling favicons later, we can enlarge smaller icons here, resulting in all favicons being displayed at the same size in the rest of the UI. When retrieving favicons we always push them into the cache, and then fetch them from the cache to display them, hence this works for now (but this is also liable to break if we ever change to only fetch from the cache on later loads, and use the fetched icon directly on first load). MozReview-Commit-ID: AN5wEOMjRYV
mobile/android/base/java/org/mozilla/gecko/favicons/cache/FaviconCache.java
--- a/mobile/android/base/java/org/mozilla/gecko/favicons/cache/FaviconCache.java
+++ b/mobile/android/base/java/org/mozilla/gecko/favicons/cache/FaviconCache.java
@@ -431,17 +431,17 @@ public class FaviconCache {
         // Never cache the default Favicon, or the null Favicon.
         if (favicon == Favicons.defaultFavicon || favicon == null) {
             return null;
         }
 
         // Some sites serve up insanely huge Favicons (Seen 512x512 ones...)
         // While we want to cache nice big icons, we apply a limit based on screen density for the
         // sake of space.
-        if (favicon.getWidth() > maxCachedWidth) {
+        if (favicon.getWidth() != maxCachedWidth) {
             return Bitmap.createScaledBitmap(favicon, maxCachedWidth, maxCachedWidth, true);
         }
 
         return favicon;
     }
 
     /**
      * Set an existing element as the most recently used element. Intended for use from read transactions. While