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
151a99c3d6
commit
1e2b39e743
@ -734,6 +734,21 @@
|
||||
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() {
|
||||
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();
|
||||
|
@ -40,6 +40,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "NewTabUtils",
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
||||
"resource://gre/modules/commonjs/sdk/core/promise.js");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ColorUtils",
|
||||
"resource:///modules/colorUtils.jsm");
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ShumwayUtils",
|
||||
"resource://shumway/ShumwayUtils.jsm");
|
||||
|
Loading…
Reference in New Issue
Block a user