Title: [159777] trunk/Source/WebInspectorUI
Revision
159777
Author
ach...@adobe.com
Date
2013-11-25 18:21:04 -0800 (Mon, 25 Nov 2013)

Log Message

Web Inspector: [CSS Regions] A page with many flows should collapse the resources tree
https://bugs.webkit.org/show_bug.cgi?id=122926

Reviewed by Timothy Hatcher.

Refactored the code in FrameTreeElement._shouldGroupIntoFolders to make it easy to track
more types of resources. Added the content flows as another type of resource that would trigger the
collapsing.

* UserInterface/DOMTreeManager.js:
(WebInspector.DOMTreeManager.prototype.namedFlowRemoved): Added code to remove the content nodes from
a flow that has been removed.
* UserInterface/FrameTreeElement.js:
(WebInspector.FrameTreeElement.prototype._shouldGroupIntoFolders.pushCategory):
(WebInspector.FrameTreeElement.prototype._shouldGroupIntoFolders.pushResourceType):
(WebInspector.FrameTreeElement.prototype._shouldGroupIntoFolders):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (159776 => 159777)


--- trunk/Source/WebInspectorUI/ChangeLog	2013-11-26 02:16:29 UTC (rev 159776)
+++ trunk/Source/WebInspectorUI/ChangeLog	2013-11-26 02:21:04 UTC (rev 159777)
@@ -1,3 +1,22 @@
+2013-11-25  Alexandru Chiculita  <ach...@adobe.com>
+
+        Web Inspector: [CSS Regions] A page with many flows should collapse the resources tree
+        https://bugs.webkit.org/show_bug.cgi?id=122926
+
+        Reviewed by Timothy Hatcher.
+
+        Refactored the code in FrameTreeElement._shouldGroupIntoFolders to make it easy to track
+        more types of resources. Added the content flows as another type of resource that would trigger the
+        collapsing.
+
+        * UserInterface/DOMTreeManager.js:
+        (WebInspector.DOMTreeManager.prototype.namedFlowRemoved): Added code to remove the content nodes from
+        a flow that has been removed.
+        * UserInterface/FrameTreeElement.js:
+        (WebInspector.FrameTreeElement.prototype._shouldGroupIntoFolders.pushCategory):
+        (WebInspector.FrameTreeElement.prototype._shouldGroupIntoFolders.pushResourceType):
+        (WebInspector.FrameTreeElement.prototype._shouldGroupIntoFolders):
+
 2013-11-25  Dan Bernstein  <m...@apple.com>
 
         Set the svn:ignore property on the Xcode project to ignore the workspace and user data.

Modified: trunk/Source/WebInspectorUI/UserInterface/DOMTreeManager.js (159776 => 159777)


--- trunk/Source/WebInspectorUI/UserInterface/DOMTreeManager.js	2013-11-26 02:16:29 UTC (rev 159776)
+++ trunk/Source/WebInspectorUI/UserInterface/DOMTreeManager.js	2013-11-26 02:21:04 UTC (rev 159777)
@@ -601,6 +601,11 @@
         var contentFlow = this._flows.get(flowKey);
         console.assert(contentFlow);
         this._flows.delete(flowKey);
+
+        // Remove any back links to this flow from the content nodes.
+        for (var contentNode of contentFlow.contentNodes)
+            this._contentNodesToFlowsMap.delete(contentNode.id);
+
         this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.ContentFlowWasRemoved, {flow: contentFlow});
     },
 

Modified: trunk/Source/WebInspectorUI/UserInterface/FrameTreeElement.js (159776 => 159777)


--- trunk/Source/WebInspectorUI/UserInterface/FrameTreeElement.js	2013-11-26 02:16:29 UTC (rev 159776)
+++ trunk/Source/WebInspectorUI/UserInterface/FrameTreeElement.js	2013-11-26 02:21:04 UTC (rev 159777)
@@ -433,7 +433,7 @@
             // When both components are not resources then just compare the titles.
             return a.mainTitle.localeCompare(b.mainTitle);
         }
-        
+
         // Non-resources should appear before the resources.
         // FIXME: There should be a better way to group the elements by their type.
         return aIsResource ? 1 : -1;
@@ -536,35 +536,28 @@
         var numberOfSmallCategories = 0;
         var numberOfMediumCategories = 0;
         var foundLargeCategory = false;
+        var frame = this._frame;
 
-        // FIXME: Use this._frame.domTree.flowsCount to count the number of flows in a frame.
-        // https://bugs.webkit.org/show_bug.cgi?id=122926
-
-        if (this._frame.childFrames.length >= WebInspector.FrameTreeElement.LargeChildCountThreshold)
-            foundLargeCategory = true;
-        else if (this._frame.childFrames.length >= WebInspector.FrameTreeElement.MediumChildCountThreshold)
-            ++numberOfMediumCategories;
-        else if (this._frame.childFrames.length)
-            ++numberOfSmallCategories;
-
-        // Iterate over all the available resource types. There are some other properties on
-        // WebInspector.Resource.Type that we need to skip, like private data and functions.
-        for (var type in WebInspector.Resource.Type) {
-            // Skip private data.
+        function pushResourceType(type) {
+            // There are some other properties on WebInspector.Resource.Type that we need to skip, like private data and functions
             if (type.charAt(0) === "_")
-                continue;
+                return false;
 
             // Only care about the values that are strings, not functions, etc.
             var typeValue = WebInspector.Resource.Type[type];
             if (typeof typeValue !== "string")
-                continue;
+                return false;
 
-            var resourceCount = this._frame.resourcesWithType(typeValue).length;
+            return pushCategory(frame.resourcesWithType(typeValue).length);
+        }
+
+        function pushCategory(resourceCount)
+        {
             if (!resourceCount)
-                continue;
+                return false;
 
             // If this type has any resources and there is a known large category, make folders.
-            if (resourceCount && foundLargeCategory)
+            if (foundLargeCategory)
                 return true;
 
             // If there are lots of this resource type, then count it as a large category.
@@ -574,24 +567,22 @@
                     return true;
 
                 foundLargeCategory = true;
-                continue;
+                return false;
             }
 
             // Check if this is a medium category.
             if (resourceCount >= WebInspector.FrameTreeElement.MediumChildCountThreshold) {
-                ++numberOfMediumCategories;
-
                 // If this is the medium category that puts us over the maximum allowed, make folders.
-                if (numberOfMediumCategories >= WebInspector.FrameTreeElement.NumberOfMediumCategoriesThreshold)
-                    return true;
-                continue;
+                return ++numberOfMediumCategories >= WebInspector.FrameTreeElement.NumberOfMediumCategoriesThreshold;
             }
 
             // This is a small category.
             ++numberOfSmallCategories;
+            return false;
         }
 
-        return false;
+        // Iterate over all the available resource types.
+        return pushCategory(frame.childFrames.length) || pushCategory(frame.domTree.flowsCount) || Object.keys(WebInspector.Resource.Type).some(pushResourceType);
     },
 
     _reloadPageClicked: function(event)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to