| 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 {!WebInspector.NetworkTimeCalculator} calculator | 9 * @param {!WebInspector.NetworkTimeCalculator} calculator |
| 10 */ | 10 */ |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 this._popoverHelper = new WebInspector.PopoverHelper(this.element); | 32 this._popoverHelper = new WebInspector.PopoverHelper(this.element); |
| 33 this._popoverHelper.initializeCallbacks(this._getPopoverAnchor.bind(this), t
his._showPopover.bind(this)); | 33 this._popoverHelper.initializeCallbacks(this._getPopoverAnchor.bind(this), t
his._showPopover.bind(this)); |
| 34 this._popoverHelper.setTimeout(300, 300); | 34 this._popoverHelper.setTimeout(300, 300); |
| 35 | 35 |
| 36 /** @type {!Array<!WebInspector.NetworkRequest>} */ | 36 /** @type {!Array<!WebInspector.NetworkRequest>} */ |
| 37 this._requestData = []; | 37 this._requestData = []; |
| 38 | 38 |
| 39 /** @type {?WebInspector.NetworkRequest} */ | 39 /** @type {?WebInspector.NetworkRequest} */ |
| 40 this._hoveredRequest = null; | 40 this._hoveredRequest = null; |
| 41 /** @type {?WebInspector.NetworkRequest.InitiatorGraph} */ |
| 42 this._initiatorGraph = null; |
| 41 | 43 |
| 42 /** @type {?WebInspector.NetworkRequest} */ | 44 /** @type {?WebInspector.NetworkRequest} */ |
| 43 this._navigationRequest = null; | 45 this._navigationRequest = null; |
| 44 | 46 |
| 45 /** @type {!Map<string, !Array<number>>} */ | 47 /** @type {!Map<string, !Array<number>>} */ |
| 46 this._eventDividers = new Map(); | 48 this._eventDividers = new Map(); |
| 47 | 49 |
| 48 var colorUsage = WebInspector.ThemeSupport.ColorUsage; | 50 var colorUsage = WebInspector.ThemeSupport.ColorUsage; |
| 49 this._rowNavigationRequestColor = WebInspector.themeSupport.patchColor("#def
", colorUsage.Background); | 51 this._rowNavigationRequestColor = WebInspector.themeSupport.patchColor("#def
", colorUsage.Background); |
| 50 this._rowStripeColor = WebInspector.themeSupport.patchColor("#f5f5f5", color
Usage.Background); | 52 this._rowStripeColor = WebInspector.themeSupport.patchColor("#f5f5f5", color
Usage.Background); |
| 51 this._rowHoverColor = WebInspector.themeSupport.patchColor("#ebf2fc", /** @t
ype {!WebInspector.ThemeSupport.ColorUsage} */ (colorUsage.Background | colorUsa
ge.Selection)); | 53 this._rowHoverColor = WebInspector.themeSupport.patchColor("#ebf2fc", /** @t
ype {!WebInspector.ThemeSupport.ColorUsage} */ (colorUsage.Background | colorUsa
ge.Selection)); |
| 54 this._parentInitiatorColor = WebInspector.themeSupport.patchColor("hsla(120,
68%, 54%, 0.2)", colorUsage.Background); |
| 55 this._initiatedColor = WebInspector.themeSupport.patchColor("hsla(0, 68%, 54
%, 0.2)", colorUsage.Background); |
| 52 | 56 |
| 53 /** @type {!Map<!WebInspector.ResourceType, string>} */ | 57 /** @type {!Map<!WebInspector.ResourceType, string>} */ |
| 54 this._borderColorsForResourceTypeCache = new Map(); | 58 this._borderColorsForResourceTypeCache = new Map(); |
| 55 /** @type {!Map<string, !CanvasGradient>} */ | 59 /** @type {!Map<string, !CanvasGradient>} */ |
| 56 this._colorsForResourceTypeCache = new Map(); | 60 this._colorsForResourceTypeCache = new Map(); |
| 57 }; | 61 }; |
| 58 | 62 |
| 59 WebInspector.NetworkTimelineColumn._colorsForResourceType = { | 63 WebInspector.NetworkTimelineColumn._colorsForResourceType = { |
| 60 document: "hsl(215, 100%, 80%)", | 64 document: "hsl(215, 100%, 80%)", |
| 61 font: "hsl(8, 100%, 80%)", | 65 font: "hsl(8, 100%, 80%)", |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 _showPopover: function(anchor, popover) | 129 _showPopover: function(anchor, popover) |
| 126 { | 130 { |
| 127 if (!this._hoveredRequest) | 131 if (!this._hoveredRequest) |
| 128 return; | 132 return; |
| 129 var content = WebInspector.RequestTimingView.createTimingTable(this._hov
eredRequest, this._calculator.minimumBoundary()); | 133 var content = WebInspector.RequestTimingView.createTimingTable(this._hov
eredRequest, this._calculator.minimumBoundary()); |
| 130 popover.showForAnchor(content, anchor); | 134 popover.showForAnchor(content, anchor); |
| 131 }, | 135 }, |
| 132 | 136 |
| 133 /** | 137 /** |
| 134 * @param {?WebInspector.NetworkRequest} request | 138 * @param {?WebInspector.NetworkRequest} request |
| 139 * @param {boolean} highlightInitiatorChain |
| 135 */ | 140 */ |
| 136 setHoveredRequest: function(request) | 141 setHoveredRequest: function(request, highlightInitiatorChain) |
| 137 { | 142 { |
| 138 this._hoveredRequest = request; | 143 this._hoveredRequest = request; |
| 144 this._initiatorGraph = (highlightInitiatorChain && request) ? request.in
itiatorGraph() : null; |
| 139 this.update(); | 145 this.update(); |
| 140 }, | 146 }, |
| 141 | 147 |
| 142 /** | 148 /** |
| 143 * @param {number} height | 149 * @param {number} height |
| 144 */ | 150 */ |
| 145 setRowHeight: function(height) | 151 setRowHeight: function(height) |
| 146 { | 152 { |
| 147 this._rowHeight = height; | 153 this._rowHeight = height; |
| 148 }, | 154 }, |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 }, | 599 }, |
| 594 | 600 |
| 595 /** | 601 /** |
| 596 * @param {!CanvasRenderingContext2D} context | 602 * @param {!CanvasRenderingContext2D} context |
| 597 * @param {!WebInspector.NetworkRequest} request | 603 * @param {!WebInspector.NetworkRequest} request |
| 598 * @param {number} rowNumber | 604 * @param {number} rowNumber |
| 599 * @param {number} y | 605 * @param {number} y |
| 600 */ | 606 */ |
| 601 _decorateRow: function(context, request, rowNumber, y) | 607 _decorateRow: function(context, request, rowNumber, y) |
| 602 { | 608 { |
| 603 if (rowNumber % 2 === 1 && this._hoveredRequest !== request && this._nav
igationRequest !== request) | 609 if (rowNumber % 2 === 1 && this._hoveredRequest !== request && this._nav
igationRequest !== request && !this._initiatorGraph) |
| 610 return; |
| 611 |
| 612 var color = getRowColor.call(this); |
| 613 if (color === "transparent") |
| 604 return; | 614 return; |
| 605 context.save(); | 615 context.save(); |
| 606 context.beginPath(); | 616 context.beginPath(); |
| 607 var color = this._rowStripeColor; | |
| 608 if (this._hoveredRequest === request) | |
| 609 color = this._rowHoverColor; | |
| 610 else if (this._navigationRequest === request) | |
| 611 color = this._rowNavigationRequestColor; | |
| 612 | |
| 613 context.fillStyle = color; | 617 context.fillStyle = color; |
| 614 context.rect(0, y, this._offsetWidth, this._rowHeight); | 618 context.rect(0, y, this._offsetWidth, this._rowHeight); |
| 615 context.fill(); | 619 context.fill(); |
| 616 context.restore(); | 620 context.restore(); |
| 621 |
| 622 /** |
| 623 * @return {string} |
| 624 * @this {WebInspector.NetworkTimelineColumn} |
| 625 */ |
| 626 function getRowColor() |
| 627 { |
| 628 if (this._hoveredRequest === request) |
| 629 return this._rowHoverColor; |
| 630 if (this._initiatorGraph) { |
| 631 if (this._initiatorGraph.initiators.has(request)) |
| 632 return this._parentInitiatorColor; |
| 633 if (this._initiatorGraph.initiated.has(request)) |
| 634 return this._initiatedColor; |
| 635 } |
| 636 if (this._navigationRequest === request) |
| 637 return this._rowNavigationRequestColor; |
| 638 if (rowNumber % 2 === 1) |
| 639 return "transparent"; |
| 640 return this._rowStripeColor; |
| 641 } |
| 617 }, | 642 }, |
| 618 | 643 |
| 619 __proto__: WebInspector.VBox.prototype | 644 __proto__: WebInspector.VBox.prototype |
| 620 }; | 645 }; |
| OLD | NEW |