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.
Files changed (144) hide show
  1. package/front_end/.eslintrc.js +6 -0
  2. package/front_end/entrypoints/formatter_worker/AcornTokenizer.ts +36 -36
  3. package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +53 -53
  4. package/front_end/entrypoints/formatter_worker/ESTreeWalker.ts +11 -11
  5. package/front_end/entrypoints/formatter_worker/FormattedContentBuilder.ts +43 -43
  6. package/front_end/entrypoints/formatter_worker/HTMLFormatter.ts +106 -105
  7. package/front_end/entrypoints/formatter_worker/JavaScriptFormatter.ts +26 -26
  8. package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +50 -55
  9. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +200 -200
  10. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +84 -83
  11. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.ts +15 -15
  12. package/front_end/entrypoints/inspector_main/InspectorMain.ts +21 -21
  13. package/front_end/entrypoints/main/ExecutionContextSelector.ts +30 -30
  14. package/front_end/entrypoints/main/MainImpl.ts +12 -12
  15. package/front_end/entrypoints/node_app/NodeConnectionsPanel.ts +33 -33
  16. package/front_end/entrypoints/node_app/NodeMain.ts +35 -35
  17. package/front_end/generated/InspectorBackendCommands.js +5 -1
  18. package/front_end/generated/protocol.d.ts +16 -0
  19. package/front_end/models/issues_manager/ContentSecurityPolicyIssue.ts +6 -6
  20. package/front_end/models/issues_manager/ContrastCheckTrigger.ts +15 -15
  21. package/front_end/models/issues_manager/CorsIssue.ts +9 -9
  22. package/front_end/models/issues_manager/CrossOriginEmbedderPolicyIssue.ts +5 -5
  23. package/front_end/models/issues_manager/DeprecationIssue.ts +7 -7
  24. package/front_end/models/issues_manager/GenericIssue.ts +5 -5
  25. package/front_end/models/issues_manager/HeavyAdIssue.ts +5 -5
  26. package/front_end/models/issues_manager/Issue.ts +10 -10
  27. package/front_end/models/issues_manager/IssueResolver.ts +11 -10
  28. package/front_end/models/issues_manager/IssuesManager.ts +56 -56
  29. package/front_end/models/issues_manager/LowTextContrastIssue.ts +4 -4
  30. package/front_end/models/issues_manager/MixedContentIssue.ts +7 -7
  31. package/front_end/models/issues_manager/NavigatorUserAgentIssue.ts +7 -7
  32. package/front_end/models/issues_manager/QuirksModeIssue.ts +4 -4
  33. package/front_end/models/issues_manager/SameSiteCookieIssue.ts +16 -16
  34. package/front_end/models/issues_manager/SharedArrayBufferIssue.ts +5 -5
  35. package/front_end/models/issues_manager/SourceFrameIssuesManager.ts +32 -31
  36. package/front_end/models/issues_manager/TrustedWebActivityIssue.ts +5 -5
  37. package/front_end/models/issues_manager/WasmCrossOriginModuleSharingIssue.ts +5 -5
  38. package/front_end/panels/application/components/BackForwardCacheView.ts +33 -33
  39. package/front_end/panels/application/components/EndpointsGrid.ts +12 -12
  40. package/front_end/panels/application/components/FrameDetailsView.ts +108 -110
  41. package/front_end/panels/application/components/OriginTrialTreeView.ts +45 -45
  42. package/front_end/panels/application/components/PermissionsPolicySection.ts +19 -19
  43. package/front_end/panels/application/components/ReportsGrid.ts +30 -30
  44. package/front_end/panels/application/components/StackTrace.ts +48 -47
  45. package/front_end/panels/application/components/TrustTokensView.ts +31 -31
  46. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +41 -52
  47. package/front_end/panels/css_overview/CSSOverviewController.ts +2 -2
  48. package/front_end/panels/css_overview/CSSOverviewPanel.ts +18 -27
  49. package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +2 -2
  50. package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +6 -6
  51. package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +4 -4
  52. package/front_end/panels/elements/components/AccessibilityTreeNode.ts +17 -17
  53. package/front_end/panels/elements/components/AdornerManager.ts +21 -21
  54. package/front_end/panels/elements/components/AdornerSettingsPane.ts +14 -14
  55. package/front_end/panels/elements/components/CSSQuery.ts +16 -16
  56. package/front_end/panels/elements/components/ComputedStyleProperty.ts +14 -14
  57. package/front_end/panels/elements/components/ComputedStyleTrace.ts +15 -15
  58. package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +78 -78
  59. package/front_end/panels/elements/components/ElementsPanelLink.ts +16 -16
  60. package/front_end/panels/elements/components/LayoutPane.ts +47 -47
  61. package/front_end/panels/elements/components/NodeText.ts +18 -18
  62. package/front_end/panels/elements/components/QueryContainer.ts +40 -40
  63. package/front_end/panels/elements/components/StylePropertyEditor.ts +18 -18
  64. package/front_end/panels/emulation/components/DeviceSizeInputElement.ts +4 -4
  65. package/front_end/panels/issues/AffectedBlockedByResponseView.ts +4 -4
  66. package/front_end/panels/issues/AffectedCookiesView.ts +4 -5
  67. package/front_end/panels/issues/AffectedDirectivesView.ts +19 -19
  68. package/front_end/panels/issues/AffectedDocumentsInQuirksModeView.ts +7 -8
  69. package/front_end/panels/issues/AffectedElementsView.ts +4 -4
  70. package/front_end/panels/issues/AffectedElementsWithLowContrastView.ts +7 -8
  71. package/front_end/panels/issues/AffectedHeavyAdView.ts +8 -8
  72. package/front_end/panels/issues/AffectedResourcesView.ts +25 -26
  73. package/front_end/panels/issues/AffectedSharedArrayBufferIssueDetailsView.ts +8 -8
  74. package/front_end/panels/issues/AffectedSourcesView.ts +4 -4
  75. package/front_end/panels/issues/AffectedTrustedWebActivityIssueDetailsView.ts +4 -4
  76. package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +17 -17
  77. package/front_end/panels/issues/CSPViolationsListView.ts +22 -23
  78. package/front_end/panels/issues/CSPViolationsView.ts +17 -17
  79. package/front_end/panels/issues/ComboBoxOfCheckBoxes.ts +13 -13
  80. package/front_end/panels/issues/CorsIssueDetailsView.ts +23 -23
  81. package/front_end/panels/issues/GenericIssueDetailsView.ts +4 -4
  82. package/front_end/panels/issues/HiddenIssuesRow.ts +7 -7
  83. package/front_end/panels/issues/IssueAggregator.ts +95 -95
  84. package/front_end/panels/issues/IssueKindView.ts +14 -14
  85. package/front_end/panels/issues/IssueView.ts +98 -98
  86. package/front_end/panels/issues/IssuesPane.ts +102 -102
  87. package/front_end/panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts +5 -5
  88. package/front_end/panels/issues/components/HideIssuesMenu.ts +10 -10
  89. package/front_end/panels/media/PlayerListView.ts +160 -97
  90. package/front_end/panels/media/PlayerMessagesView.ts +1 -0
  91. package/front_end/panels/media/playerListView.css +58 -0
  92. package/front_end/panels/network/NetworkLogView.ts +2 -6
  93. package/front_end/panels/network/NetworkWaterfallColumn.ts +2 -4
  94. package/front_end/panels/network/components/RequestTrustTokensView.ts +40 -40
  95. package/front_end/panels/network/components/WebBundleInfoView.ts +9 -9
  96. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +6 -12
  97. package/front_end/panels/settings/components/SyncSection.ts +14 -14
  98. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +96 -96
  99. package/front_end/panels/sources/BreakpointEditDialog.ts +4 -3
  100. package/front_end/panels/timeline/components/WebVitalsLane.ts +77 -76
  101. package/front_end/panels/timeline/components/WebVitalsTimeline.ts +133 -133
  102. package/front_end/panels/timeline/components/WebVitalsTooltip.ts +9 -9
  103. package/front_end/panels/webauthn/WebauthnPane.ts +203 -205
  104. package/front_end/ui/components/adorners/Adorner.ts +2 -2
  105. package/front_end/ui/components/buttons/Button.ts +9 -9
  106. package/front_end/ui/components/data_grid/DataGrid.ts +62 -62
  107. package/front_end/ui/components/data_grid/DataGridController.ts +22 -22
  108. package/front_end/ui/components/diff_view/DiffView.ts +6 -6
  109. package/front_end/ui/components/expandable_list/ExpandableList.ts +5 -5
  110. package/front_end/ui/components/icon_button/Icon.ts +4 -4
  111. package/front_end/ui/components/icon_button/IconButton.ts +4 -4
  112. package/front_end/ui/components/issue_counter/IssueCounter.ts +3 -3
  113. package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +11 -11
  114. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +50 -50
  115. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +6 -6
  116. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +4 -4
  117. package/front_end/ui/components/linear_memory_inspector/LinearMemoryNavigator.ts +12 -12
  118. package/front_end/ui/components/linear_memory_inspector/LinearMemoryValueInterpreter.ts +11 -11
  119. package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +40 -39
  120. package/front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplay.ts +18 -18
  121. package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +6 -6
  122. package/front_end/ui/components/linkifier/LinkifierImpl.ts +4 -4
  123. package/front_end/ui/components/markdown_view/MarkdownImage.ts +5 -5
  124. package/front_end/ui/components/markdown_view/MarkdownLink.ts +2 -2
  125. package/front_end/ui/components/markdown_view/MarkdownView.ts +4 -4
  126. package/front_end/ui/components/panel_feedback/FeedbackButton.ts +2 -2
  127. package/front_end/ui/components/panel_feedback/PanelFeedback.ts +2 -2
  128. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +4 -4
  129. package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +22 -22
  130. package/front_end/ui/components/report_view/ReportView.ts +16 -16
  131. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +14 -14
  132. package/front_end/ui/components/settings/SettingCheckbox.ts +5 -5
  133. package/front_end/ui/components/survey_link/SurveyLink.ts +8 -8
  134. package/front_end/ui/components/text_editor/TextEditor.ts +9 -9
  135. package/front_end/ui/components/text_prompt/TextPrompt.ts +18 -18
  136. package/front_end/ui/components/tree_outline/TreeOutline.ts +69 -70
  137. package/front_end/ui/legacy/themeColors.css +2 -0
  138. package/front_end/ui/legacy/theme_support/theme_support_impl.ts +12 -0
  139. package/package.json +1 -1
  140. package/scripts/eslint_rules/lib/use_private_class_members.js +41 -0
  141. package/scripts/eslint_rules/tests/use_private_class_members_test.js +62 -0
  142. package/scripts/migration/class-fields/migrate.js +2 -3
  143. package/scripts/migration/class-fields/migrate.sh +1 -3
  144. 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
