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 {number} rowHeight | 8 * @param {number} rowHeight |
9 * @param {number} headerHeight | 9 * @param {number} headerHeight |
10 * @param {!WebInspector.NetworkTransferTimeCalculator} calculator | 10 * @param {!WebInspector.NetworkTransferTimeCalculator} calculator |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 // TODO(allada) When timeline canvas moves out of experiment move this to st
ylesheet. | 51 // TODO(allada) When timeline canvas moves out of experiment move this to st
ylesheet. |
52 this._boundScrollContainer.style.overflow = "hidden"; | 52 this._boundScrollContainer.style.overflow = "hidden"; |
53 | 53 |
54 /** @type {!Array<!WebInspector.NetworkRequest>} */ | 54 /** @type {!Array<!WebInspector.NetworkRequest>} */ |
55 this._requestData = []; | 55 this._requestData = []; |
56 | 56 |
57 /** @type {?WebInspector.NetworkRequest} */ | 57 /** @type {?WebInspector.NetworkRequest} */ |
58 this._hoveredRequest = null; | 58 this._hoveredRequest = null; |
59 | 59 |
60 this._rowStripeColor = WebInspector.themeSupport.patchColor("#f5f5f5", WebIn
spector.ThemeSupport.ColorUsage.Background); | 60 /** @type {?WebInspector.NetworkRequest} */ |
61 this._rowHoverColor = WebInspector.themeSupport.patchColor("#ebf2fc", WebIns
pector.ThemeSupport.ColorUsage.Background); | 61 this._navigationRequest = null; |
| 62 |
| 63 var colorUsage = WebInspector.ThemeSupport.ColorUsage; |
| 64 this._rowNavigationRequestColor = WebInspector.themeSupport.patchColor("#def
", colorUsage.Background); |
| 65 this._rowStripeColor = WebInspector.themeSupport.patchColor("#f5f5f5", color
Usage.Background); |
| 66 this._rowHoverColor = WebInspector.themeSupport.patchColor("#ebf2fc", /** @t
ype {!WebInspector.ThemeSupport.ColorUsage} */ (colorUsage.Background | colorUsa
ge.Selection)); |
62 | 67 |
63 /** @type {!Map<!WebInspector.ResourceType, string>} */ | 68 /** @type {!Map<!WebInspector.ResourceType, string>} */ |
64 this._borderColorsForResourceTypeCache = new Map(); | 69 this._borderColorsForResourceTypeCache = new Map(); |
65 /** @type {!Map<string, !CanvasGradient>} */ | 70 /** @type {!Map<string, !CanvasGradient>} */ |
66 this._colorsForResourceTypeCache = new Map(); | 71 this._colorsForResourceTypeCache = new Map(); |
67 } | 72 } |
68 | 73 |
69 WebInspector.NetworkTimelineColumn.Events = { | 74 WebInspector.NetworkTimelineColumn.Events = { |
70 RequestHovered: Symbol("RequestHovered") | 75 RequestHovered: Symbol("RequestHovered") |
71 } | 76 } |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 _getRequestFromPoint: function(x, y) | 226 _getRequestFromPoint: function(x, y) |
222 { | 227 { |
223 var scrollTop = this._vScrollElement.scrollTop; | 228 var scrollTop = this._vScrollElement.scrollTop; |
224 return this._requestData[Math.floor((scrollTop + y - this._headerHeight)
/ this._rowHeight)] || null; | 229 return this._requestData[Math.floor((scrollTop + y - this._headerHeight)
/ this._rowHeight)] || null; |
225 }, | 230 }, |
226 | 231 |
227 scheduleDraw: function() | 232 scheduleDraw: function() |
228 { | 233 { |
229 if (this._updateRequestID) | 234 if (this._updateRequestID) |
230 return; | 235 return; |
231 this._updateRequestID = this.element.window().requestAnimationFrame(this
.update.bind(this, undefined)); | 236 this._updateRequestID = this.element.window().requestAnimationFrame(() =
> this.update()); |
232 }, | 237 }, |
233 | 238 |
234 /** | 239 /** |
235 * @param {!Array<!WebInspector.NetworkRequest>=} requests | 240 * @param {!{requests: !Array<!WebInspector.NetworkRequest>, navigationReque
st: ?WebInspector.NetworkRequest}=} requestData |
236 */ | 241 */ |
237 update: function(requests) | 242 update: function(requestData) |
238 { | 243 { |
239 if (requests) | 244 if (requestData) { |
240 this._requestData = requests; | 245 this._requestData = requestData.requests; |
| 246 this._navigationRequest = requestData.navigationRequest; |
| 247 } |
241 this.element.window().cancelAnimationFrame(this._updateRequestID); | 248 this.element.window().cancelAnimationFrame(this._updateRequestID); |
242 this._updateRequestID = null; | 249 this._updateRequestID = null; |
243 | 250 |
244 this._startTime = this._calculator.minimumBoundary(); | 251 this._startTime = this._calculator.minimumBoundary(); |
245 this._endTime = this._calculator.maximumBoundary(); | 252 this._endTime = this._calculator.maximumBoundary(); |
246 this._resetCanvas(); | 253 this._resetCanvas(); |
247 this._draw(); | 254 this._draw(); |
248 }, | 255 }, |
249 | 256 |
250 /** | 257 /** |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 }, | 610 }, |
604 | 611 |
605 /** | 612 /** |
606 * @param {!CanvasRenderingContext2D} context | 613 * @param {!CanvasRenderingContext2D} context |
607 * @param {!WebInspector.NetworkRequest} request | 614 * @param {!WebInspector.NetworkRequest} request |
608 * @param {number} rowNumber | 615 * @param {number} rowNumber |
609 * @param {number} y | 616 * @param {number} y |
610 */ | 617 */ |
611 _decorateRow: function(context, request, rowNumber, y) | 618 _decorateRow: function(context, request, rowNumber, y) |
612 { | 619 { |
613 if (rowNumber % 2 === 1 && this._hoveredRequest !== request) | 620 if (rowNumber % 2 === 1 && this._hoveredRequest !== request && this._nav
igationRequest !== request) |
614 return; | 621 return; |
615 context.save(); | 622 context.save(); |
616 context.beginPath(); | 623 context.beginPath(); |
617 var color = this._rowStripeColor; | 624 var color = this._rowStripeColor; |
618 if (this._hoveredRequest === request) | 625 if (this._hoveredRequest === request) |
619 color = this._rowHoverColor; | 626 color = this._rowHoverColor; |
| 627 else if (this._navigationRequest === request) |
| 628 color = this._rowNavigationRequestColor; |
620 | 629 |
621 context.fillStyle = color; | 630 context.fillStyle = color; |
622 context.rect(0, y, this._offsetWidth, this._rowHeight); | 631 context.rect(0, y, this._offsetWidth, this._rowHeight); |
623 context.fill(); | 632 context.fill(); |
624 context.restore(); | 633 context.restore(); |
625 }, | 634 }, |
626 | 635 |
627 __proto__: WebInspector.VBox.prototype | 636 __proto__: WebInspector.VBox.prototype |
628 } | 637 } |
OLD | NEW |