| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
| 8 * @param {!WebInspector.NetworkLogView} networkLogView | 8 * @param {!WebInspector.NetworkLogView} networkLogView |
| 9 * @param {!WebInspector.SortableDataGrid} dataGrid | 9 * @param {!WebInspector.SortableDataGrid} dataGrid |
| 10 */ | 10 */ |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 context.scale(window.devicePixelRatio, window.devicePixelRatio); | 150 context.scale(window.devicePixelRatio, window.devicePixelRatio); |
| 151 context.translate(0, this._networkLogView.headerHeight()); | 151 context.translate(0, this._networkLogView.headerHeight()); |
| 152 context.rect(0, 0, this._offsetWidth, this._offsetHeight); | 152 context.rect(0, 0, this._offsetWidth, this._offsetHeight); |
| 153 context.clip(); | 153 context.clip(); |
| 154 var rowHeight = this._networkLogView.rowHeight(); | 154 var rowHeight = this._networkLogView.rowHeight(); |
| 155 var scrollTop = this._scrollTop(); | 155 var scrollTop = this._scrollTop(); |
| 156 var firstRequestIndex = Math.floor(scrollTop / rowHeight); | 156 var firstRequestIndex = Math.floor(scrollTop / rowHeight); |
| 157 var lastRequestIndex = Math.min(requests.length, firstRequestIndex + Mat
h.ceil(this._offsetHeight / rowHeight)); | 157 var lastRequestIndex = Math.min(requests.length, firstRequestIndex + Mat
h.ceil(this._offsetHeight / rowHeight)); |
| 158 for (var i = firstRequestIndex; i < lastRequestIndex; i++) { | 158 for (var i = firstRequestIndex; i < lastRequestIndex; i++) { |
| 159 var rowOffset = rowHeight * i; | 159 var rowOffset = rowHeight * i; |
| 160 var rowNumber = i - firstRequestIndex; |
| 161 this._decorateRow(context, rowNumber, rowOffset - scrollTop, rowHeig
ht); |
| 160 var request = requests[i]; | 162 var request = requests[i]; |
| 161 var ranges = WebInspector.RequestTimingView.calculateRequestTimeRang
es(request, 0); | 163 var ranges = WebInspector.RequestTimingView.calculateRequestTimeRang
es(request, 0); |
| 162 for (var range of ranges) { | 164 for (var range of ranges) { |
| 163 if (range.name === WebInspector.RequestTimeRangeNames.Total || | 165 if (range.name === WebInspector.RequestTimeRangeNames.Total || |
| 164 range.name === WebInspector.RequestTimeRangeNames.Sending || | 166 range.name === WebInspector.RequestTimeRangeNames.Sending || |
| 165 range.end - range.start === 0) | 167 range.end - range.start === 0) |
| 166 continue; | 168 continue; |
| 167 this._drawBar(context, range, rowOffset - scrollTop); | 169 this._drawBar(context, range, rowOffset - scrollTop); |
| 168 } | 170 } |
| 169 } | 171 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 context.rect(start, y, end - start, height - lineWidth); | 227 context.rect(start, y, end - start, height - lineWidth); |
| 226 if (lineWidth) { | 228 if (lineWidth) { |
| 227 context.lineWidth = lineWidth; | 229 context.lineWidth = lineWidth; |
| 228 context.strokeStyle = borderColor; | 230 context.strokeStyle = borderColor; |
| 229 context.stroke(); | 231 context.stroke(); |
| 230 } | 232 } |
| 231 context.fill(); | 233 context.fill(); |
| 232 context.restore(); | 234 context.restore(); |
| 233 }, | 235 }, |
| 234 | 236 |
| 237 /** |
| 238 * @param {!CanvasRenderingContext2D} context |
| 239 * @param {number} rowNumber |
| 240 * @param {number} y |
| 241 * @param {number} rowHeight |
| 242 */ |
| 243 _decorateRow: function(context, rowNumber, y, rowHeight) |
| 244 { |
| 245 context.save(); |
| 246 if (rowNumber % 2 === 1) |
| 247 return; |
| 248 |
| 249 context.beginPath(); |
| 250 context.fillStyle = WebInspector.themeSupport.patchColor("#f5f5f5", WebI
nspector.ThemeSupport.ColorUsage.Background); |
| 251 context.rect(0, y, this._offsetWidth, rowHeight); |
| 252 context.fill(); |
| 253 context.restore(); |
| 254 }, |
| 255 |
| 235 __proto__: WebInspector.VBox.prototype | 256 __proto__: WebInspector.VBox.prototype |
| 236 } | 257 } |
| OLD | NEW |