- private readonly shadow = this.attachShadow({mode: 'open'});
142
- private mainFrameNavigations: readonly number[] = [];
143
- private startTime = 0;
144
- private duration = 1000;
145
- private maxDuration = 1000;
146
- private width = 0;
147
- private height = 0;
148
- private canvas: HTMLCanvasElement;
149
- private hoverLane: number|null = null;
150
-
151
- private fcpLane: WebVitalsEventLane;
152
- private lcpLane: WebVitalsEventLane;
153
- private layoutShiftsLane: WebVitalsEventLane;
154
- private longTasksLane: WebVitalsTimeboxLane;
155
-
156
- private context: CanvasRenderingContext2D;
157
- private animationFrame: number|null = null;
158
-
159
- private overlay: WebVitalsTooltip;
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.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));
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.canvas.getContext('2d');
172
+ const context = this.#canvas.getContext('2d');
173
173
 
174
174
  assertInstanceOf(context, CanvasRenderingContext2D);
175
175
 
176
- this.context = context;
176
+ this.#context = context;
177
177
 
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);
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.overlay = document.createElement('devtools-timeline-webvitals-tooltip');
186
- this.overlay.style.position = 'absolute';
187
- this.overlay.style.visibility = 'hidden';
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.overlay);
189
+ this.ownerDocument.body.appendChild(this.#overlay);
190
190
  }
