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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChart.js
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChart.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChart.js
index 6d828a1deac55d510b6d732487f99fad8bd74f58..9d55e82cccd3df590df26e11428527f217267acf 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChart.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChart.js
@@ -743,7 +743,13 @@ WebInspector.TimelineFlameChartDataProvider.prototype = {
barWidth -= 2 * hPadding;
barY += vPadding;
barHeight -= 2 * vPadding + 1;
- context.fillStyle = frame.idle ? "white" : (frame.hasWarnings() ? "#fad1d1" : "#d7f0d1");
+
+ if (frame.hasWarnings()) {
+ var intensity = Number.constrain(frame.duration / (30 + frame.duration), 0, 1).toFixed(3);
alph 2016/08/31 19:38:43 You have a different formula here. Is it intended?
+ context.fillStyle = `hsla(0, 80%, 85%, ${intensity})`;
+ } else {
+ context.fillStyle = frame.idle ? "white" : "#d7f0d1";
+ }
context.fillRect(barX, barY, barWidth, barHeight);
var frameDurationText = Number.preciseMillisToString(frame.duration, 1);
var textWidth = context.measureText(frameDurationText).width;

Powered by Google App Engine
This is Rietveld 408576698