Bug 916601 - Remove Ctrl +/-/0 zooming shortcuts from web console; r=harth

This commit is contained in:
Mihai Sucan 2013-09-15 12:12:27 +03:00
Родитель 78979e2433
Коммит 723bc552e7
3 изменённых файлов: 20 добавлений и 12 удалений

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

@ -15,7 +15,7 @@ function test() {
browser.addEventListener("load", function onLoad() {
browser.removeEventListener("load", onLoad, true);
Services.prefs.setIntPref("devtools.webconsole.fontSize", 10);
openConsole(null, testFontSizeChange);
HUDService.toggleBrowserConsole().then(testFontSizeChange);
}, true);
}
@ -24,19 +24,19 @@ function testFontSizeChange(hud) {
let outputNode = hud.jsterm.outputNode;
outputNode.focus();
EventUtils.synthesizeKey("-", { accelKey: true });
EventUtils.synthesizeKey("-", { accelKey: true }, hud.iframeWindow);
is(inputNode.style.fontSize, "10px", "input font stays at same size with ctrl+-");
is(outputNode.style.fontSize, inputNode.style.fontSize, "output font stays at same size with ctrl+-");
EventUtils.synthesizeKey("=", { accelKey: true });
EventUtils.synthesizeKey("=", { accelKey: true }, hud.iframeWindow);
is(inputNode.style.fontSize, "11px", "input font increased with ctrl+=");
is(outputNode.style.fontSize, inputNode.style.fontSize, "output font stays at same size with ctrl+=");
EventUtils.synthesizeKey("-", { accelKey: true });
EventUtils.synthesizeKey("-", { accelKey: true }, hud.iframeWindow);
is(inputNode.style.fontSize, "10px", "font decreased with ctrl+-");
is(outputNode.style.fontSize, inputNode.style.fontSize, "output font stays at same size with ctrl+-");
EventUtils.synthesizeKey("0", { accelKey: true });
EventUtils.synthesizeKey("0", { accelKey: true }, hud.iframeWindow);
is(inputNode.style.fontSize, "", "font reset with ctrl+0");
is(outputNode.style.fontSize, inputNode.style.fontSize, "output font stays at same size with ctrl+0");

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

@ -491,7 +491,8 @@ WebConsoleFrame.prototype = {
this._initFilterButtons();
this._changeClearModifier();
let fontSize = Services.prefs.getIntPref("devtools.webconsole.fontSize");
let fontSize = this.owner._browserConsole ?
Services.prefs.getIntPref("devtools.webconsole.fontSize") : 0;
if (fontSize != 0) {
fontSize = Math.max(MIN_FONT_SIZE, fontSize);
@ -501,6 +502,13 @@ WebConsoleFrame.prototype = {
this.inputNode.style.fontSize = fontSize + "px";
}
if (this.owner._browserConsole) {
for (let id of ["Enlarge", "Reduce", "Reset"]) {
this.document.getElementById("cmd_fullZoom" + id)
.removeAttribute("disabled");
}
}
let updateSaveBodiesPrefUI = (aElement) => {
this.getSaveRequestAndResponseBodies().then(aValue => {
aElement.setAttribute("checked", aValue);
@ -4598,12 +4606,12 @@ CommandController.prototype = {
return selectedItem && "url" in selectedItem;
}
case "consoleCmd_clearOutput":
case "cmd_fontSizeEnlarge":
case "cmd_fontSizeReduce":
case "cmd_fontSizeReset":
case "cmd_selectAll":
case "cmd_find":
return true;
case "cmd_fontSizeEnlarge":
case "cmd_fontSizeReduce":
case "cmd_fontSizeReset":
case "cmd_close":
return this.owner.owner._browserConsole;
}

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

@ -42,9 +42,9 @@ function goUpdateConsoleCommands() {
<command id="consoleCmd_clearOutput"
oncommand="goDoCommand('consoleCmd_clearOutput');"/>
<command id="cmd_find" oncommand="goDoCommand('cmd_find');"/>
<command id="cmd_fullZoomEnlarge" oncommand="goDoCommand('cmd_fontSizeEnlarge');"/>
<command id="cmd_fullZoomReduce" oncommand="goDoCommand('cmd_fontSizeReduce');"/>
<command id="cmd_fullZoomReset" oncommand="goDoCommand('cmd_fontSizeReset');"/>
<command id="cmd_fullZoomEnlarge" oncommand="goDoCommand('cmd_fontSizeEnlarge');" disabled="true"/>
<command id="cmd_fullZoomReduce" oncommand="goDoCommand('cmd_fontSizeReduce');" disabled="true"/>
<command id="cmd_fullZoomReset" oncommand="goDoCommand('cmd_fontSizeReset');" disabled="true"/>
<command id="cmd_close" oncommand="goDoCommand('cmd_close');" disabled="true"/>
</commandset>
<keyset id="consoleKeys">