Changeset 159777 in webkit
- Timestamp:
- Nov 25, 2013 6:21:04 PM (10 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r159759 r159777 1 2013-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 1 20 2013-11-25 Dan Bernstein <mitz@apple.com> 2 21 -
trunk/Source/WebInspectorUI/UserInterface/DOMTreeManager.js
r158881 r159777 602 602 console.assert(contentFlow); 603 603 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 604 609 this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.ContentFlowWasRemoved, {flow: contentFlow}); 605 610 }, -
trunk/Source/WebInspectorUI/UserInterface/FrameTreeElement.js
r157649 r159777 434 434 return a.mainTitle.localeCompare(b.mainTitle); 435 435 } 436 436 437 437 // Non-resources should appear before the resources. 438 438 // FIXME: There should be a better way to group the elements by their type. … … 537 537 var numberOfMediumCategories = 0; 538 538 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 554 543 if (type.charAt(0) === "_") 555 continue;544 return false; 556 545 557 546 // Only care about the values that are strings, not functions, etc. 558 547 var typeValue = WebInspector.Resource.Type[type]; 559 548 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 { 563 556 if (!resourceCount) 564 continue;557 return false; 565 558 566 559 // If this type has any resources and there is a known large category, make folders. 567 if ( resourceCount &&foundLargeCategory)560 if (foundLargeCategory) 568 561 return true; 569 562 … … 575 568 576 569 foundLargeCategory = true; 577 continue;570 return false; 578 571 } 579 572 580 573 // Check if this is a medium category. 581 574 if (resourceCount >= WebInspector.FrameTreeElement.MediumChildCountThreshold) { 582 ++numberOfMediumCategories;583 584 575 // 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; 588 577 } 589 578 590 579 // This is a small category. 591 580 ++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); 595 586 }, 596 587
Note: See TracChangeset
for help on using the changeset viewer.