Changeset 218983 in webkit


Ignore:
Timestamp:
Jun 29, 2017 7:16:05 PM (7 years ago)
Author:
Devin Rousso
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):

Location:
trunk/Source/WebInspectorUI
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r218975 r218983  
     12017-06-29  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Remove unnecessary hasChildren from TreeOutline
     4        https://bugs.webkit.org/show_bug.cgi?id=173986
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        * UserInterface/Views/TreeOutline.js:
     9        (WebInspector.TreeOutline):
     10        (WebInspector.TreeOutline.prototype.appendChild):
     11        (WebInspector.TreeOutline.prototype.insertChild):
     12        (WebInspector.TreeOutline.prototype.removeChildAtIndex):
     13        (WebInspector.TreeOutline.prototype.removeChild):
     14        (WebInspector.TreeOutline.prototype.get selectedTreeElementIndex):
     15
     16        * UserInterface/Views/NavigationSidebarPanel.js:
     17        (WebInspector.NavigationSidebarPanel.prototype._checkOutlinesForPendingViewStateCookie):
     18        * UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js:
     19        (WebInspector.VisualStyleCommaSeparatedKeywordEditor.prototype.get value):
     20
    1212017-06-29  Devin Rousso  <drousso@apple.com>
    222
  • trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js

    r218975 r218983  
    646646        var visibleTreeElements = [];
    647647        this.contentTreeOutlines.forEach(function(outline) {
    648             var currentTreeElement = outline.hasChildren ? outline.children[0] : null;
     648            var currentTreeElement = outline.children.length ? outline.children[0] : null;
    649649            while (currentTreeElement) {
    650650                visibleTreeElements.push(currentTreeElement);
  • trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js

    r217690 r218983  
    4545        this.allowsRepeatSelection = false;
    4646        this.root = true;
    47         this.hasChildren = false;
    4847        this.expanded = true;
    4948        this.selected = false;
     
    157156
    158157        this.children.push(child);
    159         this.hasChildren = true;
    160158        child.parent = this;
    161159        child.treeOutline = this.treeOutline;
     
    207205
    208206        this.children.splice(index, 0, child);
    209         this.hasChildren = true;
    210207        child.parent = this;
    211208        child.treeOutline = this.treeOutline;
     
    268265        child.previousSibling = null;
    269266
     267        if (!this.children.length && this._listItemNode)
     268            this._listItemNode.classList.remove("parent");
     269
    270270        if (treeOutline)
    271271            treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementRemoved, {element: child});
     
    284284
    285285        this.removeChildAtIndex(childIndex, suppressOnDeselect, suppressSelectSibling);
    286 
    287         if (!this.children.length) {
    288             if (this._listItemNode)
    289                 this._listItemNode.classList.remove("parent");
    290             this.hasChildren = false;
    291         }
    292286    }
    293287
     
    623617    get selectedTreeElementIndex()
    624618    {
    625         if (!this.hasChildren || !this.selectedTreeElement)
     619        if (!this.children.length || !this.selectedTreeElement)
    626620            return;
    627621
  • trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js

    r211462 r218983  
    6969    get value()
    7070    {
    71         if (!this._commaSeparatedKeywords.hasChildren)
     71        if (!this._commaSeparatedKeywords.children.length)
    7272            return "";
    7373
Note: See TracChangeset for help on using the changeset viewer.