Skip to content

Commit 7463a4b

Browse files
danilsomsikovDevtools-frontend LUCI CQ
authored andcommitted
Create DOMNodeLinks as in Lit templates
Bug: 407750239 Change-Id: I72ed58a87a67e737008fe809bd1afe6e081103a1 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7156363 Commit-Queue: Danil Somsikov <[email protected]> Auto-Submit: Danil Somsikov <[email protected]> Reviewed-by: Jack Franklin <[email protected]>
1 parent 9138bce commit 7463a4b

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

front_end/panels/timeline/components/LiveMetricsView.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import metricValueStyles from './metricValueStyles.css.js';
4141
import {CLS_THRESHOLDS, INP_THRESHOLDS, renderMetricValue} from './Utils.js';
4242

4343
const {html, nothing} = Lit;
44+
const {widgetConfig} = UI.Widget;
4445

4546
type DeviceOption = CrUXManager.DeviceScope|'AUTO';
4647

@@ -475,7 +476,10 @@ export class LiveMetricsView extends LegacyWrapper.LegacyWrapper.WrappableCompon
475476
${nodeLink ? html`
476477
<div class="related-info" slot="extra-info">
477478
<span class="related-info-label">${i18nString(UIStrings.lcpElement)}</span>
478-
<span class="related-info-link">${nodeLink}</span>
479+
<span class="related-info-link">
480+
<devtools-widget .widgetConfig=${widgetConfig(PanelsCommon.DOMLinkifier.DOMNodeLink, {node: this.#lcpValue?.nodeRef})}>
481+
</devtools-widget>
482+
</span>
479483
</div>
480484
`
481485
: nothing}
@@ -638,7 +642,7 @@ export class LiveMetricsView extends LegacyWrapper.LegacyWrapper.WrappableCompon
638642
</ul>
639643
` : nothing}
640644
<div class="environment-option">
641-
<devtools-widget .widgetConfig=${UI.Widget.widgetConfig(CPUThrottlingSelector, {recommendedOption: recs.cpuOption})}></devtools-widget>
645+
<devtools-widget .widgetConfig=${widgetConfig(CPUThrottlingSelector, {recommendedOption: recs.cpuOption})}></devtools-widget>
642646
</div>
643647
<div class="environment-option">
644648
<devtools-network-throttling-selector .recommendedConditions=${recs.networkConditions}></devtools-network-throttling-selector>
@@ -948,7 +952,6 @@ export class LiveMetricsView extends LegacyWrapper.LegacyWrapper.WrappableCompon
948952
949953
const isP98Excluded = this.#inpValue && this.#inpValue.value < interaction.duration;
950954
const isInp = this.#inpValue?.interactionId === interaction.interactionId;
951-
const nodeLink = interaction.nodeRef ? PanelsCommon.DOMLinkifier.Linkifier.instance().linkify(interaction.nodeRef) : Lit.nothing;
952955
953956
return html`
954957
<li id=${interaction.interactionId} class="log-item interaction" tabindex="-1">
@@ -959,7 +962,10 @@ export class LiveMetricsView extends LegacyWrapper.LegacyWrapper.WrappableCompon
959962
html`<span class="interaction-inp-chip" title=${i18nString(UIStrings.inpInteraction)}>INP</span>`
960963
: nothing}
961964
</span>
962-
<span class="interaction-node">${nodeLink}</span>
965+
<span class="interaction-node">
966+
<devtools-widget .widgetConfig=${widgetConfig(PanelsCommon.DOMLinkifier.DOMNodeLink, {node: interaction.nodeRef})}>
967+
</devtools-widget>
968+
</span>
963969
${isP98Excluded ? html`<devtools-icon
964970
class="interaction-info"
965971
name="info"
@@ -1066,7 +1072,10 @@ export class LiveMetricsView extends LegacyWrapper.LegacyWrapper.WrappableCompon
10661072
<div class="layout-shift-score">Layout shift score: ${metricValue}</div>
10671073
<div class="layout-shift-nodes">
10681074
${layoutShift.affectedNodeRefs.map(node => html`
1069-
<div class="layout-shift-node">${PanelsCommon.DOMLinkifier.Linkifier.instance().linkify(node)}</div>
1075+
<div class="layout-shift-node">
1076+
<devtools-widget .widgetConfig=${widgetConfig(PanelsCommon.DOMLinkifier.DOMNodeLink, {node})}>
1077+
</devtools-widget>
1078+
</div>
10701079
`)}
10711080
</div>
10721081
</li>

0 commit comments

Comments
 (0)