Changeset 36426 in webkit
- Timestamp:
- Sep 14, 2008 10:38:00 PM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r36423 r36426 1 2008-09-14 Anthony Ricaud <rik24d@gmail.com> 2 3 Moving all resource graphs under the same container for future scalable feature. 4 This is a speedup on resize but maybe a loss on changing the sorting function. 5 6 https://bugs.webkit.org/show_bug.cgi?id=20555 7 8 Reviewed by Timothy Hatcher. 9 10 * page/inspector/ResourcesPanel.js: Added a container for all resource graphs. 11 Added WebInspector.ResourceGraph. No more _updateGraphBars on resize. 12 * page/inspector/inspector.css: Edited corresponding rules and removed unnecessaries. 13 1 14 2008-09-14 Alexey Proskuryakov <ap@webkit.org> 2 15 -
trunk/WebCore/page/inspector/ResourcesPanel.js
r35881 r36426 1 1 /* 2 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2008 Anthony Ricaud (rik24d@gmail.com) 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 60 61 this.containerContentElement.appendChild(this.summaryElement); 61 62 63 this.resourcesGraphsElement = document.createElement("div"); 64 this.resourcesGraphsElement.id = "resources-graphs"; 65 this.containerContentElement.appendChild(this.resourcesGraphsElement); 66 62 67 this.dividersElement = document.createElement("div"); 63 68 this.dividersElement.id = "resources-dividers"; … … 167 172 { 168 173 this._updateGraphDividersIfNeeded(); 169 this._updateGraphBars();170 174 171 175 var visibleResourceView = this.visibleResourceView; … … 213 217 { 214 218 return this._needsRefresh; 215 }, 219 }, 216 220 217 221 set needsRefresh(x) … … 270 274 this.resourcesTreeElement.removeChildren(); 271 275 this.resourceViews.removeChildren(); 276 this.resourcesGraphsElement.removeChildren(); 272 277 273 278 this._updateGraphDividersIfNeeded(true); … … 283 288 resource._resourcesTreeElement = resourceTreeElement; 284 289 285 resourceTreeElement.updateGraphSideWidth(this.dividersElement.offsetWidth); 290 var resourceGraph = new WebInspector.ResourceGraph(resource); 291 resource._resourcesTreeElement._resourceGraph = resourceGraph; 292 293 this.resourcesGraphsElement.appendChild(resourceGraph.graphElement); 286 294 287 295 this.resourcesTreeElement.appendChild(resourceTreeElement); … … 304 312 305 313 this.resourcesTreeElement.removeChild(resource._resourcesTreeElement); 314 this.resourcesGraphsElement.removeChild(resource._resourcesTreeElement._resourceGraph); 306 315 307 316 resource.warnings = 0; … … 379 388 var percentages = this.calculator.computeBarGraphPercentages(resource); 380 389 381 var barLeftElement = resource._resourcesTreeElement.barLeftElement; 382 barLeftElement.style.left = percentages.start + "%"; 383 barLeftElement.style.right = (100 - percentages.end) + "%"; 384 385 var barRightElement = resource._resourcesTreeElement.barRightElement; 386 barRightElement.style.left = percentages.middle + "%"; 387 barRightElement.style.right = (100 - percentages.end) + "%"; 390 resource._resourcesTreeElement._resourceGraph.refresh(percentages); 388 391 }, 389 392 … … 548 551 if (treeElement === this.resourcesTreeElement.children[i]) 549 552 continue; 553 550 554 var wasSelected = treeElement.selected; 551 555 this.resourcesTreeElement.removeChild(treeElement); … … 553 557 if (wasSelected) 554 558 treeElement.select(true); 559 560 var graphElement = treeElement._resourceGraph.graphElement; 561 this.resourcesGraphsElement.removeChild(graphElement); 562 this.resourcesGraphsElement.insertBefore(graphElement, this.resourcesGraphsElement.children[i]); 555 563 } 556 564 }, … … 624 632 625 633 this.dividersLabelBarElement.appendChild(divider); 626 }627 },628 629 _updateGraphBars: function()630 {631 if (!this.visible) {632 this.needsRefresh = true;633 return;634 }635 636 if (document.body.offsetWidth <= 0) {637 // The stylesheet hasn't loaded yet or the window is closed,638 // so we can't calculate what is need. Return early.639 return;640 }641 642 var dividersElementWidth = this.dividersElement.offsetWidth;643 var resourcesLength = this._resources.length;644 for (var i = 0; i < resourcesLength; ++i) {645 var resourceTreeItem = this._resources[i]._resourcesTreeElement;646 if (!resourceTreeItem)647 continue;648 resourceTreeItem.updateGraphSideWidth(dividersElementWidth);649 634 } 650 635 }, … … 996 981 997 982 if (this.resourcesTreeElement.smallChildren) { 983 this.resourcesGraphsElement.addStyleClass("small"); 998 984 this.largerResourcesButton.title = WebInspector.UIString("Use large resource rows."); 999 985 this.largerResourcesButton.removeStyleClass("toggled-on"); 1000 986 } else { 987 this.resourcesGraphsElement.removeStyleClass("small"); 1001 988 this.largerResourcesButton.title = WebInspector.UIString("Use small resource rows."); 1002 989 this.largerResourcesButton.addStyleClass("toggled-on"); … … 1075 1062 this.sidebarResizeElement.style.left = (width - 3) + "px"; 1076 1063 1077 this._updateGraphBars();1078 1064 this._updateGraphDividersIfNeeded(); 1079 1065 … … 1219 1205 else 1220 1206 var start = 100; 1221 1207 1222 1208 if (resource.responseReceivedTime !== -1) 1223 1209 var middle = ((resource.responseReceivedTime - this.minimumBoundary) / this.boundarySpan) * 100; 1224 1210 else 1225 1211 var middle = 100; 1226 1212 1227 1213 if (resource.endTime !== -1) 1228 1214 var end = ((resource.endTime - this.minimumBoundary) / this.boundarySpan) * 100; … … 1352 1338 1353 1339 this.refreshTitles(); 1354 1355 this.graphSideElement = document.createElement("div");1356 this.graphSideElement.className = "resources-graph-side";1357 1358 this.barAreaElement = document.createElement("div");1359 this.barAreaElement.className = "resources-graph-bar-area";1360 this.graphSideElement.appendChild(this.barAreaElement);1361 1362 this.barLeftElement = document.createElement("div");1363 this.barLeftElement.className = "resources-graph-bar waiting";1364 this.barAreaElement.appendChild(this.barLeftElement);1365 1366 this.barRightElement = document.createElement("div");1367 this.barRightElement.className = "resources-graph-bar";1368 this.barAreaElement.appendChild(this.barRightElement);1369 1340 } 1370 1341 … … 1374 1345 WebInspector.SidebarTreeElement.prototype.onattach.call(this); 1375 1346 1376 this._listItemNode.appendChild(this.graphSideElement);1377 1347 this._listItemNode.addStyleClass("resources-category-" + this.resource.category.name); 1378 1348 }, … … 1460 1430 else 1461 1431 this.bubbleElement.removeStyleClass("error"); 1462 },1463 1464 updateGraphSideWidth: function(width)1465 {1466 width += 1; // Add one to account for the sidebar border width.1467 this.graphSideElement.style.right = -width + "px";1468 this.graphSideElement.style.width = width + "px";1469 1432 } 1470 1433 } … … 1507 1470 1508 1471 WebInspector.ResourceSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype; 1472 1473 WebInspector.ResourceGraph = function(resource) 1474 { 1475 this.resource = resource; 1476 1477 this._graphElement = document.createElement("div"); 1478 this._graphElement.className = "resources-graph-side"; 1479 1480 this._barAreaElement = document.createElement("div"); 1481 this._barAreaElement.className = "resources-graph-bar-area"; 1482 this._graphElement.appendChild(this._barAreaElement); 1483 1484 this._barLeftElement = document.createElement("div"); 1485 this._barLeftElement.className = "resources-graph-bar waiting"; 1486 this._barAreaElement.appendChild(this._barLeftElement); 1487 1488 this._barRightElement = document.createElement("div"); 1489 this._barRightElement.className = "resources-graph-bar"; 1490 this._barAreaElement.appendChild(this._barRightElement); 1491 1492 this._graphElement.addStyleClass("resources-category-" + resource.category.name); 1493 } 1494 1495 WebInspector.ResourceGraph.prototype = { 1496 get graphElement() 1497 { 1498 return this._graphElement; 1499 }, 1500 1501 refresh: function(percentages) 1502 { 1503 if (!this._graphElement.hasStyleClass("resources-category-" + this.resource.category.name)) { 1504 this._graphElement.removeMatchingStyleClasses("resources-category-\\w+"); 1505 this._graphElement.addStyleClass("resources-category-" + this.resource.category.name); 1506 } 1507 1508 this._barLeftElement.style.setProperty("left", percentages.start + "%"); 1509 this._barLeftElement.style.setProperty("right", (100 - percentages.end) + "%"); 1510 1511 this._barRightElement.style.setProperty("left", percentages.middle + "%"); 1512 this._barRightElement.style.setProperty("right", (100 - percentages.end) + "%"); 1513 } 1514 } -
trunk/WebCore/page/inspector/inspector.css
r36255 r36426 2133 2133 } 2134 2134 2135 .resource -sidebar-tree-item.resources-category-documents .resources-graph-bar {2135 .resources-category-documents .resources-graph-bar { 2136 2136 -webkit-border-image: url(Images/timelinePillBlue.png) 6 7 6 7; 2137 2137 } 2138 2138 2139 .resource -sidebar-tree-item.resources-category-stylesheets .resources-graph-bar {2139 .resources-category-stylesheets .resources-graph-bar { 2140 2140 -webkit-border-image: url(Images/timelinePillGreen.png) 6 7 6 7; 2141 2141 } 2142 2142 2143 .resource -sidebar-tree-item.resources-category-images .resources-graph-bar {2143 .resources-category-images .resources-graph-bar { 2144 2144 -webkit-border-image: url(Images/timelinePillPurple.png) 6 7 6 7; 2145 2145 } 2146 2146 2147 .resource -sidebar-tree-item.resources-category-fonts .resources-graph-bar {2147 .resources-category-fonts .resources-graph-bar { 2148 2148 -webkit-border-image: url(Images/timelinePillRed.png) 6 7 6 7; 2149 2149 } 2150 2150 2151 .resource -sidebar-tree-item.resources-category-scripts .resources-graph-bar {2151 .resources-category-scripts .resources-graph-bar { 2152 2152 -webkit-border-image: url(Images/timelinePillOrange.png) 6 7 6 7; 2153 2153 } 2154 2154 2155 .resource -sidebar-tree-item.resources-category-xhr .resources-graph-bar {2155 .resources-category-xhr .resources-graph-bar { 2156 2156 -webkit-border-image: url(Images/timelinePillYellow.png) 6 7 6 7; 2157 2157 } … … 2388 2388 } 2389 2389 2390 .sidebar-tree.small .sidebar-tree-item, .sidebar-tree .children.small .sidebar-tree-item, .sidebar-tree-item.small {2390 .sidebar-tree.small .sidebar-tree-item, .sidebar-tree .children.small .sidebar-tree-item, .sidebar-tree-item.small, .small .resources-graph-side { 2391 2391 height: 20px; 2392 2392 line-height: 18px; … … 2459 2459 } 2460 2460 2461 .sidebar-tree-item .resources-graph-side { 2462 position: absolute; 2463 height: 100%; 2464 top: 0; 2465 right: 0; 2466 } 2467 2468 .sidebar-tree-item .resources-graph-bar-area { 2461 #resources-graphs { 2462 position: absolute; 2463 left: 0; 2464 right: 0; 2465 max-height: 100%; 2466 top: 112px; 2467 z-index: -100; 2468 } 2469 2470 .resources-graph-side { 2471 position: relative; 2472 height: 36px; 2473 padding: 0 5px 0 5px; 2474 white-space: nowrap; 2475 margin-top: 1px; 2476 line-height: 34px; 2477 border-top: 1px solid transparent; 2478 } 2479 2480 .resources-graph-bar-area { 2469 2481 position: absolute; 2470 2482 top: 0; … … 2478 2490 } 2479 2491 2480 #resources-container:not(.viewing-resource) .resource -sidebar-tree-item:nth-of-type(2n) .resources-graph-side{2492 #resources-container:not(.viewing-resource) .resources-graph-side:nth-of-type(2n) { 2481 2493 background-color: rgba(0, 0, 0, 0.05); 2482 }2483 2484 #resources-container.viewing-resource #resources-sidebar .sidebar-tree-item .resources-graph-side {2485 display: none;2486 2494 } 2487 2495
Note: See TracChangeset
for help on using the changeset viewer.