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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChart.js

Issue 2242023002: DevTools: Timeline warning colors should scale with severity. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 var data = this._entryData[entryIndex]; 736 var data = this._entryData[entryIndex];
737 var type = this._entryType(entryIndex); 737 var type = this._entryType(entryIndex);
738 if (type === WebInspector.TimelineFlameChartEntryType.Frame) { 738 if (type === WebInspector.TimelineFlameChartEntryType.Frame) {
739 var /** @const */ vPadding = 1; 739 var /** @const */ vPadding = 1;
740 var /** @const */ hPadding = 1; 740 var /** @const */ hPadding = 1;
741 var frame = /** {!WebInspector.TimelineFrame} */ (data); 741 var frame = /** {!WebInspector.TimelineFrame} */ (data);
742 barX += hPadding; 742 barX += hPadding;
743 barWidth -= 2 * hPadding; 743 barWidth -= 2 * hPadding;
744 barY += vPadding; 744 barY += vPadding;
745 barHeight -= 2 * vPadding + 1; 745 barHeight -= 2 * vPadding + 1;
746 context.fillStyle = frame.idle ? "white" : (frame.hasWarnings() ? "# fad1d1" : "#d7f0d1"); 746
747 if (frame.hasWarnings()) {
748 var intensity = Number.constrain(frame.duration / (30 + frame.du ration), 0, 1).toFixed(3);
alph 2016/08/31 19:38:43 You have a different formula here. Is it intended?
749 context.fillStyle = `hsla(0, 80%, 85%, ${intensity})`;
750 } else {
751 context.fillStyle = frame.idle ? "white" : "#d7f0d1";
752 }
747 context.fillRect(barX, barY, barWidth, barHeight); 753 context.fillRect(barX, barY, barWidth, barHeight);
748 var frameDurationText = Number.preciseMillisToString(frame.duration, 1); 754 var frameDurationText = Number.preciseMillisToString(frame.duration, 1);
749 var textWidth = context.measureText(frameDurationText).width; 755 var textWidth = context.measureText(frameDurationText).width;
750 if (barWidth >= textWidth) { 756 if (barWidth >= textWidth) {
751 context.fillStyle = this.textColor(entryIndex); 757 context.fillStyle = this.textColor(entryIndex);
752 context.fillText(frameDurationText, barX + (barWidth - textWidth ) / 2, barY + barHeight - 3); 758 context.fillText(frameDurationText, barX + (barWidth - textWidth ) / 2, barY + barHeight - 3);
753 } 759 }
754 return true; 760 return true;
755 } 761 }
756 762
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 /** 1522 /**
1517 * @constructor 1523 * @constructor
1518 * @param {!WebInspector.TimelineSelection} selection 1524 * @param {!WebInspector.TimelineSelection} selection
1519 * @param {number} entryIndex 1525 * @param {number} entryIndex
1520 */ 1526 */
1521 WebInspector.TimelineFlameChartView.Selection = function(selection, entryIndex) 1527 WebInspector.TimelineFlameChartView.Selection = function(selection, entryIndex)
1522 { 1528 {
1523 this.timelineSelection = selection; 1529 this.timelineSelection = selection;
1524 this.entryIndex = entryIndex; 1530 this.entryIndex = entryIndex;
1525 } 1531 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698