191
191
 
192
192
  set data(data: WebVitalsTimelineData) {
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;
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.fcpLane.setEvents(data.fcps);
199
+ this.#fcpLane.setEvents(data.fcps);
200
200
  }
201
201
 
202
202
  if (data.lcps) {
203
- this.lcpLane.setEvents(data.lcps);
203
+ this.#lcpLane.setEvents(data.lcps);
204
204
  }
205
205
 
206
206
  if (data.layoutShifts) {
207
- this.layoutShiftsLane.setEvents(data.layoutShifts);
207
+ this.#layoutShiftsLane.setEvents(data.layoutShifts);
208
208
  }
209
209
 
210
210
  if (data.longTasks) {
211
- this.longTasksLane.setTimeboxes(data.longTasks);
211
+ this.#longTasksLane.setTimeboxes(data.longTasks);
212
212
  }
213
213
 
214
- this.scheduleRender();
214
+ this.#scheduleRender();
215
215
  }
216
216
 
217
217
  getContext(): CanvasRenderingContext2D {
218
- return this.context;
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.overlay.style.visibility = 'hidden';
226
+ this.#overlay.style.visibility = 'hidden';
227
227
  }
228
228
 
229
229
  showOverlay(content: LitHtml.TemplateResult): void {
230
- this.overlay.data = {content};
231
- this.overlay.style.visibility = 'visible';
230
+ this.#overlay.data = {content};
231
+ this.#overlay.style.visibility = 'visible';
232
232
  }
