<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[181089] trunk/Source/WebInspectorUI</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/181089">181089</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-03-05 11:40:07 -0800 (Thu, 05 Mar 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Inspector: Add ObjectTreeBaseTreeElement to share functionality
https://bugs.webkit.org/show_bug.cgi?id=142323
Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-03-05
Reviewed by Timothy Hatcher.
By making this change:
- Share lots of duplicated code.
- Array / Set / Map tree elements get context menu support
* UserInterface/Main.html:
* UserInterface/Views/ObjectTreeBaseTreeElement.js: Added.
(WebInspector.ObjectTreeBaseTreeElement):
(WebInspector.ObjectTreeBaseTreeElement.prototype.get property):
(WebInspector.ObjectTreeBaseTreeElement.prototype.get propertyPath):
(WebInspector.ObjectTreeBaseTreeElement.prototype.oncontextmenu):
(WebInspector.ObjectTreeBaseTreeElement.prototype.resolvedValue):
(WebInspector.ObjectTreeBaseTreeElement.prototype.resolvedValuePropertyPath):
(WebInspector.ObjectTreeBaseTreeElement.prototype.thisPropertyPath):
(WebInspector.ObjectTreeBaseTreeElement.prototype.hadError):
(WebInspector.ObjectTreeBaseTreeElement.prototype.propertyPathType):
(WebInspector.ObjectTreeBaseTreeElement.prototype.propertyPathString):
(WebInspector.ObjectTreeBaseTreeElement.prototype.createInteractiveGetterElement):
(WebInspector.ObjectTreeBaseTreeElement.prototype.createReadOnlyIconElement):
New file, copying most of the code from PropertyTreeElement so it can be shared.
* UserInterface/Views/ObjectTreeArrayIndexTreeElement.js:
(WebInspector.ObjectTreeArrayIndexTreeElement):
(WebInspector.ObjectTreeArrayIndexTreeElement.prototype.invokedGetter):
(WebInspector.ObjectTreeArrayIndexTreeElement.prototype._titleFragment):
(WebInspector.ObjectTreeArrayIndexTreeElement.prototype.get property): Deleted.
(WebInspector.ObjectTreeArrayIndexTreeElement.prototype._resolvedValue): Deleted.
(WebInspector.ObjectTreeArrayIndexTreeElement.prototype._propertyPathType): Deleted.
(WebInspector.ObjectTreeArrayIndexTreeElement.prototype._resolvedValuePropertyPath): Deleted.
(WebInspector.ObjectTreeArrayIndexTreeElement.prototype._thisPropertyPath): Deleted.
(WebInspector.ObjectTreeArrayIndexTreeElement.prototype._propertyPathString): Deleted.
(WebInspector.ObjectTreeArrayIndexTreeElement.prototype._updateTitle): Deleted.
(WebInspector.ObjectTreeArrayIndexTreeElement.prototype._createInteractiveGetterElement.): Deleted.
(WebInspector.ObjectTreeArrayIndexTreeElement.prototype._createReadOnlyIconElement): Deleted.
* UserInterface/Views/ObjectTreePropertyTreeElement.js:
(WebInspector.ObjectTreePropertyTreeElement):
(WebInspector.ObjectTreePropertyTreeElement.prototype.invokedGetter):
(WebInspector.ObjectTreePropertyTreeElement.prototype._updateHasChildren):
(WebInspector.ObjectTreePropertyTreeElement.prototype._updateTooltips):
(WebInspector.ObjectTreePropertyTreeElement.prototype._titleFragment):
(WebInspector.ObjectTreePropertyTreeElement.prototype._createTitlePrototype):
(WebInspector.ObjectTreePropertyTreeElement.prototype._createTitlePropertyStyle):
(WebInspector.ObjectTreePropertyTreeElement.prototype._createTitleAPIStyle):
(WebInspector.ObjectTreePropertyTreeElement.prototype._alwaysDisplayAsProperty):
(WebInspector.ObjectTreePropertyTreeElement.prototype._updateChildren):
(WebInspector.ObjectTreePropertyTreeElement.prototype._updateChildrenInternal):
(WebInspector.ObjectTreePropertyTreeElement.prototype._updateEntries):
(WebInspector.ObjectTreePropertyTreeElement.prototype._updateProperties):
(WebInspector.ObjectTreePropertyTreeElement.prototype.get property): Deleted.
(WebInspector.ObjectTreePropertyTreeElement.prototype.oncontextmenu): Deleted.
(WebInspector.ObjectTreePropertyTreeElement.prototype._resolvedValue): Deleted.
(WebInspector.ObjectTreePropertyTreeElement.prototype._propertyPathType): Deleted.
(WebInspector.ObjectTreePropertyTreeElement.prototype._resolvedValuePropertyPath): Deleted.
(WebInspector.ObjectTreePropertyTreeElement.prototype._thisPropertyPath): Deleted.
(WebInspector.ObjectTreePropertyTreeElement.prototype._updateTitleAndIcon): Deleted.
(WebInspector.ObjectTreePropertyTreeElement.prototype._createInteractiveGetterElement.): Deleted.
(WebInspector.ObjectTreePropertyTreeElement.prototype._createReadOnlyIconElement): Deleted.
(WebInspector.ObjectTreePropertyTreeElement.prototype): Deleted.
Subclass ObjectTreeBaseTreeElement and eliminate the code now
automatically handled by the base class.
* UserInterface/Views/ObjectTreeMapEntryTreeElement.js:
(WebInspector.ObjectTreeMapEntryTreeElement):
(WebInspector.ObjectTreeMapEntryTreeElement.prototype.resolvedValue):
(WebInspector.ObjectTreeMapEntryTreeElement.prototype._titleFragment):
(WebInspector.ObjectTreeMapEntryTreeElement.prototype._propertyPathString): Deleted.
* UserInterface/Views/ObjectTreeSetIndexTreeElement.js:
(WebInspector.ObjectTreeSetIndexTreeElement):
(WebInspector.ObjectTreeSetIndexTreeElement.prototype.resolvedValue):
(WebInspector.ObjectTreeSetIndexTreeElement.prototype._titleFragment):
(WebInspector.ObjectTreeSetIndexTreeElement.prototype._resolvedValuePropertyPath): Deleted.
Override resolved value since these are not about PropertyDescriptors.
This will make context menus work automatically.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceMainhtml">trunk/Source/WebInspectorUI/UserInterface/Main.html</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsObjectTreeArrayIndexTreeElementjs">trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeArrayIndexTreeElement.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsObjectTreeMapEntryTreeElementjs">trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeMapEntryTreeElement.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsObjectTreePropertyTreeElementjs">trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsObjectTreeSetIndexTreeElementjs">trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeSetIndexTreeElement.js</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsObjectTreeBaseTreeElementjs">trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (181088 => 181089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2015-03-05 19:32:51 UTC (rev 181088)
+++ trunk/Source/WebInspectorUI/ChangeLog        2015-03-05 19:40:07 UTC (rev 181089)
</span><span class="lines">@@ -1,3 +1,84 @@
</span><ins>+2015-03-05 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Add ObjectTreeBaseTreeElement to share functionality
+ https://bugs.webkit.org/show_bug.cgi?id=142323
+
+ Reviewed by Timothy Hatcher.
+
+ By making this change:
+
+ - Share lots of duplicated code.
+ - Array / Set / Map tree elements get context menu support
+
+ * UserInterface/Main.html:
+ * UserInterface/Views/ObjectTreeBaseTreeElement.js: Added.
+ (WebInspector.ObjectTreeBaseTreeElement):
+ (WebInspector.ObjectTreeBaseTreeElement.prototype.get property):
+ (WebInspector.ObjectTreeBaseTreeElement.prototype.get propertyPath):
+ (WebInspector.ObjectTreeBaseTreeElement.prototype.oncontextmenu):
+ (WebInspector.ObjectTreeBaseTreeElement.prototype.resolvedValue):
+ (WebInspector.ObjectTreeBaseTreeElement.prototype.resolvedValuePropertyPath):
+ (WebInspector.ObjectTreeBaseTreeElement.prototype.thisPropertyPath):
+ (WebInspector.ObjectTreeBaseTreeElement.prototype.hadError):
+ (WebInspector.ObjectTreeBaseTreeElement.prototype.propertyPathType):
+ (WebInspector.ObjectTreeBaseTreeElement.prototype.propertyPathString):
+ (WebInspector.ObjectTreeBaseTreeElement.prototype.createInteractiveGetterElement):
+ (WebInspector.ObjectTreeBaseTreeElement.prototype.createReadOnlyIconElement):
+ New file, copying most of the code from PropertyTreeElement so it can be shared.
+
+ * UserInterface/Views/ObjectTreeArrayIndexTreeElement.js:
+ (WebInspector.ObjectTreeArrayIndexTreeElement):
+ (WebInspector.ObjectTreeArrayIndexTreeElement.prototype.invokedGetter):
+ (WebInspector.ObjectTreeArrayIndexTreeElement.prototype._titleFragment):
+ (WebInspector.ObjectTreeArrayIndexTreeElement.prototype.get property): Deleted.
+ (WebInspector.ObjectTreeArrayIndexTreeElement.prototype._resolvedValue): Deleted.
+ (WebInspector.ObjectTreeArrayIndexTreeElement.prototype._propertyPathType): Deleted.
+ (WebInspector.ObjectTreeArrayIndexTreeElement.prototype._resolvedValuePropertyPath): Deleted.
+ (WebInspector.ObjectTreeArrayIndexTreeElement.prototype._thisPropertyPath): Deleted.
+ (WebInspector.ObjectTreeArrayIndexTreeElement.prototype._propertyPathString): Deleted.
+ (WebInspector.ObjectTreeArrayIndexTreeElement.prototype._updateTitle): Deleted.
+ (WebInspector.ObjectTreeArrayIndexTreeElement.prototype._createInteractiveGetterElement.): Deleted.
+ (WebInspector.ObjectTreeArrayIndexTreeElement.prototype._createReadOnlyIconElement): Deleted.
+ * UserInterface/Views/ObjectTreePropertyTreeElement.js:
+ (WebInspector.ObjectTreePropertyTreeElement):
+ (WebInspector.ObjectTreePropertyTreeElement.prototype.invokedGetter):
+ (WebInspector.ObjectTreePropertyTreeElement.prototype._updateHasChildren):
+ (WebInspector.ObjectTreePropertyTreeElement.prototype._updateTooltips):
+ (WebInspector.ObjectTreePropertyTreeElement.prototype._titleFragment):
+ (WebInspector.ObjectTreePropertyTreeElement.prototype._createTitlePrototype):
+ (WebInspector.ObjectTreePropertyTreeElement.prototype._createTitlePropertyStyle):
+ (WebInspector.ObjectTreePropertyTreeElement.prototype._createTitleAPIStyle):
+ (WebInspector.ObjectTreePropertyTreeElement.prototype._alwaysDisplayAsProperty):
+ (WebInspector.ObjectTreePropertyTreeElement.prototype._updateChildren):
+ (WebInspector.ObjectTreePropertyTreeElement.prototype._updateChildrenInternal):
+ (WebInspector.ObjectTreePropertyTreeElement.prototype._updateEntries):
+ (WebInspector.ObjectTreePropertyTreeElement.prototype._updateProperties):
+ (WebInspector.ObjectTreePropertyTreeElement.prototype.get property): Deleted.
+ (WebInspector.ObjectTreePropertyTreeElement.prototype.oncontextmenu): Deleted.
+ (WebInspector.ObjectTreePropertyTreeElement.prototype._resolvedValue): Deleted.
+ (WebInspector.ObjectTreePropertyTreeElement.prototype._propertyPathType): Deleted.
+ (WebInspector.ObjectTreePropertyTreeElement.prototype._resolvedValuePropertyPath): Deleted.
+ (WebInspector.ObjectTreePropertyTreeElement.prototype._thisPropertyPath): Deleted.
+ (WebInspector.ObjectTreePropertyTreeElement.prototype._updateTitleAndIcon): Deleted.
+ (WebInspector.ObjectTreePropertyTreeElement.prototype._createInteractiveGetterElement.): Deleted.
+ (WebInspector.ObjectTreePropertyTreeElement.prototype._createReadOnlyIconElement): Deleted.
+ (WebInspector.ObjectTreePropertyTreeElement.prototype): Deleted.
+ Subclass ObjectTreeBaseTreeElement and eliminate the code now
+ automatically handled by the base class.
+
+ * UserInterface/Views/ObjectTreeMapEntryTreeElement.js:
+ (WebInspector.ObjectTreeMapEntryTreeElement):
+ (WebInspector.ObjectTreeMapEntryTreeElement.prototype.resolvedValue):
+ (WebInspector.ObjectTreeMapEntryTreeElement.prototype._titleFragment):
+ (WebInspector.ObjectTreeMapEntryTreeElement.prototype._propertyPathString): Deleted.
+ * UserInterface/Views/ObjectTreeSetIndexTreeElement.js:
+ (WebInspector.ObjectTreeSetIndexTreeElement):
+ (WebInspector.ObjectTreeSetIndexTreeElement.prototype.resolvedValue):
+ (WebInspector.ObjectTreeSetIndexTreeElement.prototype._titleFragment):
+ (WebInspector.ObjectTreeSetIndexTreeElement.prototype._resolvedValuePropertyPath): Deleted.
+ Override resolved value since these are not about PropertyDescriptors.
+ This will make context menus work automatically.
+
</ins><span class="cx"> 2015-03-04 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: Improve display of previews with overflow
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceMainhtml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (181088 => 181089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Main.html        2015-03-05 19:32:51 UTC (rev 181088)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html        2015-03-05 19:40:07 UTC (rev 181089)
</span><span class="lines">@@ -316,6 +316,7 @@
</span><span class="cx"> <script src="Views/TimelineDataGridNode.js"></script>
</span><span class="cx">
</span><span class="cx"> <script src="Views/DOMDetailsSidebarPanel.js"></script>
</span><ins>+ <script src="Views/ObjectTreeBaseTreeElement.js"></script>
</ins><span class="cx"> <script src="Views/FolderizedTreeElement.js"></script>
</span><span class="cx"> <script src="Views/SourceCodeTreeElement.js"></script>
</span><span class="cx"> <script src="Views/StorageTreeElement.js"></script>
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsObjectTreeArrayIndexTreeElementjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeArrayIndexTreeElement.js (181088 => 181089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeArrayIndexTreeElement.js        2015-03-05 19:32:51 UTC (rev 181088)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeArrayIndexTreeElement.js        2015-03-05 19:40:07 UTC (rev 181089)
</span><span class="lines">@@ -23,95 +23,35 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-// FIXME: This should share more code with ObjectTreePropertyTreeElement. (getters, resolved values, context menus)
-
</del><span class="cx"> WebInspector.ObjectTreeArrayIndexTreeElement = function(property, propertyPath)
</span><span class="cx"> {
</span><del>- console.assert(property instanceof WebInspector.PropertyDescriptor);
- console.assert(propertyPath instanceof WebInspector.PropertyPath);
</del><span class="cx"> console.assert(property.isIndexProperty(), "ArrayIndexTreeElement expects numeric property names");
</span><span class="cx">
</span><del>- this._property = property;
- this._propertyPath = propertyPath;
</del><ins>+ WebInspector.ObjectTreeBaseTreeElement.call(this, property, propertyPath, property);
</ins><span class="cx">
</span><del>- var classNames = ["object-tree-property", "object-tree-array-index"];
- if (!this._property.hasValue())
- classNames.push("accessor");
</del><ins>+ this.mainTitle = this._titleFragment();
+ this.addClassName("object-tree-property");
+ this.addClassName("object-tree-array-index");
</ins><span class="cx">
</span><del>- WebInspector.GeneralTreeElement.call(this, classNames, this._titleFragment(), null, this._property, false);
-
- this.small = true;
- this.toggleOnClick = false;
- this.selectable = false;
- this.tooltipHandledSeparately = true;
- this.hasChildren = false;
</del><ins>+ if (!this.property.hasValue())
+ this.addClassName("accessor");
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WebInspector.ObjectTreeArrayIndexTreeElement.prototype = {
</span><span class="cx"> constructor: WebInspector.ObjectTreeArrayIndexTreeElement,
</span><del>- __proto__: WebInspector.GeneralTreeElement.prototype,
</del><ins>+ __proto__: WebInspector.ObjectTreeBaseTreeElement.prototype,
</ins><span class="cx">
</span><del>- // Public
</del><ins>+ // Protected
</ins><span class="cx">
</span><del>- get property()
</del><ins>+ invokedGetter: function()
</ins><span class="cx"> {
</span><del>- return this._property;
- },
-
- // Private
-
- _resolvedValue: function()
- {
- if (this._getterValue)
- return this._getterValue;
- if (this._property.hasValue())
- return this._property.value;
- return null;
- },
-
- _propertyPathType: function()
- {
- if (this._getterValue || this._property.hasValue())
- return WebInspector.PropertyPath.Type.Value;
- if (this._property.hasGetter())
- return WebInspector.PropertyPath.Type.Getter;
- if (this._property.hasSetter())
- return WebInspector.PropertyPath.Type.Setter;
- return WebInspector.PropertyPath.Type.Value;
- },
-
- _resolvedValuePropertyPath: function()
- {
- if (this._getterValue)
- return this._propertyPath.appendPropertyDescriptor(this._getterValue, this._property, WebInspector.PropertyPath.Type.Value);
- if (this._property.hasValue())
- return this._propertyPath.appendPropertyDescriptor(this._property.value, this._property, WebInspector.PropertyPath.Type.Value);
- return null;
- },
-
- _thisPropertyPath: function()
- {
- return this._propertyPath.appendPropertyDescriptor(null, this._property, this._propertyPathType());
- },
-
- _propertyPathString: function(propertyPath)
- {
- if (propertyPath.isFullPathImpossible())
- return WebInspector.UIString("Unable to determine path to property from root");
-
- return propertyPath.displayPath(this._propertyPathType());
- },
-
- _updateTitle: function()
- {
</del><span class="cx"> this.mainTitle = this._titleFragment();
</span><span class="cx">
</span><del>- if (this._getterValue)
- this.removeClassName("accessor");
-
- this._updateHasChildren();
</del><ins>+ this.removeClassName("accessor");
</ins><span class="cx"> },
</span><span class="cx">
</span><ins>+ // Private
+
</ins><span class="cx"> _titleFragment: function()
</span><span class="cx"> {
</span><span class="cx"> var container = document.createDocumentFragment();
</span><span class="lines">@@ -119,56 +59,28 @@
</span><span class="cx"> // Array index name.
</span><span class="cx"> var nameElement = container.appendChild(document.createElement("span"));
</span><span class="cx"> nameElement.className = "index-name";
</span><del>- nameElement.textContent = this._property.name;
- nameElement.title = this._propertyPathString(this._thisPropertyPath());
</del><ins>+ nameElement.textContent = this.property.name;
+ nameElement.title = this.propertyPathString(this.thisPropertyPath());
</ins><span class="cx">
</span><span class="cx"> // Value.
</span><span class="cx"> var valueElement = container.appendChild(document.createElement("span"));
</span><span class="cx"> valueElement.className = "index-value";
</span><span class="cx">
</span><del>- var resolvedValue = this._resolvedValue();
</del><ins>+ var resolvedValue = this.resolvedValue();
</ins><span class="cx"> if (resolvedValue)
</span><del>- valueElement.appendChild(WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(resolvedValue, this._resolvedValuePropertyPath()));
</del><ins>+ valueElement.appendChild(WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(resolvedValue, this.resolvedValuePropertyPath()));
</ins><span class="cx"> else {
</span><del>- if (this._property.hasGetter())
- container.appendChild(this._createInteractiveGetterElement());
- if (!this._property.hasSetter())
- container.appendChild(this._createReadOnlyIconElement());
</del><ins>+ if (this.property.hasGetter())
+ container.appendChild(this.createInteractiveGetterElement());
+ if (!this.property.hasSetter())
+ container.appendChild(this.createReadOnlyIconElement());
</ins><span class="cx"> // FIXME: What if just a setter?
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> valueElement.classList.add("value");
</span><del>- if (this._property.wasThrown || this._getterHadError)
</del><ins>+ if (this.hadError())
</ins><span class="cx"> valueElement.classList.add("error");
</span><span class="cx">
</span><span class="cx"> return container;
</span><del>- },
-
- _createInteractiveGetterElement: function()
- {
- var getterElement = document.createElement("img");
- getterElement.className = "getter";
- getterElement.title = WebInspector.UIString("Invoke getter");
-
- getterElement.addEventListener("click", function(event) {
- event.stopPropagation();
- var lastNonPrototypeObject = this._propertyPath.lastNonPrototypeObject;
- var getterObject = this._property.get;
- lastNonPrototypeObject.invokeGetter(getterObject, function(error, result, wasThrown) {
- this._getterHadError = !!(error || wasThrown);
- this._getterValue = result;
- this._updateTitle();
- }.bind(this));
- }.bind(this));
-
- return getterElement;
- },
-
- _createReadOnlyIconElement: function()
- {
- var readOnlyElement = document.createElement("img");
- readOnlyElement.className = "read-only";
- readOnlyElement.title = WebInspector.UIString("Read only");
- return readOnlyElement;
- },
</del><ins>+ }
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsObjectTreeBaseTreeElementjs"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js (0 => 181089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js        2015-03-05 19:40:07 UTC (rev 181089)
</span><span class="lines">@@ -0,0 +1,221 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.ObjectTreeBaseTreeElement = function(representedObject, propertyPath, property)
+{
+ console.assert(representedObject);
+ console.assert(propertyPath instanceof WebInspector.PropertyPath);
+ console.assert(!property || property instanceof WebInspector.PropertyDescriptor);
+
+ this._property = property;
+ this._propertyPath = propertyPath;
+
+ WebInspector.GeneralTreeElement.call(this, null, null, null, representedObject, false);
+
+ this.small = true;
+ this.toggleOnClick = true;
+ this.selectable = false;
+ this.tooltipHandledSeparately = true;
+};
+
+WebInspector.ObjectTreeBaseTreeElement.prototype = {
+ constructor: WebInspector.ObjectTreeBaseTreeElement,
+ __proto__: WebInspector.GeneralTreeElement.prototype,
+
+ // Public
+
+ get property()
+ {
+ return this._property;
+ },
+
+ get propertyPath()
+ {
+ return this._propertyPath;
+ },
+
+ // Protected
+
+ oncontextmenu: function(event)
+ {
+ this._contextMenuHandler(event);
+ },
+
+ resolvedValue: function()
+ {
+ console.assert(this._property);
+ if (this._getterValue)
+ return this._getterValue;
+ if (this._property.hasValue())
+ return this._property.value;
+ return null;
+ },
+
+ resolvedValuePropertyPath: function()
+ {
+ console.assert(this._property);
+ if (this._getterValue)
+ return this._propertyPath.appendPropertyDescriptor(this._getterValue, this._property, WebInspector.PropertyPath.Type.Value);
+ if (this._property.hasValue())
+ return this._propertyPath.appendPropertyDescriptor(this._property.value, this._property, WebInspector.PropertyPath.Type.Value);
+ return null;
+ },
+
+ thisPropertyPath: function()
+ {
+ console.assert(this._property);
+ return this._propertyPath.appendPropertyDescriptor(null, this._property, this.propertyPathType());
+ },
+
+ hadError: function()
+ {
+ console.assert(this._property);
+ return this._property.wasThrown || this._getterHadError;
+ },
+
+ propertyPathType: function()
+ {
+ console.assert(this._property);
+ if (this._getterValue || this._property.hasValue())
+ return WebInspector.PropertyPath.Type.Value;
+ if (this._property.hasGetter())
+ return WebInspector.PropertyPath.Type.Getter;
+ if (this._property.hasSetter())
+ return WebInspector.PropertyPath.Type.Setter;
+ return WebInspector.PropertyPath.Type.Value;
+ },
+
+ propertyPathString: function(propertyPath)
+ {
+ if (propertyPath.isFullPathImpossible())
+ return WebInspector.UIString("Unable to determine path to property from root");
+
+ return propertyPath.displayPath(this.propertyPathType());
+ },
+
+ createInteractiveGetterElement: function()
+ {
+ var getterElement = document.createElement("img");
+ getterElement.className = "getter";
+ getterElement.title = WebInspector.UIString("Invoke getter");
+
+ getterElement.addEventListener("click", function(event) {
+ event.stopPropagation();
+ var lastNonPrototypeObject = this._propertyPath.lastNonPrototypeObject;
+ var getterObject = this._property.get;
+ lastNonPrototypeObject.invokeGetter(getterObject, function(error, result, wasThrown) {
+ this._getterHadError = !!(error || wasThrown);
+ this._getterValue = result;
+ if (this.invokedGetter && typeof this.invokedGetter === "function")
+ this.invokedGetter();
+ }.bind(this));
+ }.bind(this));
+
+ return getterElement;
+ },
+
+ createReadOnlyIconElement: function()
+ {
+ var readOnlyElement = document.createElement("img");
+ readOnlyElement.className = "read-only";
+ readOnlyElement.title = WebInspector.UIString("Read only");
+ return readOnlyElement;
+ },
+
+ // Private
+
+ _logValue: function(value)
+ {
+ var resolvedValue = value || this.resolvedValue();
+ if (!resolvedValue)
+ return;
+
+ var propertyPath = this.resolvedValuePropertyPath();
+ var isImpossible = propertyPath.isFullPathImpossible();
+ var text = isImpossible ? WebInspector.UIString("Selected Value") : propertyPath.displayPath(this.propertyPathType());
+
+ if (!isImpossible)
+ WebInspector.quickConsole.prompt.pushHistoryItem(text);
+
+ WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text, resolvedValue);
+ },
+
+ _contextMenuHandler: function(event)
+ {
+ var resolvedValue = this.resolvedValue();
+ if (!resolvedValue)
+ return;
+
+ var contextMenu = new WebInspector.ContextMenu(event);
+ contextMenu.appendItem(WebInspector.UIString("Log Value"), this._logValue.bind(this));
+
+ var propertyPath = this.resolvedValuePropertyPath();
+ if (propertyPath && !propertyPath.isFullPathImpossible()) {
+ contextMenu.appendItem(WebInspector.UIString("Copy Path to Property"), function() {
+ InspectorFrontendHost.copyText(propertyPath.displayPath(WebInspector.PropertyPath.Type.Value));
+ }.bind(this));
+ }
+
+ contextMenu.appendSeparator();
+
+ this._appendMenusItemsForObject(contextMenu, resolvedValue);
+
+ if (!contextMenu.isEmpty())
+ contextMenu.show();
+ },
+
+ _appendMenusItemsForObject: function(contextMenu, resolvedValue)
+ {
+ if (resolvedValue.type === "function") {
+ // FIXME: We should better handle bound functions.
+ if (!isFunctionStringNativeCode(resolvedValue.description)) {
+ contextMenu.appendItem(WebInspector.UIString("Jump to Definition"), function() {
+ DebuggerAgent.getFunctionDetails(resolvedValue.objectId, function(error, response) {
+ if (error)
+ return;
+
+ var location = response.location;
+ var sourceCode = WebInspector.debuggerManager.scriptForIdentifier(location.scriptId);
+ if (!sourceCode)
+ return;
+
+ var sourceCodeLocation = sourceCode.createSourceCodeLocation(location.lineNumber, location.columnNumber || 0);
+ WebInspector.resourceSidebarPanel.showSourceCodeLocation(sourceCodeLocation);
+ });
+ });
+ }
+ return;
+ }
+
+ if (resolvedValue.subtype === "node") {
+ contextMenu.appendItem(WebInspector.UIString("Reveal in DOM Tree"), function() {
+ resolvedValue.pushNodeToFrontend(function(nodeId) {
+ WebInspector.domTreeManager.inspectElement(nodeId);
+ });
+ });
+ return;
+ }
+ }
+};
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsObjectTreeMapEntryTreeElementjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeMapEntryTreeElement.js (181088 => 181089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeMapEntryTreeElement.js        2015-03-05 19:32:51 UTC (rev 181088)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeMapEntryTreeElement.js        2015-03-05 19:40:07 UTC (rev 181089)
</span><span class="lines">@@ -26,24 +26,20 @@
</span><span class="cx"> WebInspector.ObjectTreeMapEntryTreeElement = function(object, propertyPath)
</span><span class="cx"> {
</span><span class="cx"> console.assert(object instanceof WebInspector.RemoteObject);
</span><del>- console.assert(propertyPath instanceof WebInspector.PropertyPath);
</del><span class="cx">
</span><span class="cx"> this._object = object;
</span><del>- this._propertyPath = propertyPath;
</del><span class="cx">
</span><span class="cx"> // Treat the same as an array-index just with different strings and widths.
</span><del>- WebInspector.GeneralTreeElement.call(this, ["object-tree-array-index", "object-tree-map-entry"], this._titleFragment(), null, this._object, false);
</del><ins>+ WebInspector.ObjectTreeBaseTreeElement.call(this, this._object, propertyPath);
</ins><span class="cx">
</span><del>- this.small = true;
- this.toggleOnClick = false;
- this.selectable = false;
- this.tooltipHandledSeparately = true;
- this.hasChildren = false;
</del><ins>+ this.mainTitle = this._titleFragment();
+ this.addClassName("object-tree-array-index");
+ this.addClassName("object-tree-map-entry");
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WebInspector.ObjectTreeMapEntryTreeElement.prototype = {
</span><span class="cx"> constructor: WebInspector.ObjectTreeMapEntryTreeElement,
</span><del>- __proto__: WebInspector.GeneralTreeElement.prototype,
</del><ins>+ __proto__: WebInspector.ObjectTreeBaseTreeElement.prototype,
</ins><span class="cx">
</span><span class="cx"> // Public
</span><span class="cx">
</span><span class="lines">@@ -52,16 +48,15 @@
</span><span class="cx"> return this._object;
</span><span class="cx"> },
</span><span class="cx">
</span><del>- // Private
</del><ins>+ // Protected
</ins><span class="cx">
</span><del>- _propertyPathString: function(propertyPath)
</del><ins>+ resolvedValue: function()
</ins><span class="cx"> {
</span><del>- if (propertyPath.isFullPathImpossible())
- return WebInspector.UIString("Unable to determine path to property from root");
-
- return propertyPath.displayPath(WebInspector.PropertyPath.Type.Value);
</del><ins>+ return this._object;
</ins><span class="cx"> },
</span><span class="cx">
</span><ins>+ // Private
+
</ins><span class="cx"> _titleFragment: function()
</span><span class="cx"> {
</span><span class="cx"> var container = document.createDocumentFragment();
</span><span class="lines">@@ -72,7 +67,7 @@
</span><span class="cx"> var nameElement = container.appendChild(document.createElement("span"));
</span><span class="cx"> nameElement.className = "index-name";
</span><span class="cx"> nameElement.textContent = this.displayPropertyName();
</span><del>- nameElement.title = this._propertyPathString(propertyPath);
</del><ins>+ nameElement.title = this.propertyPathString(propertyPath);
</ins><span class="cx">
</span><span class="cx"> // Value.
</span><span class="cx"> var valueElement = container.appendChild(document.createElement("span"));
</span><span class="lines">@@ -88,7 +83,7 @@
</span><span class="cx"> {
</span><span class="cx"> WebInspector.ObjectTreeMapEntryTreeElement.call(this, object, propertyPath);
</span><span class="cx"> this.addClassName("key");
</span><del>-}
</del><ins>+};
</ins><span class="cx">
</span><span class="cx"> WebInspector.ObjectTreeMapKeyTreeElement.prototype = {
</span><span class="cx"> constructor: WebInspector.ObjectTreeMapKeyTreeElement,
</span><span class="lines">@@ -113,7 +108,7 @@
</span><span class="cx"> this._key = key;
</span><span class="cx"> WebInspector.ObjectTreeMapEntryTreeElement.call(this, object, propertyPath);
</span><span class="cx"> this.addClassName("value");
</span><del>-}
</del><ins>+};
</ins><span class="cx">
</span><span class="cx"> WebInspector.ObjectTreeMapValueTreeElement.prototype = {
</span><span class="cx"> constructor: WebInspector.ObjectTreeMapValueTreeElement,
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsObjectTreePropertyTreeElementjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js (181088 => 181089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js        2015-03-05 19:32:51 UTC (rev 181088)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js        2015-03-05 19:40:07 UTC (rev 181089)
</span><span class="lines">@@ -25,50 +25,34 @@
</span><span class="cx">
</span><span class="cx"> WebInspector.ObjectTreePropertyTreeElement = function(property, propertyPath, mode, prototypeName)
</span><span class="cx"> {
</span><del>- console.assert(property instanceof WebInspector.PropertyDescriptor);
- console.assert(propertyPath instanceof WebInspector.PropertyPath);
-
- this._property = property;
</del><span class="cx"> this._mode = mode || WebInspector.ObjectTreeView.Mode.Properties;
</span><del>- this._propertyPath = propertyPath;
</del><span class="cx"> this._prototypeName = prototypeName;
</span><span class="cx">
</span><del>- var classNames = ["object-tree-property"];
</del><ins>+ WebInspector.ObjectTreeBaseTreeElement.call(this, property, propertyPath, property);
</ins><span class="cx">
</span><del>- if (this._property.hasValue()) {
- classNames.push(this._property.value.type);
- if (this._property.value.subtype)
- classNames.push(this._property.value.subtype);
</del><ins>+ this.mainTitle = this._titleFragment();
+ this.addClassName("object-tree-property");
+
+ if (this.property.hasValue()) {
+ this.addClassName(this.property.value.type);
+ if (this.property.value.subtype)
+ this.addClassName(this.property.value.subtype);
</ins><span class="cx"> } else
</span><del>- classNames.push("accessor");
</del><ins>+ this.addClassName("accessor");
</ins><span class="cx">
</span><del>- if (this._property.wasThrown)
- classNames.push("had-error");
</del><ins>+ if (this.property.wasThrown)
+ this.addClassName("had-error");
+ if (this.property.name === "__proto__")
+ this.addClassName("prototype-property");
</ins><span class="cx">
</span><del>- if (this._property.name === "__proto__")
- classNames.push("prototype-property");
-
- WebInspector.GeneralTreeElement.call(this, classNames, this._titleFragment(), null, this._property, false);
</del><span class="cx"> this._updateTooltips();
</span><span class="cx"> this._updateHasChildren();
</span><del>-
- this.small = true;
- this.toggleOnClick = true;
- this.selectable = false;
- this.tooltipHandledSeparately = true;
</del><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WebInspector.ObjectTreePropertyTreeElement.prototype = {
</span><span class="cx"> constructor: WebInspector.ObjectTreePropertyTreeElement,
</span><del>- __proto__: WebInspector.GeneralTreeElement.prototype,
</del><ins>+ __proto__: WebInspector.ObjectTreeBaseTreeElement.prototype,
</ins><span class="cx">
</span><del>- // Public
-
- get property()
- {
- return this._property;
- },
-
</del><span class="cx"> // Protected
</span><span class="cx">
</span><span class="cx"> onpopulate: function()
</span><span class="lines">@@ -88,92 +72,52 @@
</span><span class="cx"> this._previewView.showPreview();
</span><span class="cx"> },
</span><span class="cx">
</span><del>- oncontextmenu: function(event)
</del><ins>+ invokedGetter: function()
</ins><span class="cx"> {
</span><del>- this._contextMenuHandler(event);
- },
</del><ins>+ this.mainTitle = this._titleFragment();
</ins><span class="cx">
</span><del>- // Private
</del><ins>+ var resolvedValue = this.resolvedValue();
+ this.addClassName(resolvedValue.type);
+ if (resolvedValue.subtype)
+ this.addClassName(resolvedValue.subtype);
+ if (this.hadError())
+ this.addClassName("had-error");
+ this.removeClassName("accessor");
</ins><span class="cx">
</span><del>- _resolvedValue: function()
- {
- if (this._getterValue)
- return this._getterValue;
- if (this._property.hasValue())
- return this._property.value;
- return null;
</del><ins>+ this._updateHasChildren();
</ins><span class="cx"> },
</span><span class="cx">
</span><del>- _propertyPathType: function()
- {
- if (this._getterValue || this._property.hasValue())
- return WebInspector.PropertyPath.Type.Value;
- if (this._property.hasGetter())
- return WebInspector.PropertyPath.Type.Getter;
- if (this._property.hasSetter())
- return WebInspector.PropertyPath.Type.Setter;
- return WebInspector.PropertyPath.Type.Value;
- },
</del><ins>+ // Private
</ins><span class="cx">
</span><del>- _resolvedValuePropertyPath: function()
- {
- if (this._getterValue)
- return this._propertyPath.appendPropertyDescriptor(this._getterValue, this._property, WebInspector.PropertyPath.Type.Value);
- if (this._property.hasValue())
- return this._propertyPath.appendPropertyDescriptor(this._property.value, this._property, WebInspector.PropertyPath.Type.Value);
- return null;
- },
-
- _thisPropertyPath: function()
- {
- return this._propertyPath.appendPropertyDescriptor(null, this._property, this._propertyPathType());
- },
-
</del><span class="cx"> _updateHasChildren: function()
</span><span class="cx"> {
</span><del>- var resolvedValue = this._resolvedValue();
</del><ins>+ var resolvedValue = this.resolvedValue();
</ins><span class="cx"> var valueHasChildren = (resolvedValue && resolvedValue.hasChildren);
</span><del>- var wasThrown = this._property.wasThrown || this._getterHadError;
</del><ins>+ var wasThrown = this.hadError();
</ins><span class="cx">
</span><span class="cx"> if (this._mode === WebInspector.ObjectTreeView.Mode.Properties)
</span><span class="cx"> this.hasChildren = !wasThrown && valueHasChildren;
</span><span class="cx"> else
</span><del>- this.hasChildren = !wasThrown && valueHasChildren && (this._property.name === "__proto__" || this._alwaysDisplayAsProperty());
</del><ins>+ this.hasChildren = !wasThrown && valueHasChildren && (this.property.name === "__proto__" || this._alwaysDisplayAsProperty());
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> _updateTooltips: function()
</span><span class="cx"> {
</span><span class="cx"> var attributes = [];
</span><span class="cx">
</span><del>- if (this._property.configurable)
</del><ins>+ if (this.property.configurable)
</ins><span class="cx"> attributes.push("configurable");
</span><del>- if (this._property.enumerable)
</del><ins>+ if (this.property.enumerable)
</ins><span class="cx"> attributes.push("enumerable");
</span><del>- if (this._property.writable)
</del><ins>+ if (this.property.writable)
</ins><span class="cx"> attributes.push("writable");
</span><span class="cx">
</span><span class="cx"> this.iconElement.title = attributes.join(" ");
</span><span class="cx"> },
</span><span class="cx">
</span><del>- _updateTitleAndIcon: function()
- {
- this.mainTitle = this._titleFragment();
-
- if (this._getterValue) {
- this.addClassName(this._getterValue.type);
- if (this._getterValue.subtype)
- this.addClassName(this._getterValue.subtype);
- if (this._getterHadError)
- this.addClassName("had-error");
- this.removeClassName("accessor");
- }
-
- this._updateHasChildren();
- },
-
</del><span class="cx"> _titleFragment: function()
</span><span class="cx"> {
</span><del>- if (this._property.name === "__proto__")
</del><ins>+ if (this.property.name === "__proto__")
</ins><span class="cx"> return this._createTitlePrototype();
</span><span class="cx">
</span><span class="cx"> if (this._mode === WebInspector.ObjectTreeView.Mode.Properties)
</span><span class="lines">@@ -184,13 +128,13 @@
</span><span class="cx">
</span><span class="cx"> _createTitlePrototype: function()
</span><span class="cx"> {
</span><del>- console.assert(this._property.hasValue());
- console.assert(this._property.name === "__proto__");
</del><ins>+ console.assert(this.property.hasValue());
+ console.assert(this.property.name === "__proto__");
</ins><span class="cx">
</span><span class="cx"> var nameElement = document.createElement("span");
</span><span class="cx"> nameElement.className = "prototype-name";
</span><del>- nameElement.textContent = WebInspector.UIString("%s Prototype").format(this._sanitizedPrototypeString(this._property.value));
- nameElement.title = this._propertyPathString(this._thisPropertyPath());
</del><ins>+ nameElement.textContent = WebInspector.UIString("%s Prototype").format(this._sanitizedPrototypeString(this.property.value));
+ nameElement.title = this.propertyPathString(this.thisPropertyPath());
</ins><span class="cx"> return nameElement;
</span><span class="cx"> },
</span><span class="cx">
</span><span class="lines">@@ -201,42 +145,40 @@
</span><span class="cx"> // Property name.
</span><span class="cx"> var nameElement = document.createElement("span");
</span><span class="cx"> nameElement.className = "property-name";
</span><del>- nameElement.textContent = this._property.name + ": ";
- nameElement.title = this._propertyPathString(this._thisPropertyPath());
</del><ins>+ nameElement.textContent = this.property.name + ": ";
+ nameElement.title = this.propertyPathString(this.thisPropertyPath());
</ins><span class="cx">
</span><span class="cx"> // Property attributes.
</span><span class="cx"> if (this._mode === WebInspector.ObjectTreeView.Mode.Properties) {
</span><del>- if (!this._property.enumerable)
</del><ins>+ if (!this.property.enumerable)
</ins><span class="cx"> nameElement.classList.add("not-enumerable");
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Value / Getter Value / Getter.
</span><span class="cx"> var valueOrGetterElement;
</span><del>- var resolvedValue = this._resolvedValue();
</del><ins>+ var resolvedValue = this.resolvedValue();
</ins><span class="cx"> if (resolvedValue) {
</span><span class="cx"> if (resolvedValue.preview) {
</span><span class="cx"> this._previewView = new WebInspector.ObjectPreviewView(resolvedValue.preview);
</span><span class="cx"> valueOrGetterElement = this._previewView.element;
</span><span class="cx"> } else {
</span><del>- valueOrGetterElement = WebInspector.FormattedValue.createElementForRemoteObject(resolvedValue, this._property.wasThrown || this._getterHadError);
</del><ins>+ valueOrGetterElement = WebInspector.FormattedValue.createElementForRemoteObject(resolvedValue, this.hadError());
</ins><span class="cx">
</span><span class="cx"> // Special case a function property string.
</span><span class="cx"> if (resolvedValue.type === "function")
</span><span class="cx"> valueOrGetterElement.textContent = this._functionPropertyString();
</span><span class="cx"> }
</span><del>-
- // FIXME: Option+Click for Value.
</del><span class="cx"> } else {
</span><span class="cx"> valueOrGetterElement = document.createElement("span");
</span><del>- if (this._property.hasGetter())
- valueOrGetterElement.appendChild(this._createInteractiveGetterElement());
- if (!this._property.hasSetter())
- valueOrGetterElement.appendChild(this._createReadOnlyIconElement());
</del><ins>+ if (this.property.hasGetter())
+ valueOrGetterElement.appendChild(this.createInteractiveGetterElement());
+ if (!this.property.hasSetter())
+ valueOrGetterElement.appendChild(this.createReadOnlyIconElement());
</ins><span class="cx"> // FIXME: What if just a setter?
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> valueOrGetterElement.classList.add("value");
</span><del>- if (this._property.wasThrown || this._getterHadError)
</del><ins>+ if (this.hadError())
</ins><span class="cx"> valueOrGetterElement.classList.add("error");
</span><span class="cx">
</span><span class="cx"> container.appendChild(nameElement);
</span><span class="lines">@@ -250,12 +192,9 @@
</span><span class="cx"> if (this._alwaysDisplayAsProperty())
</span><span class="cx"> return this._createTitlePropertyStyle();
</span><span class="cx">
</span><del>- // Fetched getter values should already have been shown as properties.
- console.assert(!this._getterValue);
-
</del><span class="cx"> // No API to display.
</span><del>- var isFunction = this._property.hasValue() && this._property.value.type === "function";
- if (!isFunction && !this._property.hasGetter() && !this._property.hasSetter())
</del><ins>+ var isFunction = this.property.hasValue() && this.property.value.type === "function";
+ if (!isFunction && !this.property.hasGetter() && !this.property.hasSetter())
</ins><span class="cx"> return null;
</span><span class="cx">
</span><span class="cx"> var container = document.createDocumentFragment();
</span><span class="lines">@@ -263,8 +202,8 @@
</span><span class="cx"> // Function / Getter / Setter.
</span><span class="cx"> var nameElement = document.createElement("span");
</span><span class="cx"> nameElement.className = "property-name";
</span><del>- nameElement.textContent = this._property.name;
- nameElement.title = this._propertyPathString(this._thisPropertyPath());
</del><ins>+ nameElement.textContent = this.property.name;
+ nameElement.title = this.propertyPathString(this.thisPropertyPath());
</ins><span class="cx"> container.appendChild(nameElement);
</span><span class="cx">
</span><span class="cx"> if (isFunction) {
</span><span class="lines">@@ -273,52 +212,24 @@
</span><span class="cx"> paramElement.textContent = this._functionParameterString();
</span><span class="cx"> container.appendChild(paramElement);
</span><span class="cx"> } else {
</span><del>- if (this._property.hasGetter())
- container.appendChild(this._createInteractiveGetterElement());
- if (!this._property.hasSetter())
- container.appendChild(this._createReadOnlyIconElement());
</del><ins>+ if (this.property.hasGetter())
+ container.appendChild(this.createInteractiveGetterElement());
+ if (!this.property.hasSetter())
+ container.appendChild(this.createReadOnlyIconElement());
</ins><span class="cx"> // FIXME: What if just a setter?
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return container;
</span><span class="cx"> },
</span><span class="cx">
</span><del>- _createInteractiveGetterElement: function()
- {
- var getterElement = document.createElement("img");
- getterElement.className = "getter";
- getterElement.title = WebInspector.UIString("Invoke getter");
-
- getterElement.addEventListener("click", function(event) {
- event.stopPropagation();
- var lastNonPrototypeObject = this._propertyPath.lastNonPrototypeObject;
- var getterObject = this._property.get;
- lastNonPrototypeObject.invokeGetter(getterObject, function(error, result, wasThrown) {
- this._getterHadError = !!(error || wasThrown);
- this._getterValue = result;
- this._updateTitleAndIcon();
- }.bind(this));
- }.bind(this));
-
- return getterElement;
- },
-
- _createReadOnlyIconElement: function()
- {
- var readOnlyElement = document.createElement("img");
- readOnlyElement.className = "read-only";
- readOnlyElement.title = WebInspector.UIString("Read only");
- return readOnlyElement;
- },
-
</del><span class="cx"> _alwaysDisplayAsProperty: function()
</span><span class="cx"> {
</span><span class="cx"> // Constructor, though a function, is often better treated as an expandable object.
</span><del>- if (this._property.name === "constructor")
</del><ins>+ if (this.property.name === "constructor")
</ins><span class="cx"> return true;
</span><span class="cx">
</span><span class="cx"> // Non-function objects are often better treated as properties.
</span><del>- if (this._property.hasValue() && this._property.value.type !== "function")
</del><ins>+ if (this.property.hasValue() && this.property.value.type !== "function")
</ins><span class="cx"> return true;
</span><span class="cx">
</span><span class="cx"> // Fetched getter value.
</span><span class="lines">@@ -335,7 +246,7 @@
</span><span class="cx">
</span><span class="cx"> _functionParameterString: function()
</span><span class="cx"> {
</span><del>- var resolvedValue = this._resolvedValue();
</del><ins>+ var resolvedValue = this.resolvedValue();
</ins><span class="cx"> console.assert(resolvedValue.type === "function");
</span><span class="cx">
</span><span class="cx"> // For Native methods, the toString is poor. We try to provide good function parameter strings.
</span><span class="lines">@@ -378,23 +289,15 @@
</span><span class="cx"> return value.description.replace(/Prototype$/, "");
</span><span class="cx"> },
</span><span class="cx">
</span><del>- _propertyPathString: function(propertyPath)
- {
- if (propertyPath.isFullPathImpossible())
- return WebInspector.UIString("Unable to determine path to property from root");
-
- return propertyPath.displayPath(this._propertyPathType());
- },
-
</del><span class="cx"> _updateChildren: function()
</span><span class="cx"> {
</span><span class="cx"> if (this.children.length && !this.shouldRefreshChildren)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- var resolvedValue = this._resolvedValue();
</del><ins>+ var resolvedValue = this.resolvedValue();
</ins><span class="cx"> if (resolvedValue.isCollectionType() && this._mode === WebInspector.ObjectTreeView.Mode.Properties)
</span><span class="cx"> resolvedValue.getCollectionEntries(0, 100, this._updateChildrenInternal.bind(this, this._updateEntries, this._mode));
</span><del>- else if (this._property.name === "__proto__")
</del><ins>+ else if (this.property.name === "__proto__")
</ins><span class="cx"> resolvedValue.getOwnPropertyDescriptors(this._updateChildrenInternal.bind(this, this._updateProperties, WebInspector.ObjectTreeView.Mode.API));
</span><span class="cx"> else
</span><span class="cx"> resolvedValue.getDisplayablePropertyDescriptors(this._updateChildrenInternal.bind(this, this._updateProperties, this._mode));
</span><span class="lines">@@ -410,7 +313,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- handler.call(this, list, this._resolvedValuePropertyPath(), mode);
</del><ins>+ handler.call(this, list, this.resolvedValuePropertyPath(), mode);
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> _updateEntries: function(entries, propertyPath, mode)
</span><span class="lines">@@ -429,7 +332,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Show the prototype so users can see the API.
</span><del>- var resolvedValue = this._resolvedValue();
</del><ins>+ var resolvedValue = this.resolvedValue();
</ins><span class="cx"> resolvedValue.getOwnPropertyDescriptor("__proto__", function(propertyDescriptor) {
</span><span class="cx"> if (propertyDescriptor)
</span><span class="cx"> this.appendChild(new WebInspector.ObjectTreePropertyTreeElement(propertyDescriptor, propertyPath, mode));
</span><span class="lines">@@ -440,13 +343,13 @@
</span><span class="cx"> {
</span><span class="cx"> properties.sort(WebInspector.ObjectTreeView.ComparePropertyDescriptors);
</span><span class="cx">
</span><del>- var resolvedValue = this._resolvedValue();
</del><ins>+ var resolvedValue = this.resolvedValue();
</ins><span class="cx"> var isArray = resolvedValue.isArray();
</span><span class="cx"> var isPropertyMode = mode === WebInspector.ObjectTreeView.Mode.Properties || this._getterValue;
</span><span class="cx"> var isAPI = mode === WebInspector.ObjectTreeView.Mode.API;
</span><span class="cx">
</span><span class="cx"> var prototypeName = undefined;
</span><del>- if (this._property.name === "__proto__") {
</del><ins>+ if (this.property.name === "__proto__") {
</ins><span class="cx"> if (resolvedValue.description)
</span><span class="cx"> prototypeName = this._sanitizedPrototypeString(resolvedValue);
</span><span class="cx"> }
</span><span class="lines">@@ -471,78 +374,5 @@
</span><span class="cx"> var emptyMessageElement = WebInspector.ObjectTreeView.emptyMessageElement(WebInspector.UIString("No Properties."));
</span><span class="cx"> this.appendChild(new TreeElement(emptyMessageElement, null, false));
</span><span class="cx"> }
</span><del>- },
-
- _logValue: function(value)
- {
- var resolvedValue = value || this._resolvedValue();
- if (!resolvedValue)
- return;
-
- var propertyPath = this._resolvedValuePropertyPath();
- var isImpossible = propertyPath.isFullPathImpossible();
- var text = isImpossible ? WebInspector.UIString("Selected Value") : propertyPath.displayPath(this._propertyPathType());
-
- if (!isImpossible)
- WebInspector.quickConsole.prompt.pushHistoryItem(text);
-
- WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text, resolvedValue);
- },
-
- _contextMenuHandler: function(event)
- {
- var resolvedValue = this._resolvedValue();
- if (!resolvedValue)
- return;
-
- var contextMenu = new WebInspector.ContextMenu(event);
- contextMenu.appendItem(WebInspector.UIString("Log Value"), this._logValue.bind(this));
-
- var propertyPath = this._resolvedValuePropertyPath();
- if (propertyPath && !propertyPath.isFullPathImpossible()) {
- contextMenu.appendItem(WebInspector.UIString("Copy Path to Property"), function() {
- InspectorFrontendHost.copyText(propertyPath.displayPath(WebInspector.PropertyPath.Type.Value));
- }.bind(this));
- }
-
- contextMenu.appendSeparator();
-
- this._appendMenusItemsForObject(contextMenu, resolvedValue);
-
- if (!contextMenu.isEmpty())
- contextMenu.show();
- },
-
- _appendMenusItemsForObject: function(contextMenu, resolvedValue)
- {
- if (resolvedValue.type === "function") {
- // FIXME: We should better handle bound functions.
- if (!isFunctionStringNativeCode(resolvedValue.description)) {
- contextMenu.appendItem(WebInspector.UIString("Jump to Definition"), function() {
- DebuggerAgent.getFunctionDetails(resolvedValue.objectId, function(error, response) {
- if (error)
- return;
-
- var location = response.location;
- var sourceCode = WebInspector.debuggerManager.scriptForIdentifier(location.scriptId);
- if (!sourceCode)
- return;
-
- var sourceCodeLocation = sourceCode.createSourceCodeLocation(location.lineNumber, location.columnNumber || 0);
- WebInspector.resourceSidebarPanel.showSourceCodeLocation(sourceCodeLocation);
- });
- });
- }
- return;
- }
-
- if (resolvedValue.subtype === "node") {
- contextMenu.appendItem(WebInspector.UIString("Reveal in DOM Tree"), function() {
- resolvedValue.pushNodeToFrontend(function(nodeId) {
- WebInspector.domTreeManager.inspectElement(nodeId);
- });
- });
- return;
- }
</del><span class="cx"> }
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsObjectTreeSetIndexTreeElementjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeSetIndexTreeElement.js (181088 => 181089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeSetIndexTreeElement.js        2015-03-05 19:32:51 UTC (rev 181088)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeSetIndexTreeElement.js        2015-03-05 19:40:07 UTC (rev 181089)
</span><span class="lines">@@ -28,21 +28,17 @@
</span><span class="cx"> console.assert(object instanceof WebInspector.RemoteObject);
</span><span class="cx">
</span><span class="cx"> this._object = object;
</span><del>- this._propertyPath = propertyPath;
</del><span class="cx">
</span><del>- // Treat the same as an array-index just with a different character.
- WebInspector.GeneralTreeElement.call(this, ["object-tree-array-index"], this._titleFragment(), null, this._object, false);
</del><ins>+ // Treat the same as an array-index just with different strings and widths.
+ WebInspector.ObjectTreeBaseTreeElement.call(this, this._object, propertyPath);
</ins><span class="cx">
</span><del>- this.small = true;
- this.toggleOnClick = false;
- this.selectable = false;
- this.tooltipHandledSeparately = true;
- this.hasChildren = false;
</del><ins>+ this.mainTitle = this._titleFragment();
+ this.addClassName("object-tree-array-index");
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WebInspector.ObjectTreeSetIndexTreeElement.prototype = {
</span><span class="cx"> constructor: WebInspector.ObjectTreeSetIndexTreeElement,
</span><del>- __proto__: WebInspector.GeneralTreeElement.prototype,
</del><ins>+ __proto__: WebInspector.ObjectTreeBaseTreeElement.prototype,
</ins><span class="cx">
</span><span class="cx"> // Public
</span><span class="cx">
</span><span class="lines">@@ -51,17 +47,21 @@
</span><span class="cx"> return this._object;
</span><span class="cx"> },
</span><span class="cx">
</span><del>- // Private
</del><ins>+ // Protected
</ins><span class="cx">
</span><del>- _resolvedValuePropertyPath: function()
</del><ins>+ resolvedValue: function()
</ins><span class="cx"> {
</span><del>- return this._propertyPath.appendSetIndex(this._object);
</del><ins>+ return this._object;
</ins><span class="cx"> },
</span><span class="cx">
</span><ins>+ // Private
+
</ins><span class="cx"> _titleFragment: function()
</span><span class="cx"> {
</span><span class="cx"> var container = document.createDocumentFragment();
</span><span class="cx">
</span><ins>+ var propertyPath = this.propertyPath.appendSetIndex(this._object);
+
</ins><span class="cx"> // Set bullet.
</span><span class="cx"> var nameElement = container.appendChild(document.createElement("span"));
</span><span class="cx"> nameElement.className = "index-name";
</span><span class="lines">@@ -71,7 +71,7 @@
</span><span class="cx"> // Value.
</span><span class="cx"> var valueElement = container.appendChild(document.createElement("span"));
</span><span class="cx"> valueElement.className = "index-value";
</span><del>- valueElement.appendChild(WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(this._object, this._resolvedValuePropertyPath()));
</del><ins>+ valueElement.appendChild(WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(this._object, propertyPath));
</ins><span class="cx">
</span><span class="cx"> return container;
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>