Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(816)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/NetworkWaterfallColumn.js

Issue 2832653002: DevTools: brush up color blending and theming APIs. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 Network.NetworkWaterfallColumn = class extends UI.VBox { 4 Network.NetworkWaterfallColumn = class extends UI.VBox {
5 /** 5 /**
6 * @param {number} rowHeight 6 * @param {number} rowHeight
7 * @param {!Network.NetworkTimeCalculator} calculator 7 * @param {!Network.NetworkTimeCalculator} calculator
8 */ 8 */
9 constructor(rowHeight, calculator) { 9 constructor(rowHeight, calculator) {
10 // TODO(allada) Make this a shadowDOM when the NetworkWaterfallColumn gets m oved into NetworkLogViewColumns. 10 // TODO(allada) Make this a shadowDOM when the NetworkWaterfallColumn gets m oved into NetworkLogViewColumns.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 /** @type {?Network.NetworkNode} */ 43 /** @type {?Network.NetworkNode} */
44 this._hoveredNode = null; 44 this._hoveredNode = null;
45 45
46 /** @type {!Map<string, !Array<number>>} */ 46 /** @type {!Map<string, !Array<number>>} */
47 this._eventDividers = new Map(); 47 this._eventDividers = new Map();
48 48
49 /** @type {(number|undefined)} */ 49 /** @type {(number|undefined)} */
50 this._updateRequestID; 50 this._updateRequestID;
51 51
52 var colorUsage = UI.ThemeSupport.ColorUsage; 52 var colorUsage = UI.ThemeSupport.ColorUsage;
53 this._rowNavigationRequestColor = UI.themeSupport.patchColor('#def', colorUs age.Background); 53 this._rowNavigationRequestColor = UI.themeSupport.patchColorText('#def', col orUsage.Background);
54 this._rowStripeColor = UI.themeSupport.patchColor('#f5f5f5', colorUsage.Back ground); 54 this._rowStripeColor = UI.themeSupport.patchColorText('#f5f5f5', colorUsage. Background);
55 this._rowHoverColor = UI.themeSupport.patchColor( 55 this._rowHoverColor = UI.themeSupport.patchColorText(
56 '#ebf2fc', /** @type {!UI.ThemeSupport.ColorUsage} */ (colorUsage.Backgr ound | colorUsage.Selection)); 56 '#ebf2fc', /** @type {!UI.ThemeSupport.ColorUsage} */ (colorUsage.Backgr ound | colorUsage.Selection));
57 this._parentInitiatorColor = UI.themeSupport.patchColor('hsla(120, 68%, 54%, 0.2)', colorUsage.Background); 57 this._parentInitiatorColor = UI.themeSupport.patchColorText('hsla(120, 68%, 54%, 0.2)', colorUsage.Background);
58 this._initiatedColor = UI.themeSupport.patchColor('hsla(0, 68%, 54%, 0.2)', colorUsage.Background); 58 this._initiatedColor = UI.themeSupport.patchColorText('hsla(0, 68%, 54%, 0.2 )', colorUsage.Background);
59 59
60 this.element.addEventListener('mousemove', this._onMouseMove.bind(this), tru e); 60 this.element.addEventListener('mousemove', this._onMouseMove.bind(this), tru e);
61 this.element.addEventListener('mouseleave', event => this._setHoveredNode(nu ll, false), true); 61 this.element.addEventListener('mouseleave', event => this._setHoveredNode(nu ll, false), true);
62 62
63 this._styleForTimeRangeName = Network.NetworkWaterfallColumn._buildRequestTi meRangeStyle(); 63 this._styleForTimeRangeName = Network.NetworkWaterfallColumn._buildRequestTi meRangeStyle();
64 64
65 var resourceStyleTuple = Network.NetworkWaterfallColumn._buildResourceTypeSt yle(); 65 var resourceStyleTuple = Network.NetworkWaterfallColumn._buildResourceTypeSt yle();
66 /** @type {!Map<!Common.ResourceType, !Network.NetworkWaterfallColumn._Layer Style>} */ 66 /** @type {!Map<!Common.ResourceType, !Network.NetworkWaterfallColumn._Layer Style>} */
67 this._styleForWaitingResourceType = resourceStyleTuple[0]; 67 this._styleForWaitingResourceType = resourceStyleTuple[0];
68 /** @type {!Map<!Common.ResourceType, !Network.NetworkWaterfallColumn._Layer Style>} */ 68 /** @type {!Map<!Common.ResourceType, !Network.NetworkWaterfallColumn._Layer Style>} */
69 this._styleForDownloadingResourceType = resourceStyleTuple[1]; 69 this._styleForDownloadingResourceType = resourceStyleTuple[1];
70 70
71 var baseLineColor = UI.themeSupport.patchColor('#a5a5a5', UI.ThemeSupport.Co lorUsage.Foreground); 71 var baseLineColor = UI.themeSupport.patchColorText('#a5a5a5', UI.ThemeSuppor t.ColorUsage.Foreground);
72 /** @type {!Network.NetworkWaterfallColumn._LayerStyle} */ 72 /** @type {!Network.NetworkWaterfallColumn._LayerStyle} */
73 this._wiskerStyle = {borderColor: baseLineColor, lineWidth: 1}; 73 this._wiskerStyle = {borderColor: baseLineColor, lineWidth: 1};
74 /** @type {!Network.NetworkWaterfallColumn._LayerStyle} */ 74 /** @type {!Network.NetworkWaterfallColumn._LayerStyle} */
75 this._hoverDetailsStyle = {fillStyle: baseLineColor, lineWidth: 1, borderCol or: baseLineColor}; 75 this._hoverDetailsStyle = {fillStyle: baseLineColor, lineWidth: 1, borderCol or: baseLineColor};
76 76
77 /** @type {!Map<!Network.NetworkWaterfallColumn._LayerStyle, !Path2D>} */ 77 /** @type {!Map<!Network.NetworkWaterfallColumn._LayerStyle, !Path2D>} */
78 this._pathForStyle = new Map(); 78 this._pathForStyle = new Map();
79 /** @type {!Array<!Network.NetworkWaterfallColumn._TextLayer>} */ 79 /** @type {!Array<!Network.NetworkWaterfallColumn._TextLayer>} */
80 this._textLayers = []; 80 this._textLayers = [];
81 } 81 }
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 for (var drawNode of drawNodes) { 384 for (var drawNode of drawNodes) {
385 if (useTimingBars) 385 if (useTimingBars)
386 this._buildTimingBarLayers(drawNode, rowOffset - this._scrollTop); 386 this._buildTimingBarLayers(drawNode, rowOffset - this._scrollTop);
387 else 387 else
388 this._buildSimplifiedBarLayers(context, drawNode, rowOffset - this._sc rollTop); 388 this._buildSimplifiedBarLayers(context, drawNode, rowOffset - this._sc rollTop);
389 } 389 }
390 } 390 }
391 this._drawLayers(context); 391 this._drawLayers(context);
392 392
393 context.save(); 393 context.save();
394 context.fillStyle = UI.themeSupport.patchColor('#888', UI.ThemeSupport.Color Usage.Foreground); 394 context.fillStyle = UI.themeSupport.patchColorText('#888', UI.ThemeSupport.C olorUsage.Foreground);
395 for (var textData of this._textLayers) 395 for (var textData of this._textLayers)
396 context.fillText(textData.text, textData.x, textData.y); 396 context.fillText(textData.text, textData.x, textData.y);
397 context.restore(); 397 context.restore();
398 398
399 this._drawEventDividers(context); 399 this._drawEventDividers(context);
400 context.restore(); 400 context.restore();
401 401
402 const freeZoneAtLeft = 75; 402 const freeZoneAtLeft = 75;
403 const freeZoneAtRight = 18; 403 const freeZoneAtRight = 18;
404 PerfUI.TimelineGrid.drawCanvasGrid(context, this._calculator, this._fontSize , this._headerHeight, freeZoneAtLeft); 404 PerfUI.TimelineGrid.drawCanvasGrid(context, this._calculator, this._fontSize , this._headerHeight, freeZoneAtLeft);
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 return this._rowStripeColor; 626 return this._rowStripeColor;
627 } 627 }
628 } 628 }
629 }; 629 };
630 630
631 /** @typedef {!{fillStyle: (string|undefined), lineWidth: (number|undefined), bo rderColor: (string|undefined)}} */ 631 /** @typedef {!{fillStyle: (string|undefined), lineWidth: (number|undefined), bo rderColor: (string|undefined)}} */
632 Network.NetworkWaterfallColumn._LayerStyle; 632 Network.NetworkWaterfallColumn._LayerStyle;
633 633
634 /** @typedef {!{x: number, y: number, text: string}} */ 634 /** @typedef {!{x: number, y: number, text: string}} */
635 Network.NetworkWaterfallColumn._TextLayer; 635 Network.NetworkWaterfallColumn._TextLayer;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698