mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 906047 - Remove unused code from metro/base/content/Util.js [r=sfoster]
--HG-- extra : rebase_source : 76af61778df8adf89b63006e7331ed69e1c7b32c
This commit is contained in:
parent
d217407be8
commit
c2e27d0bc0
@ -13,26 +13,6 @@ let Util = {
|
||||
return aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||
},
|
||||
|
||||
// Recursively find all documents, including root document.
|
||||
getAllDocuments: function getAllDocuments(doc, resultSoFar) {
|
||||
resultSoFar = resultSoFar || [doc];
|
||||
if (!doc.defaultView)
|
||||
return resultSoFar;
|
||||
let frames = doc.defaultView.frames;
|
||||
if (!frames)
|
||||
return resultSoFar;
|
||||
|
||||
let i;
|
||||
let currentDoc;
|
||||
for (i = 0; i < frames.length; i++) {
|
||||
currentDoc = frames[i].document;
|
||||
resultSoFar.push(currentDoc);
|
||||
this.getAllDocuments(currentDoc, resultSoFar);
|
||||
}
|
||||
|
||||
return resultSoFar;
|
||||
},
|
||||
|
||||
// Put the Mozilla networking code into a state that will kick the
|
||||
// auto-connection process.
|
||||
forceOnline: function forceOnline() {
|
||||
@ -56,17 +36,6 @@ let Util = {
|
||||
* Console printing utilities
|
||||
*/
|
||||
|
||||
dumpf: function dumpf(str) {
|
||||
let args = arguments;
|
||||
let i = 1;
|
||||
dump(str.replace(/%s/g, function() {
|
||||
if (i >= args.length) {
|
||||
throw "dumps received too many placeholders and not enough arguments";
|
||||
}
|
||||
return args[i++].toString();
|
||||
}));
|
||||
},
|
||||
|
||||
// Like dump, but each arg is handled and there's an automatic newline
|
||||
dumpLn: function dumpLn() {
|
||||
for (let i = 0; i < arguments.length; i++)
|
||||
@ -74,30 +43,10 @@ let Util = {
|
||||
dump("\n");
|
||||
},
|
||||
|
||||
dumpElement: function dumpElement(aElement) {
|
||||
this.dumpLn(aElement.id);
|
||||
},
|
||||
|
||||
dumpElementTree: function dumpElementTree(aElement) {
|
||||
let node = aElement;
|
||||
while (node) {
|
||||
this.dumpLn("node:", node, "id:", node.id, "class:", node.classList);
|
||||
node = node.parentNode;
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* Element utilities
|
||||
*/
|
||||
|
||||
highlightElement: function highlightElement(aElement) {
|
||||
if (aElement == null) {
|
||||
this.dumpLn("aElement is null");
|
||||
return;
|
||||
}
|
||||
aElement.style.border = "2px solid red";
|
||||
},
|
||||
|
||||
transitionElementVisibility: function(aNodes, aVisible) {
|
||||
// accept single node or a collection of nodes
|
||||
aNodes = aNodes.length ? aNodes : [aNodes];
|
||||
@ -125,24 +74,6 @@ let Util = {
|
||||
return defd.promise;
|
||||
},
|
||||
|
||||
getHrefForElement: function getHrefForElement(target) {
|
||||
let link = null;
|
||||
while (target) {
|
||||
if (target instanceof Ci.nsIDOMHTMLAnchorElement ||
|
||||
target instanceof Ci.nsIDOMHTMLAreaElement ||
|
||||
target instanceof Ci.nsIDOMHTMLLinkElement) {
|
||||
if (target.hasAttribute("href"))
|
||||
link = target;
|
||||
}
|
||||
target = target.parentNode;
|
||||
}
|
||||
|
||||
if (link && link.hasAttribute("href"))
|
||||
return link.href;
|
||||
else
|
||||
return null;
|
||||
},
|
||||
|
||||
isTextInput: function isTextInput(aElement) {
|
||||
return ((aElement instanceof Ci.nsIDOMHTMLInputElement &&
|
||||
aElement.mozIsTextField(false)) ||
|
||||
@ -272,16 +203,6 @@ let Util = {
|
||||
aURL.indexOf("chrome:") == 0);
|
||||
},
|
||||
|
||||
isOpenableScheme: function isShareableScheme(aProtocol) {
|
||||
let dontOpen = /^(mailto|javascript|news|snews)$/;
|
||||
return (aProtocol && !dontOpen.test(aProtocol));
|
||||
},
|
||||
|
||||
isShareableScheme: function isShareableScheme(aProtocol) {
|
||||
let dontShare = /^(chrome|about|file|javascript|resource)$/;
|
||||
return (aProtocol && !dontShare.test(aProtocol));
|
||||
},
|
||||
|
||||
// Don't display anything in the urlbar for these special URIs.
|
||||
isURLEmpty: function isURLEmpty(aURL) {
|
||||
return (!aURL ||
|
||||
@ -346,68 +267,6 @@ let Util = {
|
||||
return this.displayDPI = this.getWindowUtils(window).displayDPI;
|
||||
},
|
||||
|
||||
isPortrait: function isPortrait() {
|
||||
return (window.innerWidth <= window.innerHeight);
|
||||
},
|
||||
|
||||
LOCALE_DIR_RTL: -1,
|
||||
LOCALE_DIR_LTR: 1,
|
||||
get localeDir() {
|
||||
// determine browser dir first to know which direction to snap to
|
||||
let chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry);
|
||||
return chromeReg.isLocaleRTL("global") ? this.LOCALE_DIR_RTL : this.LOCALE_DIR_LTR;
|
||||
},
|
||||
|
||||
/*
|
||||
* Process utilities
|
||||
*/
|
||||
|
||||
isParentProcess: function isInParentProcess() {
|
||||
let appInfo = Cc["@mozilla.org/xre/app-info;1"];
|
||||
return (!appInfo || appInfo.getService(Ci.nsIXULRuntime).processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT);
|
||||
},
|
||||
|
||||
/*
|
||||
* Event utilities
|
||||
*/
|
||||
|
||||
modifierMaskFromEvent: function modifierMaskFromEvent(aEvent) {
|
||||
return (aEvent.altKey ? Ci.nsIDOMEvent.ALT_MASK : 0) |
|
||||
(aEvent.ctrlKey ? Ci.nsIDOMEvent.CONTROL_MASK : 0) |
|
||||
(aEvent.shiftKey ? Ci.nsIDOMEvent.SHIFT_MASK : 0) |
|
||||
(aEvent.metaKey ? Ci.nsIDOMEvent.META_MASK : 0);
|
||||
},
|
||||
|
||||
/*
|
||||
* Download utilities
|
||||
*/
|
||||
|
||||
insertDownload: function insertDownload(aSrcUri, aFile) {
|
||||
let dm = Cc["@mozilla.org/download-manager;1"].getService(Ci.nsIDownloadManager);
|
||||
let db = dm.DBConnection;
|
||||
|
||||
let stmt = db.createStatement(
|
||||
"INSERT INTO moz_downloads (name, source, target, startTime, endTime, state, referrer) " +
|
||||
"VALUES (:name, :source, :target, :startTime, :endTime, :state, :referrer)"
|
||||
);
|
||||
|
||||
stmt.params.name = aFile.leafName;
|
||||
stmt.params.source = aSrcUri.spec;
|
||||
stmt.params.target = aFile.path;
|
||||
stmt.params.startTime = Date.now() * 1000;
|
||||
stmt.params.endTime = Date.now() * 1000;
|
||||
stmt.params.state = Ci.nsIDownloadManager.DOWNLOAD_NOTSTARTED;
|
||||
stmt.params.referrer = aSrcUri.spec;
|
||||
|
||||
stmt.execute();
|
||||
stmt.finalize();
|
||||
|
||||
let newItemId = db.lastInsertRowID;
|
||||
let download = dm.getDownload(newItemId);
|
||||
//dm.resumeDownload(download);
|
||||
//Services.obs.notifyObservers(download, "dl-start", null);
|
||||
},
|
||||
|
||||
/*
|
||||
* Local system utilities
|
||||
*/
|
||||
|
@ -1096,14 +1096,6 @@ var BrowserUI = {
|
||||
case "cmd_panel":
|
||||
PanelUI.toggle();
|
||||
break;
|
||||
case "cmd_volumeLeft":
|
||||
// Zoom in (portrait) or out (landscape)
|
||||
Browser.zoom(Util.isPortrait() ? -1 : 1);
|
||||
break;
|
||||
case "cmd_volumeRight":
|
||||
// Zoom out (portrait) or in (landscape)
|
||||
Browser.zoom(Util.isPortrait() ? 1 : -1);
|
||||
break;
|
||||
case "cmd_openFile":
|
||||
this.openFile();
|
||||
break;
|
||||
|
@ -95,12 +95,6 @@
|
||||
<command id="cmd_sanitize" oncommand="CommandUpdater.doCommand(this.id);"/>
|
||||
<command id="cmd_contextUI" oncommand="CommandUpdater.doCommand(this.id);"/>
|
||||
|
||||
<!-- screen/display -->
|
||||
<command id="cmd_lockscreen" oncommand="CommandUpdater.doCommand(this.id);"/>
|
||||
|
||||
<command id="cmd_volumeLeft" observes="bcast_contentShowing" oncommand="CommandUpdater.doCommand(this.id);"/>
|
||||
<command id="cmd_volumeRight" observes="bcast_contentShowing" oncommand="CommandUpdater.doCommand(this.id);"/>
|
||||
|
||||
<!-- scrolling -->
|
||||
<command id="cmd_scrollPageUp" oncommand="CommandUpdater.doCommand(this.id);"/>
|
||||
<command id="cmd_scrollPageDown" oncommand="CommandUpdater.doCommand(this.id);"/>
|
||||
|
Loading…
Reference in New Issue
Block a user