Web Inspector: Add refresh button to FileSystemView status bar
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Jul 2012 13:10:11 +0000 (13:10 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Jul 2012 13:10:11 +0000 (13:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90244

Patch by Taiju Tsuiki <tzik@chromium.org> on 2012-07-02
Reviewed by Vsevolod Vlasov.

Source/WebCore:

* inspector/front-end/FileSystemView.js:
(WebInspector.FileSystemView):
(WebInspector.FileSystemView.prototype.get statusBarItems):
(WebInspector.FileSystemView.prototype.showView):
(WebInspector.FileSystemView.prototype._refresh):
(WebInspector.FileSystemView.EntryTreeElement.prototype._directoryContentReceived):

LayoutTests:

* http/tests/inspector/filesystem/directory-tree.html:

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

LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/filesystem/directory-tree.html
Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/FileSystemView.js

index 5e8ab9e..c5c73a8 100644 (file)
@@ -1,3 +1,12 @@
+2012-07-02  Taiju Tsuiki  <tzik@chromium.org>
+
+        Web Inspector: Add refresh button to FileSystemView status bar
+        https://bugs.webkit.org/show_bug.cgi?id=90244
+
+        Reviewed by Vsevolod Vlasov.
+
+        * http/tests/inspector/filesystem/directory-tree.html:
+
 2012-07-02  Zan Dobersek  <zandobersek@gmail.com>
 
         Unreviewed GTK gardening, removing GTK-specific baseline that's
index 1018ef3..ffe1d70 100644 (file)
@@ -52,7 +52,7 @@ function test()
 
             fileSystemItem.select();
             fileSystemView = fileSystemItem._fileSystemView;
-            directoryTree = fileSystemView.directoryTree;
+            directoryTree = fileSystemView._directoryTree;
 
             InspectorTest.callOnRequestCompleted(testStep.shift());
         },
index 7948f8f..5232c11 100644 (file)
@@ -1,3 +1,17 @@
+2012-07-02  Taiju Tsuiki  <tzik@chromium.org>
+
+        Web Inspector: Add refresh button to FileSystemView status bar
+        https://bugs.webkit.org/show_bug.cgi?id=90244
+
+        Reviewed by Vsevolod Vlasov.
+
+        * inspector/front-end/FileSystemView.js:
+        (WebInspector.FileSystemView):
+        (WebInspector.FileSystemView.prototype.get statusBarItems):
+        (WebInspector.FileSystemView.prototype.showView):
+        (WebInspector.FileSystemView.prototype._refresh):
+        (WebInspector.FileSystemView.EntryTreeElement.prototype._directoryContentReceived):
+
 2012-06-22  Vsevolod Vlasov  <vsevik@chromium.org>
 
         Web Inspector: Implement snippets evaluation.
index bd3b37a..09008be 100644 (file)
@@ -40,18 +40,27 @@ WebInspector.FileSystemView = function(fileSystem)
     this.element.addStyleClass("storage-view");
 
     var directoryTreeElement = this.element.createChild("ol", "filesystem-directory-tree");
-    this.directoryTree = new TreeOutline(directoryTreeElement);
+    this._directoryTree = new TreeOutline(directoryTreeElement);
     this.sidebarElement.appendChild(directoryTreeElement);
     this.sidebarElement.addStyleClass("outline-disclosure");
     this.sidebarElement.addStyleClass("sidebar");
 
     var rootItem = new WebInspector.FileSystemView.EntryTreeElement(this, fileSystem.root);
     rootItem.expanded = true;
-    this.directoryTree.appendChild(rootItem);
+    this._directoryTree.appendChild(rootItem);
     this._visibleView = null;
+
+    this._refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
+    this._refreshButton.visible = true;
+    this._refreshButton.addEventListener("click", this._refresh, this);
 }
 
 WebInspector.FileSystemView.prototype = {
+    get statusBarItems()
+    {
+        return [this._refreshButton.element];
+    },
+
     /**
      * @param {WebInspector.View} view
      */
@@ -63,6 +72,11 @@ WebInspector.FileSystemView.prototype = {
             this._visibleView.detach();
         this._visibleView = view;
         view.show(this.mainElement);
+    },
+
+    _refresh: function()
+    {
+        this._directoryTree.children[0].refresh();
     }
 }
 
@@ -138,8 +152,8 @@ WebInspector.FileSystemView.EntryTreeElement.prototype = {
             var order = newEntry.name.localeCompare(oldChild._entry.name);
 
             if (order === 0) {
-                if (oldChild._entry.isDirectory && oldChild.expanded)
-                    oldChild.refresh();
+                if (oldChild._entry.isDirectory)
+                    oldChild.shouldRefreshChildren = true;
                 ++newEntryIndex;
                 ++oldChildIndex;
                 ++currentTreeItem;