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

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

Issue 2609863005: [Devtools] Fixed undefined type in Network Waterfall for Other types (Closed)
Patch Set: [Devtools] Fixed undefined type in Network Waterfall for Other types Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /** 4 /**
5 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 Network.NetworkWaterfallColumn = class extends UI.VBox { 7 Network.NetworkWaterfallColumn = class extends UI.VBox {
8 /** 8 /**
9 * @param {number} rowHeight 9 * @param {number} rowHeight
10 * @param {!Network.NetworkTimeCalculator} calculator 10 * @param {!Network.NetworkTimeCalculator} calculator
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 377
378 /** 378 /**
379 * @param {!SDK.NetworkRequest} request 379 * @param {!SDK.NetworkRequest} request
380 * @return {string} 380 * @return {string}
381 */ 381 */
382 _borderColorForResourceType(request) { 382 _borderColorForResourceType(request) {
383 var resourceType = request.resourceType(); 383 var resourceType = request.resourceType();
384 if (this._borderColorsForResourceTypeCache.has(resourceType)) 384 if (this._borderColorsForResourceTypeCache.has(resourceType))
385 return this._borderColorsForResourceTypeCache.get(resourceType); 385 return this._borderColorsForResourceTypeCache.get(resourceType);
386 var colorsForResourceType = Network.NetworkWaterfallColumn._colorsForResourc eType; 386 var colorsForResourceType = Network.NetworkWaterfallColumn._colorsForResourc eType;
387 var color = colorsForResourceType[resourceType] || colorsForResourceType.Oth er; 387 var color = colorsForResourceType[resourceType] || colorsForResourceType.oth er;
388 var parsedColor = Common.Color.parse(color); 388 var parsedColor = Common.Color.parse(color);
389 var hsla = parsedColor.hsla(); 389 var hsla = parsedColor.hsla();
390 hsla[1] /= 2; 390 hsla[1] /= 2;
391 hsla[2] -= Math.min(hsla[2], 0.2); 391 hsla[2] -= Math.min(hsla[2], 0.2);
392 var resultColor = /** @type {string} */ (parsedColor.asString(null)); 392 var resultColor = /** @type {string} */ (parsedColor.asString(null));
393 this._borderColorsForResourceTypeCache.set(resourceType, resultColor); 393 this._borderColorsForResourceTypeCache.set(resourceType, resultColor);
394 return resultColor; 394 return resultColor;
395 } 395 }
396 396
397 /** 397 /**
398 * @param {!CanvasRenderingContext2D} context 398 * @param {!CanvasRenderingContext2D} context
399 * @param {!SDK.NetworkRequest} request 399 * @param {!SDK.NetworkRequest} request
400 * @return {string|!CanvasGradient} 400 * @return {string|!CanvasGradient}
401 */ 401 */
402 _colorForResourceType(context, request) { 402 _colorForResourceType(context, request) {
403 var colorsForResourceType = Network.NetworkWaterfallColumn._colorsForResourc eType; 403 var colorsForResourceType = Network.NetworkWaterfallColumn._colorsForResourc eType;
404 var resourceType = request.resourceType(); 404 var resourceType = request.resourceType();
405 var color = colorsForResourceType[resourceType] || colorsForResourceType.Oth er; 405 var color = colorsForResourceType[resourceType] || colorsForResourceType.oth er;
406 if (request.cached()) 406 if (request.cached())
407 return color; 407 return color;
408 408
409 if (this._colorsForResourceTypeCache.has(color)) 409 if (this._colorsForResourceTypeCache.has(color))
410 return this._colorsForResourceTypeCache.get(color); 410 return this._colorsForResourceTypeCache.get(color);
411 var parsedColor = Common.Color.parse(color); 411 var parsedColor = Common.Color.parse(color);
412 var hsla = parsedColor.hsla(); 412 var hsla = parsedColor.hsla();
413 hsla[1] -= Math.min(hsla[1], 0.28); 413 hsla[1] -= Math.min(hsla[1], 0.28);
414 hsla[2] -= Math.min(hsla[2], 0.15); 414 hsla[2] -= Math.min(hsla[2], 0.15);
415 var gradient = context.createLinearGradient(0, 0, 0, this._getBarHeight()); 415 var gradient = context.createLinearGradient(0, 0, 0, this._getBarHeight());
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 return this._initiatedColor; 628 return this._initiatedColor;
629 if (node.isNavigationRequest()) 629 if (node.isNavigationRequest())
630 return this._rowNavigationRequestColor; 630 return this._rowNavigationRequestColor;
631 if (rowNumber % 2 === 1) 631 if (rowNumber % 2 === 1)
632 return 'transparent'; 632 return 'transparent';
633 return this._rowStripeColor; 633 return this._rowStripeColor;
634 } 634 }
635 } 635 }
636 }; 636 };
637 637
638 /** @enum {string} */
638 Network.NetworkWaterfallColumn._colorsForResourceType = { 639 Network.NetworkWaterfallColumn._colorsForResourceType = {
639 document: 'hsl(215, 100%, 80%)', 640 document: 'hsl(215, 100%, 80%)',
640 font: 'hsl(8, 100%, 80%)', 641 font: 'hsl(8, 100%, 80%)',
641 media: 'hsl(90, 50%, 80%)', 642 media: 'hsl(90, 50%, 80%)',
642 image: 'hsl(90, 50%, 80%)', 643 image: 'hsl(90, 50%, 80%)',
643 script: 'hsl(31, 100%, 80%)', 644 script: 'hsl(31, 100%, 80%)',
644 stylesheet: 'hsl(272, 64%, 80%)', 645 stylesheet: 'hsl(272, 64%, 80%)',
645 texttrack: 'hsl(8, 100%, 80%)', 646 texttrack: 'hsl(8, 100%, 80%)',
646 websocket: 'hsl(0, 0%, 95%)', 647 websocket: 'hsl(0, 0%, 95%)',
647 xhr: 'hsl(53, 100%, 80%)', 648 xhr: 'hsl(53, 100%, 80%)',
648 other: 'hsl(0, 0%, 95%)' 649 other: 'hsl(0, 0%, 95%)'
649 }; 650 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698