Web Inspector: Support console.table
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Feb 2015 21:07:39 +0000 (21:07 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Feb 2015 21:07:39 +0000 (21:07 +0000)
commitc2f49ee6ce897565e634ab97c9f048ffb010fb06
treed4407cdeb9dacc2efa0557c163905b0d6238784a
parent1f55adc7962c8c3a6ba087e4a0cbcaaeb622f09f
Web Inspector: Support console.table
https://bugs.webkit.org/show_bug.cgi?id=141058

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* inspector/InjectedScriptSource.js:
Include the firstLevelKeys filter when generating previews.

* runtime/ConsoleClient.cpp:
(JSC::appendMessagePrefix):
Differentiate console.table logs to system log.

Source/WebCore:

* inspector/CommandLineAPIModuleSource.js:
Include "table(foo)" as an alias of "console.table(foo)" on
the command line.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
New "Index", "(Index)", "Value", table header strings.

* UserInterface/Views/ConsoleMessage.js:
Add "Table", but add FIXMEs to consider using the protocol generated enums.

* UserInterface/Views/ConsoleMessageImpl.js:
(WebInspector.ConsoleMessageImpl.prototype._format):
Special case console.table messages.

(WebInspector.ConsoleMessageImpl.prototype._appendPropertyPreviews):
(WebInspector.ConsoleMessageImpl.prototype._propertyPreviewElement):
Factor out ProjectPreview printing. Also, replace newlines in strings
with return characters, like we did elsewhere.

(WebInspector.ConsoleMessageImpl.prototype._formatParameterAsTable):
Ultimately try to create a DataGrid from the output. Search first
for rich object data in the list. If no rich object data is found
just check for simple values. If the table is lossy, also do
a log of the object in case the user wants to see more data.

* UserInterface/Views/DataGrid.js:
(WebInspector.DataGrid):
The for..in enumeration is unordered and may not give us the
column ordering we wanted. So include an optional preferred
column names list to get the preferred order.

(WebInspector.DataGrid.createSortableDataGrid):
Numerous bug fixes here. Accidental globals, typos, and sorting failures.

(WebInspector.DataGrid.prototype.autoSizeColumns):
(WebInspector.DataGrid.prototype.textForDataGridNodeColumn):
(WebInspector.DataGrid.prototype._copyTextForDataGridNode):
Create a generic method to get the text for a datagrid node in a column.
This is important for getting the text from console.table previews which
contains Nodes.

* UserInterface/Views/LogContentView.css:
(.console-messages:focus .console-item.selected .data-grid tr.selected):
(.console-item .data-grid tr.selected):
DataGrid selection colors while in the console which may or may
not have selected console items.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179493 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/InjectedScriptSource.js
Source/JavaScriptCore/runtime/ConsoleClient.cpp
Source/WebCore/ChangeLog
Source/WebCore/inspector/CommandLineAPIModuleSource.js
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Views/ConsoleMessage.js
Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js
Source/WebInspectorUI/UserInterface/Views/DataGrid.js
Source/WebInspectorUI/UserInterface/Views/LogContentView.css