Skip to content

Commit

Permalink
Merge pull request #27 from firebug/scrollbar_bugs
Browse files Browse the repository at this point in the history
Issue 5725 (Command history isn't displayed correctly when there are too many commands in it)
http://code.google.com/p/fbug/issues/detail?id=5725
  • Loading branch information
SebastianZ committed Aug 6, 2012
2 parents d43708b + d89b323 commit 1e11371
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 11 deletions.
15 changes: 9 additions & 6 deletions extension/content/firebug/console/commandHistory.js
Expand Up @@ -24,7 +24,7 @@ Firebug.CommandHistory = function()
const commandHistoryMax = 1000;

var commandsPopup = Firebug.chrome.$("fbCommandHistory");
var commands = [];
var commands = this.commands = [];
var commandPointer = 0;
var commandInsertPointer = -1;

Expand Down Expand Up @@ -126,26 +126,29 @@ Firebug.CommandHistory = function()
if(commands.length == 0)
return;

var vbox = commandsPopup.ownerDocument.createElement("vbox");
var doc = commandsPopup.ownerDocument;

for (var i = 0; i < commands.length; i++)
{
var hbox = commandsPopup.ownerDocument.
createElementNS("http://www.w3.org/1999/xhtml", "div");
var hbox = doc.createElementNS("http://www.w3.org/1999/xhtml", "div");

hbox.classList.add("commandHistoryItem");
var shortExpr = Str.cropString(Str.stripNewLines(commands[i]), 50);
hbox.innerHTML = Str.escapeForTextNode(shortExpr);
hbox.value = i;
vbox.appendChild(hbox);
commandsPopup.appendChild(hbox);

if (i === commandPointer)
this.selectCommand(hbox);
}

commandsPopup.appendChild(vbox);
commandsPopup.openPopup(element, "before_start", 0, 0, false, false);

// make sure last element is visible
var box = doc.getAnonymousNodes(commandsPopup)[0];
var scrollBox = doc.getAnonymousNodes(box)[1];
scrollBox.scrollTop = scrollBox.scrollHeight;

return true;
};

Expand Down
4 changes: 4 additions & 0 deletions extension/content/firebug/console/commandLine.js
Expand Up @@ -450,6 +450,10 @@ Firebug.CommandLine = Obj.extend(Firebug.Module,

if (noscript && noScriptURI)
noscript.setJSEnabled(noScriptURI, false);

var consolePanel = Firebug.currentContext.panelMap.console;
if (consolePanel)
Dom.scrollToBottom(consolePanel.panelNode);
},

enterInspect: function(context)
Expand Down
4 changes: 2 additions & 2 deletions extension/content/firebug/console/consolePanel.js
Expand Up @@ -155,12 +155,12 @@ Firebug.ConsolePanel.prototype = Obj.extend(Firebug.ActivablePanel,
if (state)
wasScrolledToBottom = state.wasScrolledToBottom;

if (typeof(wasScrolledToBottom) == "boolean")
if (typeof wasScrolledToBottom == "boolean")
{
this.wasScrolledToBottom = wasScrolledToBottom;
delete state.wasScrolledToBottom;
}
else
else if (typeof this.wasScrolledToBottom != "boolean")
{
// If the previous state doesn't says where to scroll,
// scroll to the bottom by default.
Expand Down
3 changes: 2 additions & 1 deletion extension/content/firebug/firebug.css
Expand Up @@ -261,7 +261,8 @@ panelTab > panelTabMenu .menuPopup:-moz-locale-dir(rtl) {
height: 20px;
}

#fbLocationList.noTabStop> menupopup > arrowscrollbox> scrollbox {
#fbLocationList.noTabStop > menupopup > arrowscrollbox > scrollbox,
#fbCommandHistory > arrowscrollbox > scrollbox {
overflow-y: auto;
}

Expand Down
2 changes: 2 additions & 0 deletions extension/content/firebug/firebug.js
Expand Up @@ -1719,9 +1719,11 @@ Firebug.Panel = Obj.extend(new Firebug.Listener(),

if (this.panelNode)
{
var scrollTop = this.panelNode.scrollTop;
this.panelNode = doc.adoptNode(this.panelNode, true);
this.panelNode.ownerPanel = this;
doc.body.appendChild(this.panelNode);
this.panelNode.scrollTop = scrollTop;
}
},

Expand Down
4 changes: 2 additions & 2 deletions extension/content/firebug/firebugOverlay.xul
Expand Up @@ -36,8 +36,8 @@
noautofocus="true">
</panel>

<panel id="fbCommandHistory" noautofocus="true">
</panel>
<menupopup id="fbCommandHistory" noautofocus="true">
</menupopup>

<!-- Context menu for the Command Editor -->
<menupopup id="fbCommandEditorPopup" />
Expand Down
2 changes: 2 additions & 0 deletions extension/skin/classic/win/firebug.css
Expand Up @@ -146,9 +146,11 @@

#fbCommandHistory {
min-width: 200px;
max-height: 800px;
cursor: default;
font-family: monospace;
white-space: pre;
-moz-appearance: none;
}

.commandHistoryItem.selected {
Expand Down

0 comments on commit 1e11371

Please sign in to comment.