Commit b6e31aaa authored by Leszek Swirski's avatar Leszek Swirski Committed by V8 LUCI CQ

[system-analyzer] More fixes

  - Fix inline script line nos
  * Change the map source pos panel to a table
  3. Fix script sorting to not crash on missing name

Change-Id: I250c830f4be5f734a9489622ce162615bf80aab7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2964606
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75279}
parent d8f78c0a
...@@ -15,5 +15,5 @@ found in the LICENSE file. --> ...@@ -15,5 +15,5 @@ found in the LICENSE file. -->
white-space: pre; white-space: pre;
} }
</style> </style>
<section id="filePositionNode"></section> <section id="mapProperties"></section>
<section id="mapDetails"></section> <section id="mapDetails"></section>
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import {FocusEvent} from '../events.mjs'; import {FocusEvent} from '../events.mjs';
import {ExpandableText} from '../helper.mjs';
import {DOM, V8CustomElement} from '../helper.mjs'; import {DOM, V8CustomElement} from '../helper.mjs';
DOM.defineCustomElement( DOM.defineCustomElement(
...@@ -11,15 +12,14 @@ DOM.defineCustomElement( ...@@ -11,15 +12,14 @@ DOM.defineCustomElement(
constructor() { constructor() {
super(templateText); super(templateText);
this._filePositionNode.onclick = e => this._handleFilePositionClick(e);
} }
get _mapDetails() { get _mapDetails() {
return this.$('#mapDetails'); return this.$('#mapDetails');
} }
get _filePositionNode() { get _mapProperties() {
return this.$('#filePositionNode'); return this.$('#mapProperties');
} }
set map(map) { set map(map) {
...@@ -29,19 +29,32 @@ DOM.defineCustomElement( ...@@ -29,19 +29,32 @@ DOM.defineCustomElement(
} }
_update() { _update() {
let details = ''; this._mapProperties.innerText = '';
let clickableDetails = '';
if (this._map) { if (this._map) {
clickableDetails = `ID: ${this._map.id}`; let clickableDetailsTable = DOM.table('properties');
clickableDetails += `\nSource location: ${this._map.filePosition}`;
details = this._map.description; {
const row = clickableDetailsTable.insertRow();
row.insertCell().innerText = 'ID';
row.insertCell().innerText = `${this._map.id}`;
}
{
const row = clickableDetailsTable.insertRow();
row.insertCell().innerText = 'Source location';
const sourceLocation = row.insertCell();
new ExpandableText(sourceLocation, `${this._map.sourcePosition}`);
sourceLocation.className = 'clickable';
sourceLocation.onclick = e => this._handleSourcePositionClick(e);
}
this._mapProperties.appendChild(clickableDetailsTable);
this._mapDetails.innerText = this._map.description;
} else {
this._mapDetails.innerText = '';
} }
this._filePositionNode.innerText = clickableDetails;
this._filePositionNode.classList.add('clickable');
this._mapDetails.innerText = details;
} }
_handleFilePositionClick(event) { _handleSourcePositionClick(event) {
this.dispatchEvent(new FocusEvent(this._map.sourcePosition)); this.dispatchEvent(new FocusEvent(this._map.sourcePosition));
} }
}); });
...@@ -10,10 +10,6 @@ found in the LICENSE file. --> ...@@ -10,10 +10,6 @@ found in the LICENSE file. -->
font-family: Consolas, monospace; font-family: Consolas, monospace;
} }
.scriptNode:before {
counter-reset: sourceLineCounter;
}
.scriptNode span { .scriptNode span {
counter-increment: sourceLineCounter 1; counter-increment: sourceLineCounter 1;
text-indent: -3.5em; text-indent: -3.5em;
......
...@@ -63,7 +63,7 @@ DOM.defineCustomElement('view/script-panel', ...@@ -63,7 +63,7 @@ DOM.defineCustomElement('view/script-panel',
} }
_initializeScriptDropdown() { _initializeScriptDropdown() {
this._scripts.sort((a, b) => a.name.localeCompare(b.name)); this._scripts.sort((a, b) => a.name?.localeCompare(b.name) ?? 0);
let select = this.scriptDropdown; let select = this.scriptDropdown;
select.options.length = 0; select.options.length = 0;
for (const script of this._scripts) { for (const script of this._scripts) {
...@@ -245,6 +245,7 @@ class LineBuilder { ...@@ -245,6 +245,7 @@ class LineBuilder {
break; break;
} }
} }
scriptNode.style.counterReset = `sourceLineCounter ${startLine - 1}`;
for (let [lineIndex, line] of lineIterator( for (let [lineIndex, line] of lineIterator(
this._script.source, startLine)) { this._script.source, startLine)) {
scriptNode.appendChild(this._createLineNode(lineIndex, line)); scriptNode.appendChild(this._createLineNode(lineIndex, line));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment