Fixes a bug where excluding nodes from the profile could
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 May 2008 17:41:40 +0000 (17:41 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 May 2008 17:41:40 +0000 (17:41 +0000)
show an empty parent node.

<rdar://problem/5959573> Excluding nodes from the profile could show
an empty parent node

Reviewed by Kevin McCullough.

* page/inspector/ProfileView.js: Only say we have children if
all of our children nodes are visible.

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

WebCore/ChangeLog
WebCore/page/inspector/ProfileView.js

index b8f7983..b19e22a 100644 (file)
@@ -1,3 +1,16 @@
+2008-05-23  Timothy Hatcher  <timothy@apple.com>
+
+        Fixes a bug where excluding nodes from the profile could
+        show an empty parent node.
+
+        <rdar://problem/5959573> Excluding nodes from the profile could show
+        an empty parent node
+
+        Reviewed by Kevin McCullough.
+
+        * page/inspector/ProfileView.js: Only say we have children if
+        all of our children nodes are visible.
+
 2008-05-23  Anders Carlsson  <andersca@apple.com>
 
         Reviewed by Adam.
index 2296441..8152ec9 100644 (file)
@@ -114,6 +114,7 @@ WebInspector.ProfileView.prototype = {
             return;
         this.resetButton.removeStyleClass("hidden");
         this.profile.exclude(this.dataGrid.selectedNode.profileNode);
+        this.dataGrid.selectedNode.deselect();
         this.refresh();
     },
 
@@ -195,7 +196,18 @@ WebInspector.ProfileDataGridNode = function(profileView, profileNode)
     this.profileNode = profileNode;
     profileNode._dataGridNode = this;
 
-    var hasChildren = (profileNode.children.length ? true : false);
+    // Find the first child that is visible. Since we don't want to claim
+    // we have children if all the children are invisible.
+    var hasChildren = false;
+    var children = this.profileNode.children;
+    var childrenLength = children.length;
+    for (var i = 0; i < childrenLength; ++i) {
+        if (children[i].visible) {
+            hasChildren = true;
+            break;
+        }
+    }
+
     WebInspector.DataGridNode.call(this, null, hasChildren);
 
     this.addEventListener("populate", this._populate, this);