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

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

Issue 2474233002: [Devtools] Added "wiskers" to new network timeline for colored mode (Closed)
Patch Set: [Devtools] Added "wiskers" to new network timeline for colored mode Created 4 years, 1 month 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 WebInspector.NetworkTimelineColumn = class extends WebInspector.VBox { 7 WebInspector.NetworkTimelineColumn = class extends WebInspector.VBox {
8 /** 8 /**
9 * @param {number} rowHeight 9 * @param {number} rowHeight
10 * @param {!WebInspector.NetworkTimeCalculator} calculator 10 * @param {!WebInspector.NetworkTimeCalculator} calculator
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 /** 80 /**
81 * @param {!Element} element 81 * @param {!Element} element
82 * @param {!Event} event 82 * @param {!Event} event
83 * @return {!AnchorBox|undefined} 83 * @return {!AnchorBox|undefined}
84 */ 84 */
85 _getPopoverAnchor(element, event) { 85 _getPopoverAnchor(element, event) {
86 if (!this._hoveredRequest) 86 if (!this._hoveredRequest)
87 return; 87 return;
88 88
89 var range = WebInspector.RequestTimingView.calculateRequestTimeRanges(this._ hoveredRequest, 0) 89 var range = WebInspector.RequestTimingView.calculateRequestTimeRanges(this._ hoveredRequest, 0)
90 .find(data => data.name === 'total'); 90 .find(data => data.name === WebInspector.RequestTimeRangeNam es.Total);
91 var start = this._timeToPosition(range.start); 91 var start = this._timeToPosition(range.start);
92 var end = this._timeToPosition(range.end); 92 var end = this._timeToPosition(range.end);
93 93
94 if (event.clientX < this._canvasPosition.left + start || event.clientX > thi s._canvasPosition.left + end) 94 if (event.clientX < this._canvasPosition.left + start || event.clientX > thi s._canvasPosition.left + end)
95 return; 95 return;
96 96
97 var rowIndex = this._requestData.findIndex(request => this._hoveredRequest = == request); 97 var rowIndex = this._requestData.findIndex(request => this._hoveredRequest = == request);
98 var barHeight = this._getBarHeight(range.name); 98 var barHeight = this._getBarHeight(range.name);
99 var y = this._headerHeight + (this._rowHeight * rowIndex - this._scrollTop) + ((this._rowHeight - barHeight) / 2); 99 var y = this._headerHeight + (this._rowHeight * rowIndex - this._scrollTop) + ((this._rowHeight - barHeight) / 2);
100 100
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 context.fill(); 415 context.fill();
416 context.stroke(); 416 context.stroke();
417 417
418 var barWidth = Math.max(2, end - mid); 418 var barWidth = Math.max(2, end - mid);
419 context.beginPath(); 419 context.beginPath();
420 context.globalAlpha = 1; 420 context.globalAlpha = 1;
421 context.rect(mid, 0, barWidth, height - borderWidth); 421 context.rect(mid, 0, barWidth, height - borderWidth);
422 context.fill(); 422 context.fill();
423 context.stroke(); 423 context.stroke();
424 424
425 /** @type {?{left: string, right: string, tooltip: (string|undefined)}} */
426 var labels = null;
425 if (request === this._hoveredRequest) { 427 if (request === this._hoveredRequest) {
426 var labels = this._calculator.computeBarGraphLabels(request); 428 labels = this._calculator.computeBarGraphLabels(request);
427 this._drawSimplifiedBarDetails(context, labels.left, labels.right, start, mid, mid + barWidth + borderOffset); 429 this._drawSimplifiedBarDetails(context, labels.left, labels.right, start, mid, mid + barWidth + borderOffset);
428 } 430 }
429 431
432 if (!this._calculator.startAtZero) {
433 var queueingRange = WebInspector.RequestTimingView.calculateRequestTimeRan ges(request, 0)
434 .find(data => data.name === WebInspector.RequestTimeRangeNames .Total);
dgozman 2016/11/04 16:41:00 formatting is off
allada 2016/11/04 18:17:59 Done.
435 var leftLabelWidth = labels ? context.measureText(labels.left).width : 0;
436 var leftTextPlacedInBar = leftLabelWidth < mid - start;
437 const wiskerTextPadding = 13;
438 var textOffset = (labels && !leftTextPlacedInBar) ? leftLabelWidth + wiske rTextPadding : 0;
439 var queueingStart = this._timeToPosition(queueingRange.start);
440 if (start - textOffset > queueingStart) {
441 context.beginPath();
442 context.globalAlpha = 1;
443 context.strokeStyle = WebInspector.themeSupport.patchColor('#a5a5a5', We bInspector.ThemeSupport.ColorUsage.Foreground);
dgozman 2016/11/04 16:41:01 120 characters :-D
allada 2016/11/04 18:17:59 Done.
444 context.moveTo(queueingStart, Math.floor(height / 2));
445 context.lineTo(start - textOffset, Math.floor(height / 2));
446
447 const wiskerHeight = height / 2;
448 context.moveTo(queueingStart + borderOffset, wiskerHeight / 2);
449 context.lineTo(queueingStart + borderOffset, height - wiskerHeight / 2 - 1);
450 context.stroke();
451 }
452 }
453
430 context.restore(); 454 context.restore();
431 } 455 }
432 456
433 /** 457 /**
434 * @param {!CanvasRenderingContext2D} context 458 * @param {!CanvasRenderingContext2D} context
435 * @param {string} leftText 459 * @param {string} leftText
436 * @param {string} rightText 460 * @param {string} rightText
437 * @param {number} startX 461 * @param {number} startX
438 * @param {number} midX 462 * @param {number} midX
439 * @param {number} endX 463 * @param {number} endX
440 */ 464 */
441 _drawSimplifiedBarDetails(context, leftText, rightText, startX, midX, endX) { 465 _drawSimplifiedBarDetails(context, leftText, rightText, startX, midX, endX) {
442 /** @const */ 466 /** @const */
443 var barDotLineLength = 10; 467 var barDotLineLength = 10;
444 468
445 context.save(); 469 context.save();
446 var height = this._getBarHeight(); 470 var height = this._getBarHeight();
447 var leftLabelWidth = context.measureText(leftText).width; 471 var leftLabelWidth = context.measureText(leftText).width;
448 var rightLabelWidth = context.measureText(rightText).width; 472 var rightLabelWidth = context.measureText(rightText).width;
449 context.fillStyle = '#444'; 473 context.fillStyle = WebInspector.themeSupport.patchColor('#444', WebInspecto r.ThemeSupport.ColorUsage.Foreground);
450 context.strokeStyle = '#444'; 474 context.strokeStyle = WebInspector.themeSupport.patchColor('#444', WebInspec tor.ThemeSupport.ColorUsage.Foreground);
451 if (leftLabelWidth < midX - startX) { 475 if (leftLabelWidth < midX - startX) {
452 var midBarX = startX + (midX - startX) / 2 - leftLabelWidth / 2; 476 var midBarX = startX + (midX - startX) / 2 - leftLabelWidth / 2;
453 context.fillText(leftText, midBarX, this._fontSize); 477 context.fillText(leftText, midBarX, this._fontSize);
454 } else if (barDotLineLength + leftLabelWidth + this._leftPadding < startX) { 478 } else if (barDotLineLength + leftLabelWidth + this._leftPadding < startX) {
455 context.beginPath(); 479 context.beginPath();
456 context.arc(startX, Math.floor(height / 2), 2, 0, 2 * Math.PI); 480 context.arc(startX, Math.floor(height / 2), 2, 0, 2 * Math.PI);
457 context.fill(); 481 context.fill();
458 context.fillText(leftText, startX - leftLabelWidth - barDotLineLength - 1, this._fontSize); 482 context.fillText(leftText, startX - leftLabelWidth - barDotLineLength - 1, this._fontSize);
459 context.beginPath(); 483 context.beginPath();
460 context.lineWidth = 1; 484 context.lineWidth = 1;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 font: 'hsl(8, 100%, 80%)', 590 font: 'hsl(8, 100%, 80%)',
567 media: 'hsl(272, 64%, 80%)', 591 media: 'hsl(272, 64%, 80%)',
568 image: 'hsl(272, 64%, 80%)', 592 image: 'hsl(272, 64%, 80%)',
569 script: 'hsl(31, 100%, 80%)', 593 script: 'hsl(31, 100%, 80%)',
570 stylesheet: 'hsl(90, 50%, 80%)', 594 stylesheet: 'hsl(90, 50%, 80%)',
571 texttrack: 'hsl(8, 100%, 80%)', 595 texttrack: 'hsl(8, 100%, 80%)',
572 websocket: 'hsl(0, 0%, 95%)', 596 websocket: 'hsl(0, 0%, 95%)',
573 xhr: 'hsl(53, 100%, 80%)', 597 xhr: 'hsl(53, 100%, 80%)',
574 other: 'hsl(0, 0%, 95%)' 598 other: 'hsl(0, 0%, 95%)'
575 }; 599 };
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