Web Inspector: Replace last use of ObjectPropertiesSection with ObjectTreeView
[WebKit-https.git] / Source / WebInspectorUI / UserInterface / Views / TypePropertiesSection.js
index a4880cd..94604c7 100644 (file)
@@ -27,6 +27,7 @@ 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);
 };
@@ -39,8 +40,8 @@ WebInspector.TypePropertiesSection.prototype = {
     {
         this.propertiesTreeOutline.removeChildren();
 
-        var primitiveTypeNames = this.types.globalPrimitiveTypeNames || this.types.localPrimitiveTypeNames;
-        var structures = this.types.globalStructures || this.types.localStructures;
+        var primitiveTypeNames = this._typeSet.primitiveTypeNames;
+        var structures = this.types.structures;
         var properties = [];
         for (var struct of structures) {
             properties.push({
@@ -56,6 +57,10 @@ WebInspector.TypePropertiesSection.prototype = {
         }
 
         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));
 
@@ -74,7 +79,7 @@ WebInspector.TypePropertiesSection.prototype = {
     }
 };
 
-// This is mostly identical to ObjectPropertiesSection.compareProperties.
+// 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)
 {
@@ -152,6 +157,22 @@ WebInspector.TypePropertyTreeElement.prototype = {
 
         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") + ")",