Title: [161677] trunk/Source/WebInspectorUI
Revision
161677
Author
[email protected]
Date
2014-01-10 14:13:07 -0800 (Fri, 10 Jan 2014)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (161676 => 161677)


--- trunk/Source/WebInspectorUI/ChangeLog	2014-01-10 22:11:53 UTC (rev 161676)
+++ trunk/Source/WebInspectorUI/ChangeLog	2014-01-10 22:13:07 UTC (rev 161677)
@@ -1,5 +1,21 @@
 2014-01-10  Timothy Hatcher  <[email protected]>
 
+        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.
+
+2014-01-10  Timothy Hatcher  <[email protected]>
+
         Fix an exception in WebInspector.Color.
 
         https://bugs.webkit.org/show_bug.cgi?id=126765

Modified: trunk/Source/WebInspectorUI/UserInterface/TreeOutline.js (161676 => 161677)


--- trunk/Source/WebInspectorUI/UserInterface/TreeOutline.js	2014-01-10 22:11:53 UTC (rev 161676)
+++ trunk/Source/WebInspectorUI/UserInterface/TreeOutline.js	2014-01-10 22:13:07 UTC (rev 161677)
@@ -91,16 +91,9 @@
     if (child.hasChildren && child.treeOutline._treeElementsExpandedState[child.identifier] !== undefined)
         child.expanded = child.treeOutline._treeElementsExpandedState[child.identifier];
 
-    if (!this._childrenListNode) {
-        this._childrenListNode = this.treeOutline._childrenListNode.ownerDocument.createElement("ol");
-        this._childrenListNode.parentTreeElement = this;
-        this._childrenListNode.classList.add("children");
-        if (this.hidden)
-            this._childrenListNode.classList.add("hidden");
-    }
+    if (this._childrenListNode)
+        child._attach();
 
-    child._attach();
-
     if (this.treeOutline.onadd)
         this.treeOutline.onadd(child);
 
@@ -147,16 +140,9 @@
     if (child.hasChildren && child.treeOutline._treeElementsExpandedState[child.identifier] !== undefined)
         child.expanded = child.treeOutline._treeElementsExpandedState[child.identifier];
 
-    if (!this._childrenListNode) {
-        this._childrenListNode = this.treeOutline._childrenListNode.ownerDocument.createElement("ol");
-        this._childrenListNode.parentTreeElement = this;
-        this._childrenListNode.classList.add("children");
-        if (this.hidden)
-            this._childrenListNode.classList.add("hidden");
-    }
+    if (this._childrenListNode)
+        child._attach();
 
-    child._attach();
-
     if (this.treeOutline.onadd)
         this.treeOutline.onadd(child);
 
@@ -293,7 +279,7 @@
     if (!representedObject)
         return null;
 
-    if ("__treeElementIdentifier" in representedObject) {
+    if (representedObject.__treeElementIdentifier) {
         // If this representedObject has a tree element identifier, and it is a known TreeElement
         // in our tree we can just return that tree element.
         var elements = this._knownTreeElements[representedObject.__treeElementIdentifier];
@@ -321,7 +307,7 @@
     var found = false;
     for (var i = 0; i < this.children.length; ++i) {
         item = this.children[i];
-        if (item.representedObject === representedObject || isAncestor(item.representedObject, representedObject)) {
+        if (item.representedObject === representedObject || (isAncestor && isAncestor(item.representedObject, representedObject))) {
             found = true;
             break;
         }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to