Web Inspector: console should show an icon for console.info() messages
authorjond@apple.com <jond@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 May 2015 01:10:43 +0000 (01:10 +0000)
committerjond@apple.com <jond@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 May 2015 01:10:43 +0000 (01:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=18530

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* inspector/ConsoleMessage.cpp:
(Inspector::messageLevelValue):
* inspector/protocol/Console.json:
* runtime/ConsoleClient.cpp:
(JSC::appendMessagePrefix):
* runtime/ConsolePrototype.cpp:
(JSC::ConsolePrototype::finishCreation):
(JSC::consoleProtoFuncInfo):
* runtime/ConsoleTypes.h:

Source/WebInspectorUI:

Added icons for console.log, console.info and console.debug messages.

Separated console.info from console.log.

* UserInterface/Images/Debug.svg: Added.
* UserInterface/Images/Info.svg: Added.
* UserInterface/Images/Log.svg: Added.
New icon files.

* UserInterface/Models/ConsoleMessage.js:
* UserInterface/Views/ConsoleMessageView.css:
(.console-log-level::before):
(.console-info-level::before):
(.console-debug-level::before):
(:matches(.console-warning-level, .console-error-level, .console-log-level, .console-info-level, .console-debug-level).console-message):
(:matches(.console-warning-level, .console-error-level, .console-log-level, .console-info-level, .console-debug-level)::before):
(:matches(.console-warning-level, .console-error-level, .console-log-level).console-message): Deleted.
(:matches(.console-warning-level, .console-error-level, .console-log-level)::before): Deleted.
Include console.info messages in layout adjustments.

* UserInterface/Views/ConsoleMessageView.js:
(WebInspector.ConsoleMessageView):
(WebInspector.ConsoleMessageView.prototype._levelString):

Source/WebKit/mac:

* WebCoreSupport/WebChromeClient.mm:
(stringForMessageLevel):
* WebView/WebUIDelegatePrivate.h:

LayoutTests:

* inspector/console/console-api-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183659 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector-protocol/console/console-message-expected.txt
LayoutTests/inspector/console/console-api-expected.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/ConsoleMessage.cpp
Source/JavaScriptCore/inspector/protocol/Console.json
Source/JavaScriptCore/runtime/ConsoleClient.cpp
Source/JavaScriptCore/runtime/ConsolePrototype.cpp
Source/JavaScriptCore/runtime/ConsoleTypes.h
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Images/Debug.svg [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/Images/Info.svg [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/Images/Log.svg [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/Models/ConsoleMessage.js
Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.css
Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js
Source/WebInspectorUI/UserInterface/Views/LogContentView.js
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
Source/WebKit/mac/WebView/WebUIDelegatePrivate.h

index 96f0bee..691413b 100644 (file)
@@ -1,3 +1,12 @@
+2015-04-30  Jon Davis  <jond@apple.com>
+
+        Web Inspector: console should show an icon for console.info() messages
+        https://bugs.webkit.org/show_bug.cgi?id=18530
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/console/console-api-expected.txt:
+
 2015-04-30  Dean Jackson  <dino@apple.com>
 
         -apple-system-font-monospaced-numbers doesn't work on iOS
index 8c77ebd..285d7a4 100644 (file)
@@ -5,7 +5,7 @@ CONSOLE MESSAGE: line 10: error
 CONSOLE MESSAGE: line 11: debug
 Tests that console log messages make it to the frontend and have expected source, type, and levels.
 {"source":"console-api","level":"log","text":"log","location":"console-message.html:7:16","parameters":[{"type":"string"}]}
-{"source":"console-api","level":"log","text":"info","location":"console-message.html:8:17","parameters":[{"type":"string"}]}
+{"source":"console-api","level":"info","text":"info","location":"console-message.html:8:17","parameters":[{"type":"string"}]}
 {"source":"console-api","level":"warning","text":"warn","location":"console-message.html:9:17","parameters":[{"type":"string"}]}
 {"source":"console-api","level":"error","text":"error","location":"console-message.html:10:18","parameters":[{"type":"string"}]}
 {"source":"console-api","level":"debug","text":"debug","location":"console-message.html:11:18","parameters":[{"type":"string"}]}
index 98752b9..7e36e03 100644 (file)
@@ -108,7 +108,7 @@ STEP: console.debug('console.debug')
 STEP: console.info('console.info')
 {
   "_source": "console-api",
-  "_level": "log",
+  "_level": "info",
   "_messageText": "console.info",
   "_type": "log",
   "_url": null,
@@ -382,7 +382,7 @@ STEP: console.debug('message', object)
 STEP: console.info('message', object)
 {
   "_source": "console-api",
-  "_level": "log",
+  "_level": "info",
   "_messageText": "message",
   "_type": "log",
   "_url": null,
index a0fef8f..708b72a 100644 (file)
@@ -1,3 +1,20 @@
+2015-04-30  Jon Davis  <jond@apple.com>
+
+        Web Inspector: console should show an icon for console.info() messages
+        https://bugs.webkit.org/show_bug.cgi?id=18530
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/ConsoleMessage.cpp:
+        (Inspector::messageLevelValue):
+        * inspector/protocol/Console.json:
+        * runtime/ConsoleClient.cpp:
+        (JSC::appendMessagePrefix):
+        * runtime/ConsolePrototype.cpp:
+        (JSC::ConsolePrototype::finishCreation):
+        (JSC::consoleProtoFuncInfo):
+        * runtime/ConsoleTypes.h:
+
 2015-04-30  Filip Pizlo  <fpizlo@apple.com>
 
         Move all of the branchIs<type> helpers from SpeculativeJIT into AssemblyHelpers
index c1112ce..c194cd3 100644 (file)
@@ -170,6 +170,7 @@ static Inspector::Protocol::Console::ConsoleMessage::Level messageLevelValue(Mes
 {
     switch (level) {
     case MessageLevel::Log: return Inspector::Protocol::Console::ConsoleMessage::Level::Log;
+    case MessageLevel::Info: return Inspector::Protocol::Console::ConsoleMessage::Level::Info;
     case MessageLevel::Warning: return Inspector::Protocol::Console::ConsoleMessage::Level::Warning;
     case MessageLevel::Error: return Inspector::Protocol::Console::ConsoleMessage::Level::Error;
     case MessageLevel::Debug: return Inspector::Protocol::Console::ConsoleMessage::Level::Debug;
index 184e4cf..1e6d431 100644 (file)
@@ -8,7 +8,7 @@
             "description": "Console message.",
             "properties": [
                 { "name": "source", "type": "string", "enum": ["xml", "javascript", "network", "console-api", "storage", "appcache", "rendering", "css", "security", "other"], "description": "Message source." },
-                { "name": "level", "type": "string", "enum": ["log", "warning", "error", "debug"], "description": "Message severity." },
+                { "name": "level", "type": "string", "enum": ["log", "info", "warning", "error", "debug"], "description": "Message severity." },
                 { "name": "text", "type": "string", "description": "Message text." },
                 { "name": "type", "type": "string", "optional": true, "enum": ["log", "dir", "dirxml", "table", "trace", "clear", "startGroup", "startGroupCollapsed", "endGroup", "assert", "timing", "profile", "profileEnd"], "description": "Console message type." },
                 { "name": "url", "type": "string", "optional": true, "description": "URL of the message origin." },
index acd9aa6..31b48b2 100644 (file)
@@ -105,6 +105,9 @@ static void appendMessagePrefix(StringBuilder& builder, MessageSource source, Me
     case MessageLevel::Log:
         levelString = "LOG";
         break;
+    case MessageLevel::Info:
+        levelString = "INFO";
+        break;
     case MessageLevel::Warning:
         levelString = "WARN";
         break;
index e9751ed..7cad2c9 100644 (file)
@@ -41,6 +41,7 @@ const ClassInfo ConsolePrototype::s_info = { "ConsolePrototype", &Base::s_info,
 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDebug(ExecState*);
 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncError(ExecState*);
 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncLog(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncInfo(ExecState*);
 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncWarn(ExecState*);
 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncClear(ExecState*);
 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDir(ExecState*);
@@ -70,7 +71,7 @@ void ConsolePrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
     JSC_NATIVE_FUNCTION("debug", consoleProtoFuncDebug, None, 0);
     JSC_NATIVE_FUNCTION("error", consoleProtoFuncError, None, 0);
     JSC_NATIVE_FUNCTION("log", consoleProtoFuncLog, None, 0);
-    JSC_NATIVE_FUNCTION("info", consoleProtoFuncLog, None, 0); // "info" is an alias of "log".
+    JSC_NATIVE_FUNCTION("info", consoleProtoFuncInfo, None, 0);
     JSC_NATIVE_FUNCTION("warn", consoleProtoFuncWarn, None, 0);
 
     JSC_NATIVE_FUNCTION("clear", consoleProtoFuncClear, None, 0);
@@ -127,6 +128,11 @@ static EncodedJSValue JSC_HOST_CALL consoleProtoFuncLog(ExecState* exec)
     return consoleLogWithLevel(exec, MessageLevel::Log);
 }
 
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncInfo(ExecState* exec)
+{
+    return consoleLogWithLevel(exec, MessageLevel::Info);
+}
+
 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncWarn(ExecState* exec)
 {
     return consoleLogWithLevel(exec, MessageLevel::Warning);
index 45c65f5..05c1353 100644 (file)
@@ -62,6 +62,7 @@ enum class MessageLevel {
     Warning = 2,
     Error = 3,
     Debug = 4,
+    Info = 5,
 };
 
 } // namespace JSC
index 0867f82..dc8b443 100644 (file)
@@ -1,3 +1,34 @@
+2015-04-30  Jon Davis  <jond@apple.com>
+
+        Web Inspector: console should show an icon for console.info() messages
+        https://bugs.webkit.org/show_bug.cgi?id=18530
+
+        Reviewed by Timothy Hatcher.
+
+        Added icons for console.log, console.info and console.debug messages.
+
+        Separated console.info from console.log.
+
+        * UserInterface/Images/Debug.svg: Added.
+        * UserInterface/Images/Info.svg: Added.
+        * UserInterface/Images/Log.svg: Added.
+        New icon files.
+
+        * UserInterface/Models/ConsoleMessage.js:
+        * UserInterface/Views/ConsoleMessageView.css:
+        (.console-log-level::before):
+        (.console-info-level::before):
+        (.console-debug-level::before):
+        (:matches(.console-warning-level, .console-error-level, .console-log-level, .console-info-level, .console-debug-level).console-message):
+        (:matches(.console-warning-level, .console-error-level, .console-log-level, .console-info-level, .console-debug-level)::before):
+        (:matches(.console-warning-level, .console-error-level, .console-log-level).console-message): Deleted.
+        (:matches(.console-warning-level, .console-error-level, .console-log-level)::before): Deleted.
+        Include console.info messages in layout adjustments.
+
+        * UserInterface/Views/ConsoleMessageView.js:
+        (WebInspector.ConsoleMessageView):
+        (WebInspector.ConsoleMessageView.prototype._levelString):
+
 2015-04-30  Timothy Hatcher  <timothy@apple.com>
 
         Web Inspector: Scope Chain sidebar should be selected immediately when paused
index e3580c2..939c1cf 100644 (file)
Binary files a/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js and b/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js differ
diff --git a/Source/WebInspectorUI/UserInterface/Images/Debug.svg b/Source/WebInspectorUI/UserInterface/Images/Debug.svg
new file mode 100644 (file)
index 0000000..740b29d
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright © 2015 Apple Inc. All rights reserved. -->
+<svg viewBox="0 0 10 10" version="1.1" xmlns="http://www.w3.org/2000/svg">
+    <path d="M 0 1.997 C 0 1.446 0.446 1 0.996 1 L 5.693 1 C 5.973 1 6.352 1.152 6.555 1.355 L 9.845 4.645 C 10.041 4.841 10.048 5.152 9.845 5.355 L 6.555 8.645 C 6.359 8.841 5.979 9 5.693 9 L 0.996 9 C 0.446 9 0 8.547 0 8.003 L 0 1.997 Z" class="filled" fill="rgb(123, 178, 238)"/>
+</svg>
diff --git a/Source/WebInspectorUI/UserInterface/Images/Info.svg b/Source/WebInspectorUI/UserInterface/Images/Info.svg
new file mode 100644 (file)
index 0000000..e99f777
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright © 2015 Apple Inc. All rights reserved. -->
+<svg viewBox="0 0 10 10" version="1.1" xmlns="http://www.w3.org/2000/svg">
+       <circle cx="5" cy="5" r="5" fill="rgb(11, 36, 251)"/>
+    <path d="M 4.998 2.998 C 5.552 2.998 5.997 2.549 5.997 1.998 C 5.997 1.448 5.552 0.999 4.998 0.999 C 4.448 0.999 3.999 1.448 3.999 1.998 C 3.999 2.549 4.448 2.998 4.998 2.998 L 4.998 2.998 L 4.998 2.998 Z M 3.999 7.994 C 3.999 8.544 4.448 8.993 4.998 8.993 C 5.552 8.993 5.997 8.544 5.997 7.994 L 5.997 4.996 C 5.997 4.446 5.552 3.997 4.998 3.997 C 4.448 3.997 3.999 4.446 3.999 4.996 L 3.999 7.994 L 3.999 7.994 Z" class="filled" fill="white"/>
+</svg>
diff --git a/Source/WebInspectorUI/UserInterface/Images/Log.svg b/Source/WebInspectorUI/UserInterface/Images/Log.svg
new file mode 100644 (file)
index 0000000..16175eb
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright © 2015 Apple Inc. All rights reserved. -->
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10" version="1.1">
+    <path d="M 3.998 6.998 L 3.998 2.001 C 3.998 1.451 3.553 1.002 2.999 1.002 C 2.449 1.002 2 1.451 2 2.001 L 2 7.997 C 2 8.272 2.112 8.522 2.293 8.703 C 2.474 8.885 2.724 8.996 2.999 8.996 L 7.009 8.996 C 7.559 8.996 8.008 8.551 8.008 7.997 C 8.008 7.447 7.559 6.998 7.009 6.998 L 3.998 6.998 L 3.998 6.998 Z M 5 5 C 5 5.554 5.449 5.999 5.999 5.999 L 7.005 5.999 C 7.555 5.999 8.004 5.554 8.004 5 C 8.004 4.45 7.555 4.001 7.005 4.001 L 5.999 4.001 C 5.449 4.001 5 4.45 5 5 Z M 5 2.001 C 5 2.555 5.449 3 5.999 3 L 7.005 3 C 7.555 3 8.004 2.555 8.004 2.001 C 8.004 1.451 7.555 1.002 7.005 1.002 L 5.999 1.002 C 5.449 1.002 5 1.451 5 2.001 Z" class="filled" fill="rgb(181, 181, 181)"/>
+</svg>
index db831fc..3fbab43 100644 (file)
@@ -138,6 +138,7 @@ WebInspector.ConsoleMessage.MessageType = {
 
 WebInspector.ConsoleMessage.MessageLevel = {
     Log: "log",
+    Info: "info",
     Warning: "warning",
     Error: "error",
     Debug: "debug",
index 064b59d..8b32174 100644 (file)
     padding-right: 0;
 }
 
+.console-log-level::before {
+    content: url(../Images/Log.svg);
+}
+
+.console-info-level::before {
+    content: url(../Images/Info.svg);
+}
+
+.console-debug-level::before {
+    content: url(../Images/Debug.svg);
+}
+
 .console-error-level::before {
     content: url(../Images/Error.svg);
 }
     content: url(../Images/UserInputPromptPrevious.svg);
 }
 
-.console-debug-level::before {
-    background-color: blue;
-}
-
-:matches(.console-warning-level, .console-error-level, .console-log-level).console-message {
+:matches(.console-warning-level, .console-error-level, .console-log-level, .console-info-level, .console-debug-level).console-message {
  /* Move non-monospace log/warning/error text up a bit. */
     padding: 3px 12px 3px 20px;
 }
 
-:matches(.console-warning-level, .console-error-level, .console-log-level)::before {
+:matches(.console-warning-level, .console-error-level, .console-log-level, .console-info-level, .console-debug-level)::before {
  /* Re-center log/warning/error icons. */
     padding-top: 1px;
 }
index bb4fe49..b5de3cb 100644 (file)
@@ -50,6 +50,10 @@ WebInspector.ConsoleMessageView = class ConsoleMessageView extends WebInspector.
             this._element.classList.add("console-log-level");
             this._element.setAttribute("data-labelprefix", WebInspector.UIString("Log: "));
             break;
+        case WebInspector.ConsoleMessage.MessageLevel.Info:
+            this._element.classList.add("console-info-level");
+            this._element.setAttribute("data-labelprefix", WebInspector.UIString("Info: "));
+            break;
         case WebInspector.ConsoleMessage.MessageLevel.Debug:
             this._element.classList.add("console-debug-level");
             this._element.setAttribute("data-labelprefix", WebInspector.UIString("Debug: "));
@@ -743,6 +747,8 @@ WebInspector.ConsoleMessageView = class ConsoleMessageView extends WebInspector.
         switch (this._message.level) {
         case WebInspector.ConsoleMessage.MessageLevel.Log:
             return "Log";
+        case WebInspector.ConsoleMessage.MessageLevel.Info:
+            return "Info";
         case WebInspector.ConsoleMessage.MessageLevel.Warning:
             return "Warning";
         case WebInspector.ConsoleMessage.MessageLevel.Debug:
index 78e0308..206fa8b 100644 (file)
@@ -671,6 +671,7 @@ WebInspector.LogContentView.prototype = {
                     visible = showsErrors;
                     break;
                 case WebInspector.ConsoleMessage.MessageLevel.Log:
+                case WebInspector.ConsoleMessage.MessageLevel.Info:
                 case WebInspector.ConsoleMessage.MessageLevel.Debug:
                     visible = showsLogs;
                     break;
index 4d72c6f..930d927 100644 (file)
@@ -1,3 +1,14 @@
+2015-04-30  Jon Davis  <jond@apple.com>
+
+        Web Inspector: console should show an icon for console.info() messages
+        https://bugs.webkit.org/show_bug.cgi?id=18530
+
+        Reviewed by Timothy Hatcher.
+
+        * WebCoreSupport/WebChromeClient.mm:
+        (stringForMessageLevel):
+        * WebView/WebUIDelegatePrivate.h:
+
 2015-04-29  Myles C. Maxfield  <mmaxfield@apple.com>
 
         [OS X] Use CTFontCreateForCSS instead of doing font search ourselves
index b9709f5..4f66a86 100644 (file)
@@ -113,6 +113,7 @@ NSString *WebConsoleMessageOtherMessageSource = @"OtherMessageSource";
 
 NSString *WebConsoleMessageDebugMessageLevel = @"DebugMessageLevel";
 NSString *WebConsoleMessageLogMessageLevel = @"LogMessageLevel";
+NSString *WebConsoleMessageInfoMessageLevel = @"InfoMessageLevel";
 NSString *WebConsoleMessageWarningMessageLevel = @"WarningMessageLevel";
 NSString *WebConsoleMessageErrorMessageLevel = @"ErrorMessageLevel";
 
@@ -400,6 +401,8 @@ inline static NSString *stringForMessageLevel(MessageLevel level)
         return WebConsoleMessageDebugMessageLevel;
     case MessageLevel::Log:
         return WebConsoleMessageLogMessageLevel;
+    case MessageLevel::Info:
+        return WebConsoleMessageInfoMessageLevel;
     case MessageLevel::Warning:
         return WebConsoleMessageWarningMessageLevel;
     case MessageLevel::Error:
index b61c773..b398132 100644 (file)
@@ -169,6 +169,7 @@ extern NSString *WebConsoleMessageOtherMessageSource;
 // Message Levels.
 extern NSString *WebConsoleMessageDebugMessageLevel;
 extern NSString *WebConsoleMessageLogMessageLevel;
+extern NSString *WebConsoleMessageInfoMessageLevel;
 extern NSString *WebConsoleMessageWarningMessageLevel;
 extern NSString *WebConsoleMessageErrorMessageLevel;