Web Inspector: Remove unused DataGrid and TreeOutline code
authormattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Nov 2018 19:47:01 +0000 (19:47 +0000)
committermattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Nov 2018 19:47:01 +0000 (19:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191622
<rdar://problem/46052014>

Reviewed by Devin Rousso.

* UserInterface/Views/CanvasDetailsSidebarPanel.js:
(WI.CanvasDetailsSidebarPanel.prototype.initialLayout):

* UserInterface/Views/DOMTreeElement.js:
(WI.DOMTreeElement.prototype.insertChildElement):

* UserInterface/Views/DOMTreeOutline.js:
(WI.DOMTreeOutline):
(WI.DOMTreeOutline.prototype.update):

* UserInterface/Views/DataGrid.js:
(WI.DataGrid.prototype.removeChildrenRecursive): Deleted.

* UserInterface/Views/DataGridNode.js:
(WI.DataGridNode.prototype.removeChildren):
(WI.DataGridNode.prototype.removeChildrenRecursive): Deleted.

* UserInterface/Views/ErrorObjectView.css:
(.error-object:not(.expanded) .content):
(.error-object .content):
(.error-object:not(.expanded) .tree-outline): Deleted.
(.error-object .tree-outline): Deleted.

* UserInterface/Views/ErrorObjectView.js:
(WI.ErrorObjectView):
(WI.ErrorObjectView.prototype.get treeOutline): Deleted.
Use a simple container since TreeOutline features aren't used,
and remove unused property `treeOutline`.

* UserInterface/Views/RecordingTraceDetailsSidebarPanel.js:
(WI.RecordingTraceDetailsSidebarPanel):

* UserInterface/Views/TreeElement.js:
(WI.TreeElement.prototype.removeChildren):
(WI.TreeElement.prototype.removeChildrenRecursive): Deleted.

* UserInterface/Views/TreeOutline.js:
(WI.TreeOutline):
(WI.TreeOutline.prototype.removeChildrenRecursive): Deleted.
(WI.TreeOutline.prototype.reattachIfIndexChanged): Deleted.
Removed `element` parameter now that the only use case has been removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238626 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/CanvasDetailsSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js
Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js
Source/WebInspectorUI/UserInterface/Views/DataGrid.js
Source/WebInspectorUI/UserInterface/Views/DataGridNode.js
Source/WebInspectorUI/UserInterface/Views/ErrorObjectView.css
Source/WebInspectorUI/UserInterface/Views/ErrorObjectView.js
Source/WebInspectorUI/UserInterface/Views/RecordingTraceDetailsSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/TreeElement.js
Source/WebInspectorUI/UserInterface/Views/TreeOutline.js

index f6eed99..e3a0f01 100644 (file)
@@ -1,3 +1,53 @@
+2018-11-28  Matt Baker  <mattbaker@apple.com>
+
+        Web Inspector: Remove unused DataGrid and TreeOutline code
+        https://bugs.webkit.org/show_bug.cgi?id=191622
+        <rdar://problem/46052014>
+
+        Reviewed by Devin Rousso.
+
+        * UserInterface/Views/CanvasDetailsSidebarPanel.js:
+        (WI.CanvasDetailsSidebarPanel.prototype.initialLayout):
+
+        * UserInterface/Views/DOMTreeElement.js:
+        (WI.DOMTreeElement.prototype.insertChildElement):
+
+        * UserInterface/Views/DOMTreeOutline.js:
+        (WI.DOMTreeOutline):
+        (WI.DOMTreeOutline.prototype.update):
+
+        * UserInterface/Views/DataGrid.js:
+        (WI.DataGrid.prototype.removeChildrenRecursive): Deleted.
+
+        * UserInterface/Views/DataGridNode.js:
+        (WI.DataGridNode.prototype.removeChildren):
+        (WI.DataGridNode.prototype.removeChildrenRecursive): Deleted.
+
+        * UserInterface/Views/ErrorObjectView.css:
+        (.error-object:not(.expanded) .content):
+        (.error-object .content):
+        (.error-object:not(.expanded) .tree-outline): Deleted.
+        (.error-object .tree-outline): Deleted.
+
+        * UserInterface/Views/ErrorObjectView.js:
+        (WI.ErrorObjectView):
+        (WI.ErrorObjectView.prototype.get treeOutline): Deleted.
+        Use a simple container since TreeOutline features aren't used,
+        and remove unused property `treeOutline`.
+
+        * UserInterface/Views/RecordingTraceDetailsSidebarPanel.js:
+        (WI.RecordingTraceDetailsSidebarPanel):
+
+        * UserInterface/Views/TreeElement.js:
+        (WI.TreeElement.prototype.removeChildren):
+        (WI.TreeElement.prototype.removeChildrenRecursive): Deleted.
+
+        * UserInterface/Views/TreeOutline.js:
+        (WI.TreeOutline):
+        (WI.TreeOutline.prototype.removeChildrenRecursive): Deleted.
+        (WI.TreeOutline.prototype.reattachIfIndexChanged): Deleted.
+        Removed `element` parameter now that the only use case has been removed.
+
 2018-11-27  Matt Baker  <mattbaker@apple.com>
 
         Web Inspector: Elements tab should allow selecting/deleting multiple DOM nodes
index 80db9ac..d1988ff 100644 (file)
@@ -136,7 +136,7 @@ WI.CanvasDetailsSidebarPanel = class CanvasDetailsSidebarPanel extends WI.Detail
         this._sections.push(this._cssCanvasSection);
 
         const selectable = false;
-        let backtraceTreeOutline = new WI.TreeOutline(null, selectable);
+        let backtraceTreeOutline = new WI.TreeOutline(selectable);
         backtraceTreeOutline.disclosureButtons = false;
         this._backtraceTreeController = new WI.CallFrameTreeController(backtraceTreeOutline);
 
index edab8a7..7c43b34 100644 (file)
@@ -423,7 +423,7 @@ WI.DOMTreeElement = class DOMTreeElement extends WI.TreeElement
     insertChildElement(child, index, closingTag)
     {
         var newElement = new WI.DOMTreeElement(child, closingTag);
-        newElement.selectable = this.treeOutline._selectEnabled;
+        newElement.selectable = this.treeOutline.selectable;
         this.insertChild(newElement, index);
         return newElement;
     }
index 541e2f9..756d108 100644 (file)
@@ -30,9 +30,9 @@
 
 WI.DOMTreeOutline = class DOMTreeOutline extends WI.TreeOutline
 {
-    constructor(omitRootDOMNode, selectEnabled, excludeRevealElementContextMenu)
+    constructor(omitRootDOMNode, selectable, excludeRevealElementContextMenu)
     {
-        super();
+        super(selectable);
 
         this.element.addEventListener("mousedown", this._onmousedown.bind(this), false);
         this.element.addEventListener("mousemove", this._onmousemove.bind(this), false);
@@ -46,7 +46,6 @@ WI.DOMTreeOutline = class DOMTreeOutline extends WI.TreeOutline
         this.element.classList.add("dom", WI.SyntaxHighlightedStyleClassName);
 
         this._includeRootDOMNode = !omitRootDOMNode;
-        this._selectEnabled = selectEnabled;
         this._excludeRevealElementContextMenu = excludeRevealElementContextMenu;
         this._rootDOMNode = null;
         this._selectedDOMNode = null;
@@ -165,14 +164,14 @@ WI.DOMTreeOutline = class DOMTreeOutline extends WI.TreeOutline
         var treeElement;
         if (this._includeRootDOMNode) {
             treeElement = new WI.DOMTreeElement(this.rootDOMNode);
-            treeElement.selectable = this._selectEnabled;
+            treeElement.selectable = this.selectable;
             this.appendChild(treeElement);
         } else {
             // FIXME: this could use findTreeElement to reuse a tree element if it already exists
             var node = this.rootDOMNode.firstChild;
             while (node) {
                 treeElement = new WI.DOMTreeElement(node);
-                treeElement.selectable = this._selectEnabled;
+                treeElement.selectable = this.selectable;
                 this.appendChild(treeElement);
                 node = node.nextSibling;
 
index 9fa1545..9e56b04 100644 (file)
@@ -1239,32 +1239,6 @@ WI.DataGrid = class DataGrid extends WI.View
         this.hasChildren = false;
     }
 
-    removeChildrenRecursive()
-    {
-        var childrenToRemove = this.children;
-
-        var child = this.children[0];
-        while (child) {
-            if (child.children.length)
-                childrenToRemove = childrenToRemove.concat(child.children);
-            child = child.traverseNextNode(false, this, true);
-        }
-
-        for (var i = 0; i < childrenToRemove.length; ++i) {
-            child = childrenToRemove[i];
-            child.deselect();
-            child._detach();
-
-            child.children = [];
-            child.dataGrid = null;
-            child.parent = null;
-            child.nextSibling = null;
-            child.previousSibling = null;
-        }
-
-        this.children = [];
-    }
-
     findNode(comparator, skipHidden, stayWithin, dontPopulate)
     {
         console.assert(typeof comparator === "function");
index 43c8b33..e99eed3 100644 (file)
@@ -409,7 +409,6 @@ WI.DataGridNode = class DataGridNode extends WI.Object
     insertChild() { return WI.DataGrid.prototype.insertChild.apply(this, arguments); }
     removeChild() { return WI.DataGrid.prototype.removeChild.apply(this, arguments); }
     removeChildren() { return WI.DataGrid.prototype.removeChildren.apply(this, arguments); }
-    removeChildrenRecursive() { return WI.DataGrid.prototype.removeChildrenRecursive.apply(this, arguments); }
 
     _recalculateSiblings(myIndex)
     {
index 991595d..bec920f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
     display: none;
 }
 
-.error-object:not(.expanded) .tree-outline {
+.error-object:not(.expanded) .content {
     display: none;
 }
 
-.error-object .tree-outline {
+.error-object .content {
     padding-left: 16px
 }
index 0aca1f4..acdb032 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015, 2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -43,7 +43,7 @@ WI.ErrorObjectView = class ErrorObjectView extends WI.Object
         previewElement.addEventListener("click", this._handlePreviewOrTitleElementClick.bind(this));
 
         this._outlineElement = this._element.appendChild(document.createElement("div"));
-        this._outline = new WI.TreeOutline(this._outlineElement);
+        this._outlineElement.className = "content";
     }
 
     // Static
@@ -80,11 +80,6 @@ WI.ErrorObjectView = class ErrorObjectView extends WI.Object
         return this._element;
     }
 
-    get treeOutline()
-    {
-        return this._outline;
-    }
-
     get expanded()
     {
         return this._expanded;
index 8ccf827..a38cd83 100644 (file)
@@ -30,7 +30,7 @@ WI.RecordingTraceDetailsSidebarPanel = class RecordingTraceDetailsSidebarPanel e
         super("recording-trace", WI.UIString("Trace"));
 
         const selectable = false;
-        this._backtraceTreeOutline = new WI.TreeOutline(null, selectable);
+        this._backtraceTreeOutline = new WI.TreeOutline(selectable);
         this._backtraceTreeOutline.disclosureButtons = false;
         this._backtraceTreeController = new WI.CallFrameTreeController(this._backtraceTreeOutline);
 
index 4e4c744..545fc71 100644 (file)
@@ -62,7 +62,6 @@ WI.TreeElement = class TreeElement extends WI.Object
     removeChild() { return WI.TreeOutline.prototype.removeChild.apply(this, arguments); }
     removeChildAtIndex() { return WI.TreeOutline.prototype.removeChildAtIndex.apply(this, arguments); }
     removeChildren() { return WI.TreeOutline.prototype.removeChildren.apply(this, arguments); }
-    removeChildrenRecursive() { return WI.TreeOutline.prototype.removeChildrenRecursive.apply(this, arguments); }
     selfOrDescendant() { return WI.TreeOutline.prototype.selfOrDescendant.apply(this, arguments); }
 
     get arrowToggleWidth()
index 5e1b990..4bd90df 100644 (file)
 
 WI.TreeOutline = class TreeOutline extends WI.Object
 {
-    constructor(element, selectable = true)
+    constructor(selectable = true)
     {
         super();
 
-        this.element = element || document.createElement("ol");
+        this.element = document.createElement("ol");
         this.element.classList.add(WI.TreeOutline.ElementStyleClassName);
         this.element.addEventListener("contextmenu", this._handleContextmenu.bind(this));
 
@@ -391,54 +391,6 @@ WI.TreeOutline = class TreeOutline extends WI.Object
         this.children = [];
     }
 
-    removeChildrenRecursive(suppressOnDeselect)
-    {
-        let childrenToRemove = this.children;
-        let child = this.children[0];
-        while (child) {
-            if (child.children.length)
-                childrenToRemove = childrenToRemove.concat(child.children);
-            child = child.traverseNextTreeElement(false, this, true);
-        }
-
-        for (let child of childrenToRemove) {
-            child.deselect(suppressOnDeselect);
-
-            let treeOutline = child.treeOutline;
-            if (treeOutline)
-                treeOutline._forgetTreeElement(child);
-
-            child._detach();
-            child.children = [];
-            child.treeOutline = null;
-            child.parent = null;
-            child.nextSibling = null;
-            child.previousSibling = null;
-
-            if (treeOutline)
-                treeOutline.dispatchEventToListeners(WI.TreeOutline.Event.ElementRemoved, {element: child});
-        }
-
-        this.children = [];
-    }
-
-    reattachIfIndexChanged(treeElement, insertionIndex)
-    {
-        if (this.children[insertionIndex] === treeElement)
-            return;
-
-        let wasSelected = treeElement.selected;
-
-        console.assert(!treeElement.parent || treeElement.parent === this);
-        if (treeElement.parent === this)
-            this.removeChild(treeElement);
-
-        this.insertChild(treeElement, insertionIndex);
-
-        if (wasSelected)
-            treeElement.select();
-    }
-
     _rememberTreeElement(element)
     {
         this._treeElementIndexCache.clear();