chrome-devtools-frontend 1.0.951864 → 1.0.952284
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/front_end/.eslintrc.js +6 -0
- package/front_end/entrypoints/formatter_worker/AcornTokenizer.ts +36 -36
- package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +53 -53
- package/front_end/entrypoints/formatter_worker/ESTreeWalker.ts +11 -11
- package/front_end/entrypoints/formatter_worker/FormattedContentBuilder.ts +43 -43
- package/front_end/entrypoints/formatter_worker/HTMLFormatter.ts +106 -105
- package/front_end/entrypoints/formatter_worker/JavaScriptFormatter.ts +26 -26
- package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +50 -55
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +200 -200
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +84 -83
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.ts +15 -15
- package/front_end/entrypoints/inspector_main/InspectorMain.ts +21 -21
- package/front_end/entrypoints/main/ExecutionContextSelector.ts +30 -30
- package/front_end/entrypoints/main/MainImpl.ts +12 -12
- package/front_end/entrypoints/node_app/NodeConnectionsPanel.ts +33 -33
- package/front_end/entrypoints/node_app/NodeMain.ts +35 -35
- package/front_end/generated/InspectorBackendCommands.js +5 -1
- package/front_end/generated/protocol.d.ts +16 -0
- package/front_end/models/issues_manager/ContentSecurityPolicyIssue.ts +6 -6
- package/front_end/models/issues_manager/ContrastCheckTrigger.ts +15 -15
- package/front_end/models/issues_manager/CorsIssue.ts +9 -9
- package/front_end/models/issues_manager/CrossOriginEmbedderPolicyIssue.ts +5 -5
- package/front_end/models/issues_manager/DeprecationIssue.ts +7 -7
- package/front_end/models/issues_manager/GenericIssue.ts +5 -5
- package/front_end/models/issues_manager/HeavyAdIssue.ts +5 -5
- package/front_end/models/issues_manager/Issue.ts +10 -10
- package/front_end/models/issues_manager/IssueResolver.ts +11 -10
- package/front_end/models/issues_manager/IssuesManager.ts +56 -56
- package/front_end/models/issues_manager/LowTextContrastIssue.ts +4 -4
- package/front_end/models/issues_manager/MixedContentIssue.ts +7 -7
- package/front_end/models/issues_manager/NavigatorUserAgentIssue.ts +7 -7
- package/front_end/models/issues_manager/QuirksModeIssue.ts +4 -4
- package/front_end/models/issues_manager/SameSiteCookieIssue.ts +16 -16
- package/front_end/models/issues_manager/SharedArrayBufferIssue.ts +5 -5
- package/front_end/models/issues_manager/SourceFrameIssuesManager.ts +32 -31
- package/front_end/models/issues_manager/TrustedWebActivityIssue.ts +5 -5
- package/front_end/models/issues_manager/WasmCrossOriginModuleSharingIssue.ts +5 -5
- package/front_end/panels/application/components/BackForwardCacheView.ts +33 -33
- package/front_end/panels/application/components/EndpointsGrid.ts +12 -12
- package/front_end/panels/application/components/FrameDetailsView.ts +108 -110
- package/front_end/panels/application/components/OriginTrialTreeView.ts +45 -45
- package/front_end/panels/application/components/PermissionsPolicySection.ts +19 -19
- package/front_end/panels/application/components/ReportsGrid.ts +30 -30
- package/front_end/panels/application/components/StackTrace.ts +48 -47
- package/front_end/panels/application/components/TrustTokensView.ts +31 -31
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +41 -52
- package/front_end/panels/css_overview/CSSOverviewController.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewPanel.ts +18 -27
- package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +6 -6
- package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +4 -4
- package/front_end/panels/elements/components/AccessibilityTreeNode.ts +17 -17
- package/front_end/panels/elements/components/AdornerManager.ts +21 -21
- package/front_end/panels/elements/components/AdornerSettingsPane.ts +14 -14
- package/front_end/panels/elements/components/CSSQuery.ts +16 -16
- package/front_end/panels/elements/components/ComputedStyleProperty.ts +14 -14
- package/front_end/panels/elements/components/ComputedStyleTrace.ts +15 -15
- package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +78 -78
- package/front_end/panels/elements/components/ElementsPanelLink.ts +16 -16
- package/front_end/panels/elements/components/LayoutPane.ts +47 -47
- package/front_end/panels/elements/components/NodeText.ts +18 -18
- package/front_end/panels/elements/components/QueryContainer.ts +40 -40
- package/front_end/panels/elements/components/StylePropertyEditor.ts +18 -18
- package/front_end/panels/emulation/components/DeviceSizeInputElement.ts +4 -4
- package/front_end/panels/issues/AffectedBlockedByResponseView.ts +4 -4
- package/front_end/panels/issues/AffectedCookiesView.ts +4 -5
- package/front_end/panels/issues/AffectedDirectivesView.ts +19 -19
- package/front_end/panels/issues/AffectedDocumentsInQuirksModeView.ts +7 -8
- package/front_end/panels/issues/AffectedElementsView.ts +4 -4
- package/front_end/panels/issues/AffectedElementsWithLowContrastView.ts +7 -8
- package/front_end/panels/issues/AffectedHeavyAdView.ts +8 -8
- package/front_end/panels/issues/AffectedResourcesView.ts +25 -26
- package/front_end/panels/issues/AffectedSharedArrayBufferIssueDetailsView.ts +8 -8
- package/front_end/panels/issues/AffectedSourcesView.ts +4 -4
- package/front_end/panels/issues/AffectedTrustedWebActivityIssueDetailsView.ts +4 -4
- package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +17 -17
- package/front_end/panels/issues/CSPViolationsListView.ts +22 -23
- package/front_end/panels/issues/CSPViolationsView.ts +17 -17
- package/front_end/panels/issues/ComboBoxOfCheckBoxes.ts +13 -13
- package/front_end/panels/issues/CorsIssueDetailsView.ts +23 -23
- package/front_end/panels/issues/GenericIssueDetailsView.ts +4 -4
- package/front_end/panels/issues/HiddenIssuesRow.ts +7 -7
- package/front_end/panels/issues/IssueAggregator.ts +95 -95
- package/front_end/panels/issues/IssueKindView.ts +14 -14
- package/front_end/panels/issues/IssueView.ts +98 -98
- package/front_end/panels/issues/IssuesPane.ts +102 -102
- package/front_end/panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts +5 -5
- package/front_end/panels/issues/components/HideIssuesMenu.ts +10 -10
- package/front_end/panels/media/PlayerListView.ts +160 -97
- package/front_end/panels/media/PlayerMessagesView.ts +1 -0
- package/front_end/panels/media/playerListView.css +58 -0
- package/front_end/panels/network/NetworkLogView.ts +2 -6
- package/front_end/panels/network/NetworkWaterfallColumn.ts +2 -4
- package/front_end/panels/network/components/RequestTrustTokensView.ts +40 -40
- package/front_end/panels/network/components/WebBundleInfoView.ts +9 -9
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +6 -12
- package/front_end/panels/settings/components/SyncSection.ts +14 -14
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +96 -96
- package/front_end/panels/sources/BreakpointEditDialog.ts +4 -3
- package/front_end/panels/timeline/components/WebVitalsLane.ts +77 -76
- package/front_end/panels/timeline/components/WebVitalsTimeline.ts +133 -133
- package/front_end/panels/timeline/components/WebVitalsTooltip.ts +9 -9
- package/front_end/panels/webauthn/WebauthnPane.ts +203 -205
- package/front_end/ui/components/adorners/Adorner.ts +2 -2
- package/front_end/ui/components/buttons/Button.ts +9 -9
- package/front_end/ui/components/data_grid/DataGrid.ts +62 -62
- package/front_end/ui/components/data_grid/DataGridController.ts +22 -22
- package/front_end/ui/components/diff_view/DiffView.ts +6 -6
- package/front_end/ui/components/expandable_list/ExpandableList.ts +5 -5
- package/front_end/ui/components/icon_button/Icon.ts +4 -4
- package/front_end/ui/components/icon_button/IconButton.ts +4 -4
- package/front_end/ui/components/issue_counter/IssueCounter.ts +3 -3
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +11 -11
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +50 -50
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +6 -6
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +4 -4
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryNavigator.ts +12 -12
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryValueInterpreter.ts +11 -11
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +40 -39
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplay.ts +18 -18
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +6 -6
- package/front_end/ui/components/linkifier/LinkifierImpl.ts +4 -4
- package/front_end/ui/components/markdown_view/MarkdownImage.ts +5 -5
- package/front_end/ui/components/markdown_view/MarkdownLink.ts +2 -2
- package/front_end/ui/components/markdown_view/MarkdownView.ts +4 -4
- package/front_end/ui/components/panel_feedback/FeedbackButton.ts +2 -2
- package/front_end/ui/components/panel_feedback/PanelFeedback.ts +2 -2
- package/front_end/ui/components/panel_feedback/PreviewToggle.ts +4 -4
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +22 -22
- package/front_end/ui/components/report_view/ReportView.ts +16 -16
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +14 -14
- package/front_end/ui/components/settings/SettingCheckbox.ts +5 -5
- package/front_end/ui/components/survey_link/SurveyLink.ts +8 -8
- package/front_end/ui/components/text_editor/TextEditor.ts +9 -9
- package/front_end/ui/components/text_prompt/TextPrompt.ts +18 -18
- package/front_end/ui/components/tree_outline/TreeOutline.ts +69 -70
- package/front_end/ui/legacy/themeColors.css +2 -0
- package/front_end/ui/legacy/theme_support/theme_support_impl.ts +12 -0
- package/package.json +1 -1
- package/scripts/eslint_rules/lib/use_private_class_members.js +41 -0
- package/scripts/eslint_rules/tests/use_private_class_members_test.js +62 -0
- package/scripts/migration/class-fields/migrate.js +2 -3
- package/scripts/migration/class-fields/migrate.sh +1 -3
- package/scripts/migration/class-fields/package.json +1 -1
|
@@ -138,84 +138,84 @@ export function assertInstanceOf<T>(instance: any, constructor: Constructor<T>):
|
|
|
138
138
|
|
|
139
139
|
export class WebVitalsTimeline extends HTMLElement {
|
|
140
140
|
static readonly litTagName = LitHtml.literal`devtools-timeline-webvitals`;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
141
|
+
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
142
|
+
#mainFrameNavigations: readonly number[] = [];
|
|
143
|
+
#startTime = 0;
|
|
144
|
+
#duration = 1000;
|
|
145
|
+
#maxDuration = 1000;
|
|
146
|
+
#width = 0;
|
|
147
|
+
#height = 0;
|
|
148
|
+
#canvas: HTMLCanvasElement;
|
|
149
|
+
#hoverLane: number|null = null;
|
|
150
|
+
|
|
151
|
+
#fcpLane: WebVitalsEventLane;
|
|
152
|
+
#lcpLane: WebVitalsEventLane;
|
|
153
|
+
#layoutShiftsLane: WebVitalsEventLane;
|
|
154
|
+
#longTasksLane: WebVitalsTimeboxLane;
|
|
155
|
+
|
|
156
|
+
#context: CanvasRenderingContext2D;
|
|
157
|
+
#animationFrame: number|null = null;
|
|
158
|
+
|
|
159
|
+
#overlay: WebVitalsTooltip;
|
|
160
160
|
|
|
161
161
|
constructor() {
|
|
162
162
|
super();
|
|
163
163
|
|
|
164
|
-
this
|
|
165
|
-
this
|
|
166
|
-
this
|
|
167
|
-
this
|
|
168
|
-
this
|
|
169
|
-
this
|
|
170
|
-
this
|
|
164
|
+
this.#canvas = document.createElement('canvas');
|
|
165
|
+
this.#canvas.style.width = '100%';
|
|
166
|
+
this.#canvas.style.height = `${Math.max(LINE_HEIGHT * NUMBER_OF_LANES, 120)}px`;
|
|
167
|
+
this.#shadow.appendChild(this.#canvas);
|
|
168
|
+
this.#canvas.addEventListener('pointermove', this.#handlePointerMove.bind(this));
|
|
169
|
+
this.#canvas.addEventListener('pointerout', this.#handlePointerOut.bind(this));
|
|
170
|
+
this.#canvas.addEventListener('click', this.#handleClick.bind(this));
|
|
171
171
|
|
|
172
|
-
const context = this
|
|
172
|
+
const context = this.#canvas.getContext('2d');
|
|
173
173
|
|
|
174
174
|
assertInstanceOf(context, CanvasRenderingContext2D);
|
|
175
175
|
|
|
176
|
-
this
|
|
176
|
+
this.#context = context;
|
|
177
177
|
|
|
178
|
-
this
|
|
179
|
-
this, i18nString(UIStrings.fcp), e => this
|
|
180
|
-
this
|
|
181
|
-
this, i18nString(UIStrings.lcp), e => this
|
|
182
|
-
this
|
|
183
|
-
this
|
|
178
|
+
this.#fcpLane = new WebVitalsEventLane(
|
|
179
|
+
this, i18nString(UIStrings.fcp), e => this.#getMarkerTypeForFCPEvent(e), this.#getFCPMarkerOverlay);
|
|
180
|
+
this.#lcpLane = new WebVitalsEventLane(
|
|
181
|
+
this, i18nString(UIStrings.lcp), e => this.#getMarkerTypeForLCPEvent(e), this.#getLCPMarkerOverlay);
|
|
182
|
+
this.#layoutShiftsLane = new WebVitalsEventLane(this, i18nString(UIStrings.ls), _ => MarkerType.Bad);
|
|
183
|
+
this.#longTasksLane = new WebVitalsTimeboxLane(this, i18nString(UIStrings.longTasks), this.#getLongTaskOverlay);
|
|
184
184
|
|
|
185
|
-
this
|
|
186
|
-
this
|
|
187
|
-
this
|
|
185
|
+
this.#overlay = document.createElement('devtools-timeline-webvitals-tooltip');
|
|
186
|
+
this.#overlay.style.position = 'absolute';
|
|
187
|
+
this.#overlay.style.visibility = 'hidden';
|
|
188
188
|
|
|
189
|
-
this.ownerDocument.body.appendChild(this
|
|
189
|
+
this.ownerDocument.body.appendChild(this.#overlay);
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
set data(data: WebVitalsTimelineData) {
|
|
193
|
-
this
|
|
194
|
-
this
|
|
195
|
-
this
|
|
196
|
-
this
|
|
193
|
+
this.#startTime = data.startTime || this.#startTime;
|
|
194
|
+
this.#duration = data.duration || this.#duration;
|
|
195
|
+
this.#maxDuration = data.maxDuration || this.#maxDuration;
|
|
196
|
+
this.#mainFrameNavigations = data.mainFrameNavigations || this.#mainFrameNavigations;
|
|
197
197
|
|
|
198
198
|
if (data.fcps) {
|
|
199
|
-
this
|
|
199
|
+
this.#fcpLane.setEvents(data.fcps);
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
if (data.lcps) {
|
|
203
|
-
this
|
|
203
|
+
this.#lcpLane.setEvents(data.lcps);
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
if (data.layoutShifts) {
|
|
207
|
-
this
|
|
207
|
+
this.#layoutShiftsLane.setEvents(data.layoutShifts);
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
if (data.longTasks) {
|
|
211
|
-
this
|
|
211
|
+
this.#longTasksLane.setTimeboxes(data.longTasks);
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
this
|
|
214
|
+
this.#scheduleRender();
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
getContext(): CanvasRenderingContext2D {
|
|
218
|
-
return this
|
|
218
|
+
return this.#context;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
getLineHeight(): number {
|
|
@@ -223,62 +223,62 @@ export class WebVitalsTimeline extends HTMLElement {
|
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
hideOverlay(): void {
|
|
226
|
-
this
|
|
226
|
+
this.#overlay.style.visibility = 'hidden';
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
showOverlay(content: LitHtml.TemplateResult): void {
|
|
230
|
-
this
|
|
231
|
-
this
|
|
230
|
+
this.#overlay.data = {content};
|
|
231
|
+
this.#overlay.style.visibility = 'visible';
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
|
|
235
|
-
this
|
|
234
|
+
#handlePointerMove(e: MouseEvent): void {
|
|
235
|
+
this.#updateOverlayPosition(e.clientX, e.clientY);
|
|
236
236
|
|
|
237
237
|
const x = e.offsetX, y = e.offsetY;
|
|
238
238
|
const lane = Math.floor(y / LINE_HEIGHT);
|
|
239
239
|
|
|
240
|
-
this
|
|
241
|
-
this
|
|
242
|
-
this
|
|
243
|
-
this
|
|
244
|
-
this
|
|
240
|
+
this.#hoverLane = lane;
|
|
241
|
+
this.#fcpLane.handlePointerMove(this.#hoverLane === 1 ? x : null);
|
|
242
|
+
this.#lcpLane.handlePointerMove(this.#hoverLane === 2 ? x : null);
|
|
243
|
+
this.#layoutShiftsLane.handlePointerMove(this.#hoverLane === 3 ? x : null);
|
|
244
|
+
this.#longTasksLane.handlePointerMove(this.#hoverLane === 4 ? x : null);
|
|
245
245
|
|
|
246
|
-
this
|
|
246
|
+
this.#scheduleRender();
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
|
|
249
|
+
#updateOverlayPosition(clientX: number, clientY: number): void {
|
|
250
250
|
coordinator.read(() => {
|
|
251
251
|
const bb1 = this.getBoundingClientRect();
|
|
252
|
-
const bb2 = this
|
|
252
|
+
const bb2 = this.#overlay.getBoundingClientRect();
|
|
253
253
|
|
|
254
254
|
const x = clientX + 10 + bb2.width > bb1.x + bb1.width ? clientX - bb2.width - 10 : clientX + 10;
|
|
255
255
|
|
|
256
256
|
coordinator.write(() => {
|
|
257
|
-
this
|
|
258
|
-
this
|
|
257
|
+
this.#overlay.style.top = `${clientY + 10}px`;
|
|
258
|
+
this.#overlay.style.left = `${x}px`;
|
|
259
259
|
});
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
|
|
264
|
-
this
|
|
265
|
-
this
|
|
266
|
-
this
|
|
267
|
-
this
|
|
263
|
+
#handlePointerOut(_: MouseEvent): void {
|
|
264
|
+
this.#fcpLane.handlePointerMove(null);
|
|
265
|
+
this.#lcpLane.handlePointerMove(null);
|
|
266
|
+
this.#layoutShiftsLane.handlePointerMove(null);
|
|
267
|
+
this.#longTasksLane.handlePointerMove(null);
|
|
268
268
|
|
|
269
|
-
this
|
|
269
|
+
this.#scheduleRender();
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
|
|
272
|
+
#handleClick(e: MouseEvent): void {
|
|
273
273
|
const x = e.offsetX;
|
|
274
274
|
|
|
275
275
|
this.focus();
|
|
276
|
-
this
|
|
277
|
-
this
|
|
278
|
-
this
|
|
279
|
-
this
|
|
276
|
+
this.#fcpLane.handleClick(this.#hoverLane === 1 ? x : null);
|
|
277
|
+
this.#lcpLane.handleClick(this.#hoverLane === 2 ? x : null);
|
|
278
|
+
this.#layoutShiftsLane.handleClick(this.#hoverLane === 3 ? x : null);
|
|
279
|
+
this.#longTasksLane.handleClick(this.#hoverLane === 4 ? x : null);
|
|
280
280
|
|
|
281
|
-
this
|
|
281
|
+
this.#scheduleRender();
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
/**
|
|
@@ -286,7 +286,7 @@ export class WebVitalsTimeline extends HTMLElement {
|
|
|
286
286
|
* @param x
|
|
287
287
|
*/
|
|
288
288
|
tX(x: number): number {
|
|
289
|
-
return (x - this
|
|
289
|
+
return (x - this.#startTime) / this.#duration * this.#width;
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
/**
|
|
@@ -294,21 +294,21 @@ export class WebVitalsTimeline extends HTMLElement {
|
|
|
294
294
|
* @param duration
|
|
295
295
|
*/
|
|
296
296
|
tD(duration: number): number {
|
|
297
|
-
return duration / this
|
|
297
|
+
return duration / this.#duration * this.#width;
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
setSize(width: number, height: number): void {
|
|
301
301
|
const scale = window.devicePixelRatio;
|
|
302
302
|
|
|
303
|
-
this
|
|
304
|
-
this
|
|
303
|
+
this.#width = width;
|
|
304
|
+
this.#height = Math.max(height, 120);
|
|
305
305
|
|
|
306
|
-
this
|
|
307
|
-
this
|
|
308
|
-
this
|
|
306
|
+
this.#canvas.width = Math.floor(this.#width * scale);
|
|
307
|
+
this.#canvas.height = Math.floor(this.#height * scale);
|
|
308
|
+
this.#context.scale(scale, scale);
|
|
309
309
|
|
|
310
|
-
this.style.width = this
|
|
311
|
-
this.style.height = this
|
|
310
|
+
this.style.width = this.#width + 'px';
|
|
311
|
+
this.style.height = this.#height + 'px';
|
|
312
312
|
this.render();
|
|
313
313
|
}
|
|
314
314
|
|
|
@@ -316,7 +316,7 @@ export class WebVitalsTimeline extends HTMLElement {
|
|
|
316
316
|
this.style.display = 'block';
|
|
317
317
|
this.tabIndex = 0;
|
|
318
318
|
|
|
319
|
-
const boundingClientRect = this
|
|
319
|
+
const boundingClientRect = this.#canvas.getBoundingClientRect();
|
|
320
320
|
const width = boundingClientRect.width;
|
|
321
321
|
const height = boundingClientRect.height;
|
|
322
322
|
|
|
@@ -325,10 +325,10 @@ export class WebVitalsTimeline extends HTMLElement {
|
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
disconnectedCallback(): void {
|
|
328
|
-
this
|
|
328
|
+
this.#overlay.remove();
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
-
|
|
331
|
+
#getMarkerTypeForFCPEvent(event: WebVitalsFCPEvent): MarkerType {
|
|
332
332
|
const t = this.getTimeSinceLastMainFrameNavigation(event.timestamp);
|
|
333
333
|
if (t <= FCP_GOOD_TIMING) {
|
|
334
334
|
return MarkerType.Good;
|
|
@@ -339,7 +339,7 @@ export class WebVitalsTimeline extends HTMLElement {
|
|
|
339
339
|
return MarkerType.Bad;
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
|
|
342
|
+
#getMarkerTypeForLCPEvent(event: WebVitalsLCPEvent): MarkerType {
|
|
343
343
|
const t = this.getTimeSinceLastMainFrameNavigation(event.timestamp);
|
|
344
344
|
if (t <= LCP_GOOD_TIMING) {
|
|
345
345
|
return MarkerType.Good;
|
|
@@ -350,7 +350,7 @@ export class WebVitalsTimeline extends HTMLElement {
|
|
|
350
350
|
return MarkerType.Bad;
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
|
|
353
|
+
#getFCPMarkerOverlay(): LitHtml.TemplateResult {
|
|
354
354
|
return LitHtml.html`
|
|
355
355
|
<table class="table">
|
|
356
356
|
<thead>
|
|
@@ -378,7 +378,7 @@ export class WebVitalsTimeline extends HTMLElement {
|
|
|
378
378
|
`;
|
|
379
379
|
}
|
|
380
380
|
|
|
381
|
-
|
|
381
|
+
#getLCPMarkerOverlay(): LitHtml.TemplateResult {
|
|
382
382
|
return LitHtml.html`
|
|
383
383
|
<table class="table">
|
|
384
384
|
<thead>
|
|
@@ -406,7 +406,7 @@ export class WebVitalsTimeline extends HTMLElement {
|
|
|
406
406
|
`;
|
|
407
407
|
}
|
|
408
408
|
|
|
409
|
-
|
|
409
|
+
#getLongTaskOverlay(timebox: Timebox): LitHtml.TemplateResult {
|
|
410
410
|
return LitHtml.html`
|
|
411
411
|
<table class="table">
|
|
412
412
|
<thead>
|
|
@@ -433,75 +433,75 @@ export class WebVitalsTimeline extends HTMLElement {
|
|
|
433
433
|
`;
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
-
|
|
437
|
-
this
|
|
438
|
-
this
|
|
439
|
-
this
|
|
436
|
+
#renderMainFrameNavigations(markers: readonly number[]): void {
|
|
437
|
+
this.#context.save();
|
|
438
|
+
this.#context.strokeStyle = 'blue';
|
|
439
|
+
this.#context.beginPath();
|
|
440
440
|
for (const marker of markers) {
|
|
441
|
-
this
|
|
442
|
-
this
|
|
441
|
+
this.#context.moveTo(this.tX(marker), 0);
|
|
442
|
+
this.#context.lineTo(this.tX(marker), this.#height);
|
|
443
443
|
}
|
|
444
|
-
this
|
|
445
|
-
this
|
|
444
|
+
this.#context.stroke();
|
|
445
|
+
this.#context.restore();
|
|
446
446
|
}
|
|
447
447
|
|
|
448
448
|
getTimeSinceLastMainFrameNavigation(time: number): number {
|
|
449
449
|
let i = 0, prev = 0;
|
|
450
|
-
while (i < this
|
|
451
|
-
prev = this
|
|
450
|
+
while (i < this.#mainFrameNavigations.length && this.#mainFrameNavigations[i] <= time) {
|
|
451
|
+
prev = this.#mainFrameNavigations[i];
|
|
452
452
|
i++;
|
|
453
453
|
}
|
|
454
454
|
return time - prev;
|
|
455
455
|
}
|
|
456
456
|
|
|
457
457
|
render(): void {
|
|
458
|
-
this
|
|
459
|
-
this
|
|
458
|
+
this.#context.save();
|
|
459
|
+
this.#context.clearRect(0, 0, this.#width, this.#height);
|
|
460
460
|
|
|
461
|
-
this
|
|
461
|
+
this.#context.strokeStyle = '#dadce0';
|
|
462
462
|
|
|
463
463
|
// Render the grid in the background.
|
|
464
|
-
this
|
|
464
|
+
this.#context.beginPath();
|
|
465
465
|
for (let i = 0; i < NUMBER_OF_LANES; i++) {
|
|
466
|
-
this
|
|
467
|
-
this
|
|
466
|
+
this.#context.moveTo(0, (i * LINE_HEIGHT) + 0.5);
|
|
467
|
+
this.#context.lineTo(this.#width, (i * LINE_HEIGHT) + 0.5);
|
|
468
468
|
}
|
|
469
|
-
this
|
|
470
|
-
this
|
|
471
|
-
this
|
|
472
|
-
this
|
|
469
|
+
this.#context.moveTo(0, NUMBER_OF_LANES * LINE_HEIGHT - 0.5);
|
|
470
|
+
this.#context.lineTo(this.#width, NUMBER_OF_LANES * LINE_HEIGHT - 0.5);
|
|
471
|
+
this.#context.stroke();
|
|
472
|
+
this.#context.restore();
|
|
473
473
|
|
|
474
474
|
// Render the WebVitals label.
|
|
475
|
-
this
|
|
476
|
-
this
|
|
477
|
-
const text = this
|
|
475
|
+
this.#context.save();
|
|
476
|
+
this.#context.font = '11px ' + Host.Platform.fontFamily();
|
|
477
|
+
const text = this.#context.measureText('Web Vitals');
|
|
478
478
|
const height = text.actualBoundingBoxAscent - text.actualBoundingBoxDescent;
|
|
479
|
-
this
|
|
480
|
-
this
|
|
481
|
-
this
|
|
479
|
+
this.#context.fillStyle = '#202124';
|
|
480
|
+
this.#context.fillText('Web Vitals', 6, 4 + height);
|
|
481
|
+
this.#context.restore();
|
|
482
482
|
|
|
483
483
|
// Render all the lanes.
|
|
484
|
-
this
|
|
485
|
-
this
|
|
486
|
-
this
|
|
487
|
-
this
|
|
488
|
-
this
|
|
489
|
-
this
|
|
490
|
-
this
|
|
491
|
-
this
|
|
492
|
-
this
|
|
493
|
-
this
|
|
494
|
-
|
|
495
|
-
this
|
|
484
|
+
this.#context.save();
|
|
485
|
+
this.#context.translate(0, Number(LINE_HEIGHT));
|
|
486
|
+
this.#fcpLane.render();
|
|
487
|
+
this.#context.translate(0, Number(LINE_HEIGHT));
|
|
488
|
+
this.#lcpLane.render();
|
|
489
|
+
this.#context.translate(0, Number(LINE_HEIGHT));
|
|
490
|
+
this.#layoutShiftsLane.render();
|
|
491
|
+
this.#context.translate(0, Number(LINE_HEIGHT));
|
|
492
|
+
this.#longTasksLane.render();
|
|
493
|
+
this.#context.restore();
|
|
494
|
+
|
|
495
|
+
this.#renderMainFrameNavigations(this.#mainFrameNavigations);
|
|
496
496
|
}
|
|
497
497
|
|
|
498
|
-
|
|
499
|
-
if (this
|
|
498
|
+
#scheduleRender(): void {
|
|
499
|
+
if (this.#animationFrame) {
|
|
500
500
|
return;
|
|
501
501
|
}
|
|
502
502
|
|
|
503
|
-
this
|
|
504
|
-
this
|
|
503
|
+
this.#animationFrame = window.requestAnimationFrame(() => {
|
|
504
|
+
this.#animationFrame = null;
|
|
505
505
|
this.render();
|
|
506
506
|
});
|
|
507
507
|
}
|
|
@@ -18,25 +18,25 @@ export interface WebVitalsTooltipData {
|
|
|
18
18
|
|
|
19
19
|
export class WebVitalsTooltip extends HTMLElement {
|
|
20
20
|
static readonly litTagName = LitHtml.literal`devtools-timeline-webvitals-tooltip`;
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
22
|
+
#content: LitHtml.TemplateResult|null = null;
|
|
23
23
|
|
|
24
24
|
set data(data: WebVitalsTooltipData) {
|
|
25
|
-
this
|
|
26
|
-
this
|
|
25
|
+
this.#content = data.content;
|
|
26
|
+
this.#render();
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
connectedCallback(): void {
|
|
30
|
-
this
|
|
31
|
-
this
|
|
30
|
+
this.#shadow.adoptedStyleSheets = [webVitalsTooltipStyles];
|
|
31
|
+
this.#render();
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
#render(): void {
|
|
35
35
|
// clang-format off
|
|
36
36
|
LitHtml.render(LitHtml.html`<div class="tooltip">
|
|
37
|
-
${this
|
|
37
|
+
${this.#content}
|
|
38
38
|
</div>
|
|
39
|
-
`, this
|
|
39
|
+
`, this.#shadow, {host: this});
|
|
40
40
|
// clang-format off
|
|
41
41
|
}
|
|
42
42
|
}
|