Changeset 159777 in webkit


Ignore:
Timestamp:
Nov 25, 2013 6:21:04 PM (10 years ago)
Author:
Alexandru Chiculita
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):

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r159759 r159777  
     12013-11-25  Alexandru Chiculita  <achicu@adobe.com>
     2
     3        Web Inspector: [CSS Regions] A page with many flows should collapse the resources tree
     4        https://bugs.webkit.org/show_bug.cgi?id=122926
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        Refactored the code in FrameTreeElement._shouldGroupIntoFolders to make it easy to track
     9        more types of resources. Added the content flows as another type of resource that would trigger the
     10        collapsing.
     11
     12        * UserInterface/DOMTreeManager.js:
     13        (WebInspector.DOMTreeManager.prototype.namedFlowRemoved): Added code to remove the content nodes from
     14        a flow that has been removed.
     15        * UserInterface/FrameTreeElement.js:
     16        (WebInspector.FrameTreeElement.prototype._shouldGroupIntoFolders.pushCategory):
     17        (WebInspector.FrameTreeElement.prototype._shouldGroupIntoFolders.pushResourceType):
     18        (WebInspector.FrameTreeElement.prototype._shouldGroupIntoFolders):
     19
    1202013-11-25  Dan Bernstein  <mitz@apple.com>
    221
  • trunk/Source/WebInspectorUI/UserInterface/DOMTreeManager.js

    r158881 r159777  
    602602        console.assert(contentFlow);
    603603        this._flows.delete(flowKey);
     604
     605        // Remove any back links to this flow from the content nodes.
     606        for (var contentNode of contentFlow.contentNodes)
     607            this._contentNodesToFlowsMap.delete(contentNode.id);
     608
    604609        this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.ContentFlowWasRemoved, {flow: contentFlow});
    605610    },
  • trunk/Source/WebInspectorUI/UserInterface/FrameTreeElement.js

    r157649 r159777  
    434434            return a.mainTitle.localeCompare(b.mainTitle);
    435435        }
    436        
     436
    437437        // Non-resources should appear before the resources.
    438438        // FIXME: There should be a better way to group the elements by their type.
     
    537537        var numberOfMediumCategories = 0;
    538538        var foundLargeCategory = false;
    539 
    540         // FIXME: Use this._frame.domTree.flowsCount to count the number of flows in a frame.
    541         // https://bugs.webkit.org/show_bug.cgi?id=122926
    542 
    543         if (this._frame.childFrames.length >= WebInspector.FrameTreeElement.LargeChildCountThreshold)
    544             foundLargeCategory = true;
    545         else if (this._frame.childFrames.length >= WebInspector.FrameTreeElement.MediumChildCountThreshold)
    546             ++numberOfMediumCategories;
    547         else if (this._frame.childFrames.length)
    548             ++numberOfSmallCategories;
    549 
    550         // Iterate over all the available resource types. There are some other properties on
    551         // WebInspector.Resource.Type that we need to skip, like private data and functions.
    552         for (var type in WebInspector.Resource.Type) {
    553             // Skip private data.
     539        var frame = this._frame;
     540
     541        function pushResourceType(type) {
     542            // There are some other properties on WebInspector.Resource.Type that we need to skip, like private data and functions
    554543            if (type.charAt(0) === "_")
    555                 continue;
     544                return false;
    556545
    557546            // Only care about the values that are strings, not functions, etc.
    558547            var typeValue = WebInspector.Resource.Type[type];
    559548            if (typeof typeValue !== "string")
    560                 continue;
    561 
    562             var resourceCount = this._frame.resourcesWithType(typeValue).length;
     549                return false;
     550
     551            return pushCategory(frame.resourcesWithType(typeValue).length);
     552        }
     553
     554        function pushCategory(resourceCount)
     555        {
    563556            if (!resourceCount)
    564                 continue;
     557                return false;
    565558
    566559            // If this type has any resources and there is a known large category, make folders.
    567             if (resourceCount && foundLargeCategory)
     560            if (foundLargeCategory)
    568561                return true;
    569562
     
    575568
    576569                foundLargeCategory = true;
    577                 continue;
     570                return false;
    578571            }
    579572
    580573            // Check if this is a medium category.
    581574            if (resourceCount >= WebInspector.FrameTreeElement.MediumChildCountThreshold) {
    582                 ++numberOfMediumCategories;
    583 
    584575                // If this is the medium category that puts us over the maximum allowed, make folders.
    585                 if (numberOfMediumCategories >= WebInspector.FrameTreeElement.NumberOfMediumCategoriesThreshold)
    586                     return true;
    587                 continue;
     576                return ++numberOfMediumCategories >= WebInspector.FrameTreeElement.NumberOfMediumCategoriesThreshold;
    588577            }
    589578
    590579            // This is a small category.
    591580            ++numberOfSmallCategories;
    592         }
    593 
    594         return false;
     581            return false;
     582        }
     583
     584        // Iterate over all the available resource types.
     585        return pushCategory(frame.childFrames.length) || pushCategory(frame.domTree.flowsCount) || Object.keys(WebInspector.Resource.Type).some(pushResourceType);
    595586    },
    596587
Note: See TracChangeset for help on using the changeset viewer.