Bug 927938 - Remove extra refresh of TopSites tile backgrounds. r=rsilveira
authorSam Foster <sfoster@mozilla.com>
Thu, 17 Oct 2013 15:47:22 -0700
changeset 166061 62c563fee1dd6035737044d89254534f4487c08a
parent 166060 d8fd745a009558dd0226a0a86b0a589390b7af94
child 166062 51dee39976fb76a469a558ee8f6cf5559192dfc2
child 166161 070ebdc4a8e4f37ea5341a0fc3baf0f8fc3380f0
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrsilveira
bugs927938
milestone27.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 927938 - Remove extra refresh of TopSites tile backgrounds. r=rsilveira
browser/metro/base/content/startui/TopSitesView.js
browser/metro/modules/View.jsm
--- a/browser/metro/base/content/startui/TopSitesView.js
+++ b/browser/metro/base/content/startui/TopSitesView.js
@@ -162,19 +162,22 @@ TopSitesView.prototype = Util.extend(Obj
       throw new Error("Invalid Site object passed to TopSitesView updateTile");
     }
     this._updateFavicon(aTileNode, Util.makeURI(aSite.url));
 
     Task.spawn(function() {
       let filepath = PageThumbsStorage.getFilePathForURL(aSite.url);
       if (yield OS.File.exists(filepath)) {
         aSite.backgroundImage = 'url("'+PageThumbs.getThumbnailURL(aSite.url)+'")';
-        if ('backgroundImage' in aTileNode) {
+        // use the setter when available to update the backgroundImage value
+        if ('backgroundImage' in aTileNode &&
+            aTileNode.backgroundImage != aSite.backgroundImage) {
           aTileNode.backgroundImage = aSite.backgroundImage;
         } else {
+          // just update the attribute for when the node gets the binding applied
           aTileNode.setAttribute("customImage", aSite.backgroundImage);
         }
       }
     });
 
     aSite.applyToTileNode(aTileNode);
     if (aTileNode.refresh) {
       aTileNode.refresh();
--- a/browser/metro/modules/View.jsm
+++ b/browser/metro/modules/View.jsm
@@ -82,18 +82,18 @@ View.prototype = {
       aItem.style.color = foreground; //color text
       aItem.setAttribute("customColor", background);
       let matteColor =  0xffffff; // white
       let alpha = 0.04; // the tint weight
       let [,r,g,b] = background.match(/rgb\((\d+),(\d+),(\d+)/);
       // get the rgb value that represents this color at given opacity over a white matte
       let tintColor = ColorUtils.addRgbColors(matteColor, ColorUtils.createDecimalColorWord(r,g,b,alpha));
       aItem.setAttribute("tintColor", ColorUtils.convertDecimalToRgbColor(tintColor));
-
-      if (aItem.refresh) {
-        aItem.refresh();
+      // when bound, use the setter to propogate the color change through the tile
+      if ('color' in aItem) {
+        aItem.color = background;
       }
     };
     let failureAction = function() {};
     ColorUtils.getForegroundAndBackgroundIconColors(xpFaviconURI, successAction, failureAction);
   }
 
 };