Title: [180625] trunk/Source/WebInspectorUI
- Revision
- 180625
- Author
- commit-qu...@webkit.org
- Date
- 2015-02-25 07:10:04 -0800 (Wed, 25 Feb 2015)
Log Message
Web Inspector: Improve Regex/Error output in Object Tree and Previews
https://bugs.webkit.org/show_bug.cgi?id=142010
Patch by Joseph Pecoraro <pecor...@apple.com> on 2015-02-25
Reviewed by Timothy Hatcher.
* UserInterface/Views/ObjectPreviewView.js:
(WebInspector.ObjectPreviewView):
(WebInspector.ObjectPreviewView.prototype._initTitleElement):
Since some object types may be formatted as simple values, ensure they get
the formatted style even in the title view.
(WebInspector.ObjectPreviewView.prototype._appendPreview):
Those object types that can be formatted as simple values should skip
to the value formatting phase.
(WebInspector.ObjectPreviewView.prototype._appendPropertyPreviews):
Do not show property previews for error objects. Always assume lossy
so that it can be expanded.
* UserInterface/Views/ObjectTreeView.js:
(WebInspector.ObjectTreeView):
Make a similiar improvement for ObjectTree titles when previews are
unavailable. This will make dir(value) show a stylized value in the
title of the Object Tree.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (180624 => 180625)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-02-25 15:03:48 UTC (rev 180624)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-02-25 15:10:04 UTC (rev 180625)
@@ -1,5 +1,32 @@
2015-02-25 Joseph Pecoraro <pecor...@apple.com>
+ Web Inspector: Improve Regex/Error output in Object Tree and Previews
+ https://bugs.webkit.org/show_bug.cgi?id=142010
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Views/ObjectPreviewView.js:
+ (WebInspector.ObjectPreviewView):
+ (WebInspector.ObjectPreviewView.prototype._initTitleElement):
+ Since some object types may be formatted as simple values, ensure they get
+ the formatted style even in the title view.
+
+ (WebInspector.ObjectPreviewView.prototype._appendPreview):
+ Those object types that can be formatted as simple values should skip
+ to the value formatting phase.
+
+ (WebInspector.ObjectPreviewView.prototype._appendPropertyPreviews):
+ Do not show property previews for error objects. Always assume lossy
+ so that it can be expanded.
+
+ * UserInterface/Views/ObjectTreeView.js:
+ (WebInspector.ObjectTreeView):
+ Make a similiar improvement for ObjectTree titles when previews are
+ unavailable. This will make dir(value) show a stylized value in the
+ title of the Object Tree.
+
+2015-02-25 Joseph Pecoraro <pecor...@apple.com>
+
Web Inspector: Improve PropertyPath display strings for getters / values
https://bugs.webkit.org/show_bug.cgi?id=142008
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js (180624 => 180625)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js 2015-02-25 15:03:48 UTC (rev 180624)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js 2015-02-25 15:10:04 UTC (rev 180625)
@@ -41,8 +41,8 @@
this._titleElement = this._element.appendChild(document.createElement("span"));
this._titleElement.className = "title";
- this._titleElement.textContent = preview.description || "";
this._titleElement.hidden = true;
+ this._initTitleElement();
if (this._lossless)
this._element.classList.add("lossless");
@@ -93,6 +93,15 @@
// Private
+ _initTitleElement: function()
+ {
+ // Display null / regexps as simple formatted values even in title.
+ if (this._preview.subtype === "regexp" || this._preview.subtype === "null")
+ this._titleElement.appendChild(WebInspector.FormattedValue.createElementForObjectPreview(this._preview));
+ else
+ this._titleElement.textContent = this._preview.description || "";
+ },
+
_numberOfPropertiesToShowInMode: function()
{
return this._mode === WebInspector.ObjectPreviewView.Mode.Brief ? 3 : Infinity;
@@ -100,20 +109,28 @@
_appendPreview: function(element, preview)
{
- // Class name for non-array object types.
- if (preview.type === "object" && preview.subtype !== "null" && preview.subtype !== "array" && preview.description !== "Object") {
- var nameElement = element.appendChild(document.createElement("span"));
- nameElement.className = "object-preview-name";
- nameElement.textContent = preview.description + " ";
+ var displayObjectAsValue = false;
+ if (preview.type === "object") {
+ if (preview.subtype === "regexp" || preview.subtype === "null") {
+ // Display null / regexps as simple formatted values.
+ displayObjectAsValue = true;
+ } else if (preview.subtype !== "array" && preview.description !== "Object") {
+ // Class names for other non-array / non-basic-Object types.
+ var nameElement = element.appendChild(document.createElement("span"));
+ nameElement.className = "object-preview-name";
+ nameElement.textContent = preview.description + " ";
+ }
}
// Content.
var bodyElement = element.appendChild(document.createElement("span"));
bodyElement.className = "object-preview-body";
- if (preview.collectionEntryPreviews)
- return this._appendEntryPreviews(bodyElement, preview);
- if (preview.propertyPreviews)
- return this._appendPropertyPreviews(bodyElement, preview);
+ if (!displayObjectAsValue) {
+ if (preview.collectionEntryPreviews)
+ return this._appendEntryPreviews(bodyElement, preview);
+ if (preview.propertyPreviews)
+ return this._appendPropertyPreviews(bodyElement, preview);
+ }
return this._appendValuePreview(bodyElement, preview);
},
@@ -146,19 +163,21 @@
_appendPropertyPreviews: function(element, preview)
{
- // Do not show empty properties preview for Date previews.
- var isDate = preview.subtype === "date";
- var numProperties = preview.propertyPreviews.length;
- if (!numProperties && isDate)
- return preview.lossless;
+ // Do not show Error properties in previews. They are more useful in full views.
+ if (preview.subtype === "error")
+ return false;
+ // Do not show Date properties in previews. If there are any properties, show them in full view.
+ if (preview.subtype === "date")
+ return !preview.propertyPreviews.length;
+
var isArray = preview.subtype === "array";
element.appendChild(document.createTextNode(isArray ? "[" : "{"));
var numberAdded = 0;
var limit = this._numberOfPropertiesToShowInMode();
- for (var i = 0; i < numProperties && numberAdded < limit; ++i) {
+ for (var i = 0; i < preview.propertyPreviews.length && numberAdded < limit; ++i) {
var property = preview.propertyPreviews[i];
// FIXME: Better handle getter/setter accessors. Should we show getters in previews?
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js (180624 => 180625)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js 2015-02-25 15:03:48 UTC (rev 180624)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js 2015-02-25 15:10:04 UTC (rev 180625)
@@ -49,7 +49,7 @@
} else {
this._titleElement = document.createElement("span");
this._titleElement.className = "title";
- this._titleElement.textContent = this._object.description || "";
+ this._titleElement.appendChild(WebInspector.FormattedValue.createElementForRemoteObject(this._object));
this._titleElement.addEventListener("click", this._handlePreviewOrTitleElementClick.bind(this));
this._element.appendChild(this._titleElement);
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes