mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Bug 950936 - Add disable autohide button in browser toolbox to help debug panel/popups. r=bgrins
This commit is contained in:
parent
5d76a7e03f
commit
c5ec2a3f0f
@ -593,6 +593,7 @@ TabTarget.prototype = {
|
||||
this._tab = null;
|
||||
this._form = null;
|
||||
this._remote = null;
|
||||
this._root = null;
|
||||
},
|
||||
|
||||
toString: function() {
|
||||
|
@ -60,6 +60,9 @@ function testPreferenceAndUIStateIsConsistent() {
|
||||
toolboxButtonNodes.push(doc.getElementById("command-button-frames"));
|
||||
let toggleableTools = toolbox.toolboxButtons;
|
||||
|
||||
// The noautohide button is only displayed in the browser toolbox
|
||||
toggleableTools = toggleableTools.filter(tool => tool.id != "command-button-noautohide");
|
||||
|
||||
for (let tool of toggleableTools) {
|
||||
let isVisible = getBoolPref(tool.visibilityswitch);
|
||||
|
||||
@ -82,6 +85,10 @@ function testToggleToolboxButtons() {
|
||||
toolboxButtonNodes = [...doc.querySelectorAll(".command-button:not(#command-button-tilt)")];
|
||||
}
|
||||
|
||||
// The noautohide button is only displayed in the browser toolbox
|
||||
toggleableTools = toggleableTools.filter(tool => tool.id != "command-button-noautohide");
|
||||
toolboxButtonNodes = toolboxButtonNodes.filter(btn => btn.id != "command-button-noautohide");
|
||||
|
||||
is (checkNodes.length, toggleableTools.length, "All of the buttons are toggleable." );
|
||||
is (checkNodes.length, toolboxButtonNodes.length, "All of the DOM buttons are toggleable." );
|
||||
|
||||
@ -89,9 +96,9 @@ function testToggleToolboxButtons() {
|
||||
let id = tool.id;
|
||||
let matchedCheckboxes = checkNodes.filter(node=>node.id === id);
|
||||
let matchedButtons = toolboxButtonNodes.filter(button=>button.id === id);
|
||||
ok (matchedCheckboxes.length === 1,
|
||||
is (matchedCheckboxes.length, 1,
|
||||
"There should be a single toggle checkbox for: " + id);
|
||||
ok (matchedButtons.length === 1,
|
||||
is (matchedButtons.length, 1,
|
||||
"There should be a DOM button for: " + id);
|
||||
is (matchedButtons[0], tool.button,
|
||||
"DOM buttons should match for: " + id);
|
||||
|
@ -175,6 +175,9 @@ OptionsPanel.prototype = {
|
||||
if (this.toolbox.target.isMultiProcess && tool.id === "command-button-tilt") {
|
||||
continue;
|
||||
}
|
||||
if (!tool.isTargetSupported(this.toolbox.target)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
enabledToolbarButtonsBox.appendChild(createCommandCheckbox(tool));
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ function setPrefDefaults() {
|
||||
Services.prefs.setBoolPref("devtools.performance.ui.show-platform-data", true);
|
||||
Services.prefs.setBoolPref("devtools.inspector.showAllAnonymousContent", true);
|
||||
Services.prefs.setBoolPref("browser.dom.window.dump.enabled", true);
|
||||
Services.prefs.setBoolPref("devtools.command-button-noautohide.enabled", true);
|
||||
}
|
||||
|
||||
window.addEventListener("load", function() {
|
||||
|
@ -61,6 +61,8 @@ loader.lazyRequireGetter(this, "createPerformanceFront",
|
||||
"devtools/server/actors/performance", true);
|
||||
loader.lazyRequireGetter(this, "system",
|
||||
"devtools/shared/system");
|
||||
loader.lazyRequireGetter(this, "getPreferenceFront",
|
||||
"devtools/server/actors/preference", true);
|
||||
loader.lazyGetter(this, "osString", () => {
|
||||
return Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS;
|
||||
});
|
||||
@ -91,7 +93,9 @@ const ToolboxButtons = exports.ToolboxButtons = [
|
||||
{ id: "command-button-eyedropper" },
|
||||
{ id: "command-button-screenshot" },
|
||||
{ id: "command-button-rulers" },
|
||||
{ id: "command-button-measure" }
|
||||
{ id: "command-button-measure" },
|
||||
{ id: "command-button-noautohide",
|
||||
isTargetSupported: target => target.chrome },
|
||||
];
|
||||
|
||||
/**
|
||||
@ -119,6 +123,7 @@ function Toolbox(target, selectedTool, hostType, hostOptions) {
|
||||
this._toolRegistered = this._toolRegistered.bind(this);
|
||||
this._toolUnregistered = this._toolUnregistered.bind(this);
|
||||
this._refreshHostTitle = this._refreshHostTitle.bind(this);
|
||||
this._toggleAutohide = this._toggleAutohide.bind(this);
|
||||
this.selectFrame = this.selectFrame.bind(this);
|
||||
this._updateFrames = this._updateFrames.bind(this);
|
||||
this._splitConsoleOnKeypress = this._splitConsoleOnKeypress.bind(this);
|
||||
@ -378,6 +383,9 @@ Toolbox.prototype = {
|
||||
let framesMenu = this.doc.getElementById("command-button-frames");
|
||||
framesMenu.addEventListener("command", this.selectFrame, true);
|
||||
|
||||
let noautohideMenu = this.doc.getElementById("command-button-noautohide");
|
||||
noautohideMenu.addEventListener("command", this._toggleAutohide, true);
|
||||
|
||||
this.textboxContextMenuPopup =
|
||||
this.doc.getElementById("toolbox-textbox-context-popup");
|
||||
this.textboxContextMenuPopup.addEventListener("popupshowing",
|
||||
@ -1012,7 +1020,7 @@ Toolbox.prototype = {
|
||||
visibilityswitch: "devtools." + options.id + ".enabled",
|
||||
isTargetSupported: options.isTargetSupported
|
||||
? options.isTargetSupported
|
||||
: target => target.isLocalTab
|
||||
: target => target.isLocalTab,
|
||||
};
|
||||
}).filter(button=>button);
|
||||
},
|
||||
@ -1040,6 +1048,8 @@ Toolbox.prototype = {
|
||||
}
|
||||
});
|
||||
|
||||
this._updateNoautohideButton();
|
||||
|
||||
// Tilt is handled separately because it is disabled in E10S mode. Because
|
||||
// we have removed tilt from toolboxButtons we have to deal with it here.
|
||||
let tiltEnabled = !this.target.isMultiProcess &&
|
||||
@ -1541,6 +1551,40 @@ Toolbox.prototype = {
|
||||
this._host.setTitle(title);
|
||||
},
|
||||
|
||||
// Returns an instance of the preference actor
|
||||
get _preferenceFront() {
|
||||
return this.target.root.then(rootForm => {
|
||||
return new getPreferenceFront(this.target.client, rootForm);
|
||||
});
|
||||
},
|
||||
|
||||
_toggleAutohide: Task.async(function*() {
|
||||
let prefName = "ui.popup.disable_autohide";
|
||||
let front = yield this._preferenceFront;
|
||||
let current = yield front.getBoolPref(prefName);
|
||||
yield front.setBoolPref(prefName, !current);
|
||||
|
||||
this._updateNoautohideButton();
|
||||
}),
|
||||
|
||||
_updateNoautohideButton: Task.async(function*() {
|
||||
let menu = this.doc.getElementById("command-button-noautohide");
|
||||
if (menu.getAttribute("hidden") === "true") {
|
||||
return;
|
||||
}
|
||||
if (!this.target.root) {
|
||||
return;
|
||||
}
|
||||
let prefName = "ui.popup.disable_autohide";
|
||||
let front = yield this._preferenceFront;
|
||||
let current = yield front.getBoolPref(prefName);
|
||||
if (current) {
|
||||
menu.setAttribute("checked", "true");
|
||||
} else {
|
||||
menu.removeAttribute("checked");
|
||||
}
|
||||
}),
|
||||
|
||||
_listFrames: function(event) {
|
||||
if (!this._target.activeTab || !this._target.activeTab.traits.frames) {
|
||||
// We are not targetting a regular TabActor
|
||||
|
@ -126,6 +126,10 @@
|
||||
hidden="true">
|
||||
<menupopup position="bottomright topright"></menupopup>
|
||||
</toolbarbutton>
|
||||
<toolbarbutton id="command-button-noautohide"
|
||||
class="command-button command-button-invertable"
|
||||
tooltiptext="&toolboxNoAutoHideTooltip;"
|
||||
hidden="true" />
|
||||
</hbox>
|
||||
<vbox id="toolbox-controls-separator" class="devtools-separator"/>
|
||||
<hbox id="toolbox-option-container"/>
|
||||
|
@ -188,6 +188,7 @@ devtools.jar:
|
||||
skin/images/command-console@2x.png (themes/images/command-console@2x.png)
|
||||
skin/images/command-eyedropper.png (themes/images/command-eyedropper.png)
|
||||
skin/images/command-eyedropper@2x.png (themes/images/command-eyedropper@2x.png)
|
||||
skin/images/command-noautohide.svg (themes/images/command-noautohide.svg)
|
||||
skin/images/command-rulers.png (themes/images/command-rulers.png)
|
||||
skin/images/command-rulers@2x.png (themes/images/command-rulers@2x.png)
|
||||
skin/images/command-measure.png (themes/images/command-measure.png)
|
||||
|
@ -41,6 +41,12 @@ values from browser.dtd. -->
|
||||
- It allows you to switch the context of the whole toolbox. -->
|
||||
<!ENTITY toolboxFramesTooltip "Select an iframe as the currently targeted document">
|
||||
|
||||
<!-- LOCALIZATION NOTE (toolboxNoAutoHideButton): This is the label for
|
||||
- the button to force the popups/panels to stay visible on blur.
|
||||
- This is only visible in the browser toolbox as it is meant for
|
||||
- addon developers and Firefox contributors. -->
|
||||
<!ENTITY toolboxNoAutoHideTooltip "Disable popup auto hide">
|
||||
|
||||
<!-- LOCALIZATION NOTE (browserToolboxErrorMessage): This is the label
|
||||
- shown next to error details when the Browser Toolbox is unable to open. -->
|
||||
<!ENTITY browserToolboxErrorMessage "Error opening Browser Toolbox:">
|
||||
|
@ -51,6 +51,7 @@ pref("devtools.command-button-eyedropper.enabled", false);
|
||||
pref("devtools.command-button-screenshot.enabled", false);
|
||||
pref("devtools.command-button-rulers.enabled", false);
|
||||
pref("devtools.command-button-measure.enabled", false);
|
||||
pref("devtools.command-button-noautohide.enabled", false);
|
||||
|
||||
// Inspector preferences
|
||||
// Enable the Inspector
|
||||
|
8
devtools/client/themes/images/command-noautohide.svg
Executable file
8
devtools/client/themes/images/command-noautohide.svg
Executable file
@ -0,0 +1,8 @@
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<svg width="16" height="16" viewBox="0 0 30 29" xmlns="http://www.w3.org/2000/svg" fill="whitesmoke">
|
||||
<g fill-rule="evenodd">
|
||||
<path d="M3 1v11c0-1.104-.896-2-2-2h11c-1.104 0-2 .896-2 2V1c0 1.104.896 2 2 2H1c1.104 0 2-.896 2-2zM0 1c0-.553.447-1 1-1h11c.553 0 1 .447 1 1v11c0 .553-.447 1-1 1H1c-.553 0-1-.447-1-1V1zM20 1v11c0-1.104-.896-2-2-2h11c-1.104 0-2 .896-2 2V1c0 1.104.896 2 2 2H18c1.104 0 2-.896 2-2zm-3 0c0-.553.447-1 1-1h11c.553 0 1 .447 1 1v11c0 .553-.447 1-1 1H18c-.553 0-1-.447-1-1V1zM20 17v11c0-1.104-.896-2-2-2h11c-1.104 0-2 .896-2 2V17c0 1.104.896 2 2 2H18c1.104 0 2-.896 2-2zm-3 0c0-.553.447-1 1-1h11c.553 0 1 .447 1 1v11c0 .553-.447 1-1 1H18c-.553 0-1-.447-1-1V17zM3 17v11c0-1.104-.896-2-2-2h11c-1.104 0-2 .896-2 2V17c0 1.104.896 2 2 2H1c1.104 0 2-.896 2-2zm-3 0c0-.553.447-1 1-1h11c.553 0 1 .447 1 1v11c0 .553-.447 1-1 1H1c-.553 0-1-.447-1-1V17z"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
@ -744,6 +744,10 @@
|
||||
background-image: url("chrome://devtools/skin/images/command-console.png");
|
||||
}
|
||||
|
||||
#command-button-noautohide > image {
|
||||
background-image: url("chrome://devtools/skin/images/command-noautohide.svg");
|
||||
}
|
||||
|
||||
#command-button-eyedropper > image {
|
||||
background-image: url("chrome://devtools/skin/images/command-eyedropper.png");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user