Skip to content

Commit c2b4e0d

Browse files
pfaffeDevtools-frontend LUCI CQ
authored andcommitted
[css value tracing] Use arrow icon exclusively
The mix of icons is confusing, and the arrow icon alone looks much nicer. Drive-by: Outline and format the view function. Bug: 396080529 Change-Id: Ib7c1f3bb716784b1bfc20f747d46587f6eed0b27 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6333508 Reviewed-by: Eric Leese <[email protected]> Auto-Submit: Philip Pfaffe <[email protected]> Commit-Queue: Philip Pfaffe <[email protected]>
1 parent a3ae29f commit c2b4e0d

File tree

2 files changed

+50
-36
lines changed

2 files changed

+50
-36
lines changed

front_end/panels/elements/CSSValueTraceView.ts

Lines changed: 49 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -30,47 +30,62 @@ export type View = (
3030
target: HTMLElement,
3131
) => void;
3232

33+
function defaultView(input: ViewInput, _: unknown, target: HTMLElement): void {
34+
const [firstEvaluation, ...intermediateEvaluations] = input.evaluations;
35+
render(
36+
// clang-format off
37+
html`
38+
<div class="css-value-trace monospace">
39+
${input.substitutions.map(
40+
line =>
41+
html`<span class="trace-line-icon" aria-label="is equal to"></span
42+
><span class="trace-line">${line}</span>`,
43+
)}
44+
${firstEvaluation && intermediateEvaluations.length === 0
45+
? html`<span class="trace-line-icon" aria-label="is equal to"></span
46+
><span class="trace-line">${firstEvaluation}</span>`
47+
: html`<details
48+
@toggle=${input.onToggle}
49+
?hidden=${!firstEvaluation ||
50+
intermediateEvaluations.length === 0}
51+
>
52+
<summary>
53+
<span class="trace-line-icon" aria-label="is equal to"></span
54+
><devtools-icon class="marker"></devtools-icon
55+
><span class="trace-line">${firstEvaluation}</span>
56+
</summary>
57+
<div>
58+
${intermediateEvaluations.map(
59+
evaluation =>
60+
html`<span class="trace-line-icon" aria-label="is equal to"
61+
></span
62+
><span class="trace-line">${evaluation}</span>`,
63+
)}
64+
</div>
65+
</details>`}
66+
${!input.finalResult
67+
? ''
68+
: html`<span class="trace-line-icon" aria-label="is equal to"></span
69+
><span class="trace-line">${input.finalResult}</span>`}
70+
</div>
71+
`,
72+
// clang-format on
73+
target,
74+
);
75+
}
76+
3377
export class CSSValueTraceView extends UI.Widget.VBox {
3478
#view: View;
3579
#finalResult: Node[]|undefined = undefined;
3680
#evaluations: Node[][] = [];
3781
#substitutions: Node[][] = [];
3882

39-
constructor(
40-
view: View = (input, _, target):
41-
void => {
42-
const substitutionIcon = html`<span class=trace-line-icon aria-label="resolved to">\u21B3</span>`;
43-
const evalIcon = html`<span class=trace-line-icon aria-label="is equal to">\u003D</span>`;
44-
const [firstEvaluation, ...intermediateEvaluations] = input.evaluations;
45-
render(
46-
// clang-format off
47-
html`
48-
<div class="css-value-trace monospace">
49-
${input.substitutions.map(line => html`${substitutionIcon}<span class="trace-line">${line}</span>`)}
50-
${
51-
firstEvaluation && intermediateEvaluations.length === 0
52-
? html`${evalIcon}<span class="trace-line">${firstEvaluation}</span>`
53-
: html`<details
54-
@toggle=${input.onToggle}
55-
?hidden=${!firstEvaluation || intermediateEvaluations.length === 0}>
56-
<summary>
57-
${evalIcon}<devtools-icon class=marker></devtools-icon><span class="trace-line">${firstEvaluation}</span>
58-
</summary>
59-
<div>
60-
${intermediateEvaluations.map(evaluation => html`${evalIcon}<span class="trace-line">${evaluation}</span>`)}
61-
</div>
62-
</details>`
63-
}
64-
${!input.finalResult ? '' : html`${evalIcon}<span class="trace-line">${input.finalResult}</span>`}
65-
</div>
66-
`,
67-
// clang-format on
68-
target,
69-
);
70-
},
71-
) {
83+
constructor(view: View = defaultView) {
7284
super(true);
73-
this.registerRequiredCSS(cssValueTraceViewStyles, stylePropertiesTreeOutlineStyles);
85+
this.registerRequiredCSS(
86+
cssValueTraceViewStyles,
87+
stylePropertiesTreeOutlineStyles,
88+
);
7489
this.#view = view;
7590
this.requestUpdate();
7691
}

front_end/panels/elements/cssValueTraceView.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
.css-value-trace {
8-
--cell-width: 2em;
8+
--cell-width: 1.5em;
99

1010
display: grid;
1111
grid-template-columns: var(--cell-width) 1fr;
@@ -15,7 +15,6 @@
1515
grid-column-start: 1;
1616
width: var(--sys-size-9);
1717
height: var(--sys-size-9);
18-
font-size: var(--sys-size-9);
1918
text-align: center;
2019
color: var(--icon-default);
2120
padding-top: var(--sys-size-4);

0 commit comments

Comments
 (0)