mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 784042 - Use mozIColorAnalyzer for autocomplete search result tiles. r=mbrubeck
This commit is contained in:
parent
1d10b3c1aa
commit
5ef10eeaf9
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user