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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 return [this._largerResourcesButton.element, this._preserveLogToggle.ele
ment, this._clearButton.element, this._filterBarElement]; | 96 return [this._largerResourcesButton.element, this._preserveLogToggle.ele
ment, this._clearButton.element, this._filterBarElement]; |
97 }, | 97 }, |
98 | 98 |
99 isCategoryVisible: function(categoryName) | 99 isCategoryVisible: function(categoryName) |
100 { | 100 { |
101 return true; | 101 return true; |
102 }, | 102 }, |
103 | 103 |
104 elementsToRestoreScrollPositionsFor: function() | 104 elementsToRestoreScrollPositionsFor: function() |
105 { | 105 { |
106 return [this.containerElement]; | 106 return [this.containerElement, this._dataGrid.scrollContainer]; |
107 }, | 107 }, |
108 | 108 |
109 resize: function() | 109 resize: function() |
110 { | 110 { |
111 WebInspector.Panel.prototype.resize.call(this); | 111 WebInspector.Panel.prototype.resize.call(this); |
112 this._dataGrid.updateWidths(); | 112 this._dataGrid.updateWidths(); |
113 this._positionSummaryBar(); | 113 this._positionSummaryBar(); |
114 }, | 114 }, |
115 | 115 |
116 updateSidebarWidth: function(width) | 116 updateSidebarWidth: function(width) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 151 } |
152 | 152 |
153 if (!this._summaryBarRowNode && !fillerRow.offsetHeight) { | 153 if (!this._summaryBarRowNode && !fillerRow.offsetHeight) { |
154 // Glue status to table. | 154 // Glue status to table. |
155 this._summaryBarRowNode = new WebInspector.NetworkTotalGridNode(this
._summaryBarElement); | 155 this._summaryBarRowNode = new WebInspector.NetworkTotalGridNode(this
._summaryBarElement); |
156 this._summaryBarElement.removeStyleClass("network-summary-bar-bottom
"); | 156 this._summaryBarElement.removeStyleClass("network-summary-bar-bottom
"); |
157 this._dataGrid.appendChild(this._summaryBarRowNode); | 157 this._dataGrid.appendChild(this._summaryBarRowNode); |
158 this._dataGrid.element.style.bottom = 0; | 158 this._dataGrid.element.style.bottom = 0; |
159 this._sortItems(); | 159 this._sortItems(); |
160 } | 160 } |
| 161 this._updateOffscreenRows(); |
161 }, | 162 }, |
162 | 163 |
163 _resetSummaryBar: function() | 164 _resetSummaryBar: function() |
164 { | 165 { |
165 delete this._summaryBarRowNode; | 166 delete this._summaryBarRowNode; |
166 this._summaryBarElement.parentElement.removeChild(this._summaryBarElemen
t); | 167 this._summaryBarElement.parentElement.removeChild(this._summaryBarElemen
t); |
167 this._updateSummaryBar(); | 168 this._updateSummaryBar(); |
168 }, | 169 }, |
169 | 170 |
170 _createTimelineGrid: function() | 171 _createTimelineGrid: function() |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 columns.timeline.title = ""; | 208 columns.timeline.title = ""; |
208 columns.timeline.sortable = false; | 209 columns.timeline.sortable = false; |
209 columns.timeline.width = "37%"; | 210 columns.timeline.width = "37%"; |
210 columns.timeline.sort = "ascending"; | 211 columns.timeline.sort = "ascending"; |
211 | 212 |
212 this._dataGrid = new WebInspector.DataGrid(columns); | 213 this._dataGrid = new WebInspector.DataGrid(columns); |
213 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu
.bind(this), true); | 214 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu
.bind(this), true); |
214 this.containerElement.appendChild(this._dataGrid.element); | 215 this.containerElement.appendChild(this._dataGrid.element); |
215 this._dataGrid.addEventListener("sorting changed", this._sortItems, this
); | 216 this._dataGrid.addEventListener("sorting changed", this._sortItems, this
); |
216 this._dataGrid.addEventListener("width changed", this._updateDividersIfN
eeded, this); | 217 this._dataGrid.addEventListener("width changed", this._updateDividersIfN
eeded, this); |
| 218 this._dataGrid.scrollContainer.addEventListener("scroll", this._updateOf
fscreenRows.bind(this)); |
217 | 219 |
218 this._patchTimelineHeader(); | 220 this._patchTimelineHeader(); |
219 }, | 221 }, |
220 | 222 |
221 _makeHeaderFragment: function(title, subtitle) | 223 _makeHeaderFragment: function(title, subtitle) |
222 { | 224 { |
223 var fragment = document.createDocumentFragment(); | 225 var fragment = document.createDocumentFragment(); |
224 fragment.appendChild(document.createTextNode(title)); | 226 fragment.appendChild(document.createTextNode(title)); |
225 var subtitleDiv = document.createElement("div"); | 227 var subtitleDiv = document.createElement("div"); |
226 subtitleDiv.className = "network-header-subtitle"; | 228 subtitleDiv.className = "network-header-subtitle"; |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 var harArchive = { | 1020 var harArchive = { |
1019 log: (new WebInspector.HARLog()).build() | 1021 log: (new WebInspector.HARLog()).build() |
1020 } | 1022 } |
1021 InspectorFrontendHost.copyText(JSON.stringify(harArchive)); | 1023 InspectorFrontendHost.copyText(JSON.stringify(harArchive)); |
1022 }, | 1024 }, |
1023 | 1025 |
1024 _exportResource: function(resource) | 1026 _exportResource: function(resource) |
1025 { | 1027 { |
1026 var har = (new WebInspector.HAREntry(resource)).build(); | 1028 var har = (new WebInspector.HAREntry(resource)).build(); |
1027 InspectorFrontendHost.copyText(JSON.stringify(har)); | 1029 InspectorFrontendHost.copyText(JSON.stringify(har)); |
| 1030 }, |
| 1031 |
| 1032 _updateOffscreenRows: function(e) |
| 1033 { |
| 1034 var dataTableBody = this._dataGrid.dataTableBody; |
| 1035 var rows = dataTableBody.children; |
| 1036 var recordsCount = rows.length; |
| 1037 if (recordsCount < 2) |
| 1038 return; // Filler row only. |
| 1039 |
| 1040 var visibleTop = this._dataGrid.scrollContainer.scrollTop; |
| 1041 var visibleBottom = visibleTop + this._dataGrid.scrollContainer.offsetHe
ight; |
| 1042 |
| 1043 var rowHeight = rows[0].offsetHeight; |
| 1044 |
| 1045 // Filler is at recordsCount - 1. |
| 1046 for (var i = 0; i < recordsCount - 1; ++i) { |
| 1047 var row = rows[i]; |
| 1048 // Don't touch summaty - quit instead. |
| 1049 if (row === this._summaryBarRowNode) |
| 1050 break; |
| 1051 var rowIsVisible = i * rowHeight < visibleBottom && (i + 1) * rowHei
ght > visibleTop; |
| 1052 if (rowIsVisible !== row.rowIsVisible) { |
| 1053 if (rowIsVisible) |
| 1054 row.removeStyleClass("offscreen"); |
| 1055 else |
| 1056 row.addStyleClass("offscreen"); |
| 1057 row.rowIsVisible = rowIsVisible; |
| 1058 } |
| 1059 } |
1028 } | 1060 } |
1029 } | 1061 } |
1030 | 1062 |
1031 WebInspector.NetworkPanel.prototype.__proto__ = WebInspector.Panel.prototype; | 1063 WebInspector.NetworkPanel.prototype.__proto__ = WebInspector.Panel.prototype; |
1032 | 1064 |
1033 WebInspector.NetworkBaseCalculator = function() | 1065 WebInspector.NetworkBaseCalculator = function() |
1034 { | 1066 { |
1035 } | 1067 } |
1036 | 1068 |
1037 WebInspector.NetworkBaseCalculator.prototype = { | 1069 WebInspector.NetworkBaseCalculator.prototype = { |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1667 { | 1699 { |
1668 var td = document.createElement("td"); | 1700 var td = document.createElement("td"); |
1669 td.setAttribute("colspan", 7); | 1701 td.setAttribute("colspan", 7); |
1670 td.className = "network-summary"; | 1702 td.className = "network-summary"; |
1671 td.appendChild(this._summaryBarElement); | 1703 td.appendChild(this._summaryBarElement); |
1672 this._element.appendChild(td); | 1704 this._element.appendChild(td); |
1673 } | 1705 } |
1674 } | 1706 } |
1675 | 1707 |
1676 WebInspector.NetworkTotalGridNode.prototype.__proto__ = WebInspector.DataGridNod
e.prototype; | 1708 WebInspector.NetworkTotalGridNode.prototype.__proto__ = WebInspector.DataGridNod
e.prototype; |
OLD | NEW |