Makes setting shouldRefreshChildren on a TreeElement perform the refresh
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Apr 2008 20:29:47 +0000 (20:29 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Apr 2008 20:29:47 +0000 (20:29 +0000)
immediately if the element is already expanded.

Reviewed by Adam Roben.

* page/inspector/treeoutline.js:
(TreeElement.prototype.get shouldRefreshChildren): Return this._shouldRefreshChildren.
(TreeElement.prototype.set shouldRefreshChildren): If changing to true, and
already expanded,
call expand again to trigger the refresh. Sets this._shouldRefreshChildren.
(TreeElement.prototype._attach): Check for this._shouldRefreshChildren.
(TreeElement.prototype.expand): Ditto.

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

WebCore/ChangeLog
WebCore/page/inspector/treeoutline.js

index 2adccbe..9a2d457 100644 (file)
@@ -1,3 +1,18 @@
+2008-04-04  Timothy Hatcher  <timothy@apple.com>
+
+        Makes setting shouldRefreshChildren on a TreeElement perform the refresh
+        immediately if the element is already expanded.
+
+        Reviewed by Adam Roben.
+
+        * page/inspector/treeoutline.js:
+        (TreeElement.prototype.get shouldRefreshChildren): Return this._shouldRefreshChildren.
+        (TreeElement.prototype.set shouldRefreshChildren): If changing to true, and
+        already expanded,
+        call expand again to trigger the refresh. Sets this._shouldRefreshChildren.
+        (TreeElement.prototype._attach): Check for this._shouldRefreshChildren.
+        (TreeElement.prototype.expand): Ditto.
+
 2008-04-04  Jon Honeycutt  <jhoneycutt@apple.com>
 
         Reviewed by Beth.
 2008-04-04  Jon Honeycutt  <jhoneycutt@apple.com>
 
         Reviewed by Beth.
index 44dc4d3..1248055 100644 (file)
@@ -460,6 +460,16 @@ TreeElement.prototype = {
             if (this._childrenListNode)
                 this._childrenListNode.removeStyleClass("hidden");
         }
             if (this._childrenListNode)
                 this._childrenListNode.removeStyleClass("hidden");
         }
+    },
+
+    get shouldRefreshChildren() {
+        return this._shouldRefreshChildren;
+    },
+
+    set shouldRefreshChildren(x) {
+        this._shouldRefreshChildren = x;
+        if (x && this.expanded)
+            this.expand();
     }
 }
 
     }
 }
 
@@ -471,7 +481,7 @@ TreeElement.prototype.removeChildrenRecursive = TreeOutline._removeChildrenRecur
 
 TreeElement.prototype._attach = function()
 {
 
 TreeElement.prototype._attach = function()
 {
-    if (!this._listItemNode || this.parent.refreshChildren) {
+    if (!this._listItemNode || this.parent._shouldRefreshChildren) {
         if (this._listItemNode && this._listItemNode.parentNode)
             this._listItemNode.parentNode.removeChild(this._listItemNode);
 
         if (this._listItemNode && this._listItemNode.parentNode)
             this._listItemNode.parentNode.removeChild(this._listItemNode);
 
@@ -587,10 +597,10 @@ TreeElement.prototype.collapseRecursively = function()
 
 TreeElement.prototype.expand = function()
 {
 
 TreeElement.prototype.expand = function()
 {
-    if (!this.hasChildren || (this.expanded && !this.refreshChildren && this._childrenListNode))
+    if (!this.hasChildren || (this.expanded && !this._shouldRefreshChildren && this._childrenListNode))
         return;
 
         return;
 
-    if (!this._childrenListNode || this.refreshChildren) {
+    if (!this._childrenListNode || this._shouldRefreshChildren) {
         if (this._childrenListNode && this._childrenListNode.parentNode)
             this._childrenListNode.parentNode.removeChild(this._childrenListNode);
 
         if (this._childrenListNode && this._childrenListNode.parentNode)
             this._childrenListNode.parentNode.removeChild(this._childrenListNode);
 
@@ -607,7 +617,7 @@ TreeElement.prototype.expand = function()
         for (var i = 0; i < this.children.length; ++i)
             this.children[i]._attach();
 
         for (var i = 0; i < this.children.length; ++i)
             this.children[i]._attach();
 
-        delete this.refreshChildren;
+        delete this._shouldRefreshChildren;
     }
 
     if (this._listItemNode) {
     }
 
     if (this._listItemNode) {