Bug 784042 - Use mozIColorAnalyzer for autocomplete search result tiles. r=mbrubeck

This commit is contained in:
Allison Naaktgeboren 2014-02-28 16:59:07 -05:00
parent 1d10b3c1aa
commit 5ef10eeaf9

View File

@ -734,6 +734,22 @@
item.setAttribute("label", label);
item.setAttribute("value", value);
item.setAttribute("iconURI", iconURI);
let xpFaviconURI = Services.io.newURI(iconURI.replace("moz-anno:favicon:",""), null, null);
Task.spawn(function() {
Components.utils.import("resource:///modules/colorUtils.jsm");
let colorInfo = yield ColorUtils.getForegroundAndBackgroundIconColors(xpFaviconURI);
if ( !(colorInfo && colorInfo.background && colorInfo.foreground)
|| (item.getAttribute("iconURI") != iconURI) ) {
return;
}
let { background, foreground } = colorInfo;
item.style.color = foreground; //color text
item.setAttribute("customColor", background);
// when bound, use the setter to propogate the color change through the tile
if ('color' in item) {
item.color = background;
}
}).then(null, err => Components.utils.reportError(err));
}
this._results.arrangeItems();