mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1118926 (Part 2) - Remove remnants of -moz-resolution in JavaScript code. r=dolske
This commit is contained in:
parent
9b3da6ca38
commit
3ec62c3b82
@ -533,12 +533,10 @@ var LoopUI;
|
||||
}
|
||||
|
||||
this.PlacesUtils.promiseFaviconLinkUrl(pageURI).then(uri => {
|
||||
uri = this.PlacesUtils.getImageURLForResolution(window, uri.spec);
|
||||
|
||||
// We XHR the favicon to get a File object, which we can pass to the FileReader
|
||||
// object. The FileReader turns the File object into a data-uri.
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("get", uri, true);
|
||||
xhr.open("get", uri.spec, true);
|
||||
xhr.responseType = "blob";
|
||||
xhr.overrideMimeType("image/x-icon");
|
||||
xhr.onload = () => {
|
||||
|
@ -3785,7 +3785,6 @@ function FillHistoryMenu(aParent) {
|
||||
PlacesUtils.favicons.getFaviconURLForPage(entryURI, function (aURI) {
|
||||
if (aURI) {
|
||||
let iconURL = PlacesUtils.favicons.getFaviconLinkForIcon(aURI).spec;
|
||||
iconURL = PlacesUtils.getImageURLForResolution(window, iconURL);
|
||||
item.style.listStyleImage = "url(" + iconURL + ")";
|
||||
}
|
||||
});
|
||||
|
@ -673,12 +673,10 @@ ContentSearchUIController.prototype = {
|
||||
return row;
|
||||
},
|
||||
|
||||
// Converts favicon array buffer into data URI of the right size and dpi.
|
||||
// Converts favicon array buffer into a data URI.
|
||||
_getFaviconURIFromBuffer: function (buffer) {
|
||||
let blob = new Blob([buffer]);
|
||||
let dpiSize = Math.round(16 * window.devicePixelRatio);
|
||||
let sizeStr = dpiSize + "," + dpiSize;
|
||||
return URL.createObjectURL(blob) + "#-moz-resolution=" + sizeStr;
|
||||
return URL.createObjectURL(blob);
|
||||
},
|
||||
|
||||
// Adds "@2x" to the name of the given PNG url for "retina" screens.
|
||||
|
@ -904,9 +904,6 @@
|
||||
}
|
||||
|
||||
let sizedIconUrl = browser.mIconURL || "";
|
||||
if (sizedIconUrl) {
|
||||
sizedIconUrl = this.PlacesUtils.getImageURLForResolution(window, sizedIconUrl);
|
||||
}
|
||||
if (sizedIconUrl != aTab.getAttribute("image")) {
|
||||
if (sizedIconUrl)
|
||||
aTab.setAttribute("image", sizedIconUrl);
|
||||
|
@ -37,8 +37,7 @@ add_task(function* () {
|
||||
|
||||
let result = gURLBar.popup.richlistbox.children[0];
|
||||
ok(result.hasAttribute("image"), "Result should have an image attribute");
|
||||
// Image attribute gets a suffix (-moz-resolution) added in the value.
|
||||
ok(result.getAttribute("image").startsWith(engine.iconURI.spec),
|
||||
ok(result.getAttribute("image") === engine.iconURI.spec,
|
||||
"Image attribute should have the search engine's icon");
|
||||
|
||||
EventUtils.synthesizeKey("VK_RETURN" , { });
|
||||
|
@ -214,7 +214,7 @@ const CustomizableWidgets = [
|
||||
onHistoryVisit(uri, aEvent, item);
|
||||
});
|
||||
if (icon) {
|
||||
let iconURL = PlacesUtils.getImageURLForResolution(win, "moz-anno:favicon:" + icon);
|
||||
let iconURL = "moz-anno:favicon:" + icon;
|
||||
item.setAttribute("image", iconURL);
|
||||
}
|
||||
fragment.appendChild(item);
|
||||
|
@ -388,8 +388,7 @@ PlacesViewBase.prototype = {
|
||||
|
||||
let icon = aPlacesNode.icon;
|
||||
if (icon)
|
||||
element.setAttribute("image",
|
||||
PlacesUtils.getImageURLForResolution(window, icon));
|
||||
element.setAttribute("image", icon);
|
||||
}
|
||||
|
||||
element._placesNode = aPlacesNode;
|
||||
@ -527,8 +526,7 @@ PlacesViewBase.prototype = {
|
||||
if (!icon)
|
||||
elt.removeAttribute("image");
|
||||
else if (icon != elt.getAttribute("image"))
|
||||
elt.setAttribute("image",
|
||||
PlacesUtils.getImageURLForResolution(window, icon));
|
||||
elt.setAttribute("image", icon);
|
||||
},
|
||||
|
||||
nodeAnnotationChanged:
|
||||
@ -1058,8 +1056,7 @@ PlacesToolbar.prototype = {
|
||||
button.setAttribute("label", aChild.title || "");
|
||||
let icon = aChild.icon;
|
||||
if (icon)
|
||||
button.setAttribute("image",
|
||||
PlacesUtils.getImageURLForResolution(window, icon));
|
||||
button.setAttribute("image", icon);
|
||||
|
||||
if (PlacesUtils.containerTypes.indexOf(type) != -1) {
|
||||
button.setAttribute("type", "menu");
|
||||
@ -1886,8 +1883,7 @@ PlacesPanelMenuView.prototype = {
|
||||
button.setAttribute("label", aChild.title || "");
|
||||
let icon = aChild.icon;
|
||||
if (icon)
|
||||
button.setAttribute("image",
|
||||
PlacesUtils.getImageURLForResolution(window, icon));
|
||||
button.setAttribute("image", icon);
|
||||
|
||||
if (PlacesUtils.containerTypes.indexOf(type) != -1) {
|
||||
button.setAttribute("container", "true");
|
||||
|
@ -1414,9 +1414,6 @@ PlacesTreeView.prototype = {
|
||||
return "";
|
||||
|
||||
let node = this._getNodeForRow(aRow);
|
||||
if (PlacesUtils.nodeIsURI(node) && node.icon)
|
||||
return PlacesUtils.getImageURLForResolution(window, node.icon);
|
||||
|
||||
return node.icon;
|
||||
},
|
||||
|
||||
|
@ -116,8 +116,7 @@ var gSearchPane = {
|
||||
let item = list.appendItem(e.name);
|
||||
item.setAttribute("class", "menuitem-iconic searchengine-menuitem menuitem-with-favicon");
|
||||
if (e.iconURI) {
|
||||
let uri = PlacesUtils.getImageURLForResolution(window, e.iconURI.spec);
|
||||
item.setAttribute("image", uri);
|
||||
item.setAttribute("image", e.iconURI.spec);
|
||||
}
|
||||
item.engine = e;
|
||||
if (e.name == currentEngine)
|
||||
@ -488,8 +487,7 @@ EngineView.prototype = {
|
||||
|
||||
getImageSrc: function(index, column) {
|
||||
if (column.id == "engineName" && this._engineStore.engines[index].iconURI) {
|
||||
let uri = this._engineStore.engines[index].iconURI.spec;
|
||||
return PlacesUtils.getImageURLForResolution(window, uri);
|
||||
return this._engineStore.engines[index].iconURI.spec;
|
||||
}
|
||||
return "";
|
||||
},
|
||||
|
@ -265,9 +265,6 @@
|
||||
<parameter name="element"/>
|
||||
<parameter name="uri"/>
|
||||
<body><![CDATA[
|
||||
if (uri) {
|
||||
uri = this.PlacesUtils.getImageURLForResolution(window, uri);
|
||||
}
|
||||
element.setAttribute("src", uri);
|
||||
]]></body>
|
||||
</method>
|
||||
@ -1091,8 +1088,7 @@
|
||||
let currentEngine = Services.search.currentEngine;
|
||||
let uri = currentEngine.iconURI;
|
||||
if (uri) {
|
||||
uri = uri.spec;
|
||||
this.setAttribute("src", PlacesUtils.getImageURLForResolution(window, uri));
|
||||
this.setAttribute("src", uri.spec);
|
||||
}
|
||||
else {
|
||||
// If the default has just been changed to a provider without icon,
|
||||
@ -1254,8 +1250,7 @@
|
||||
button.setAttribute("tooltiptext", engine.uri);
|
||||
button.setAttribute("uri", engine.uri);
|
||||
if (engine.icon) {
|
||||
let uri = PlacesUtils.getImageURLForResolution(window, engine.icon);
|
||||
button.setAttribute("image", uri);
|
||||
button.setAttribute("image", engine.icon);
|
||||
}
|
||||
button.setAttribute("title", engine.title);
|
||||
addEngineList.appendChild(button);
|
||||
@ -1328,7 +1323,7 @@
|
||||
button.id = "searchbar-engine-one-off-item-" + engine.name.replace(/ /g, '-');
|
||||
let uri = "chrome://browser/skin/search-engine-placeholder.png";
|
||||
if (engine.iconURI) {
|
||||
uri = PlacesUtils.getImageURLForResolution(window, engine.iconURI.spec);
|
||||
uri = engine.iconURI.spec;
|
||||
}
|
||||
button.setAttribute("image", uri);
|
||||
button.setAttribute("class", "searchbar-engine-one-off-item");
|
||||
|
@ -169,7 +169,7 @@ this.RecentlyClosedTabsAndWindowsMenuUtils = {
|
||||
};
|
||||
|
||||
function setImage(aWindow, aItem, aElement) {
|
||||
let iconURL = PlacesUtils.getImageURLForResolution(aWindow, aItem.image);
|
||||
let iconURL = aItem.image;
|
||||
// don't initiate a connection just to fetch a favicon (see bug 467828)
|
||||
if (/^https?:/.test(iconURL))
|
||||
iconURL = "moz-anno:favicon:" + iconURL;
|
||||
|
@ -91,10 +91,6 @@ var FavIcons = {
|
||||
tabImage = this._favIconService.getFaviconLinkForIcon(tabImageURI).spec;
|
||||
}
|
||||
|
||||
if (tabImage) {
|
||||
tabImage = PlacesUtils.getImageURLForResolution(window, tabImage);
|
||||
}
|
||||
|
||||
callback(tabImage);
|
||||
},
|
||||
|
||||
@ -107,8 +103,7 @@ var FavIcons = {
|
||||
let {currentURI} = tab.linkedBrowser;
|
||||
this._favIconService.getFaviconURLForPage(currentURI, function (uri) {
|
||||
if (uri) {
|
||||
let icon = PlacesUtils.getImageURLForResolution(window,
|
||||
this._favIconService.getFaviconLinkForIcon(uri).spec);
|
||||
let icon = this._favIconService.getFaviconLinkForIcon(uri).spec;
|
||||
callback(icon);
|
||||
} else {
|
||||
callback(this.defaultFavicon);
|
||||
|
@ -1659,40 +1659,6 @@ this.PlacesUtils = {
|
||||
return deferred.promise;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the passed URL with a #-moz-resolution fragment
|
||||
* for the specified dimensions and devicePixelRatio.
|
||||
*
|
||||
* @param aWindow
|
||||
* A window from where we want to get the device
|
||||
* pixel Ratio
|
||||
*
|
||||
* @param aURL
|
||||
* The URL where we should add the fragment
|
||||
*
|
||||
* @param aWidth
|
||||
* The target image width
|
||||
*
|
||||
* @param aHeight
|
||||
* The target image height
|
||||
*
|
||||
* @return The URL with the fragment at the end
|
||||
*/
|
||||
getImageURLForResolution:
|
||||
function PU_getImageURLForResolution(aWindow, aURL, aWidth = 16, aHeight = 16) {
|
||||
// We only want to modify the URL when the file extension is ".ico" or
|
||||
// it's a data URI with an icon media-type.
|
||||
let uri = Services.io.newURI(aURL, null, null);
|
||||
if ((!(uri instanceof Ci.nsIURL) || uri.fileExtension.toLowerCase() != "ico") &&
|
||||
!/^data:image\/(?:x-icon|icon|ico)/.test(aURL)) {
|
||||
return aURL;
|
||||
}
|
||||
let width = Math.round(aWidth * aWindow.devicePixelRatio);
|
||||
let height = Math.round(aHeight * aWindow.devicePixelRatio);
|
||||
return aURL + (aURL.includes("#") ? "&" : "#") +
|
||||
"-moz-resolution=" + width + "," + height;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the unique id for an item (a bookmark, a folder or a separator) given
|
||||
* its item id.
|
||||
|
@ -1198,24 +1198,6 @@ extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_getImageURLForResolution">
|
||||
<parameter name="aWin"/>
|
||||
<parameter name="aURL"/>
|
||||
<parameter name="aWidth"/>
|
||||
<parameter name="aHeight"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!aURL.endsWith('.ico') && !aURL.endsWith('.ICO')) {
|
||||
return aURL;
|
||||
}
|
||||
let width = Math.round(aWidth * aWin.devicePixelRatio);
|
||||
let height = Math.round(aHeight * aWin.devicePixelRatio);
|
||||
return aURL + (aURL.includes("#") ? "&" : "#") +
|
||||
"-moz-resolution=" + width + "," + height;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_appendCurrentResult">
|
||||
<body>
|
||||
<![CDATA[
|
||||
@ -1257,7 +1239,7 @@ extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
|
||||
// set these attributes before we set the class
|
||||
// so that we can use them from the constructor
|
||||
let iconURI = this._getImageURLForResolution(window, controller.getImageAt(this._currentIndex), 16, 16);
|
||||
let iconURI = controller.getImageAt(this._currentIndex);
|
||||
item.setAttribute("image", iconURI);
|
||||
item.setAttribute("url", url);
|
||||
item.setAttribute("title", controller.getCommentAt(this._currentIndex));
|
||||
|
Loading…
Reference in New Issue
Block a user