<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[159777] trunk/Source/WebInspectorUI</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/159777">159777</a></dd>
<dt>Author</dt> <dd>achicu@adobe.com</dd>
<dt>Date</dt> <dd>2013-11-25 18:21:04 -0800 (Mon, 25 Nov 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>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):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceDOMTreeManagerjs">trunk/Source/WebInspectorUI/UserInterface/DOMTreeManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceFrameTreeElementjs">trunk/Source/WebInspectorUI/UserInterface/FrameTreeElement.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (159776 => 159777)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+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):
+
</ins><span class="cx"> 2013-11-25 Dan Bernstein <mitz@apple.com>
</span><span class="cx">
</span><span class="cx"> Set the svn:ignore property on the Xcode project to ignore the workspace and user data.
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceDOMTreeManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/DOMTreeManager.js (159776 => 159777)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -601,6 +601,11 @@
</span><span class="cx"> var contentFlow = this._flows.get(flowKey);
</span><span class="cx"> console.assert(contentFlow);
</span><span class="cx"> this._flows.delete(flowKey);
</span><ins>+
+ // Remove any back links to this flow from the content nodes.
+ for (var contentNode of contentFlow.contentNodes)
+ this._contentNodesToFlowsMap.delete(contentNode.id);
+
</ins><span class="cx"> this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.ContentFlowWasRemoved, {flow: contentFlow});
</span><span class="cx"> },
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceFrameTreeElementjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/FrameTreeElement.js (159776 => 159777)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -433,7 +433,7 @@
</span><span class="cx"> // When both components are not resources then just compare the titles.
</span><span class="cx"> return a.mainTitle.localeCompare(b.mainTitle);
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> // Non-resources should appear before the resources.
</span><span class="cx"> // FIXME: There should be a better way to group the elements by their type.
</span><span class="cx"> return aIsResource ? 1 : -1;
</span><span class="lines">@@ -536,35 +536,28 @@
</span><span class="cx"> var numberOfSmallCategories = 0;
</span><span class="cx"> var numberOfMediumCategories = 0;
</span><span class="cx"> var foundLargeCategory = false;
</span><ins>+ var frame = this._frame;
</ins><span class="cx">
</span><del>- // 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.
</del><ins>+ function pushResourceType(type) {
+ // There are some other properties on WebInspector.Resource.Type that we need to skip, like private data and functions
</ins><span class="cx"> if (type.charAt(0) === "_")
</span><del>- continue;
</del><ins>+ return false;
</ins><span class="cx">
</span><span class="cx"> // Only care about the values that are strings, not functions, etc.
</span><span class="cx"> var typeValue = WebInspector.Resource.Type[type];
</span><span class="cx"> if (typeof typeValue !== "string")
</span><del>- continue;
</del><ins>+ return false;
</ins><span class="cx">
</span><del>- var resourceCount = this._frame.resourcesWithType(typeValue).length;
</del><ins>+ return pushCategory(frame.resourcesWithType(typeValue).length);
+ }
+
+ function pushCategory(resourceCount)
+ {
</ins><span class="cx"> if (!resourceCount)
</span><del>- continue;
</del><ins>+ return false;
</ins><span class="cx">
</span><span class="cx"> // If this type has any resources and there is a known large category, make folders.
</span><del>- if (resourceCount && foundLargeCategory)
</del><ins>+ if (foundLargeCategory)
</ins><span class="cx"> return true;
</span><span class="cx">
</span><span class="cx"> // If there are lots of this resource type, then count it as a large category.
</span><span class="lines">@@ -574,24 +567,22 @@
</span><span class="cx"> return true;
</span><span class="cx">
</span><span class="cx"> foundLargeCategory = true;
</span><del>- continue;
</del><ins>+ return false;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Check if this is a medium category.
</span><span class="cx"> if (resourceCount >= WebInspector.FrameTreeElement.MediumChildCountThreshold) {
</span><del>- ++numberOfMediumCategories;
-
</del><span class="cx"> // If this is the medium category that puts us over the maximum allowed, make folders.
</span><del>- if (numberOfMediumCategories >= WebInspector.FrameTreeElement.NumberOfMediumCategoriesThreshold)
- return true;
- continue;
</del><ins>+ return ++numberOfMediumCategories >= WebInspector.FrameTreeElement.NumberOfMediumCategoriesThreshold;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // This is a small category.
</span><span class="cx"> ++numberOfSmallCategories;
</span><ins>+ return false;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- return false;
</del><ins>+ // Iterate over all the available resource types.
+ return pushCategory(frame.childFrames.length) || pushCategory(frame.domTree.flowsCount) || Object.keys(WebInspector.Resource.Type).some(pushResourceType);
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> _reloadPageClicked: function(event)
</span></span></pre>
</div>
</div>
</body>
</html>