Changeset 161677 in webkit


Ignore:
Timestamp:
Jan 10, 2014 2:13:07 PM (10 years ago)
Author:
timothy@apple.com
Message:

Clean up some areas of TreeOutline.

https://bugs.webkit.org/show_bug.cgi?id=123924

Reviewed by Joseph Pecoraro.

  • UserInterface/TreeOutline.js:

(TreeOutline.prototype.appendChild): Don't force create _childrenListNode, it will be created
when the tree element is expanded. Only attach if _childrenListNode already exists.
(TreeOutline.prototype.insertChild): Ditto.
(TreeOutline.prototype.getCachedTreeElement): Check the value of treeElementIdentifier
not just the existence of the property. It should never be null/undefined/0, but be safe.
(TreeOutline.prototype.findTreeElement): Null check isAncestor, it isn't required.

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r161674 r161677  
     12014-01-10  Timothy Hatcher  <timothy@apple.com>
     2
     3        Clean up some areas of TreeOutline.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=123924
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        * UserInterface/TreeOutline.js:
     10        (TreeOutline.prototype.appendChild): Don't force create _childrenListNode, it will be created
     11        when the tree element is expanded. Only attach if _childrenListNode already exists.
     12        (TreeOutline.prototype.insertChild): Ditto.
     13        (TreeOutline.prototype.getCachedTreeElement): Check the value of __treeElementIdentifier
     14        not just the existence of the property. It should never be null/undefined/0, but be safe.
     15        (TreeOutline.prototype.findTreeElement): Null check isAncestor, it isn't required.
     16
    1172014-01-10  Timothy Hatcher  <timothy@apple.com>
    218
  • trunk/Source/WebInspectorUI/UserInterface/TreeOutline.js

    r160025 r161677  
    9292        child.expanded = child.treeOutline._treeElementsExpandedState[child.identifier];
    9393
    94     if (!this._childrenListNode) {
    95         this._childrenListNode = this.treeOutline._childrenListNode.ownerDocument.createElement("ol");
    96         this._childrenListNode.parentTreeElement = this;
    97         this._childrenListNode.classList.add("children");
    98         if (this.hidden)
    99             this._childrenListNode.classList.add("hidden");
    100     }
    101 
    102     child._attach();
     94    if (this._childrenListNode)
     95        child._attach();
    10396
    10497    if (this.treeOutline.onadd)
     
    148141        child.expanded = child.treeOutline._treeElementsExpandedState[child.identifier];
    149142
    150     if (!this._childrenListNode) {
    151         this._childrenListNode = this.treeOutline._childrenListNode.ownerDocument.createElement("ol");
    152         this._childrenListNode.parentTreeElement = this;
    153         this._childrenListNode.classList.add("children");
    154         if (this.hidden)
    155             this._childrenListNode.classList.add("hidden");
    156     }
    157 
    158     child._attach();
     143    if (this._childrenListNode)
     144        child._attach();
    159145
    160146    if (this.treeOutline.onadd)
     
    294280        return null;
    295281
    296     if ("__treeElementIdentifier" in representedObject) {
     282    if (representedObject.__treeElementIdentifier) {
    297283        // If this representedObject has a tree element identifier, and it is a known TreeElement
    298284        // in our tree we can just return that tree element.
     
    322308    for (var i = 0; i < this.children.length; ++i) {
    323309        item = this.children[i];
    324         if (item.representedObject === representedObject || isAncestor(item.representedObject, representedObject)) {
     310        if (item.representedObject === representedObject || (isAncestor && isAncestor(item.representedObject, representedObject))) {
    325311            found = true;
    326312            break;
Note: See TracChangeset for help on using the changeset viewer.