[tools][system-analyzer] Color compatibility

Changes:

* Transition edges on timeline-track with the same color of the map type.
* Log file reader loading background adapted to light theme.
* Support additional IC log event colors.
* Move theme switch button to top of the app.

Bug: v8:10644, v8:10673

Change-Id: Ib086b6f4a8bc5f86a4925b251112c640e37278ef
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2379869
Reviewed-by: Sathya Gunasekaran  <gsathya@chromium.org>
Commit-Queue: Zeynep Cankara <zcankara@google.com>
Cr-Commit-Position: refs/heads/master@{#69600}
This commit is contained in:
Zeynep Cankara 2020-08-28 05:18:59 +01:00 committed by Commit Bot
parent 1227c465c8
commit 25d4fde588
5 changed files with 17 additions and 15 deletions

View File

@ -120,16 +120,20 @@ function typeToColor(type) {
return CSSColor.red; return CSSColor.red;
case 'LoadGlobalIC': case 'LoadGlobalIC':
return CSSColor.green; return CSSColor.green;
case 'LoadIC':
return CSSColor.primaryColor;
case 'StoreInArrayLiteralIC': case 'StoreInArrayLiteralIC':
return CSSColor.violet; return CSSColor.violet;
case 'StoreGlobalIC':
return CSSColor.blue;
case 'StoreIC': case 'StoreIC':
return CSSColor.orange; return CSSColor.orange;
case 'KeyedLoadIC': case 'KeyedLoadIC':
return CSSColor.red; return CSSColor.red;
case 'KeyedStoreIC': case 'KeyedStoreIC':
return CSSColor.primaryColor; return CSSColor.yellow;
} }
return CSSColor.primaryColor; return CSSColor.secondaryColor;
} }

View File

@ -11,6 +11,7 @@
--error-color: #cf6679; --error-color: #cf6679;
--map-background-color: #5e5454; --map-background-color: #5e5454;
--timeline-background-color: #1f1f1f; --timeline-background-color: #1f1f1f;
--file-reader-background-color: #ffffff80;
--red: #dc6eae; --red: #dc6eae;
--green: #aedc6e; --green: #aedc6e;
--yellow: #eeff41; --yellow: #eeff41;
@ -32,6 +33,7 @@
--error-color: #b00020; --error-color: #b00020;
--map-background-color: #5e5454; --map-background-color: #5e5454;
--timeline-background-color: #fdfcfc; --timeline-background-color: #fdfcfc;
--file-reader-background-color: #887e8b80;
--red: #b71c1c; --red: #b71c1c;
--green: #7db300; --green: #7db300;
--yellow: #ffff00; --yellow: #ffff00;

View File

@ -41,9 +41,8 @@ found in the LICENSE file. -->
white-space: nowrap; white-space: nowrap;
} }
/*Simple css to style it like a toggle switch*/
.theme-switch-wrapper { .theme-switch-wrapper {
display: flex; display: inline-block;
align-items: center; align-items: center;
} }
@ -129,6 +128,12 @@ found in the LICENSE file. -->
<log-file-reader id="log-file-reader"></log-file-reader> <log-file-reader id="log-file-reader"></log-file-reader>
<br></br> <br></br>
</section> </section>
<div class="theme-switch-wrapper">
<label class="theme-switch" for="checkbox">
<input type="checkbox" id="checkbox" />
<div class="slider round"></div>
</label>
</div>
<div id="container" class="initial"> <div id="container" class="initial">
<timeline-panel id="timeline-panel"> <timeline-panel id="timeline-panel">
<timeline-track id="map-track"></timeline-track> <timeline-track id="map-track"></timeline-track>
@ -138,12 +143,6 @@ found in the LICENSE file. -->
<ic-panel id="ic-panel" onchange="app.handleSelectIc(event)"></ic-panel> <ic-panel id="ic-panel" onchange="app.handleSelectIc(event)"></ic-panel>
</div> </div>
</div> </div>
<div class="theme-switch-wrapper">
<label class="theme-switch" for="checkbox">
<input type="checkbox" id="checkbox" />
<div class="slider round"></div>
</label>
</div>
<div id="instructions"> <div id="instructions">
<h2>Instructions</h2> <h2>Instructions</h2>
<p> <p>

View File

@ -48,7 +48,7 @@ found in the LICENSE file. -->
left: 0px; left: 0px;
width: 100%; width: 100%;
height: 100%; height: 100%;
background-color: rgba(255, 255, 255, 0.5); background-color: var(--file-reader-background-color);
} }
#spinner { #spinner {

View File

@ -420,7 +420,6 @@ defineCustomElement('./timeline/timeline-track', (templateText) =>
ctx.lineTo(xTo, yTo); ctx.lineTo(xTo, yTo);
} }
if (!showLabel) { if (!showLabel) {
ctx.strokeStyle = CSSColor.onBackgroundColor;
ctx.stroke(); ctx.stroke();
} else { } else {
let centerX, centerY; let centerX, centerY;
@ -431,12 +430,11 @@ defineCustomElement('./timeline/timeline-track', (templateText) =>
centerX = xTo; centerX = xTo;
centerY = yTo; centerY = yTo;
} }
ctx.strokeStyle = CSSColor.onBackgroundColor;
ctx.moveTo(centerX, centerY); ctx.moveTo(centerX, centerY);
ctx.lineTo(centerX + offsetX, centerY - labelOffset); ctx.lineTo(centerX + offsetX, centerY - labelOffset);
ctx.stroke(); ctx.stroke();
ctx.textAlign = 'left'; ctx.textAlign = 'left';
ctx.fillStyle = CSSColor.onBackgroundColor; ctx.fillStyle = typeToColor(edge.type);
ctx.fillText( ctx.fillText(
edge.toString(), centerX + offsetX + 2, centerY - labelOffset); edge.toString(), centerX + offsetX + 2, centerY - labelOffset);
} }
@ -448,7 +446,6 @@ defineCustomElement('./timeline/timeline-track', (templateText) =>
if (depth >= max) return; if (depth >= max) return;
ctx.globalAlpha = 0.5 - depth * (0.3 / max); ctx.globalAlpha = 0.5 - depth * (0.3 / max);
ctx.strokeStyle = CSSColor.timelineBackgroundColor; ctx.strokeStyle = CSSColor.timelineBackgroundColor;
const limit = Math.min(map.children.length, 100) const limit = Math.min(map.children.length, 100)
for (let i = 0; i < limit; i++) { for (let i = 0; i < limit; i++) {
let edge = map.children[i]; let edge = map.children[i];