Commit 0bd404c0 authored by Yang Guo's avatar Yang Guo Committed by Commit Bot

DevTools: refer to newer docs for performance metrics

TBR=luoe@chromium.org

Bug: chromium:999739
Change-Id: I6a9a0a6c70f98f5cf018aa473e30a7b4dc659ec2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1778614Reviewed-by: default avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#692414}
parent 04f4644c
......@@ -698,6 +698,36 @@ Timeline.TimelineUIUtils = class {
}
}
/**
* @param {!SDK.TracingModel.Event} event
* @return {!Element}
*/
static buildDetailsNodeForPerformanceEvent(event) {
/** @type {string} */
let link =
'https://developers.google.com/web/fundamentals/performance/user-centric-performance-metrics#user-centric_performance_metrics';
let name = 'page performance metrics';
const recordType = TimelineModel.TimelineModel.RecordType;
switch (event.name) {
case recordType.MarkLCPCandidate:
link = 'https://web.dev/largest-contentful-paint';
name = 'largest contentful paint';
break;
case recordType.MarkFCP:
link = 'https://web.dev/first-contentful-paint';
name = 'first contentful paint';
break;
case recordType.MarkFMP:
link = 'https://web.dev/first-meaningful-paint/';
name = 'first meaningful paint';
break;
default:
break;
}
return UI.html`<div>${UI.XLink.create(link, ls`Learn more`)} about ${name}.</div>`;
}
/**
* @param {!SDK.TracingModel.Event} event
* @param {!TimelineModel.TimelineModel} model
......@@ -954,11 +984,8 @@ Timeline.TimelineUIUtils = class {
case recordTypes.MarkDOMContent:
contentHelper.appendTextRow(
ls`Timestamp`, Number.preciseMillisToString(event.startTime - model.minimumRecordTime(), 1));
const learnMoreLink = UI.XLink.create(
'https://developers.google.com/web/fundamentals/performance/user-centric-performance-metrics#user-centric_performance_metrics',
ls`Learn more`);
const linkDiv = UI.html`<div>${learnMoreLink} about page performance metrics.</div>`;
contentHelper.appendElementRow(ls`Details`, linkDiv);
contentHelper.appendElementRow(
ls`Details`, Timeline.TimelineUIUtils.buildDetailsNodeForPerformanceEvent(event));
break;
default: {
......
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