Bug 1054712 - Remove duplicate logic from tabbrowser and search bar by using the getImageURLForResolution helper function in PlacesUtils. r=MattN

This commit is contained in:
Bernardo P. Rittmeyer 2014-08-18 14:33:00 -07:00
parent e5c228e808
commit 29a48d1281
2 changed files with 8 additions and 6 deletions

View File

@ -85,6 +85,9 @@
Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
.getService(Components.interfaces.mozIPlacesAutoComplete);
</field>
<field name="PlacesUtils" readonly="true">
(Components.utils.import("resource://gre/modules/PlacesUtils.jsm", {})).PlacesUtils;
</field>
<field name="mTabBox" readonly="true">
document.getAnonymousElementByAttribute(this, "anonid", "tabbox");
</field>
@ -840,9 +843,7 @@
let sizedIconUrl = browser.mIconURL || "";
if (sizedIconUrl) {
let size = Math.round(16 * window.devicePixelRatio);
sizedIconUrl += (sizedIconUrl.contains("#") ? "&" : "#") +
"-moz-resolution=" + size + "," + size;
sizedIconUrl = this.PlacesUtils.getImageURLForResolution(window, sizedIconUrl);
}
if (sizedIconUrl != aTab.getAttribute("image")) {
if (sizedIconUrl)

View File

@ -125,6 +125,9 @@
<field name="FormHistory" readonly="true">
(Components.utils.import("resource://gre/modules/FormHistory.jsm", {})).FormHistory;
</field>
<field name="PlacesUtils" readonly="true">
(Components.utils.import("resource://gre/modules/PlacesUtils.jsm", {})).PlacesUtils;
</field>
<property name="engines" readonly="true">
<getter><![CDATA[
@ -292,9 +295,7 @@
<parameter name="uri"/>
<body><![CDATA[
if (uri) {
let size = Math.round(16 * window.devicePixelRatio);
if (!uri.contains("#"))
uri += "#-moz-resolution=" + size + "," + size;
uri = this.PlacesUtils.getImageURLForResolution(window, uri);
}
element.setAttribute("src", uri);
]]></body>