Skip to content
Permalink
Browse files
Web Inspector: [CSS Regions] A page with many flows should collapse t…
…he 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):


Canonical link: https://commits.webkit.org/143028@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159777 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
achicu committed Nov 26, 2013
1 parent 803b4a3 commit c86222ab7cb184d2c1f69233a70b2c49e8575856
Showing 3 changed files with 42 additions and 27 deletions.
@@ -1,3 +1,22 @@
2013-11-25 Alexandru Chiculita <achicu@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 <mitz@apple.com>

Set the svn:ignore property on the Xcode project to ignore the workspace and user data.
@@ -601,6 +601,11 @@ WebInspector.DOMTreeManager.prototype = {
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});
},

@@ -433,7 +433,7 @@ WebInspector.FrameTreeElement.prototype = {
// 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 @@ WebInspector.FrameTreeElement.prototype = {
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 @@ WebInspector.FrameTreeElement.prototype = {
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)

0 comments on commit c86222a

Please sign in to comment.