Title: [180319] trunk/Source/WebInspectorUI
Revision
180319
Author
jonowe...@apple.com
Date
2015-02-18 15:55:25 -0800 (Wed, 18 Feb 2015)

Log Message

Web Inspector: Inspecting a page where resources are in folders forces folder organization on every subsequent page
https://bugs.webkit.org/show_bug.cgi?id=141397

Reviewed by Timothy Hatcher.

When removeChildren is called on an instance of a FolderizedTreeElement, the element's _groupedIntoFolders flag
will now be set to false. This will prevent unnecessary folderization upon a frame navigation. Also during an
onpopulate event, addChildForRepresentedObject is called repeatedly and much of the work done during each call
was unnecessary. That work has now been partially removed and partially relocated to a function that is only
called at the beginning of an onpopulate event.

* UserInterface/Views/FolderizedTreeElement.js:
(WebInspector.FolderizedTreeElement.prototype.set removeChildren): Set _groupedIntoFolders to false.
(WebInspector.FolderizedTreeElement.prototype.addChildForRepresentedObject): Remove unnecessary treeOutline
emptiness check, and move _shouldGroupIntoFolders() check to new function prepareToPopulate().
(WebInspector.FolderizedTreeElement.prototype.prepareToPopulate): Create.
(WebInspector.FolderizedTreeElement.prototype._populateFromNewChildQueue): Call prepareToPopulate().

* UserInterface/Views/FrameTreeElement.js:
(WebInspector.FrameTreeElement.prototype.onpopulate): Call prepareToPopulate().

* UserInterface/Views/GeneralTreeElement.js: Drive-by inheritance style fix.
* UserInterface/Views/ResourceTreeElement.js: Drive-by inheritance style fix.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (180318 => 180319)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-02-18 23:54:19 UTC (rev 180318)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-02-18 23:55:25 UTC (rev 180319)
@@ -1,3 +1,29 @@
+2015-02-18  Jono Wells  <jonowe...@apple.com>
+
+        Web Inspector: Inspecting a page where resources are in folders forces folder organization on every subsequent page
+        https://bugs.webkit.org/show_bug.cgi?id=141397
+
+        Reviewed by Timothy Hatcher.
+
+        When removeChildren is called on an instance of a FolderizedTreeElement, the element's _groupedIntoFolders flag
+        will now be set to false. This will prevent unnecessary folderization upon a frame navigation. Also during an
+        onpopulate event, addChildForRepresentedObject is called repeatedly and much of the work done during each call
+        was unnecessary. That work has now been partially removed and partially relocated to a function that is only
+        called at the beginning of an onpopulate event.
+
+        * UserInterface/Views/FolderizedTreeElement.js:
+        (WebInspector.FolderizedTreeElement.prototype.set removeChildren): Set _groupedIntoFolders to false.
+        (WebInspector.FolderizedTreeElement.prototype.addChildForRepresentedObject): Remove unnecessary treeOutline
+        emptiness check, and move _shouldGroupIntoFolders() check to new function prepareToPopulate().
+        (WebInspector.FolderizedTreeElement.prototype.prepareToPopulate): Create.
+        (WebInspector.FolderizedTreeElement.prototype._populateFromNewChildQueue): Call prepareToPopulate().
+
+        * UserInterface/Views/FrameTreeElement.js:
+        (WebInspector.FrameTreeElement.prototype.onpopulate): Call prepareToPopulate().
+
+        * UserInterface/Views/GeneralTreeElement.js: Drive-by inheritance style fix.
+        * UserInterface/Views/ResourceTreeElement.js: Drive-by inheritance style fix.
+
 2015-02-16  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: ES6: Improved Console Support for Promise Objects

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/FolderizedTreeElement.js (180318 => 180319)


--- trunk/Source/WebInspectorUI/UserInterface/Views/FolderizedTreeElement.js	2015-02-18 23:54:19 UTC (rev 180318)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/FolderizedTreeElement.js	2015-02-18 23:55:25 UTC (rev 180319)
@@ -88,6 +88,8 @@
             folder.removeChildren();
 
         this._folderTypeMap.clear();
+
+        this._groupedIntoFolders = false;
     },
 
     // Protected
@@ -101,21 +103,6 @@
             return;
         }
 
-        this.updateParentStatus();
-
-        if (!this.treeOutline) {
-            // Just mark as needing to update to avoid doing work that might not be needed.
-            this.shouldRefreshChildren = true;
-            return;
-        }
-
-        if (!this._groupedIntoFolders && this._shouldGroupIntoFolders()) {
-            // Mark as needing a refresh to rebuild the tree into folders.
-            this._groupedIntoFolders = true;
-            this.shouldRefreshChildren = true;
-            return;
-        }
-
         var childTreeElement = this.treeOutline.getCachedTreeElement(representedObject);
         if (!childTreeElement)
             childTreeElement = new settings.treeElementConstructor(representedObject);
@@ -172,6 +159,12 @@
             this.removeChildren();
     },
 
+    prepareToPopulate: function()
+    {
+        if (!this._groupedIntoFolders && this._shouldGroupIntoFolders())
+            this._groupedIntoFolders = true;
+    },
+
     // Private
 
     _clearNewChildQueue: function()
@@ -191,6 +184,8 @@
             return;
         }
 
+        this.prepareToPopulate();
+
         for (var i = 0; i < this._newChildQueue.length; ++i)
             this.addChildForRepresentedObject(this._newChildQueue[i]);
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js (180318 => 180319)


--- trunk/Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js	2015-02-18 23:54:19 UTC (rev 180318)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js	2015-02-18 23:55:25 UTC (rev 180319)
@@ -229,10 +229,11 @@
     {
         if (this.children.length && !this.shouldRefreshChildren)
             return;
-
         this.shouldRefreshChildren = false;
 
         this.removeChildren();
+        this.updateParentStatus();
+        this.prepareToPopulate();
 
         for (var i = 0; i < this._frame.childFrames.length; ++i)
             this.addChildForRepresentedObject(this._frame.childFrames[i]);
@@ -250,6 +251,7 @@
         var flowMap = this._frame.domTree.flowMap;
         for (var flowKey in flowMap)
             this.addChildForRepresentedObject(flowMap[flowKey]);
+
     },
 
     onexpand: function()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js (180318 => 180319)


--- trunk/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js	2015-02-18 23:54:19 UTC (rev 180318)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js	2015-02-18 23:55:25 UTC (rev 180319)
@@ -52,6 +52,7 @@
 
 WebInspector.GeneralTreeElement.prototype = {
     constructor: WebInspector.GeneralTreeElement,
+    __proto__: TreeElement.prototype,
 
     // Public
 
@@ -394,5 +395,3 @@
             this._statusElement.textContent = this._status;
     }
 };
-
-WebInspector.GeneralTreeElement.prototype.__proto__ = TreeElement.prototype;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTreeElement.js (180318 => 180319)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTreeElement.js	2015-02-18 23:54:19 UTC (rev 180318)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTreeElement.js	2015-02-18 23:55:25 UTC (rev 180319)
@@ -76,6 +76,7 @@
 
 WebInspector.ResourceTreeElement.prototype = {
     constructor: WebInspector.ResourceTreeElement,
+    __proto__: WebInspector.SourceCodeTreeElement.prototype,
 
     // Public
 
@@ -194,5 +195,3 @@
         this.callFirstAncestorFunction("descendantResourceTreeElementTypeDidChange", [this, event.data.oldType]);
     }
 };
-
-WebInspector.ResourceTreeElement.prototype.__proto__ = WebInspector.SourceCodeTreeElement.prototype;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to