Title: [218983] trunk/Source/WebInspectorUI
Revision
218983
Author
[email protected]
Date
2017-06-29 19:16:05 -0700 (Thu, 29 Jun 2017)

Log Message

Web Inspector: Remove unnecessary hasChildren from TreeOutline
https://bugs.webkit.org/show_bug.cgi?id=173986

Reviewed by Joseph Pecoraro.

* UserInterface/Views/TreeOutline.js:
(WebInspector.TreeOutline):
(WebInspector.TreeOutline.prototype.appendChild):
(WebInspector.TreeOutline.prototype.insertChild):
(WebInspector.TreeOutline.prototype.removeChildAtIndex):
(WebInspector.TreeOutline.prototype.removeChild):
(WebInspector.TreeOutline.prototype.get selectedTreeElementIndex):

* UserInterface/Views/NavigationSidebarPanel.js:
(WebInspector.NavigationSidebarPanel.prototype._checkOutlinesForPendingViewStateCookie):
* UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js:
(WebInspector.VisualStyleCommaSeparatedKeywordEditor.prototype.get value):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (218982 => 218983)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-06-30 02:09:09 UTC (rev 218982)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-06-30 02:16:05 UTC (rev 218983)
@@ -1,5 +1,25 @@
 2017-06-29  Devin Rousso  <[email protected]>
 
+        Web Inspector: Remove unnecessary hasChildren from TreeOutline
+        https://bugs.webkit.org/show_bug.cgi?id=173986
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/TreeOutline.js:
+        (WebInspector.TreeOutline):
+        (WebInspector.TreeOutline.prototype.appendChild):
+        (WebInspector.TreeOutline.prototype.insertChild):
+        (WebInspector.TreeOutline.prototype.removeChildAtIndex):
+        (WebInspector.TreeOutline.prototype.removeChild):
+        (WebInspector.TreeOutline.prototype.get selectedTreeElementIndex):
+
+        * UserInterface/Views/NavigationSidebarPanel.js:
+        (WebInspector.NavigationSidebarPanel.prototype._checkOutlinesForPendingViewStateCookie):
+        * UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js:
+        (WebInspector.VisualStyleCommaSeparatedKeywordEditor.prototype.get value):
+
+2017-06-29  Devin Rousso  <[email protected]>
+
         Web Inspector: Cleanup unused/invalid parameters for SidebarPanels
         https://bugs.webkit.org/show_bug.cgi?id=173985
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js (218982 => 218983)


--- trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js	2017-06-30 02:09:09 UTC (rev 218982)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js	2017-06-30 02:16:05 UTC (rev 218983)
@@ -645,7 +645,7 @@
 
         var visibleTreeElements = [];
         this.contentTreeOutlines.forEach(function(outline) {
-            var currentTreeElement = outline.hasChildren ? outline.children[0] : null;
+            var currentTreeElement = outline.children.length ? outline.children[0] : null;
             while (currentTreeElement) {
                 visibleTreeElements.push(currentTreeElement);
                 currentTreeElement = currentTreeElement.traverseNextTreeElement(false, null, false);

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js (218982 => 218983)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js	2017-06-30 02:09:09 UTC (rev 218982)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js	2017-06-30 02:16:05 UTC (rev 218983)
@@ -44,7 +44,6 @@
         this._treeElementsExpandedState = [];
         this.allowsRepeatSelection = false;
         this.root = true;
-        this.hasChildren = false;
         this.expanded = true;
         this.selected = false;
         this.treeOutline = this;
@@ -156,7 +155,6 @@
         var isFirstChild = !this.children.length;
 
         this.children.push(child);
-        this.hasChildren = true;
         child.parent = this;
         child.treeOutline = this.treeOutline;
         child.treeOutline._rememberTreeElement(child);
@@ -206,7 +204,6 @@
         var isFirstChild = !this.children.length;
 
         this.children.splice(index, 0, child);
-        this.hasChildren = true;
         child.parent = this;
         child.treeOutline = this.treeOutline;
         child.treeOutline._rememberTreeElement(child);
@@ -267,6 +264,9 @@
         child.nextSibling = null;
         child.previousSibling = null;
 
+        if (!this.children.length && this._listItemNode)
+            this._listItemNode.classList.remove("parent");
+
         if (treeOutline)
             treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementRemoved, {element: child});
     }
@@ -283,12 +283,6 @@
             return;
 
         this.removeChildAtIndex(childIndex, suppressOnDeselect, suppressSelectSibling);
-
-        if (!this.children.length) {
-            if (this._listItemNode)
-                this._listItemNode.classList.remove("parent");
-            this.hasChildren = false;
-        }
     }
 
     removeChildren(suppressOnDeselect)
@@ -622,7 +616,7 @@
 
     get selectedTreeElementIndex()
     {
-        if (!this.hasChildren || !this.selectedTreeElement)
+        if (!this.children.length || !this.selectedTreeElement)
             return;
 
         for (var i = 0; i < this.children.length; ++i) {

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js (218982 => 218983)


--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js	2017-06-30 02:09:09 UTC (rev 218982)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js	2017-06-30 02:16:05 UTC (rev 218983)
@@ -68,7 +68,7 @@
 
     get value()
     {
-        if (!this._commaSeparatedKeywords.hasChildren)
+        if (!this._commaSeparatedKeywords.children.length)
             return "";
 
         let value = "";
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to