Commit a31ef787 authored by timothy@apple.com's avatar timothy@apple.com
Browse files

Make input in the Web Inspector console print before any output

        that might be added by the called function.

        https://bugs.webkit.org/show_bug.cgi?id=19931

        Reviewed by Oliver Hunt.

        * inspector/front-end/Console.js:
        (WebInspector.Console.prototype._enterKeyPressed): Add the command
        message before evaluating the result. Associate the originating
        command to the result, so if they are adjacent there is no divider.
        (WebInspector.ConsoleCommand): No longer take a result.
        (WebInspector.ConsoleCommand.prototype.toMessageElement): Result
        code removed since it isn't used now.
        (WebInspector.ConsoleCommandResult): Subclass ConsoleMessage.
        (WebInspector.ConsoleCommandResult.prototype.toMessageElement):
        Call the ConsoleMessage toMessageElement and add a style class.
        * inspector/front-end/inspector.css: Add a new style class for
        adjacent results to hide the divider. Also tweak the position of
        the disclosure triangle for objects to not use the left margin.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@41352 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 300dc10a
2009-02-28 Timothy Hatcher <timothy@apple.com>
Make input in the Web Inspector console print before any output
that might be added by the called function.
https://bugs.webkit.org/show_bug.cgi?id=19931
Reviewed by Oliver Hunt.
* inspector/front-end/Console.js:
(WebInspector.Console.prototype._enterKeyPressed): Add the command
message before evaluating the result. Associate the originating
command to the result, so if they are adjacent there is no divider.
(WebInspector.ConsoleCommand): No longer take a result.
(WebInspector.ConsoleCommand.prototype.toMessageElement): Result
code removed since it isn't used now.
(WebInspector.ConsoleCommandResult): Subclass ConsoleMessage.
(WebInspector.ConsoleCommandResult.prototype.toMessageElement):
Call the ConsoleMessage toMessageElement and add a style class.
* inspector/front-end/inspector.css: Add a new style class for
adjacent results to hide the divider. Also tweak the position of
the disclosure triangle for objects to not use the left margin.
2009-03-01 Chris Fleizach <cfleizach@apple.com>
 
Reviewed by Oliver Hunt.
......@@ -446,6 +446,9 @@ WebInspector.Console.prototype = {
if (!str.length)
return;
var commandMessage = new WebInspector.ConsoleCommand(str);
this.addMessage(commandMessage);
var result;
var exception = false;
try {
......@@ -459,8 +462,8 @@ WebInspector.Console.prototype = {
this.prompt.historyOffset = 0;
this.prompt.text = "";
var level = exception ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log;
this.addMessage(new WebInspector.ConsoleCommand(str, result, this._format(result), level));
var level = (exception ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log);
this.addMessage(new WebInspector.ConsoleCommandResult(result, level, commandMessage));
},
_mouseOverNode: function(event)
......@@ -859,11 +862,9 @@ WebInspector.ConsoleMessage.MessageLevel = {
EndGroup: 8
}
WebInspector.ConsoleCommand = function(command, result, formattedResultElement, level)
WebInspector.ConsoleCommand = function(command)
{
this.command = command;
this.formattedResultElement = formattedResultElement;
this.level = level;
}
WebInspector.ConsoleCommand.prototype = {
......@@ -878,30 +879,28 @@ WebInspector.ConsoleCommand.prototype = {
commandTextElement.textContent = this.command;
element.appendChild(commandTextElement);
var resultElement = document.createElement("div");
resultElement.className = "console-message";
element.appendChild(resultElement);
switch (this.level) {
case WebInspector.ConsoleMessage.MessageLevel.Log:
resultElement.addStyleClass("console-log-level");
break;
case WebInspector.ConsoleMessage.MessageLevel.Warning:
resultElement.addStyleClass("console-warning-level");
break;
case WebInspector.ConsoleMessage.MessageLevel.Error:
resultElement.addStyleClass("console-error-level");
return element;
}
}
var resultTextElement = document.createElement("span");
resultTextElement.className = "console-message-text";
resultTextElement.appendChild(this.formattedResultElement);
resultElement.appendChild(resultTextElement);
WebInspector.ConsoleCommandResult = function(result, level, originatingCommand)
{
WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, level, -1, null, null, 1, result);
this.originatingCommand = originatingCommand;
}
WebInspector.ConsoleCommandResult.prototype = {
toMessageElement: function()
{
var element = WebInspector.ConsoleMessage.prototype.toMessageElement.call(this);
element.addStyleClass("console-user-command-result");
return element;
}
}
WebInspector.ConsoleCommandResult.prototype.__proto__ = WebInspector.ConsoleMessage.prototype;
WebInspector.ConsoleGroup = function(parentGroup, level)
{
this.parentGroup = parentGroup;
......@@ -928,6 +927,9 @@ WebInspector.ConsoleGroup.prototype = {
element.addEventListener("click", this._titleClicked.bind(this), true);
} else
this.messagesElement.appendChild(element);
if (element.previousSibling && msg.originatingCommand && element.previousSibling.command === msg.originatingCommand)
element.previousSibling.addStyleClass("console-adjacent-user-command-result");
},
_titleClicked: function(event)
......
......@@ -463,6 +463,10 @@ body.console-visible #console {
background-image: url(Images/userInputIcon.png);
}
.console-user-command-result::before {
background-image: url(Images/userInputResultIcon.png);
}
.console-message, .console-user-command {
position: relative;
border-bottom: 1px solid rgb(240, 240, 240);
......@@ -470,6 +474,14 @@ body.console-visible #console {
min-height: 16px;
}
.console-adjacent-user-command-result {
border-bottom: none;
}
.console-adjacent-user-command-result + .console-user-command-result::before {
background-image: none;
}
.console-message::before, .console-user-command::before, #console-prompt::before, .console-group-title-level::before {
position: absolute;
display: block;
......@@ -576,20 +588,20 @@ body.console-visible #console {
}
.console-group-messages .section {
margin: 0;
margin: 0 0 0 12px !important;
}
.console-group-messages .section .header {
padding: 0 8px 0 0;
background-image: none;
border: none;
min-height: 16px;
min-height: 0;
}
.console-group-messages .section .header::before {
position: absolute;
top: 1px;
left: 12px;
left: 1px;
width: 8px;
height: 8px;
content: url(Images/treeRightTriangleBlack.png);
......@@ -618,10 +630,19 @@ body.console-visible #console {
margin-top: -1px;
}
.console-formatted-object, .console-formatted-node {
position: relative;
display: block;
}
.console-formatted-object .section, .console-formatted-node .section {
position: static;
}
.console-formatted-object .properties, .console-formatted-node .properties {
padding-left: 0 !important;
}
.auto-complete-text {
color: rgb(128, 128, 128);
-webkit-user-select: none;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment