OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> | 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> |
4 * Copyright (C) 2011 Google Inc. All rights reserved. | 4 * Copyright (C) 2011 Google Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 if (columnIdentifier === "timeline") { | 307 if (columnIdentifier === "timeline") { |
308 this._sortByTimeline(); | 308 this._sortByTimeline(); |
309 return; | 309 return; |
310 } | 310 } |
311 var sortingFunction = this._sortingFunctions[columnIdentifier]; | 311 var sortingFunction = this._sortingFunctions[columnIdentifier]; |
312 if (!sortingFunction) | 312 if (!sortingFunction) |
313 return; | 313 return; |
314 | 314 |
315 this._dataGrid.sortNodes(sortingFunction, this._dataGrid.sortOrder === "
descending"); | 315 this._dataGrid.sortNodes(sortingFunction, this._dataGrid.sortOrder === "
descending"); |
316 this._timelineSortSelector.selectedIndex = 0; | 316 this._timelineSortSelector.selectedIndex = 0; |
| 317 this._updateOffscreenRows(); |
317 }, | 318 }, |
318 | 319 |
319 _sortByTimeline: function() | 320 _sortByTimeline: function() |
320 { | 321 { |
321 var selectedIndex = this._timelineSortSelector.selectedIndex; | 322 var selectedIndex = this._timelineSortSelector.selectedIndex; |
322 if (!selectedIndex) | 323 if (!selectedIndex) |
323 selectedIndex = 1; // Sort by start time by default. | 324 selectedIndex = 1; // Sort by start time by default. |
324 var selectedOption = this._timelineSortSelector[selectedIndex]; | 325 var selectedOption = this._timelineSortSelector[selectedIndex]; |
325 var value = selectedOption.value; | 326 var value = selectedOption.value; |
326 | 327 |
327 var sortingFunction = this._sortingFunctions[value]; | 328 var sortingFunction = this._sortingFunctions[value]; |
328 this._dataGrid.sortNodes(sortingFunction); | 329 this._dataGrid.sortNodes(sortingFunction); |
329 this.calculator = this._calculators[value]; | 330 this.calculator = this._calculators[value]; |
330 if (this.calculator.startAtZero) | 331 if (this.calculator.startAtZero) |
331 this._timelineGrid.hideEventDividers(); | 332 this._timelineGrid.hideEventDividers(); |
332 else | 333 else |
333 this._timelineGrid.showEventDividers(); | 334 this._timelineGrid.showEventDividers(); |
334 this._dataGrid.markColumnAsSortedBy("timeline", "ascending"); | 335 this._dataGrid.markColumnAsSortedBy("timeline", "ascending"); |
| 336 this._updateOffscreenRows(); |
335 }, | 337 }, |
336 | 338 |
337 _createFilterStatusBarItems: function() | 339 _createFilterStatusBarItems: function() |
338 { | 340 { |
339 var filterBarElement = document.createElement("div"); | 341 var filterBarElement = document.createElement("div"); |
340 filterBarElement.className = "scope-bar status-bar-item"; | 342 filterBarElement.className = "scope-bar status-bar-item"; |
341 filterBarElement.id = "network-filter"; | 343 filterBarElement.id = "network-filter"; |
342 | 344 |
343 function createFilterElement(category, label) | 345 function createFilterElement(category, label) |
344 { | 346 { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 // If selectMultiple is turned on, and we were selected, we just | 485 // If selectMultiple is turned on, and we were selected, we just |
484 // want to unselect ourselves. | 486 // want to unselect ourselves. |
485 target.removeStyleClass("selected"); | 487 target.removeStyleClass("selected"); |
486 this._hideCategory(target.category); | 488 this._hideCategory(target.category); |
487 } else { | 489 } else { |
488 // If selectMultiple is turned on, and we weren't selected, we just | 490 // If selectMultiple is turned on, and we weren't selected, we just |
489 // want to select ourselves. | 491 // want to select ourselves. |
490 target.addStyleClass("selected"); | 492 target.addStyleClass("selected"); |
491 this._showCategory(target.category); | 493 this._showCategory(target.category); |
492 } | 494 } |
| 495 this._updateOffscreenRows(); |
493 }, | 496 }, |
494 | 497 |
495 _scheduleRefresh: function() | 498 _scheduleRefresh: function() |
496 { | 499 { |
497 if (this._needsRefresh) | 500 if (this._needsRefresh) |
498 return; | 501 return; |
499 | 502 |
500 this._needsRefresh = true; | 503 this._needsRefresh = true; |
501 | 504 |
502 if (this.visible && !("_refreshTimeout" in this)) | 505 if (this.visible && !("_refreshTimeout" in this)) |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 { | 1036 { |
1034 var dataTableBody = this._dataGrid.dataTableBody; | 1037 var dataTableBody = this._dataGrid.dataTableBody; |
1035 var rows = dataTableBody.children; | 1038 var rows = dataTableBody.children; |
1036 var recordsCount = rows.length; | 1039 var recordsCount = rows.length; |
1037 if (recordsCount < 2) | 1040 if (recordsCount < 2) |
1038 return; // Filler row only. | 1041 return; // Filler row only. |
1039 | 1042 |
1040 var visibleTop = this._dataGrid.scrollContainer.scrollTop; | 1043 var visibleTop = this._dataGrid.scrollContainer.scrollTop; |
1041 var visibleBottom = visibleTop + this._dataGrid.scrollContainer.offsetHe
ight; | 1044 var visibleBottom = visibleTop + this._dataGrid.scrollContainer.offsetHe
ight; |
1042 | 1045 |
1043 var rowHeight = rows[0].offsetHeight; | 1046 var rowHeight = 0; |
1044 | 1047 |
1045 // Filler is at recordsCount - 1. | 1048 // Filler is at recordsCount - 1. |
| 1049 var unfilteredRowIndex = 0; |
1046 for (var i = 0; i < recordsCount - 1; ++i) { | 1050 for (var i = 0; i < recordsCount - 1; ++i) { |
1047 var row = rows[i]; | 1051 var row = rows[i]; |
1048 // Don't touch summaty - quit instead. | 1052 // Don't touch summaty - quit instead. |
1049 if (row === this._summaryBarRowNode) | 1053 if (this._summaryBarRowNode && row === this._summaryBarRowNode.eleme
nt) |
1050 break; | 1054 break; |
1051 var rowIsVisible = i * rowHeight < visibleBottom && (i + 1) * rowHei
ght > visibleTop; | 1055 |
| 1056 var dataGridNode = this._dataGrid.dataGridNodeFromNode(row); |
| 1057 if (dataGridNode.isFilteredOut()) { |
| 1058 row.removeStyleClass("offscreen"); |
| 1059 continue; |
| 1060 } |
| 1061 |
| 1062 if (!rowHeight) |
| 1063 rowHeight = row.offsetHeight; |
| 1064 |
| 1065 var rowIsVisible = unfilteredRowIndex * rowHeight < visibleBottom &&
(unfilteredRowIndex + 1) * rowHeight > visibleTop; |
1052 if (rowIsVisible !== row.rowIsVisible) { | 1066 if (rowIsVisible !== row.rowIsVisible) { |
1053 if (rowIsVisible) | 1067 if (rowIsVisible) |
1054 row.removeStyleClass("offscreen"); | 1068 row.removeStyleClass("offscreen"); |
1055 else | 1069 else |
1056 row.addStyleClass("offscreen"); | 1070 row.addStyleClass("offscreen"); |
1057 row.rowIsVisible = rowIsVisible; | 1071 row.rowIsVisible = rowIsVisible; |
1058 } | 1072 } |
| 1073 unfilteredRowIndex++; |
1059 } | 1074 } |
1060 } | 1075 } |
1061 } | 1076 } |
1062 | 1077 |
1063 WebInspector.NetworkPanel.prototype.__proto__ = WebInspector.Panel.prototype; | 1078 WebInspector.NetworkPanel.prototype.__proto__ = WebInspector.Panel.prototype; |
1064 | 1079 |
1065 WebInspector.NetworkBaseCalculator = function() | 1080 WebInspector.NetworkBaseCalculator = function() |
1066 { | 1081 { |
1067 } | 1082 } |
1068 | 1083 |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 this._nameCell = this._createDivInTD("name"); | 1372 this._nameCell = this._createDivInTD("name"); |
1358 this._methodCell = this._createDivInTD("method"); | 1373 this._methodCell = this._createDivInTD("method"); |
1359 this._statusCell = this._createDivInTD("status"); | 1374 this._statusCell = this._createDivInTD("status"); |
1360 this._typeCell = this._createDivInTD("type"); | 1375 this._typeCell = this._createDivInTD("type"); |
1361 this._sizeCell = this._createDivInTD("size"); | 1376 this._sizeCell = this._createDivInTD("size"); |
1362 this._timeCell = this._createDivInTD("time"); | 1377 this._timeCell = this._createDivInTD("time"); |
1363 this._createTimelineCell(); | 1378 this._createTimelineCell(); |
1364 this._nameCell.addEventListener("click", this.select.bind(this), false); | 1379 this._nameCell.addEventListener("click", this.select.bind(this), false); |
1365 }, | 1380 }, |
1366 | 1381 |
| 1382 isFilteredOut: function() |
| 1383 { |
| 1384 if (!this._panel._hiddenCategories.all) |
| 1385 return false; |
| 1386 return this._resource.category.name in this._panel._hiddenCategories; |
| 1387 }, |
| 1388 |
1367 select: function() | 1389 select: function() |
1368 { | 1390 { |
1369 this._panel._showResource(this._resource); | 1391 this._panel._showResource(this._resource); |
1370 WebInspector.DataGridNode.prototype.select.apply(this, arguments); | 1392 WebInspector.DataGridNode.prototype.select.apply(this, arguments); |
1371 }, | 1393 }, |
1372 | 1394 |
1373 get selectable() | 1395 get selectable() |
1374 { | 1396 { |
1375 if (!this._panel._viewingResourceMode) | 1397 if (!this._panel._viewingResourceMode) |
1376 return false; | 1398 return false; |
1377 if (!this._panel._hiddenCategories.all) | 1399 return !this.isFilteredOut(); |
1378 return true; | |
1379 if (this._panel._hiddenCategories[this._resource.category.name]) | |
1380 return false; | |
1381 return true; | |
1382 }, | 1400 }, |
1383 | 1401 |
1384 _createDivInTD: function(columnIdentifier) | 1402 _createDivInTD: function(columnIdentifier) |
1385 { | 1403 { |
1386 var td = document.createElement("td"); | 1404 var td = document.createElement("td"); |
1387 td.className = columnIdentifier + "-column"; | 1405 td.className = columnIdentifier + "-column"; |
1388 var div = document.createElement("div"); | 1406 var div = document.createElement("div"); |
1389 td.appendChild(div); | 1407 td.appendChild(div); |
1390 this._element.appendChild(td); | 1408 this._element.appendChild(td); |
1391 return div; | 1409 return div; |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1688 | 1706 |
1689 WebInspector.NetworkDataGridNode.prototype.__proto__ = WebInspector.DataGridNode
.prototype; | 1707 WebInspector.NetworkDataGridNode.prototype.__proto__ = WebInspector.DataGridNode
.prototype; |
1690 | 1708 |
1691 WebInspector.NetworkTotalGridNode = function(element) | 1709 WebInspector.NetworkTotalGridNode = function(element) |
1692 { | 1710 { |
1693 this._summaryBarElement = element; | 1711 this._summaryBarElement = element; |
1694 WebInspector.DataGridNode.call(this, {summaryRow: true}); | 1712 WebInspector.DataGridNode.call(this, {summaryRow: true}); |
1695 } | 1713 } |
1696 | 1714 |
1697 WebInspector.NetworkTotalGridNode.prototype = { | 1715 WebInspector.NetworkTotalGridNode.prototype = { |
| 1716 isFilteredOut: function() |
| 1717 { |
| 1718 return false; |
| 1719 }, |
| 1720 |
| 1721 get selectable() |
| 1722 { |
| 1723 return false; |
| 1724 }, |
| 1725 |
1698 createCells: function() | 1726 createCells: function() |
1699 { | 1727 { |
1700 var td = document.createElement("td"); | 1728 var td = document.createElement("td"); |
1701 td.setAttribute("colspan", 7); | 1729 td.setAttribute("colspan", 7); |
1702 td.className = "network-summary"; | 1730 td.className = "network-summary"; |
1703 td.appendChild(this._summaryBarElement); | 1731 td.appendChild(this._summaryBarElement); |
1704 this._element.appendChild(td); | 1732 this._element.appendChild(td); |
1705 } | 1733 } |
1706 } | 1734 } |
1707 | 1735 |
1708 WebInspector.NetworkTotalGridNode.prototype.__proto__ = WebInspector.DataGridNod
e.prototype; | 1736 WebInspector.NetworkTotalGridNode.prototype.__proto__ = WebInspector.DataGridNod
e.prototype; |
OLD | NEW |