233
233
 
234
- private handlePointerMove(e: MouseEvent): void {
235
- this.updateOverlayPosition(e.clientX, e.clientY);
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.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);
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.scheduleRender();
246
+ this.#scheduleRender();
247
247
  }
248
248
 
249
- private updateOverlayPosition(clientX: number, clientY: number): void {
249
+ #updateOverlayPosition(clientX: number, clientY: number): void {
250
250
  coordinator.read(() => {
251
251
  const bb1 = this.getBoundingClientRect();
252
- const bb2 = this.overlay.getBoundingClientRect();
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.overlay.style.top = `${clientY + 10}px`;
258
- this.overlay.style.left = `${x}px`;
257
+ this.#overlay.style.top = `${clientY + 10}px`;
258
+ this.#overlay.style.left = `${x}px`;
259
259
  });
260
260
  });
261
261
  }
262
262
 
263
- private handlePointerOut(_: MouseEvent): void {
264
- this.fcpLane.handlePointerMove(null);
265
- this.lcpLane.handlePointerMove(null);
266
- this.layoutShiftsLane.handlePointerMove(null);
267
- this.longTasksLane.handlePointerMove(null);
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.scheduleRender();
269
+ this.#scheduleRender();
270
270
  }
271
271
 
272
- private handleClick(e: MouseEvent): void {
272
+ #handleClick(e: MouseEvent): void {
273
273
  const x = e.offsetX;
274
274
 
275
275
  this.focus();
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);
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.scheduleRender();
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.startTime) / this.duration * this.width;
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.duration * this.width;
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.width = width;
304
- this.height = Math.max(height, 120);
303
+ this.#width = width;
304
+ this.#height = Math.max(height, 120);
305
305
 
