Bug 1091036 - Allow toolbox full screen for remote runtime projects. r=jryans

This commit is contained in:
Paul Rouget 2014-11-10 03:37:03 +01:00
Родитель 821aea821e
Коммит e7968109b1
4 изменённых файлов: 103 добавлений и 0 удалений

Просмотреть файл

@ -738,6 +738,7 @@ let UI = {
}
deck.selectedPanel = panel;
this.updateProjectEditorMenusVisibility();
this.updateToolboxFullscreenState();
},
resetDeck: function() {
@ -896,6 +897,8 @@ let UI = {
splitter.removeAttribute("hidden");
let iframe = document.createElement("iframe");
iframe.id = "toolbox";
document.querySelector("notificationbox").insertBefore(iframe, splitter.nextSibling);
let host = devtools.Toolbox.HostType.CUSTOM;
let options = { customIframe: iframe };
@ -906,9 +909,22 @@ let UI = {
document.querySelector("#action-button-debug").setAttribute("active", "true");
this.updateToolboxFullscreenState();
return gDevTools.showToolbox(target, null, host, options);
},
updateToolboxFullscreenState: function() {
let panel = document.querySelector("#deck").selectedPanel;
let nbox = document.querySelector("#notificationbox");
if (panel.id == "deck-panel-details" &&
AppManager.selectedProject.type != "packaged" &&
this.toolboxIframe) {
nbox.setAttribute("toolboxfullscreen", "true");
} else {
nbox.removeAttribute("toolboxfullscreen");
}
},
closeToolboxUI: function() {
this.resetFocus();
Services.prefs.setIntPref("devtools.toolbox.footer.height", this.toolboxIframe.height);
@ -921,6 +937,7 @@ let UI = {
let splitter = document.querySelector(".devtools-horizontal-splitter");
splitter.setAttribute("hidden", "true");
document.querySelector("#action-button-debug").removeAttribute("active");
this.updateToolboxFullscreenState();
},
};

Просмотреть файл

@ -39,3 +39,4 @@ support-files =
[test_autoconnect_runtime.html]
[test_telemetry.html]
[test_device_preferences.html]
[test_fullscreenToolbox.html]

Просмотреть файл

@ -0,0 +1,74 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8">
<title></title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"></script>
<script type="application/javascript;version=1.8" src="head.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
</head>
<body>
<script type="application/javascript;version=1.8">
function connectToLocal(win) {
let deferred = promise.defer();
win.AppManager.connection.once(
win.Connection.Events.CONNECTED,
() => deferred.resolve());
win.document.querySelectorAll(".runtime-panel-item-other")[1].click();
return deferred.promise;
}
window.onload = function() {
SimpleTest.waitForExplicitFinish();
Task.spawn(function* () {
Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
win = yield openWebIDE();
win.AppManager.update("runtimelist");
yield connectToLocal(win);
yield waitForUpdate(win, "list-tabs-response");
// Select main process
yield win.Cmds.showProjectPanel();
SimpleTest.executeSoon(() => {
win.document.querySelectorAll("#project-panel-runtimeapps .panel-item")[0].click();
});
yield waitForUpdate(win, "project");
ok(win.UI.toolboxPromise, "Toolbox promise exists");
yield win.UI.toolboxPromise;
ok(win.UI.toolboxIframe, "Toolbox iframe exists");
let nbox = win.document.querySelector("#notificationbox");
ok(nbox.hasAttribute("toolboxfullscreen"), "Toolbox is fullsreen");
win.Cmds.showRuntimeDetails();
ok(!nbox.hasAttribute("toolboxfullscreen"), "Toolbox is not fullscreen");
yield win.Cmds.disconnectRuntime();
yield closeWebIDE(win);
const { DebuggerServer } = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
DebuggerServer.destroy();
SimpleTest.finish();
});
}
</script>
</body>
</html>

Просмотреть файл

@ -291,3 +291,14 @@ panel > .panel-arrowcontainer > .panel-arrowcontent {
position: relative;
border-bottom: 1px solid #aaa;
}
/* Toolbox */
#notificationbox[toolboxfullscreen] > .devtools-horizontal-splitter,
#notificationbox[toolboxfullscreen] > #deck {
display: none;
}
#notificationbox[toolboxfullscreen] > #toolbox {
-moz-box-flex: 1;
}