зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1305777 - Fix ESLint issues for moved files. r=jdescottes
MozReview-Commit-ID: 6PVoLP4MFir --HG-- extra : rebase_source : 12648e919de27465f768206a15200d4d3a2d92a5
This commit is contained in:
Родитель
efbf4624b2
Коммит
abb935a5b5
|
@ -15,13 +15,13 @@ var global = this;
|
|||
return;
|
||||
}
|
||||
|
||||
var Ci = Components.interfaces;
|
||||
const Ci = Components.interfaces;
|
||||
const gDeviceSizeWasPageSize = docShell.deviceSizeIsPageSize;
|
||||
const gFloatingScrollbarsStylesheet = Services.io.newURI("chrome://devtools/skin/floating-scrollbars-responsive-design.css");
|
||||
var gRequiresFloatingScrollbars;
|
||||
|
||||
var active = false;
|
||||
var resizeNotifications = false;
|
||||
let requiresFloatingScrollbars;
|
||||
let active = false;
|
||||
let resizeNotifications = false;
|
||||
|
||||
addMessageListener("ResponsiveMode:Start", startResponsiveMode);
|
||||
addMessageListener("ResponsiveMode:Stop", stopResponsiveMode);
|
||||
|
@ -38,7 +38,7 @@ var global = this;
|
|||
sendAsyncMessage("ResponsiveMode:IsActive:Done", { active });
|
||||
}
|
||||
|
||||
function startResponsiveMode({data:data}) {
|
||||
function startResponsiveMode({ data }) {
|
||||
debug("START");
|
||||
if (active) {
|
||||
debug("ALREADY STARTED");
|
||||
|
@ -46,10 +46,11 @@ var global = this;
|
|||
return;
|
||||
}
|
||||
addMessageListener("ResponsiveMode:RequestScreenshot", screenshot);
|
||||
let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebProgress);
|
||||
let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebProgress);
|
||||
webProgress.addProgressListener(WebProgressListener, Ci.nsIWebProgress.NOTIFY_ALL);
|
||||
docShell.deviceSizeIsPageSize = true;
|
||||
gRequiresFloatingScrollbars = data.requiresFloatingScrollbars;
|
||||
requiresFloatingScrollbars = data.requiresFloatingScrollbars;
|
||||
if (data.notifyOnResize) {
|
||||
startOnResize();
|
||||
}
|
||||
|
@ -104,7 +105,8 @@ var global = this;
|
|||
}
|
||||
active = false;
|
||||
removeMessageListener("ResponsiveMode:RequestScreenshot", screenshot);
|
||||
let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebProgress);
|
||||
let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebProgress);
|
||||
webProgress.removeProgressListener(WebProgressListener);
|
||||
docShell.deviceSizeIsPageSize = gDeviceSizeWasPageSize;
|
||||
restoreScrollbars();
|
||||
|
@ -113,7 +115,7 @@ var global = this;
|
|||
}
|
||||
|
||||
function makeScrollbarsFloating() {
|
||||
if (!gRequiresFloatingScrollbars) {
|
||||
if (!requiresFloatingScrollbars) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -126,7 +128,8 @@ var global = this;
|
|||
|
||||
for (let d of allDocShells) {
|
||||
let win = d.contentViewer.DOMDocument.defaultView;
|
||||
let winUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||
let winUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
try {
|
||||
winUtils.loadSheet(gFloatingScrollbarsStylesheet, win.AGENT_SHEET);
|
||||
} catch (e) { }
|
||||
|
@ -142,7 +145,8 @@ var global = this;
|
|||
}
|
||||
for (let d of allDocShells) {
|
||||
let win = d.contentViewer.DOMDocument.defaultView;
|
||||
let winUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||
let winUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
try {
|
||||
winUtils.removeSheet(gFloatingScrollbarsStylesheet, win.AGENT_SHEET);
|
||||
} catch (e) { }
|
||||
|
@ -173,17 +177,17 @@ var global = this;
|
|||
sendAsyncMessage("ResponsiveMode:RequestScreenshot:Done", canvas.toDataURL());
|
||||
}
|
||||
|
||||
var WebProgressListener = {
|
||||
let WebProgressListener = {
|
||||
onLocationChange(webProgress, request, URI, flags) {
|
||||
if (flags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT) {
|
||||
return;
|
||||
}
|
||||
makeScrollbarsFloating();
|
||||
},
|
||||
QueryInterface: function QueryInterface(aIID) {
|
||||
if (aIID.equals(Ci.nsIWebProgressListener) ||
|
||||
aIID.equals(Ci.nsISupportsWeakReference) ||
|
||||
aIID.equals(Ci.nsISupports)) {
|
||||
QueryInterface: function QueryInterface(iid) {
|
||||
if (iid.equals(Ci.nsIWebProgressListener) ||
|
||||
iid.equals(Ci.nsISupportsWeakReference) ||
|
||||
iid.equals(Ci.nsISupports)) {
|
||||
return this;
|
||||
}
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { Cc, Ci, Cu } = require("chrome");
|
||||
const { Cc, Ci } = require("chrome");
|
||||
|
||||
loader.lazyRequireGetter(this, "ResponsiveUIManager", "devtools/client/responsive.html/manager", true);
|
||||
|
||||
const BRAND_SHORT_NAME = Cc["@mozilla.org/intl/stringbundle;1"].
|
||||
getService(Ci.nsIStringBundleService).
|
||||
createBundle("chrome://branding/locale/brand.properties").
|
||||
GetStringFromName("brandShortName");
|
||||
const BRAND_SHORT_NAME = Cc["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Ci.nsIStringBundleService)
|
||||
.createBundle("chrome://branding/locale/brand.properties")
|
||||
.GetStringFromName("brandShortName");
|
||||
|
||||
const Services = require("Services");
|
||||
const osString = Services.appinfo.OS;
|
||||
|
@ -28,7 +28,7 @@ exports.items = [
|
|||
name: "resize on",
|
||||
description: l10n.lookup("resizeModeOnDesc"),
|
||||
manual: l10n.lookupFormat("resizeModeManual2", [BRAND_SHORT_NAME]),
|
||||
exec: gcli_cmd_resize
|
||||
exec: resize
|
||||
},
|
||||
{
|
||||
item: "command",
|
||||
|
@ -36,7 +36,7 @@ exports.items = [
|
|||
name: "resize off",
|
||||
description: l10n.lookup("resizeModeOffDesc"),
|
||||
manual: l10n.lookupFormat("resizeModeManual2", [BRAND_SHORT_NAME]),
|
||||
exec: gcli_cmd_resize
|
||||
exec: resize
|
||||
},
|
||||
{
|
||||
item: "command",
|
||||
|
@ -44,30 +44,32 @@ exports.items = [
|
|||
name: "resize toggle",
|
||||
buttonId: "command-button-responsive",
|
||||
buttonClass: "command-button command-button-invertable",
|
||||
tooltipText: l10n.lookupFormat("resizeModeToggleTooltip2",
|
||||
[(osString == "Darwin" ? "Cmd+Opt+M" : "Ctrl+Shift+M")]),
|
||||
tooltipText: l10n.lookupFormat(
|
||||
"resizeModeToggleTooltip2",
|
||||
[(osString == "Darwin" ? "Cmd+Opt+M" : "Ctrl+Shift+M")]
|
||||
),
|
||||
description: l10n.lookup("resizeModeToggleDesc"),
|
||||
manual: l10n.lookupFormat("resizeModeManual2", [BRAND_SHORT_NAME]),
|
||||
state: {
|
||||
isChecked: function (aTarget) {
|
||||
if (!aTarget.tab) {
|
||||
isChecked: function (target) {
|
||||
if (!target.tab) {
|
||||
return false;
|
||||
}
|
||||
return ResponsiveUIManager.isActiveForTab(aTarget.tab);
|
||||
return ResponsiveUIManager.isActiveForTab(target.tab);
|
||||
},
|
||||
onChange: function (aTarget, aChangeHandler) {
|
||||
if (aTarget.tab) {
|
||||
ResponsiveUIManager.on("on", aChangeHandler);
|
||||
ResponsiveUIManager.on("off", aChangeHandler);
|
||||
onChange: function (target, changeHandler) {
|
||||
if (target.tab) {
|
||||
ResponsiveUIManager.on("on", changeHandler);
|
||||
ResponsiveUIManager.on("off", changeHandler);
|
||||
}
|
||||
},
|
||||
offChange: function (aTarget, aChangeHandler) {
|
||||
offChange: function (target, changeHandler) {
|
||||
// Do not check for target.tab as it may already be null during destroy
|
||||
ResponsiveUIManager.off("on", aChangeHandler);
|
||||
ResponsiveUIManager.off("off", aChangeHandler);
|
||||
ResponsiveUIManager.off("on", changeHandler);
|
||||
ResponsiveUIManager.off("off", changeHandler);
|
||||
},
|
||||
},
|
||||
exec: gcli_cmd_resize
|
||||
exec: resize
|
||||
},
|
||||
{
|
||||
item: "command",
|
||||
|
@ -86,11 +88,11 @@ exports.items = [
|
|||
description: l10n.lookup("resizePageArgHeightDesc"),
|
||||
},
|
||||
],
|
||||
exec: gcli_cmd_resize
|
||||
exec: resize
|
||||
}
|
||||
];
|
||||
|
||||
function* gcli_cmd_resize(args, context) {
|
||||
function* resize(args, context) {
|
||||
let browserWindow = context.environment.chromeWindow;
|
||||
yield ResponsiveUIManager.handleGcliCommand(browserWindow,
|
||||
browserWindow.gBrowser.selectedTab,
|
||||
|
|
|
@ -227,7 +227,7 @@ TouchSimulator.prototype = {
|
|||
},
|
||||
|
||||
sendContextMenu({ target, clientX, clientY, screenX, screenY }) {
|
||||
let view = target.ownerDocument.defaultView;
|
||||
let view = target.ownerGlobal;
|
||||
let { MouseEvent } = view;
|
||||
let evt = new MouseEvent("contextmenu", {
|
||||
bubbles: true,
|
||||
|
@ -302,7 +302,7 @@ TouchSimulator.prototype = {
|
|||
|
||||
getContent(target) {
|
||||
let win = (target && target.ownerDocument)
|
||||
? target.ownerDocument.defaultView
|
||||
? target.ownerGlobal
|
||||
: null;
|
||||
return win;
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче