Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (184735 => 184736)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-05-21 23:30:15 UTC (rev 184735)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-05-21 23:33:42 UTC (rev 184736)
@@ -1,3 +1,91 @@
+2015-05-21 Joseph Pecoraro <pecor...@apple.com>
+
+ Web Inspector: Improve the UI of the type profiler popover
+ https://bugs.webkit.org/show_bug.cgi?id=140737
+
+ Reviewed by Timothy Hatcher.
+
+ Display TypeDescriptions in a Tree similiar to ObjectTrees.
+ Currently the only information we have in a TypeDescription
+ is the property names, and not their types, so all we can
+ display in the tree are names.
+
+ * Localizations/en.lproj/localizedStrings.js:
+ * UserInterface/Controllers/TypeTokenAnnotator.js:
+ (WebInspector.TypeTokenAnnotator.prototype._insertTypeToken):
+ * UserInterface/Main.html:
+ * UserInterface/Models/ScriptSyntaxTree.js:
+ (WebInspector.ScriptSyntaxTree.prototype.updateTypes):
+ * UserInterface/Models/StructureDescription.js: Added.
+ (WebInspector.StructureDescription):
+ (WebInspector.StructureDescription.fromPayload):
+ (WebInspector.StructureDescription.prototype.get fields):
+ (WebInspector.StructureDescription.prototype.get optionalFields):
+ (WebInspector.StructureDescription.prototype.get constructorName):
+ (WebInspector.StructureDescription.prototype.get prototypeStructure):
+ (WebInspector.StructureDescription.prototype.get imprecise):
+ * UserInterface/Models/TypeDescription.js: Added.
+ (WebInspector.TypeDescription):
+ (WebInspector.TypeDescription.fromPayload):
+ (WebInspector.TypeDescription.prototype.get leastCommonAncestor):
+ (WebInspector.TypeDescription.prototype.get typeSet):
+ (WebInspector.TypeDescription.prototype.get structures):
+ (WebInspector.TypeDescription.prototype.get valid):
+ (WebInspector.TypeDescription.prototype.get truncated):
+ * UserInterface/Models/TypeSet.js:
+ (WebInspector.TypeSet):
+ (WebInspector.TypeSet.prototype.get primitiveTypeNames):
+ * UserInterface/Views/ObjectTreeView.js:
+ (WebInspector.ObjectTreeView.prototype._updateChildren):
+ * UserInterface/Views/Section.css: Removed.
+ * UserInterface/Views/Section.js: Removed.
+ * UserInterface/Views/SourceCodeTextEditor.css:
+ (.popover .expandable):
+ * UserInterface/Views/SourceCodeTextEditor.js:
+ (WebInspector.SourceCodeTextEditor):
+ (WebInspector.SourceCodeTextEditor.prototype.showPopoverForTypes):
+ (WebInspector.SourceCodeTextEditor.prototype._populateWithScriptContent):
+ (WebInspector.SourceCodeTextEditor.prototype._tokenTrackingControllerHighlightedJavaScriptTypeInformation.handler):
+ (WebInspector.SourceCodeTextEditor.prototype._tokenTrackingControllerHighlightedJavaScriptTypeInformation):
+ (WebInspector.SourceCodeTextEditor.prototype._showPopoverForObject):
+ * UserInterface/Views/TypePropertiesSection.js: Removed.
+ * UserInterface/Views/TypeTokenView.js:
+ (WebInspector.TypeTokenView):
+ (WebInspector.TypeTokenView.titleForPopover):
+ (WebInspector.TypeTokenView.prototype.update):
+ (WebInspector.TypeTokenView.prototype._setUpMouseoverHandlers):
+ (WebInspector.TypeTokenView.prototype._shouldShowPopover):
+ (WebInspector.TypeTokenView.prototype._displayTypeName):
+ * UserInterface/Views/TypeTreeElement.css: Added.
+ (.type-tree-element):
+ (.type-tree-element > .titles):
+ (.type-tree-element > .disclosure-button):
+ (.type-tree-element.parent > .disclosure-button):
+ (.type-tree-element.parent.expanded > .disclosure-button):
+ (.type-tree-element > .icon):
+ (.type-tree-element.prototype):
+ (.type-tree-element.prototype:focus):
+ (.type-tree-element.prototype + ol):
+ * UserInterface/Views/TypeTreeElement.js: Added.
+ (WebInspector.TypeTreeElement):
+ (WebInspector.TypeTreeElement.prototype.get name):
+ (WebInspector.TypeTreeElement.prototype.get isPrototype):
+ (WebInspector.TypeTreeElement.prototype.onpopulate):
+ (WebInspector.TypeTreeElement.prototype.onexpand):
+ * UserInterface/Views/TypeTreeView.css: Renamed from Source/WebInspectorUI/UserInterface/Views/PropertiesSection.js.
+ (.type-tree):
+ (.type-tree-outline):
+ (.type-tree-outline li):
+ (.type-tree-outline ol):
+ (.type-tree-outline ol.expanded):
+ (.type-tree-outline li .empty-message):
+ * UserInterface/Views/TypeTreeView.js: Added.
+ (WebInspector.TypeTreeView):
+ (WebInspector.TypeTreeView.prototype.get typeDescription):
+ (WebInspector.TypeTreeView.prototype.get element):
+ (WebInspector.TypeTreeView.prototype.get treeOutline):
+ (WebInspector.TypeTreeView.prototype._populate):
+
2015-05-20 Joseph Pecoraro <pecor...@apple.com>
Web Inspector: Fix WebInspector.StackTrace style
Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (184735 => 184736)
--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2015-05-21 23:30:15 UTC (rev 184735)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2015-05-21 23:33:42 UTC (rev 184736)
@@ -337,6 +337,7 @@
localizedStrings["No Search Results"] = "No Search Results";
localizedStrings["No exact ARIA role match."] = "No exact ARIA role match.";
localizedStrings["No message"] = "No message";
+localizedStrings["No properties."] = "No properties.";
localizedStrings["Node"] = "Node";
localizedStrings["Not found"] = "Not found";
localizedStrings["Online"] = "Online";
@@ -368,7 +369,6 @@
localizedStrings["Probes"] = "Probes";
localizedStrings["Processing Instruction"] = "Processing Instruction";
localizedStrings["Properties"] = "Properties";
-localizedStrings["Prototype"] = "Prototype";
localizedStrings["Query Parameters"] = "Query Parameters";
localizedStrings["Query String"] = "Query String";
localizedStrings["Radial Gradient"] = "Radial Gradient";
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TypeTokenAnnotator.js (184735 => 184736)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TypeTokenAnnotator.js 2015-05-21 23:30:15 UTC (rev 184735)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TypeTokenAnnotator.js 2015-05-21 23:33:42 UTC (rev 184736)
@@ -87,7 +87,7 @@
_insertTypeToken(node)
{
if (node.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier) {
- if (!node.attachments.__typeToken && node.attachments.types && node.attachments.types.isValid)
+ if (!node.attachments.__typeToken && node.attachments.types && node.attachments.types.valid)
this._insertToken(node.range[0], node, false, WebInspector.TypeTokenView.TitleType.Variable, node.name);
if (node.attachments.__typeToken)
@@ -99,13 +99,13 @@
console.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration || node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression);
var functionReturnType = node.attachments.returnTypes;
- if (!functionReturnType || !functionReturnType.isValid)
+ if (!functionReturnType || !functionReturnType.valid)
return;
// If a function does not have an explicit return statement with an argument (i.e, "return x;" instead of "return;")
// then don't show a return type unless we think it's a constructor.
var scriptSyntaxTree = this._script._scriptSyntaxTree;
- if (!node.attachments.__typeToken && (scriptSyntaxTree.containsNonEmptyReturnStatement(node.body) || !WebInspector.TypeSet.fromPayload(functionReturnType).isContainedIn(WebInspector.TypeSet.TypeBit.Undefined))) {
+ if (!node.attachments.__typeToken && (scriptSyntaxTree.containsNonEmptyReturnStatement(node.body) || !WebInspector.TypeSet.fromPayload(functionReturnType.typeSet).isContainedIn(WebInspector.TypeSet.TypeBit.Undefined))) {
var functionName = node.id ? node.id.name : null;
var offset = node.isGetterOrSetter ? node.getterOrSetterRange[0] : node.range[0];
this._insertToken(offset, node, true, WebInspector.TypeTokenView.TitleType.ReturnStatement, functionName);
Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (184735 => 184736)
--- trunk/Source/WebInspectorUI/UserInterface/Main.html 2015-05-21 23:30:15 UTC (rev 184735)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html 2015-05-21 23:33:42 UTC (rev 184736)
@@ -129,7 +129,6 @@
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
- <link rel="stylesheet" href=""
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
@@ -153,6 +152,8 @@
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
+ <link rel="stylesheet" href=""
+ <link rel="stylesheet" href=""
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
@@ -300,10 +301,12 @@
<script src=""
<script src=""
<script src=""
+ <script src=""
<script src=""
<script src=""
<script src=""
<script src=""
+ <script src=""
<script src=""
<script src=""
@@ -314,7 +317,6 @@
<script src=""
<script src=""
<script src=""
- <script src=""
<script src=""
<script src=""
<script src=""
@@ -330,7 +332,6 @@
<script src=""
<script src=""
<script src=""
- <script src=""
<script src=""
<script src=""
<script src=""
@@ -519,8 +520,9 @@
<script src=""
<script src=""
<script src=""
- <script src=""
<script src=""
+ <script src=""
+ <script src=""
<script src=""
<script src=""
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js (184735 => 184736)
--- trunk/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js 2015-05-21 23:30:15 UTC (rev 184735)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js 2015-05-21 23:33:42 UTC (rev 184736)
@@ -204,7 +204,7 @@
for (var i = 0; i < typeInformationArray.length; i++) {
var node = allRequestNodes[i];
- var typeInformation = typeInformationArray[i];
+ var typeInformation = WebInspector.TypeDescription.fromPayload(typeInformationArray[i]);
if (allRequests[i].typeInformationDescriptor === WebInspector.ScriptSyntaxTree.TypeProfilerSearchDescriptor.FunctionReturn)
node.attachments.returnTypes = typeInformation;
else
Added: trunk/Source/WebInspectorUI/UserInterface/Models/StructureDescription.js (0 => 184736)
--- trunk/Source/WebInspectorUI/UserInterface/Models/StructureDescription.js (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/StructureDescription.js 2015-05-21 23:33:42 UTC (rev 184736)
@@ -0,0 +1,81 @@
+/*
+ * 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.StructureDescription = class StructureDescription extends WebInspector.Object
+{
+ constructor(fields, optionalFields, constructorName, prototypeStructure, imprecise)
+ {
+ super();
+
+ console.assert(!fields || fields.every(function(x) { return typeof x === "string"; }));
+ console.assert(!optionalFields || optionalFields.every(function(x) { return typeof x === "string"; }));
+ console.assert(!constructorName || typeof constructorName === "string");
+ console.assert(!prototypeStructure || prototypeStructure instanceof WebInspector.StructureDescription);
+
+ this._fields = fields || null;
+ this._optionalFields = optionalFields || null;
+ this._constructorName = constructorName || "";
+ this._prototypeStructure = prototypeStructure || null;
+ this._imprecise = imprecise || false;
+ }
+
+ // Static
+
+ // Runtime.StructureDescription.
+ static fromPayload(payload)
+ {
+ if (payload.prototypeStructure)
+ payload.prototypeStructure = WebInspector.StructureDescription.fromPayload(payload.prototypeStructure);
+
+ return new WebInspector.StructureDescription(payload.fields, payload.optionalFields, payload.constructorName, payload.prototypeStructure, payload.imprecise);
+ }
+
+ // Public
+
+ get fields()
+ {
+ return this._fields;
+ }
+
+ get optionalFields()
+ {
+ return this._optionalFields;
+ }
+
+ get constructorName()
+ {
+ return this._constructorName;
+ }
+
+ get prototypeStructure()
+ {
+ return this._prototypeStructure;
+ }
+
+ get imprecise()
+ {
+ return this._imprecise;
+ }
+};
Added: trunk/Source/WebInspectorUI/UserInterface/Models/TypeDescription.js (0 => 184736)
--- trunk/Source/WebInspectorUI/UserInterface/Models/TypeDescription.js (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/TypeDescription.js 2015-05-21 23:33:42 UTC (rev 184736)
@@ -0,0 +1,85 @@
+/*
+ * 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.TypeDescription = class TypeDescription extends WebInspector.Object
+{
+ constructor(leastCommonAncestor, typeSet, structures, valid, truncated)
+ {
+ super();
+
+ console.assert(!leastCommonAncestor || typeof leastCommonAncestor === "string");
+ console.assert(!typeSet || typeSet instanceof WebInspector.TypeSet);
+ console.assert(!structures || structures.every(function(x) { return x instanceof WebInspector.StructureDescription; }));
+
+ this._leastCommonAncestor = leastCommonAncestor || null;
+ this._typeSet = typeSet || null;
+ this._structures = structures || null;
+ this._valid = valid || false;
+ this._truncated = truncated || false;
+ }
+
+ // Static
+
+ // Runtime.TypeDescription.
+ static fromPayload(payload)
+ {
+ var typeSet = undefined;
+ if (payload.typeSet)
+ typeSet = WebInspector.TypeSet.fromPayload(payload.typeSet);
+
+ var structures = undefined;
+ if (payload.structures)
+ structures = payload.structures.map(function(x) { return WebInspector.StructureDescription.fromPayload(x); });
+
+ return new WebInspector.TypeDescription(payload.leastCommonAncestor, typeSet, structures, payload.isValid, payload.isTruncated);
+ }
+
+ // Public
+
+ get leastCommonAncestor()
+ {
+ return this._leastCommonAncestor;
+ }
+
+ get typeSet()
+ {
+ return this._typeSet;
+ }
+
+ get structures()
+ {
+ return this._structures;
+ }
+
+ get valid()
+ {
+ return this._valid;
+ }
+
+ get truncated()
+ {
+ return this._truncated;
+ }
+};
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/TypeSet.js (184735 => 184736)
--- trunk/Source/WebInspectorUI/UserInterface/Models/TypeSet.js 2015-05-21 23:30:15 UTC (rev 184735)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/TypeSet.js 2015-05-21 23:33:42 UTC (rev 184736)
@@ -26,13 +26,12 @@
WebInspector.TypeSet = class TypeSet extends WebInspector.Object
{
- constructor(runtimeTypeDescriptionPayload)
+ constructor(typeSet)
{
super();
- this._types = runtimeTypeDescriptionPayload;
+ console.assert(typeSet);
- var typeSet = this._types.typeSet;
var bitString = 0x0;
if (typeSet.isFunction)
bitString |= WebInspector.TypeSet.TypeBit.Function;
@@ -52,10 +51,10 @@
bitString |= WebInspector.TypeSet.TypeBit.Object;
if (typeSet.isSymbol)
bitString |= WebInspector.TypeSet.TypeBit.Symbol;
-
console.assert(bitString);
- this._bitString = bitString;
+ this._typeSet = typeSet;
+ this._bitString = bitString;
this._primitiveTypeNames = null;
}
@@ -94,7 +93,7 @@
return this._primitiveTypeNames;
this._primitiveTypeNames = [];
- var typeSet = this._types.typeSet;
+ var typeSet = this._typeSet;
if (typeSet.isUndefined)
this._primitiveTypeNames.push("Undefined");
if (typeSet.isNull)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js (184735 => 184736)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js 2015-05-21 23:30:15 UTC (rev 184735)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js 2015-05-21 23:33:42 UTC (rev 184736)
@@ -255,6 +255,8 @@
}
handler.call(this, list, this._propertyPath);
+
+ this.dispatchEventToListeners(WebInspector.ObjectTreeView.Event.Updated);
}
_updateEntries(entries, propertyPath)
@@ -368,3 +370,7 @@
PrototypeAPI: Symbol("object-tree-prototype-api"), // API view on a live object instance, so getters can be invoked.
ClassAPI: Symbol("object-tree-class-api"), // API view without an object instance, can not invoke getters.
};
+
+WebInspector.ObjectTreeView.Event = {
+ Updated: "object-tree-updated",
+};
Deleted: trunk/Source/WebInspectorUI/UserInterface/Views/PropertiesSection.js (184735 => 184736)
--- trunk/Source/WebInspectorUI/UserInterface/Views/PropertiesSection.js 2015-05-21 23:30:15 UTC (rev 184735)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/PropertiesSection.js 2015-05-21 23:33:42 UTC (rev 184736)
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2013 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.PropertiesSection = function(title, subtitle)
-{
- this.propertiesElement = document.createElement("ol");
- this.propertiesElement.className = "properties properties-tree";
- this.propertiesElement.tabIndex = 0;
- this.propertiesTreeOutline = new WebInspector.TreeOutline(this.propertiesElement);
- this.propertiesTreeOutline.section = this;
-
- WebInspector.Section.call(this, title, subtitle);
-
- this.element.appendChild(this.propertiesElement);
-};
-
-WebInspector.PropertiesSection.prototype.__proto__ = WebInspector.Section.prototype;
Deleted: trunk/Source/WebInspectorUI/UserInterface/Views/Section.css (184735 => 184736)
--- trunk/Source/WebInspectorUI/UserInterface/Views/Section.css 2015-05-21 23:30:15 UTC (rev 184735)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/Section.css 2015-05-21 23:33:42 UTC (rev 184736)
@@ -1,195 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-.section {
- position: relative;
-}
-
-.section .header {
- color: black;
- padding: 0 8px 0 18px;
- min-height: 18px;
- white-space: nowrap;
- background-origin: padding;
- background-clip: padding;
-}
-
-.section .header .title::before {
- width: 8px;
- height: 8px;
-
- margin-right: 4px;
- margin-left: -8px;
-
- background-image: -webkit-canvas(disclosure-triangle-tiny-closed-normal);
- background-size: 8px 8px;
- background-repeat: no-repeat;
-
- content: " ";
- display: inline-block;
-}
-
-.section.expanded .header .title::before {
- background-image: -webkit-canvas(disclosure-triangle-tiny-open-normal);
-}
-
-.section .header .title, .event-bar .header .title {
- font-weight: normal;
- word-wrap: break-word;
- white-space: normal;
- line-height: 18px; /* @FIXME: Don't hardcode line-height. */
-}
-
-.section .header .title.blank-title {
- font-style: italic;
-}
-
-.section .header label, .event-bar .header label {
- display: none;
-}
-
-.section.expanded .header label, .event-bar.expanded .header label {
- display: inline;
-}
-
-.section .header .subtitle, .event-bar .header .subtitle {
- float: right;
- margin-left: 5px;
- max-width: 55%;
- text-overflow: ellipsis;
- overflow: hidden;
-}
-
-.section .header .subtitle a {
- color: inherit;
-}
-
-.section .properties, .event-bar .event-properties {
- display: none;
-}
-
-.section.expanded .properties, .event-bar.expanded .event-properties {
- display: block;
- padding-left: 16px;
-}
-
-.section.expanded.no-header .properties {
- padding-left: 0;
-}
-
-.section.no-affect .properties li {
- opacity: 0.5;
-}
-
-.section.no-affect .properties li.editing {
- opacity: 1.0;
-}
-
-.properties-tree {
- margin: 0;
- padding: 0 6px 2px;
- list-style: none;
- min-height: 18px;
- outline: none;
-}
-
-.properties-tree li {
- margin-left: 12px;
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- -webkit-user-select: text;
- cursor: default;
-}
-
-.properties-tree li.parent {
- margin-left: 1px;
-}
-
-.properties-tree li.parent::before {
- float: left;
-
- content: "";
-
- background-image: -webkit-canvas(disclosure-triangle-tiny-closed-normal);
- background-size: 8px 8px;
- background-repeat: no-repeat;
-
- width: 8px;
- height: 8px;
-
- margin-top: 2px;
- padding-right: 2px;
-}
-
-.properties-tree li.parent.expanded::before {
- background-image: -webkit-canvas(disclosure-triangle-tiny-open-normal);
-}
-
-.properties-tree li .info {
- padding-top: 4px;
- padding-bottom: 3px;
-}
-
-.properties-tree ol {
- display: none;
- margin: 0;
- -webkit-padding-start: 12px;
- list-style: none;
-}
-
-.properties-tree ol.expanded {
- display: block;
-}
-
-.section .properties li.editing-sub-part {
- padding: 3px 6px 8px 18px;
- margin: -3px -6px -8px -6px;
- text-overflow: clip;
-}
-
-.section .properties .name, .event-properties .name {
- color: rgb(136, 19, 145);
-}
-
-.section .properties .dimmed {
- opacity: 0.6;
-}
-
-.section .properties .value.error {
- color: red;
-}
-
-.section .properties .number, .event-properties .number {
- color: blue;
-}
-
-.section .properties .keyword, .event-properties .keyword {
- color: rgb(136, 19, 79);
-}
-
-.section .properties .color, .event-properties .color {
- color: rgb(118, 15, 21);
-}
Deleted: trunk/Source/WebInspectorUI/UserInterface/Views/Section.js (184735 => 184736)
--- trunk/Source/WebInspectorUI/UserInterface/Views/Section.js 2015-05-21 23:30:15 UTC (rev 184735)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/Section.js 2015-05-21 23:33:42 UTC (rev 184736)
@@ -1,216 +0,0 @@
-/*
- * Copyright (C) 2013 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.Section = function(title, subtitle)
-{
- // FIXME: Convert this to a WebInspector.Object subclass, and call super().
- // WebInspector.Object.call(this);
-
- this.element = document.createElement("div");
- this.element.className = "section";
- this.element._section = this;
-
- if (typeof title === "string" || title instanceof Node || typeof subtitle === "string") {
- this.headerElement = document.createElement("div");
- this.headerElement.className = "header";
-
- this.titleElement = document.createElement("div");
- this.titleElement.className = "title";
-
- this.subtitleElement = document.createElement("div");
- this.subtitleElement.className = "subtitle";
-
- this.headerElement.appendChild(this.subtitleElement);
- this.headerElement.appendChild(this.titleElement);
-
- this.headerElement.addEventListener("click", this.handleClick.bind(this), false);
- this.element.appendChild(this.headerElement);
-
- this.title = title;
- this.subtitle = subtitle;
- } else
- this.element.classList.add("no-header");
-
- this._expanded = false;
-
- if (!this.headerElement)
- this.expand();
-};
-
-WebInspector.Section.Event = {
- VisibleContentDidChange: "section-visible-content-did-change"
-};
-
-WebInspector.Section.prototype = {
- get title()
- {
- return this._title;
- },
-
- set title(x)
- {
- if (this._title === x)
- return;
- this._title = x;
-
- if (x instanceof Node) {
- this.titleElement.removeChildren();
- this.titleElement.appendChild(x);
- } else
- this.titleElement.textContent = x;
- },
-
- get subtitle()
- {
- return this._subtitle;
- },
-
- set subtitle(x)
- {
- if (this._subtitle === x)
- return;
- this._subtitle = x;
- this.subtitleElement.textContent = x;
- },
-
- get expanded()
- {
- return this._expanded;
- },
-
- set expanded(x)
- {
- if (x)
- this.expand();
- else
- this.collapse();
- },
-
- get populated()
- {
- return this._populated;
- },
-
- set populated(x)
- {
- this._populated = x;
- if (!x && this._expanded) {
- this.onpopulate();
- this._populated = true;
- }
- },
-
- onpopulate: function()
- {
- // Overriden by subclasses.
- },
-
- get firstSibling()
- {
- var parent = this.element.parentElement;
- if (!parent)
- return null;
-
- var childElement = parent.firstChild;
- while (childElement) {
- if (childElement._section)
- return childElement._section;
- childElement = childElement.nextSibling;
- }
-
- return null;
- },
-
- get lastSibling()
- {
- var parent = this.element.parentElement;
- if (!parent)
- return null;
-
- var childElement = parent.lastChild;
- while (childElement) {
- if (childElement._section)
- return childElement._section;
- childElement = childElement.previousSibling;
- }
-
- return null;
- },
-
- get nextSibling()
- {
- var curElement = this.element;
- do {
- curElement = curElement.nextSibling;
- } while (curElement && !curElement._section);
-
- return curElement ? curElement._section : null;
- },
-
- get previousSibling()
- {
- var curElement = this.element;
- do {
- curElement = curElement.previousSibling;
- } while (curElement && !curElement._section);
-
- return curElement ? curElement._section : null;
- },
-
- expand: function()
- {
- if (this._expanded)
- return;
- this._expanded = true;
- this.element.classList.add("expanded");
-
- if (!this._populated) {
- this.onpopulate();
- this._populated = true;
- } else
- this.dispatchEventToListeners(WebInspector.Section.Event.VisibleContentDidChange);
- },
-
- collapse: function()
- {
- if (!this._expanded)
- return;
- this._expanded = false;
- this.element.classList.remove("expanded");
- },
-
- toggleExpanded: function()
- {
- this.expanded = !this.expanded;
- },
-
- handleClick: function(e)
- {
- this.toggleExpanded();
- e.stopPropagation();
- }
-};
-
-WebInspector.Section.prototype.__proto__ = WebInspector.Object.prototype;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.css (184735 => 184736)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.css 2015-05-21 23:30:15 UTC (rev 184735)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.css 2015-05-21 23:33:42 UTC (rev 184736)
@@ -136,6 +136,9 @@
.popover .expandable {
min-width: 300px;
min-height: 250px;
+
+ max-width: 350px;
+ max-height: 450px;
}
.popover .debugger-popover-content > .title {
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js (184735 => 184736)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js 2015-05-21 23:30:15 UTC (rev 184735)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js 2015-05-21 23:33:42 UTC (rev 184736)
@@ -269,7 +269,7 @@
return newActivatedState;
}
- showPopoverForTypes(types, bounds, title)
+ showPopoverForTypes(typeDescription, bounds, title)
{
var content = document.createElement("div");
content.className = "object expandable";
@@ -279,11 +279,12 @@
titleElement.textContent = title;
content.appendChild(titleElement);
- var section = new WebInspector.TypePropertiesSection(types);
- section.expanded = true;
- section.element.classList.add("body");
- content.appendChild(section.element);
+ var bodyElement = content.appendChild(document.createElement("div"));
+ bodyElement.className = "body";
+ var typeTreeView = new WebInspector.TypeTreeView(typeDescription);
+ bodyElement.appendChild(typeTreeView.element);
+
this._showPopover(content, bounds);
}
@@ -1417,10 +1418,11 @@
console.assert(allTypes.length === 1);
if (!allTypes.length)
return;
- var types = allTypes[0];
- if (types.isValid) {
+
+ var typeDescription = WebInspector.TypeDescription.fromPayload(allTypes[0]);
+ if (typeDescription.valid) {
var popoverTitle = WebInspector.TypeTokenView.titleForPopover(WebInspector.TypeTokenView.TitleType.Variable, candidate._expression_);
- this.showPopoverForTypes(types, null, popoverTitle);
+ this.showPopoverForTypes(typeDescription, null, popoverTitle);
}
}
@@ -1509,7 +1511,13 @@
bodyElement.className = "body";
bodyElement.appendChild(objectTree.element);
- this._showPopover(content);
+ // Show the popover once we have the first set of properties for the object.
+ var candidate = this.tokenTrackingController.candidate;
+ objectTree.addEventListener(WebInspector.ObjectTreeView.Event.Updated, function() {
+ if (candidate === this.tokenTrackingController.candidate)
+ this._showPopover(content);
+ objectTree.removeEventListener(null, null, this);
+ }, this);
}
_showPopoverWithFormattedValue(remoteObject)
Deleted: trunk/Source/WebInspectorUI/UserInterface/Views/TypePropertiesSection.js (184735 => 184736)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TypePropertiesSection.js 2015-05-21 23:30:15 UTC (rev 184735)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TypePropertiesSection.js 2015-05-21 23:33:42 UTC (rev 184736)
@@ -1,184 +0,0 @@
-/*
- * Copyright (C) 2014-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.TypePropertiesSection = function(types, title, subtitle)
-{
- this.emptyPlaceholder = WebInspector.UIString("No Properties");
- this.types = types;
- this._typeSet = WebInspector.TypeSet.fromPayload(this.types);
-
- WebInspector.PropertiesSection.call(this, title, subtitle);
-};
-
-WebInspector.TypePropertiesSection.prototype = {
- constructor: WebInspector.TypePropertiesSection,
- __proto__: WebInspector.PropertiesSection.prototype,
-
- onpopulate: function()
- {
- this.propertiesTreeOutline.removeChildren();
-
- var primitiveTypeNames = this._typeSet.primitiveTypeNames;
- var structures = this.types.structures;
- var properties = [];
- for (var struct of structures) {
- properties.push({
- name: struct.constructorName,
- structure: struct
- });
- }
- for (var primitiveName of primitiveTypeNames) {
- properties.push({
- name: primitiveName,
- structure: null
- });
- }
-
- properties.sort(WebInspector.TypePropertiesSection.PropertyComparator);
-
- if (this.types.isTruncated)
- properties.push({name: "\u2026", structure: null});
-
- for (var property of properties)
- this.propertiesTreeOutline.appendChild(new WebInspector.TypePropertyTreeElement(property));
-
- if (!this.propertiesTreeOutline.children.length) {
- var title = document.createElement("div");
- title.className = "info";
- title.textContent = this.emptyPlaceholder;
- var infoElement = new WebInspector.TreeElement(title, null, false);
- this.propertiesTreeOutline.appendChild(infoElement);
- }
-
- this.dispatchEventToListeners(WebInspector.Section.Event.VisibleContentDidChange);
-
- if (properties.length === 1)
- this.propertiesTreeOutline.children[0].expandRecursively();
- }
-};
-
-// This is mostly identical to ObjectTreeView.compareProperties.
-// But this checks for equality because we can have two objects named the same thing.
-WebInspector.TypePropertiesSection.PropertyComparator = function(propertyA, propertyB)
-{
- var a = propertyA.name;
- var b = propertyB.name;
- if (a.indexOf("__proto__") !== -1)
- return 1;
- if (b.indexOf("__proto__") !== -1)
- return -1;
- if (a === b)
- return 0;
-
- var diff = 0;
- var chunk = /^\d+|^\D+/;
- var chunka, chunkb, anum, bnum;
- while (diff === 0) {
- if (!a && b)
- return -1;
- if (!b && a)
- return 1;
- chunka = a.match(chunk)[0];
- chunkb = b.match(chunk)[0];
- anum = !isNaN(chunka);
- bnum = !isNaN(chunkb);
- if (anum && !bnum)
- return -1;
- if (bnum && !anum)
- return 1;
- if (anum && bnum) {
- diff = chunka - chunkb;
- if (diff === 0 && chunka.length !== chunkb.length) {
- if (!+chunka && !+chunkb) // chunks are strings of all 0s (special case)
- return chunka.length - chunkb.length;
- else
- return chunkb.length - chunka.length;
- }
- } else if (chunka !== chunkb)
- return (chunka < chunkb) ? -1 : 1;
- a = a.substring(chunka.length);
- b = b.substring(chunkb.length);
- }
-
- return diff;
-};
-
-WebInspector.TypePropertyTreeElement = class TypePropertyTreeElement extends WebInspector.TreeElement
-{
- constructor(property)
- {
- var titleElement = document.createElement("span");
- super(titleElement, null, false);
-
- this.property = property;
-
- titleElement.className = "name";
- titleElement.textContent = this.property.name;
-
- this.toggleOnClick = true;
- this.hasChildren = !!this.property.structure;
- }
-
- onpopulate()
- {
- this.removeChildren();
-
- var properties = [];
- for (var fieldName of this.property.structure.fields) {
- properties.push({
- name: fieldName,
- structure: null
- });
- }
-
- properties.sort(WebInspector.TypePropertiesSection.PropertyComparator);
-
- for (var property of properties)
- this.appendChild(new WebInspector.TypePropertyTreeElement(property));
-
- properties = [];
- for (var fieldName of this.property.structure.optionalFields) {
- properties.push({
- name: fieldName + "?",
- structure: null
- });
- }
-
- properties.sort(WebInspector.TypePropertiesSection.PropertyComparator);
-
- if (this.property.structure.isImprecise)
- properties.push({name: "\u2026", structure: null});
-
- if (this.property.structure.prototypeStructure) {
- properties.push({
- name: this.property.structure.prototypeStructure.constructorName + " (" + WebInspector.UIString("Prototype") + ")",
- structure: this.property.structure.prototypeStructure
- });
- }
-
- for (var property of properties)
- this.appendChild(new WebInspector.TypePropertyTreeElement(property));
- }
-};
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TypeTokenView.js (184735 => 184736)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TypeTokenView.js 2015-05-21 23:30:15 UTC (rev 184735)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TypeTokenView.js 2015-05-21 23:33:42 UTC (rev 184736)
@@ -40,8 +40,9 @@
this.element = span;
this._tokenAnnotator = tokenAnnotator;
- this._types = null;
- this._typeSet = null;
+
+ this._typeDescription = null;
+
this._colorClass = null;
this._popoverTitle = WebInspector.TypeTokenView.titleForPopover(titleType, functionOrVariableName);
@@ -53,26 +54,23 @@
static titleForPopover(titleType, functionOrVariableName)
{
- var titleString = null;
if (titleType === WebInspector.TypeTokenView.TitleType.Variable)
- titleString = WebInspector.UIString("Type information for variable: %s").format(functionOrVariableName);
- else {
- if (functionOrVariableName)
- titleString = WebInspector.UIString("Return type for function: %s").format(functionOrVariableName);
- else
- titleString = WebInspector.UIString("Return type for anonymous function");
- }
+ return WebInspector.UIString("Type information for variable: %s").format(functionOrVariableName);
- return titleString;
+ if (functionOrVariableName)
+ return WebInspector.UIString("Return type for function: %s").format(functionOrVariableName);
+
+ return WebInspector.UIString("Return type for anonymous function");
}
// Public
- update(types)
+ update(typeDescription)
{
- this._types = types;
- this._typeSet = WebInspector.TypeSet.fromPayload(this._types);
+ console.assert(typeDescription instanceof WebInspector.TypeDescription);
+ this._typeDescription = typeDescription;
+
var title = this._displayTypeName();
if (title === this.element.textContent)
return;
@@ -100,7 +98,7 @@
var domRect = this.element.getBoundingClientRect();
var bounds = new WebInspector.Rect(domRect.left, domRect.top, domRect.width, domRect.height);
- this._tokenAnnotator.sourceCodeTextEditor.showPopoverForTypes(this._types, bounds, this._popoverTitle);
+ this._tokenAnnotator.sourceCodeTextEditor.showPopoverForTypes(this._typeDescription, bounds, this._popoverTitle);
}
if (this._shouldShowPopover())
@@ -115,13 +113,13 @@
_shouldShowPopover()
{
- if (!this._types.isValid)
+ if (!this._typeDescription.valid)
return false;
- if (this._typeSet.primitiveTypeNames.length > 1)
+ if (this._typeDescription.typeSet.primitiveTypeNames.length > 1)
return true;
- if (this._types.structures && this._types.structures.length)
+ if (this._typeDescription.structures && this._typeDescription.structures.length)
return true;
return false;
@@ -129,16 +127,16 @@
_displayTypeName()
{
- if (!this._types.isValid)
+ if (!this._typeDescription.valid)
return "";
- var typeSet = this._typeSet;
+ var typeSet = this._typeDescription.typeSet;
- if (this._types.leastCommonAncestor && !this._typeSet.primitiveTypeNames.length) {
+ if (this._typeDescription.leastCommonAncestor && !this._typeDescription.typeSet.primitiveTypeNames.length) {
if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Object))
- return this._types.leastCommonAncestor;
+ return this._typeDescription.leastCommonAncestor;
if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Object | WebInspector.TypeSet.NullOrUndefinedTypeBits))
- return this._types.leastCommonAncestor + "?";
+ return this._typeDescription.leastCommonAncestor + "?";
}
// The order of these checks are important.
Added: trunk/Source/WebInspectorUI/UserInterface/Views/TypeTreeElement.css (0 => 184736)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TypeTreeElement.css (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TypeTreeElement.css 2015-05-21 23:33:42 UTC (rev 184736)
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+.type-tree-element {
+ margin-top: 1px;
+}
+
+.type-tree-element > .titles {
+ position: relative;
+ line-height: normal;
+ padding-bottom: 1px;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ white-space: nowrap;
+ display: inline-block;
+ vertical-align: top;
+}
+
+.type-tree-element > .disclosure-button {
+ display: inline-block;
+ vertical-align: top;
+
+ width: 15px;
+ height: 16px;
+
+ margin-left: -1px;
+ border: 0;
+ background: none;
+ -webkit-appearance: none;
+}
+
+.type-tree-element.parent > .disclosure-button {
+ background-color: transparent;
+ background-image: -webkit-canvas(navigation-sidebar-panel-disclosure-triangle-closed-normal);
+ background-repeat: no-repeat;
+ background-position: center;
+ background-size: 13px 13px;
+}
+
+.type-tree-element.parent.expanded > .disclosure-button {
+ background-image: -webkit-canvas(navigation-sidebar-panel-disclosure-triangle-open-normal);
+}
+
+.type-tree-element > .icon {
+ display: none;
+}
+
+.type-tree-element.prototype {
+ display: inline-block;
+
+ border: 1px solid hsla(0, 0%, 0%, 0.06);
+ background-color: hsla(0, 0%, 0%, 0.03);
+ border-radius: 3px;
+
+ padding: 0 10px 1px 0;
+ margin: 3px 0 2px 0;
+}
+
+.type-tree-element.prototype:hover,
+.type-tree-element.prototype:focus {
+ border-color: hsla(0, 0%, 0%, 0.1);
+}
+
+.type-tree-element.prototype + ol {
+ -webkit-padding-start: 0px;
+}
Added: trunk/Source/WebInspectorUI/UserInterface/Views/TypeTreeElement.js (0 => 184736)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TypeTreeElement.js (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TypeTreeElement.js 2015-05-21 23:33:42 UTC (rev 184736)
@@ -0,0 +1,131 @@
+/*
+ * 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.TypeTreeElement = class TypeTreeElement extends WebInspector.GeneralTreeElement
+{
+ constructor(name, structureDescription, isPrototype)
+ {
+ super(null, null, null, structureDescription || null, false);
+
+ console.assert(!structureDescription || structureDescription instanceof WebInspector.StructureDescription);
+
+ this._name = name;
+ this._structureDescription = structureDescription || null;
+ this._isPrototype = isPrototype;
+
+ this._populated = false;
+ this._autoExpandedChildren = false;
+
+ this.small = true;
+ this.toggleOnClick = true;
+ this.selectable = false;
+ this.tooltipHandledSeparately = true;
+ this.hasChildren = structureDescription;
+
+ var displayName = this._isPrototype ? WebInspector.UIString("%s Prototype").format(name.replace(/Prototype$/, "")) : name;
+ var nameElement = document.createElement("span");
+ nameElement.classList.add("type-name");
+ nameElement.textContent = displayName;
+ this.mainTitle = nameElement;
+
+ this.addClassName("type-tree-element");
+ if (this._isPrototype)
+ this.addClassName("prototype");
+ }
+
+ // Public
+
+ get name()
+ {
+ return this._name;
+ }
+
+ get isPrototype()
+ {
+ return this._isPrototype;
+ }
+
+ // Protected
+
+ onpopulate()
+ {
+ if (this._populated)
+ return;
+
+ this._populated = true;
+
+ var properties = [];
+ for (var name of this._structureDescription.fields) {
+ // FIXME: The backend can send us an empty string. Why? (Symbol?)
+ if (name === "")
+ continue;
+ properties.push({name});
+ }
+ properties.sort(WebInspector.ObjectTreeView.comparePropertyDescriptors);
+
+ var optionalProperties = [];
+ for (var name of this._structureDescription.optionalFields) {
+ // FIXME: The backend can send us an empty string. Why? (Symbol?)
+ if (name === "")
+ continue;
+ optionalProperties.push({name: name + "?"});
+ }
+ optionalProperties.sort(WebInspector.ObjectTreeView.comparePropertyDescriptors);
+
+ for (var property of properties)
+ this.appendChild(new WebInspector.TypeTreeElement(property.name, null));
+ for (var property of optionalProperties)
+ this.appendChild(new WebInspector.TypeTreeElement(property.name, null));
+
+ if (this._structureDescription.imprecise) {
+ var truncatedMessageElement = WebInspector.ObjectTreeView.createEmptyMessageElement("\u2026");
+ this.appendChild(new WebInspector.TreeElement(truncatedMessageElement, null, false));
+ }
+
+ if (!this.children.length) {
+ var emptyMessageElement = WebInspector.ObjectTreeView.createEmptyMessageElement(WebInspector.UIString("No properties."));
+ this.appendChild(new WebInspector.TreeElement(emptyMessageElement, null, false));
+ }
+
+ console.assert(this.children.length > 0);
+
+ var prototypeStructure = this._structureDescription.prototypeStructure;
+ if (prototypeStructure)
+ this.appendChild(new WebInspector.TypeTreeElement(prototypeStructure.constructorName, prototypeStructure, true));
+ }
+
+ onexpand()
+ {
+ if (this._autoExpandedChildren)
+ return;
+
+ this._autoExpandedChildren = true;
+
+ // On first expand, auto-expand children until "Object".
+ var lastChild = this.children[this.children.length - 1];
+ if (lastChild && lastChild.hasChildren && lastChild.isPrototype && lastChild.name !== "Object")
+ lastChild.expand();
+ }
+};
Copied: trunk/Source/WebInspectorUI/UserInterface/Views/TypeTreeView.css (from rev 184734, trunk/Source/WebInspectorUI/UserInterface/Views/PropertiesSection.js) (0 => 184736)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TypeTreeView.css (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TypeTreeView.css 2015-05-21 23:33:42 UTC (rev 184736)
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+.type-tree {
+ position: relative;
+ display: block;
+
+ color: black;
+ font-family: -webkit-system-font, sans-serif;
+ font-size: 12px;
+}
+
+.type-tree-outline {
+ margin: 0;
+ padding: 0 6px 2px;
+ list-style: none;
+ min-height: 18px;
+ outline: none;
+}
+
+.type-tree-outline li {
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ -webkit-user-select: text;
+ cursor: default;
+}
+
+.type-tree-outline ol {
+ display: none;
+ margin: 0;
+ -webkit-padding-start: 16px;
+ list-style: none;
+}
+
+.type-tree-outline ol.expanded {
+ display: block;
+}
+
+.type-tree-outline li .empty-message {
+ color: rgb(60%, 60%, 60%);
+ margin-left: 13px;
+}
Added: trunk/Source/WebInspectorUI/UserInterface/Views/TypeTreeView.js (0 => 184736)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TypeTreeView.js (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TypeTreeView.js 2015-05-21 23:33:42 UTC (rev 184736)
@@ -0,0 +1,92 @@
+/*
+ * 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.TypeTreeView = class TypeTreeView extends WebInspector.Object
+{
+ constructor(typeDescription)
+ {
+ super();
+
+ console.assert(typeDescription instanceof WebInspector.TypeDescription);
+
+ this._typeDescription = typeDescription;
+
+ this._element = document.createElement("div");
+ this._element.className = "type-tree";
+
+ this._outlineElement = document.createElement("ol");
+ this._outlineElement.className = "type-tree-outline";
+ this._outline = new WebInspector.TreeOutline(this._outlineElement);
+ this._element.appendChild(this._outlineElement);
+
+ this._populate();
+
+ // Auto-expand if there is one sub-type. TypeTreeElement handles further auto-expansion.
+ if (this._outline.children.length === 1)
+ this._outline.children[0].expand();
+ }
+
+ // Public
+
+ get typeDescription()
+ {
+ return this._typeDescription;
+ }
+
+ get element()
+ {
+ return this._element;
+ }
+
+ get treeOutline()
+ {
+ return this._outline;
+ }
+
+ // Private
+
+ _populate()
+ {
+ var types = [];
+ for (var structure of this._typeDescription.structures)
+ types.push({name: structure.constructorName, structure});
+ for (var primitiveName of this._typeDescription.typeSet.primitiveTypeNames)
+ types.push({name: primitiveName});
+ types.sort(WebInspector.ObjectTreeView.comparePropertyDescriptors);
+
+ for (var type of types)
+ this._outline.appendChild(new WebInspector.TypeTreeElement(type.name, type.structure, false));
+
+ if (this._typeDescription.truncated) {
+ var truncatedMessageElement = WebInspector.ObjectTreeView.createEmptyMessageElement("\u2026");
+ this._outline.appendChild(new WebInspector.TreeElement(truncatedMessageElement, null, false));
+ }
+
+ if (!this._outline.children.length) {
+ var errorMessageElement = WebInspector.ObjectTreeView.createEmptyMessageElement(WebInspector.UIString("No properties."));
+ this._outline.appendChild(new WebInspector.TreeElement(errorMessageElement, null, false));
+ }
+ }
+};