306
- this.canvas.width = Math.floor(this.width * scale);
307
- this.canvas.height = Math.floor(this.height * scale);
308
- this.context.scale(scale, scale);
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.width + 'px';
311
- this.style.height = this.height + 'px';
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.canvas.getBoundingClientRect();
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.overlay.remove();
328
+ this.#overlay.remove();
329
329
  }
330
330
 
331
- private getMarkerTypeForFCPEvent(event: WebVitalsFCPEvent): MarkerType {
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
- private getMarkerTypeForLCPEvent(event: WebVitalsLCPEvent): MarkerType {
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
- private getFCPMarkerOverlay(): LitHtml.TemplateResult {
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
- private getLCPMarkerOverlay(): LitHtml.TemplateResult {
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
- private getLongTaskOverlay(timebox: Timebox): LitHtml.TemplateResult {
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
- private renderMainFrameNavigations(markers: readonly number[]): void {
437
- this.context.save();
438
- this.context.strokeStyle = 'blue';
439
- this.context.beginPath();
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.context.moveTo(this.tX(marker), 0);
442
- this.context.lineTo(this.tX(marker), this.height);
441
+ this.#context.moveTo(this.tX(marker), 0);
442
+ this.#context.lineTo(this.tX(marker), this.#height);
443
443
  }
444
- this.context.stroke();
445
- this.context.restore();
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.mainFrameNavigations.length && this.mainFrameNavigations[i] <= time) {
451
- prev = this.mainFrameNavigations[i];
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.context.save();
459
- this.context.clearRect(0, 0, this.width, this.height);
458
+ this.#context.save();
459
+ this.#context.clearRect(0, 0, this.#width, this.#height);
460
460
 
461
- this.context.strokeStyle = '#dadce0';
461
+ this.#context.strokeStyle = '#dadce0';
462
462
 
463
463
  // Render the grid in the background.
464
- this.context.beginPath();
464
+ this.#context.beginPath();
465
465
  for (let i = 0; i < NUMBER_OF_LANES; i++) {
466
- this.context.moveTo(0, (i * LINE_HEIGHT) + 0.5);
467
- this.context.lineTo(this.width, (i * LINE_HEIGHT) + 0.5);
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.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();
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.context.save();
476
- this.context.font = '11px ' + Host.Platform.fontFamily();
477
- const text = this.context.measureText('Web Vitals');
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.context.fillStyle = '#202124';
480
- this.context.fillText('Web Vitals', 6, 4 + height);
481
- this.context.restore();
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.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);
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
- private scheduleRender(): void {
499
- if (this.animationFrame) {
498
+ #scheduleRender(): void {
499
+ if (this.#animationFrame) {
500
500
  return;
501
501
  }
502
502
 
503
- this.animationFrame = window.requestAnimationFrame(() => {
504
- this.animationFrame = null;
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
- private readonly shadow = this.attachShadow({mode: 'open'});
22
- private content: LitHtml.TemplateResult|null = null;
21
+ readonly #shadow = this.attachShadow({mode: 'open'});
22
+ #content: LitHtml.TemplateResult|null = null;
23
23
 
24
24
  set data(data: WebVitalsTooltipData) {
25
- this.content = data.content;
26
- this.render();
25
+ this.#content = data.content;
26
+ this.#render();
27
27
  }
28
28
 
29
29
  connectedCallback(): void {
30
- this.shadow.adoptedStyleSheets = [webVitalsTooltipStyles];
31
- this.render();
30
+ this.#shadow.adoptedStyleSheets = [webVitalsTooltipStyles];
31
+ this.#render();
32
32
  }
33
33
 
34
- private render(): void {
34
+ #render(): void {
35
35
  // clang-format off
36
36
  LitHtml.render(LitHtml.html`<div class="tooltip">
37
- ${this.content}
37
+ ${this.#content}
38
38
  </div>
39
- `, this.shadow, {host: this});
39
+ `, this.#shadow, {host: this});
40
40
  // clang-format off
41
41
  }
42
42
  }