Title: [194243] trunk/Source/WebInspectorUI
- Revision
- 194243
- Author
- [email protected]
- Date
- 2015-12-17 15:37:51 -0800 (Thu, 17 Dec 2015)
Log Message
Web Inspector: Improve console.trace, make it more like console.assert and inline the message
https://bugs.webkit.org/show_bug.cgi?id=152352
Reviewed by Timothy Hatcher.
* Localizations/en.lproj/localizedStrings.js:
New "Trace" related strings.
* UserInterface/Views/ConsoleMessageView.js:
(WebInspector.ConsoleMessageView.prototype.expand):
Since we auto-expand Trace messages for their Call Stack, don't also
auto-expand a single inner object, which may be big and push the
actual stack trace off the screen.
(WebInspector.ConsoleMessageView.prototype._appendMessageTextAndArguments):
Behave like Assert messages and absorb a message string, and include
extra arguments gracefully.
(WebInspector.ConsoleMessageView.prototype._appendFormattedArguments):
For expandable messages with simple extra arguments (console.trace with
primitives and backtrace, or console.assert with primitives and backtrace)
we were hiding the inline lossless previews and not showing them as a
bulleted list below. We can just keep the lossless previews inline in the
title, since they were only put there because they are small and lossless.
(WebInspector.ConsoleMessageView.prototype.toClipboardString):
No need to hard code "console.trace()" in the clipboard.
* UserInterface/Views/ConsoleMessageView.css:
(.console-message.expandable.expanded :matches(.console-message-preview, .console-message-preview-divider):not(.inline-lossless)):
(.console-message.expandable.expanded :matches(.console-message-preview, .console-message-preview-divider)): Deleted.
Don't hide the inline lossless preview in the console message title when it is inline-lossless.
* UserInterface/Views/ObjectTreeView.js:
(WebInspector.ObjectTreeView.prototype.expand):
Do not allow expanding a loss-less preview.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (194242 => 194243)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-12-17 23:37:48 UTC (rev 194242)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-12-17 23:37:51 UTC (rev 194243)
@@ -1,3 +1,42 @@
+2015-12-17 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: Improve console.trace, make it more like console.assert and inline the message
+ https://bugs.webkit.org/show_bug.cgi?id=152352
+
+ Reviewed by Timothy Hatcher.
+
+ * Localizations/en.lproj/localizedStrings.js:
+ New "Trace" related strings.
+
+ * UserInterface/Views/ConsoleMessageView.js:
+ (WebInspector.ConsoleMessageView.prototype.expand):
+ Since we auto-expand Trace messages for their Call Stack, don't also
+ auto-expand a single inner object, which may be big and push the
+ actual stack trace off the screen.
+
+ (WebInspector.ConsoleMessageView.prototype._appendMessageTextAndArguments):
+ Behave like Assert messages and absorb a message string, and include
+ extra arguments gracefully.
+
+ (WebInspector.ConsoleMessageView.prototype._appendFormattedArguments):
+ For expandable messages with simple extra arguments (console.trace with
+ primitives and backtrace, or console.assert with primitives and backtrace)
+ we were hiding the inline lossless previews and not showing them as a
+ bulleted list below. We can just keep the lossless previews inline in the
+ title, since they were only put there because they are small and lossless.
+
+ (WebInspector.ConsoleMessageView.prototype.toClipboardString):
+ No need to hard code "console.trace()" in the clipboard.
+
+ * UserInterface/Views/ConsoleMessageView.css:
+ (.console-message.expandable.expanded :matches(.console-message-preview, .console-message-preview-divider):not(.inline-lossless)):
+ (.console-message.expandable.expanded :matches(.console-message-preview, .console-message-preview-divider)): Deleted.
+ Don't hide the inline lossless preview in the console message title when it is inline-lossless.
+
+ * UserInterface/Views/ObjectTreeView.js:
+ (WebInspector.ObjectTreeView.prototype.expand):
+ Do not allow expanding a loss-less preview.
+
2015-12-16 Joseph Pecoraro <[email protected]>
Web Inspector: Add JSContext Script Profiling
Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (194242 => 194243)
--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2015-12-17 23:37:48 UTC (rev 194242)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2015-12-17 23:37:51 UTC (rev 194243)
@@ -620,6 +620,8 @@
localizedStrings["Total Time"] = "Total Time";
localizedStrings["Total number of resources, click to show the Resources tab"] = "Total number of resources, click to show the Resources tab";
localizedStrings["Total size of all resources, click to show the Network Requests timeline"] = "Total size of all resources, click to show the Network Requests timeline";
+localizedStrings["Trace"] = "Trace";
+localizedStrings["Trace: %s"] = "Trace: %s";
localizedStrings["Transfered"] = "Transfered";
localizedStrings["Transform"] = "Transform";
localizedStrings["Transition"] = "Transition";
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.css (194242 => 194243)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.css 2015-12-17 23:37:48 UTC (rev 194242)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.css 2015-12-17 23:37:51 UTC (rev 194243)
@@ -89,7 +89,7 @@
background-image: url(../Images/DisclosureTriangles.svg#open-normal);
}
-.console-message.expandable.expanded :matches(.console-message-preview, .console-message-preview-divider) {
+.console-message.expandable.expanded :matches(.console-message-preview, .console-message-preview-divider):not(.inline-lossless) {
display: none;
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js (194242 => 194243)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js 2015-12-17 23:37:48 UTC (rev 194242)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js 2015-12-17 23:37:51 UTC (rev 194243)
@@ -157,7 +157,8 @@
this._element.classList.add("expanded");
// Auto-expand an inner object tree if there is a single object.
- if (this._objectTree) {
+ // For Trace messages we are auto-expanding for the call stack, don't also auto-expand an object as well.
+ if (this._objectTree && this._message.type !== WebInspector.ConsoleMessage.MessageType.Trace) {
if (!this._extraParameters || this._extraParameters.length <= 1)
this._objectTree.expand();
}
@@ -189,9 +190,6 @@
if (this._message.savedResultIndex)
clipboardString = clipboardString.replace(/\s*=\s*(\$\d+)$/, " = $1");
- if (this._message.type === WebInspector.ConsoleMessage.MessageType.Trace)
- clipboardString = "console.trace()";
-
let hasStackTrace = this._shouldShowStackTrace();
if (!hasStackTrace) {
let repeatString = this.repeatCount > 1 ? "x" + this.repeatCount : "";
@@ -234,8 +232,14 @@
if (this._message.source === WebInspector.ConsoleMessage.MessageSource.ConsoleAPI) {
switch (this._message.type) {
case WebInspector.ConsoleMessage.MessageType.Trace:
- // FIXME: We should use a better string then console.trace.
- element.append("console.trace()");
+ var args = [WebInspector.UIString("Trace")];
+ if (this._message.parameters) {
+ if (this._message.parameters[0].type === "string")
+ args = [WebInspector.UIString("Trace: %s")].concat(this._message.parameters);
+ else
+ args = args.concat(this._message.parameters);
+ }
+ this._appendFormattedArguments(element, args);
break;
case WebInspector.ConsoleMessage.MessageType.Assert:
@@ -462,8 +466,11 @@
previewContainer.appendChild(previewElement);
// If this preview is effectively lossless, we can avoid making this console message expandable.
- if ((isPreviewView && preview.lossless) || (!isPreviewView && this._shouldConsiderObjectLossless(parameter)))
+ if ((isPreviewView && preview.lossless) || (!isPreviewView && this._shouldConsiderObjectLossless(parameter))) {
this._extraParameters = null;
+ enclosedElement.classList.add("inline-lossless");
+ previewContainer.classList.add("inline-lossless");
+ }
} else {
// Multiple objects. Show an indicator.
builderElement.append(" ", enclosedElement);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js (194242 => 194243)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js 2015-12-17 23:37:48 UTC (rev 194242)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js 2015-12-17 23:37:51 UTC (rev 194243)
@@ -182,6 +182,9 @@
if (this._expanded)
return;
+ if (this._hasLosslessPreview)
+ return;
+
this._expanded = true;
this._element.classList.add("expanded");
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes