chrome-devtools-frontend 1.0.1664496 → 1.0.1665921

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 (407) hide show
  1. package/.agents/skills/devtools-testing-guidance/SKILL.md +48 -0
  2. package/.agents/skills/devtools-ux-writing-refactor/SKILL.md +3 -3
  3. package/.agents/skills/repro-flaky-tests/SKILL.md +2 -2
  4. package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +7 -1
  5. package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +2 -0
  6. package/.agents/skills/version-control/SKILL.md +4 -3
  7. package/docs/ui_engineering.md +89 -0
  8. package/eslint.config.mjs +9 -2
  9. package/front_end/Images/rollup.config.mjs +1 -1
  10. package/front_end/Tests.js +15 -16
  11. package/front_end/core/common/Gzip.ts +2 -2
  12. package/front_end/core/common/Settings.ts +4 -20
  13. package/front_end/core/common/Srcset.ts +1 -1
  14. package/front_end/core/common/VersionController.ts +1 -1
  15. package/front_end/core/host/AidaClient.ts +19 -4
  16. package/front_end/core/host/AidaGcaTranslation.ts +2 -2
  17. package/front_end/core/host/GcaClient.ts +2 -2
  18. package/front_end/core/host/GdpClient.ts +3 -3
  19. package/front_end/core/host/InspectorFrontendHostStub.ts +1 -1
  20. package/front_end/core/host/ResourceLoader.ts +15 -15
  21. package/front_end/core/protocol_client/DevToolsCDPConnection.ts +2 -2
  22. package/front_end/core/protocol_client/InspectorBackend.ts +1 -1
  23. package/front_end/core/root/Runtime.ts +0 -1
  24. package/front_end/core/sdk/CSSMatchedStyles.ts +78 -3
  25. package/front_end/core/sdk/CSSMetadata.ts +17 -12
  26. package/front_end/core/sdk/CSSProperty.ts +1 -1
  27. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +2 -2
  28. package/front_end/core/sdk/CSSRule.ts +3 -3
  29. package/front_end/core/sdk/CSSStyleSheetHeader.ts +3 -3
  30. package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +1 -1
  31. package/front_end/core/sdk/Connections.ts +1 -1
  32. package/front_end/core/sdk/DebuggerModel.ts +13 -13
  33. package/front_end/core/sdk/NetworkManager.ts +19 -19
  34. package/front_end/core/sdk/NetworkRequest.ts +57 -57
  35. package/front_end/core/sdk/OverlayModel.ts +1 -1
  36. package/front_end/core/sdk/PageResourceLoader.ts +2 -2
  37. package/front_end/core/sdk/RehydratingConnection.ts +5 -5
  38. package/front_end/core/sdk/ScreenCaptureModel.ts +1 -1
  39. package/front_end/core/sdk/Script.ts +2 -2
  40. package/front_end/core/sdk/ServerTiming.ts +7 -7
  41. package/front_end/core/sdk/ServiceWorkerCacheModel.ts +1 -1
  42. package/front_end/core/sdk/ServiceWorkerManager.ts +11 -11
  43. package/front_end/core/sdk/SourceMapScopeChainEntry.ts +2 -2
  44. package/front_end/core/sdk/SourceMapScopesInfo.ts +1 -1
  45. package/front_end/core/sdk/StorageKeyManager.ts +1 -1
  46. package/front_end/core/sdk/sdk-meta.ts +98 -98
  47. package/front_end/devtools_compatibility.js +15 -13
  48. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +4 -8
  49. package/front_end/entrypoints/main/MainImpl.ts +2 -3
  50. package/front_end/entrypoints/main/main-meta.ts +1 -16
  51. package/front_end/entrypoints/shell/shell.ts +1 -0
  52. package/front_end/entrypoints/trace_app/trace_app.ts +1 -0
  53. package/front_end/foundation/README.md +1 -1
  54. package/front_end/foundation/Universe.test.api.ts +73 -0
  55. package/front_end/foundation/Universe.ts +22 -0
  56. package/front_end/generated/InspectorBackendCommands.ts +2 -2
  57. package/front_end/generated/SupportedCSSProperties.js +1 -1
  58. package/front_end/generated/protocol.ts +19 -0
  59. package/front_end/models/ai_assistance/AiAgent2.ts +1 -1
  60. package/front_end/models/ai_assistance/AiConversation.ts +1 -1
  61. package/front_end/models/ai_assistance/BuiltInAi.ts +1 -1
  62. package/front_end/models/ai_assistance/ChangeManager.ts +0 -70
  63. package/front_end/models/ai_assistance/ExtensionScope.ts +2 -36
  64. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +9 -9
  65. package/front_end/models/ai_assistance/agents/AiAgent.ts +10 -2
  66. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +4 -4
  67. package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +1 -1
  68. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +21 -21
  69. package/front_end/models/ai_assistance/agents/StorageAgent.ts +4 -4
  70. package/front_end/models/ai_assistance/agents/StylingAgent.ts +1 -1
  71. package/front_end/models/ai_assistance/ai_assistance.ts +0 -5
  72. package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +11 -4
  73. package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +8 -2
  74. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +14 -11
  75. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +2 -2
  76. package/front_end/models/ai_assistance/performance/AICallTree.ts +2 -2
  77. package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +1 -1
  78. package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +9 -2
  79. package/front_end/models/ai_assistance/tools/GetStyles.ts +4 -4
  80. package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +2 -5
  81. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +2 -2
  82. package/front_end/models/ai_code_generation/AiCodeGeneration.ts +2 -2
  83. package/front_end/models/badges/badges-meta.ts +27 -0
  84. package/front_end/models/bindings/CSSWorkspaceBinding.ts +4 -3
  85. package/front_end/models/bindings/ContentProviderBasedProject.ts +1 -1
  86. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +6 -7
  87. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +5 -4
  88. package/front_end/models/bindings/PresentationConsoleMessageHelper.ts +72 -29
  89. package/front_end/models/bindings/ResourceMapping.ts +38 -32
  90. package/front_end/models/bindings/ResourceScriptMapping.ts +5 -7
  91. package/front_end/models/breakpoints/BreakpointManager.ts +2 -1
  92. package/front_end/models/har/Writer.ts +2 -2
  93. package/front_end/models/issues_manager/ElementAccessibilityIssue.ts +1 -1
  94. package/front_end/models/issues_manager/GenericIssue.ts +1 -1
  95. package/front_end/models/issues_manager/IssuesManager.ts +14 -5
  96. package/front_end/models/issues_manager/PartitioningBlobURLIssue.ts +1 -1
  97. package/front_end/models/issues_manager/SRIMessageSignatureIssue.ts +2 -2
  98. package/front_end/models/issues_manager/SourceFrameIssuesManager.ts +13 -2
  99. package/front_end/models/issues_manager/issues_manager.ts +0 -2
  100. package/front_end/models/live-metrics/LiveMetrics.ts +22 -5
  101. package/front_end/models/live-metrics/web-vitals-injected/rollup.config.mjs +1 -1
  102. package/front_end/models/live-metrics/web-vitals-injected/spec/spec.ts +10 -4
  103. package/front_end/models/logs/logs-meta.ts +23 -16
  104. package/front_end/models/persistence/AutomaticFileSystemWorkspaceBinding.ts +2 -2
  105. package/front_end/models/persistence/IsolatedFileSystem.ts +1 -1
  106. package/front_end/models/persistence/IsolatedFileSystemManager.ts +1 -1
  107. package/front_end/models/source_map_scopes/NamesResolver.ts +104 -86
  108. package/front_end/models/source_map_scopes/ScopeChainModel.ts +6 -2
  109. package/front_end/models/stack_trace/StackTraceModel.ts +1 -1
  110. package/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +1 -1
  111. package/front_end/models/trace/handlers/UserTimingsHandler.ts +17 -6
  112. package/front_end/models/trace/helpers/SamplesIntegrator.ts +1 -1
  113. package/front_end/models/trace/helpers/Timing.ts +1 -1
  114. package/front_end/models/trace/insights/Common.ts +1 -1
  115. package/front_end/models/trace/insights/DocumentLatency.ts +3 -3
  116. package/front_end/models/trace/insights/LCPDiscovery.ts +1 -1
  117. package/front_end/models/trace/insights/ModernHTTP.ts +1 -1
  118. package/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +2 -2
  119. package/front_end/models/workspace_diff/WorkspaceDiff.ts +14 -9
  120. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +2 -15
  121. package/front_end/panels/ai_assistance/ai_assistance.ts +1 -2
  122. package/front_end/panels/ai_assistance/components/ChatInput.ts +23 -19
  123. package/front_end/panels/ai_assistance/components/ChatMessage.ts +9 -18
  124. package/front_end/panels/ai_assistance/components/ChatView.ts +2 -35
  125. package/front_end/panels/ai_assistance/components/DisabledWidget.ts +1 -1
  126. package/front_end/panels/ai_assistance/components/ExploreWidget.ts +4 -4
  127. package/front_end/panels/ai_assistance/components/ImageResize.ts +74 -0
  128. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +2 -2
  129. package/front_end/panels/animation/AnimationGroupPreviewUI.ts +28 -29
  130. package/front_end/panels/animation/AnimationTimeline.ts +3 -3
  131. package/front_end/panels/animation/animationTimeline.css +0 -2
  132. package/front_end/panels/application/AppManifestView.ts +1 -1
  133. package/front_end/panels/application/ApplicationPanelSidebar.ts +1 -1
  134. package/front_end/panels/application/CookieItemsView.ts +1 -1
  135. package/front_end/panels/application/CrashReportContextView.ts +3 -3
  136. package/front_end/panels/application/DeviceBoundSessionsModel.ts +1 -1
  137. package/front_end/panels/application/DeviceBoundSessionsTreeElement.ts +1 -1
  138. package/front_end/panels/application/DeviceBoundSessionsView.ts +1 -1
  139. package/front_end/panels/application/IndexedDBViews.ts +1 -1
  140. package/front_end/panels/application/KeyValueStorageItemsView.ts +1 -1
  141. package/front_end/panels/application/OriginTrialTreeView.ts +1 -1
  142. package/front_end/panels/application/ServiceWorkersView.ts +6 -6
  143. package/front_end/panels/application/StorageBucketsTreeElement.ts +1 -1
  144. package/front_end/panels/application/StorageItemsToolbar.ts +3 -3
  145. package/front_end/panels/application/WebMCPView.ts +7 -5
  146. package/front_end/panels/application/components/AdsView.ts +21 -6
  147. package/front_end/panels/application/components/BackForwardCacheView.ts +2 -2
  148. package/front_end/panels/application/components/ProtocolHandlersView.ts +1 -1
  149. package/front_end/panels/application/components/StorageMetadataView.ts +1 -1
  150. package/front_end/panels/application/preloading/components/MismatchedPreloadingGrid.ts +2 -2
  151. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +2 -1
  152. package/front_end/panels/application/preloading/components/PreloadingString.ts +3 -3
  153. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +2 -1
  154. package/front_end/panels/autofill/AutofillView.ts +1 -1
  155. package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +1 -1
  156. package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +2 -2
  157. package/front_end/panels/changes/ChangesSidebar.ts +2 -2
  158. package/front_end/panels/changes/ChangesView.ts +4 -5
  159. package/front_end/panels/changes/CombinedDiffView.ts +3 -3
  160. package/front_end/panels/changes/changes-meta.ts +2 -2
  161. package/front_end/panels/common/AiCodeCompletionTeaser.ts +1 -1
  162. package/front_end/panels/common/AiCodeGenerationTeaser.ts +3 -3
  163. package/front_end/panels/common/BadgeNotification.ts +8 -8
  164. package/front_end/panels/common/DOMLinkifier.ts +1 -1
  165. package/front_end/panels/common/GdpSignUpDialog.ts +2 -2
  166. package/front_end/panels/common/GeminiRebrandPromoDialog.ts +1 -1
  167. package/front_end/panels/common/aiCodeCompletionDisclaimer.css +0 -1
  168. package/front_end/panels/console/ConsoleInsightTeaser.ts +1 -1
  169. package/front_end/panels/console/ConsolePinPane.ts +3 -3
  170. package/front_end/panels/console/ConsolePrompt.ts +6 -4
  171. package/front_end/panels/console/ConsoleSidebar.ts +8 -10
  172. package/front_end/panels/console_counters/WarningErrorCounter.ts +10 -11
  173. package/front_end/panels/coverage/CoverageView.ts +2 -2
  174. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +3 -3
  175. package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +1 -1
  176. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +1 -1
  177. package/front_end/panels/elements/CSSRuleValidator.ts +1 -1
  178. package/front_end/panels/elements/ComputedStyleWidget.ts +3 -2
  179. package/front_end/panels/elements/ElementsTreeElement.ts +3 -3
  180. package/front_end/panels/elements/EventListenersWidget.ts +1 -3
  181. package/front_end/panels/elements/LayoutPane.ts +23 -13
  182. package/front_end/panels/elements/StandaloneStylesContainer.ts +7 -7
  183. package/front_end/panels/elements/StylePropertiesSection.ts +33 -5
  184. package/front_end/panels/elements/StylePropertyTreeElement.ts +5 -5
  185. package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +6 -6
  186. package/front_end/panels/elements/StylesSidebarPane.ts +4 -3
  187. package/front_end/panels/elements/elements-meta.ts +18 -2
  188. package/front_end/panels/emulation/DeviceModeToolbar.ts +100 -40
  189. package/front_end/panels/emulation/DeviceModeView.ts +5 -4
  190. package/front_end/panels/emulation/MediaQueryInspector.ts +35 -19
  191. package/front_end/panels/event_listeners/EventListenersView.ts +4 -4
  192. package/front_end/panels/explain/components/ConsoleInsight.ts +8 -9
  193. package/front_end/panels/explain/explain-meta.ts +3 -3
  194. package/front_end/panels/layer_viewer/LayerTreeOutline.ts +135 -167
  195. package/front_end/panels/layer_viewer/Layers3DView.ts +10 -23
  196. package/front_end/panels/layer_viewer/layer_viewer-meta.ts +27 -0
  197. package/front_end/panels/lighthouse/LighthouseController.ts +44 -55
  198. package/front_end/panels/lighthouse/LighthousePanel.ts +9 -9
  199. package/front_end/panels/lighthouse/LighthouseReportSelector.ts +2 -2
  200. package/front_end/panels/lighthouse/LighthouseStartView.ts +9 -12
  201. package/front_end/panels/lighthouse/LighthouseStatusView.ts +33 -33
  202. package/front_end/panels/lighthouse/RadioSetting.ts +1 -1
  203. package/front_end/panels/lighthouse/lighthouse-meta.ts +131 -1
  204. package/front_end/panels/media/EventDisplayTable.ts +67 -94
  205. package/front_end/panels/media/PlayerListView.ts +1 -1
  206. package/front_end/panels/media/eventDisplayTable.css +9 -4
  207. package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +5 -5
  208. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +1 -1
  209. package/front_end/panels/network/EventSourceMessagesView.ts +98 -107
  210. package/front_end/panels/network/NetworkLogViewColumns.ts +1 -1
  211. package/front_end/panels/network/NetworkWaterfallColumn.ts +1 -1
  212. package/front_end/panels/network/RequestConditionsDrawer.ts +2 -2
  213. package/front_end/panels/network/RequestCookiesView.ts +2 -2
  214. package/front_end/panels/network/RequestHeadersView.ts +5 -5
  215. package/front_end/panels/network/RequestPayloadView.ts +4 -4
  216. package/front_end/panels/network/RequestTimingView.ts +2 -2
  217. package/front_end/panels/network/components/DirectSocketConnectionView.ts +1 -1
  218. package/front_end/panels/network/eventSourceMessagesView.css +12 -3
  219. package/front_end/panels/network/networkTimingTable.css +2 -2
  220. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +1 -1
  221. package/front_end/panels/profiler/BottomUpProfileDataGrid.ts +25 -29
  222. package/front_end/panels/profiler/HeapProfileView.ts +308 -247
  223. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +13 -3
  224. package/front_end/panels/profiler/HeapSnapshotView.ts +30 -10
  225. package/front_end/panels/profiler/HeapTimelineOverview.ts +5 -2
  226. package/front_end/panels/profiler/ProfileDataGrid.ts +128 -157
  227. package/front_end/panels/profiler/ProfileFlameChartDataProvider.ts +17 -5
  228. package/front_end/panels/profiler/ProfilesPanel.ts +2 -2
  229. package/front_end/panels/profiler/TopDownProfileDataGrid.ts +17 -21
  230. package/front_end/panels/profiler/profilesPanel.css +9 -13
  231. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +2 -2
  232. package/front_end/panels/recorder/CreateRecordingView.ts +4 -4
  233. package/front_end/panels/recorder/RecorderPanel.ts +6 -6
  234. package/front_end/panels/recorder/RecordingView.ts +1 -1
  235. package/front_end/panels/recorder/ReplaySection.ts +1 -1
  236. package/front_end/panels/recorder/StepView.ts +1 -1
  237. package/front_end/panels/recorder/injected/rollup.config.mjs +1 -1
  238. package/front_end/panels/search/SearchView.ts +1 -1
  239. package/front_end/panels/security/SecurityPanel.ts +54 -41
  240. package/front_end/panels/sensors/LocationsSettingsTab.ts +246 -233
  241. package/front_end/panels/sensors/SensorsView.ts +1 -1
  242. package/front_end/panels/settings/AISettingsTab.ts +11 -10
  243. package/front_end/panels/settings/SettingsScreen.ts +29 -24
  244. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +2 -2
  245. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +5 -5
  246. package/front_end/panels/sources/BreakpointEditDialog.ts +2 -2
  247. package/front_end/panels/sources/BreakpointsView.ts +1 -1
  248. package/front_end/panels/sources/CallStackSidebarPane.ts +2 -2
  249. package/front_end/panels/sources/DebuggerPausedMessage.ts +2 -2
  250. package/front_end/panels/sources/DebuggerPlugin.ts +25 -22
  251. package/front_end/panels/sources/ScopeChainSidebarPane.ts +3 -1
  252. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +7 -5
  253. package/front_end/panels/sources/sources-meta.ts +1 -1
  254. package/front_end/panels/timeline/CountersGraph.ts +1 -2
  255. package/front_end/panels/timeline/ExtensionTrackAppender.ts +1 -1
  256. package/front_end/panels/timeline/TimelineDetailsView.ts +2 -2
  257. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +2 -2
  258. package/front_end/panels/timeline/TimelineFlameChartView.ts +4 -4
  259. package/front_end/panels/timeline/TimelinePaintProfilerView.ts +1 -1
  260. package/front_end/panels/timeline/TimelinePanel.ts +53 -81
  261. package/front_end/panels/timeline/TimelineSelectorStatsView.ts +10 -3
  262. package/front_end/panels/timeline/TimelineUIUtils.ts +18 -4
  263. package/front_end/panels/timeline/TrackConfigBanner.ts +1 -1
  264. package/front_end/panels/timeline/components/ExportTraceOptions.ts +1 -1
  265. package/front_end/panels/timeline/components/LayoutShiftDetails.ts +8 -9
  266. package/front_end/panels/timeline/components/NetworkRequestTooltip.ts +1 -1
  267. package/front_end/panels/timeline/components/TimelineRangeSummaryView.ts +1 -1
  268. package/front_end/panels/timeline/components/insights/DuplicatedJavaScript.ts +2 -2
  269. package/front_end/panels/timeline/components/insights/LCPBreakdown.ts +1 -1
  270. package/front_end/panels/timeline/components/insights/LegacyJavaScript.ts +1 -1
  271. package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +2 -2
  272. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +5 -0
  273. package/front_end/panels/timeline/overlays/components/TimespanBreakdownOverlay.ts +13 -8
  274. package/front_end/panels/timeline/overlays/components/timespanBreakdownOverlay.css +1 -0
  275. package/front_end/panels/timeline/timeline-meta.ts +169 -0
  276. package/front_end/panels/timeline/timelineFlameChartView.css +5 -0
  277. package/front_end/panels/webauthn/WebauthnPane.ts +1 -1
  278. package/front_end/panels/whats_new/ReleaseNoteText.ts +9 -9
  279. package/front_end/panels/whats_new/resources/WNDT.md +7 -8
  280. package/front_end/third_party/chromium/README.chromium +1 -1
  281. package/front_end/third_party/web-vitals/README.chromium +2 -2
  282. package/front_end/third_party/web-vitals/package/README.md +120 -19
  283. package/front_end/third_party/web-vitals/package/attribution.d.ts +16 -0
  284. package/front_end/third_party/web-vitals/package/attribution.js +18 -0
  285. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.d.ts +1 -1
  286. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.d.ts +1 -7
  287. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.js +53 -32
  288. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.d.ts +2 -2
  289. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +43 -12
  290. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.d.ts +1 -1
  291. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.js +21 -3
  292. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.d.ts +1 -1
  293. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.js +30 -24
  294. package/front_end/third_party/web-vitals/package/dist/modules/lib/FCPEntryManager.d.ts +3 -0
  295. package/front_end/third_party/web-vitals/package/dist/modules/lib/FCPEntryManager.js +18 -0
  296. package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.d.ts +2 -1
  297. package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.js +18 -2
  298. package/front_end/third_party/web-vitals/package/dist/modules/lib/LCPEntryManager.d.ts +1 -0
  299. package/front_end/third_party/web-vitals/package/dist/modules/lib/LCPEntryManager.js +1 -0
  300. package/front_end/third_party/web-vitals/package/dist/modules/lib/bindReporter.d.ts +1 -1
  301. package/front_end/third_party/web-vitals/package/dist/modules/lib/generateUniqueID.js +1 -1
  302. package/front_end/third_party/web-vitals/package/dist/modules/lib/getLoadState.d.ts +1 -1
  303. package/front_end/third_party/web-vitals/package/dist/modules/lib/getLoadState.js +7 -7
  304. package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.js +1 -1
  305. package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.d.ts +1 -1
  306. package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.js +4 -1
  307. package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.d.ts +7 -3
  308. package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.js +20 -11
  309. package/front_end/third_party/web-vitals/package/dist/modules/lib/initUnique.js +8 -3
  310. package/front_end/third_party/web-vitals/package/dist/modules/lib/observe.d.ts +3 -1
  311. package/front_end/third_party/web-vitals/package/dist/modules/lib/observe.js +19 -4
  312. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/interactionCountPolyfill.js +1 -1
  313. package/front_end/third_party/web-vitals/package/dist/modules/lib/softNavs.d.ts +3 -0
  314. package/front_end/third_party/web-vitals/package/dist/modules/lib/softNavs.js +38 -0
  315. package/front_end/third_party/web-vitals/package/dist/modules/lib/whenIdleOrHidden.js +5 -1
  316. package/front_end/third_party/web-vitals/package/dist/modules/onCLS.d.ts +1 -1
  317. package/front_end/third_party/web-vitals/package/dist/modules/onCLS.js +30 -11
  318. package/front_end/third_party/web-vitals/package/dist/modules/onFCP.d.ts +1 -1
  319. package/front_end/third_party/web-vitals/package/dist/modules/onFCP.js +36 -4
  320. package/front_end/third_party/web-vitals/package/dist/modules/onINP.d.ts +1 -1
  321. package/front_end/third_party/web-vitals/package/dist/modules/onINP.js +42 -22
  322. package/front_end/third_party/web-vitals/package/dist/modules/onLCP.d.ts +1 -1
  323. package/front_end/third_party/web-vitals/package/dist/modules/onLCP.js +109 -30
  324. package/front_end/third_party/web-vitals/package/dist/modules/onTTFB.d.ts +1 -1
  325. package/front_end/third_party/web-vitals/package/dist/modules/onTTFB.js +25 -7
  326. package/front_end/third_party/web-vitals/package/dist/modules/types/base.d.ts +24 -1
  327. package/front_end/third_party/web-vitals/package/dist/modules/types/fcp.d.ts +1 -1
  328. package/front_end/third_party/web-vitals/package/dist/modules/types/inp.d.ts +14 -6
  329. package/front_end/third_party/web-vitals/package/dist/modules/types/lcp.d.ts +1 -1
  330. package/front_end/third_party/web-vitals/package/dist/modules/types/ttfb.d.ts +2 -2
  331. package/front_end/third_party/web-vitals/package/dist/modules/types.d.ts +26 -4
  332. package/front_end/third_party/web-vitals/package/package.json +21 -22
  333. package/front_end/third_party/web-vitals/package/src/attribution/onCLS.ts +1 -1
  334. package/front_end/third_party/web-vitals/package/src/attribution/onFCP.ts +62 -39
  335. package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +52 -15
  336. package/front_end/third_party/web-vitals/package/src/attribution/onLCP.ts +25 -7
  337. package/front_end/third_party/web-vitals/package/src/attribution/onTTFB.ts +43 -37
  338. package/front_end/third_party/web-vitals/package/src/lib/{polyfills/getFirstHiddenTimePolyfill.ts → FCPEntryManager.ts} +4 -14
  339. package/front_end/third_party/web-vitals/package/src/lib/InteractionManager.ts +22 -2
  340. package/front_end/third_party/web-vitals/package/src/lib/LCPEntryManager.ts +1 -0
  341. package/front_end/third_party/web-vitals/package/src/lib/bindReporter.ts +1 -1
  342. package/front_end/third_party/web-vitals/package/src/lib/generateUniqueID.ts +1 -1
  343. package/front_end/third_party/web-vitals/package/src/lib/getLoadState.ts +11 -12
  344. package/front_end/third_party/web-vitals/package/src/lib/getSelector.ts +1 -1
  345. package/front_end/third_party/web-vitals/package/src/lib/getVisibilityWatcher.ts +4 -1
  346. package/front_end/third_party/web-vitals/package/src/lib/initMetric.ts +24 -11
  347. package/front_end/third_party/web-vitals/package/src/lib/initUnique.ts +12 -4
  348. package/front_end/third_party/web-vitals/package/src/lib/observe.ts +26 -5
  349. package/front_end/third_party/web-vitals/package/src/lib/polyfills/interactionCountPolyfill.ts +1 -1
  350. package/front_end/third_party/web-vitals/package/src/lib/softNavs.ts +48 -0
  351. package/front_end/third_party/web-vitals/package/src/lib/whenIdleOrHidden.ts +12 -4
  352. package/front_end/third_party/web-vitals/package/src/onCLS.ts +75 -18
  353. package/front_end/third_party/web-vitals/package/src/onFCP.ts +66 -7
  354. package/front_end/third_party/web-vitals/package/src/onINP.ts +100 -39
  355. package/front_end/third_party/web-vitals/package/src/onLCP.ts +169 -34
  356. package/front_end/third_party/web-vitals/package/src/onTTFB.ts +50 -13
  357. package/front_end/third_party/web-vitals/package/src/types/base.ts +31 -10
  358. package/front_end/third_party/web-vitals/package/src/types/fcp.ts +1 -1
  359. package/front_end/third_party/web-vitals/package/src/types/inp.ts +14 -6
  360. package/front_end/third_party/web-vitals/package/src/types/lcp.ts +1 -1
  361. package/front_end/third_party/web-vitals/package/src/types/ttfb.ts +2 -2
  362. package/front_end/third_party/web-vitals/package/src/types.ts +32 -9
  363. package/front_end/third_party/web-vitals/patches/0001-Add-onEachInteraction-to-onINP-options.patch +11 -11
  364. package/front_end/third_party/web-vitals/rebuild.sh +2 -2
  365. package/front_end/third_party/web-vitals/web-vitals-tsconfig.json +2 -0
  366. package/front_end/ui/components/buttons/Button.ts +16 -0
  367. package/front_end/ui/components/dialogs/Dialog.ts +1 -1
  368. package/front_end/ui/components/highlighting/HighlightManager.ts +6 -1
  369. package/front_end/ui/components/highlighting/highlighting.ts +1 -1
  370. package/front_end/ui/components/icon_button/FileSourceIcon.ts +1 -1
  371. package/front_end/ui/components/linkifier/LinkifierImpl.ts +1 -1
  372. package/front_end/ui/components/markdown_view/MarkdownLinksMap.ts +2 -2
  373. package/front_end/ui/components/settings/SettingCheckbox.ts +12 -7
  374. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +2 -2
  375. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +6 -6
  376. package/front_end/ui/components/text_editor/javascript.ts +3 -1
  377. package/front_end/ui/components/tooltips/Tooltip.ts +1 -1
  378. package/front_end/ui/legacy/ContextMenu.ts +12 -2
  379. package/front_end/ui/legacy/ListControl.ts +1 -1
  380. package/front_end/ui/legacy/SelectMenu.docs.ts +17 -19
  381. package/front_end/ui/legacy/Toolbar.ts +4 -1
  382. package/front_end/ui/legacy/Treeoutline.ts +1 -1
  383. package/front_end/ui/legacy/components/color_picker/spectrum.css +1 -2
  384. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +1 -1
  385. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +50 -4
  386. package/front_end/ui/legacy/components/object_ui/JavaScriptREPL.ts +3 -1
  387. package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +4 -4
  388. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +8 -7
  389. package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +14 -11
  390. package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +1 -1
  391. package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +15 -5
  392. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +4 -4
  393. package/front_end/ui/legacy/components/utils/Linkifier.ts +5 -1
  394. package/front_end/ui/lit/render.ts +1 -1
  395. package/front_end/ui/settings/SettingUIRegistration.ts +8 -3
  396. package/front_end/ui/visual_logging/KnownContextValues.ts +8 -0
  397. package/front_end/ui/visual_logging/LoggingEvents.ts +1 -1
  398. package/inspector_overlay/main.ts +1 -1
  399. package/mcp/mcp.ts +5 -4
  400. package/package.json +13 -13
  401. package/front_end/models/ai_assistance/AgentProject.ts +0 -261
  402. package/front_end/models/ai_assistance/agents/PatchAgent.ts +0 -306
  403. package/front_end/models/issues_manager/CheckFormsIssuesTrigger.ts +0 -45
  404. package/front_end/models/text_utils/text_utils.ts +0 -5
  405. package/front_end/panels/ai_assistance/PatchWidget.ts +0 -867
  406. package/front_end/panels/ai_assistance/SelectWorkspaceDialog.ts +0 -368
  407. package/front_end/panels/ai_assistance/selectWorkspaceDialog.css +0 -92
@@ -1,7 +1,6 @@
1
1
  // Copyright 2020 The Chromium Authors
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
- /* eslint-disable @devtools/no-imperative-dom-api */
5
4
 
6
5
  /*
7
6
  * Copyright (C) 2009 280 North Inc. All Rights Reserved.
@@ -28,38 +27,17 @@
28
27
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
28
  */
30
29
 
31
- import * as i18n from '../../core/i18n/i18n.js';
32
30
  import * as Platform from '../../core/platform/platform.js';
33
31
  import type * as CPUProfile from '../../models/cpu_profile/cpu_profile.js';
34
- import {Icon} from '../../ui/kit/kit.js';
35
- import * as DataGrid from '../../ui/legacy/components/data_grid/data_grid.js';
36
32
  import * as UI from '../../ui/legacy/legacy.js';
37
33
 
38
- const UIStrings = {
39
- /**
40
- * @description This message is presented as a tooltip when developers investigate the performance
41
- * of a page. The tooltip alerts developers that some parts of code in execution were not optimized
42
- * (made to run faster) and that associated timing information must be considered with this in
43
- * mind. The placeholder text is the reason the code was not optimized.
44
- * @example {Optimized too many times} PH1
45
- */
46
- notOptimizedS: 'Not optimized: {PH1}',
47
- /**
48
- * @description Generic text with two placeholders separated by a comma
49
- * @example {1 613 680} PH1
50
- * @example {44 %} PH2
51
- */
52
- genericTextTwoPlaceholders: '{PH1}, {PH2}',
53
- } as const;
54
- const str_ = i18n.i18n.registerUIStrings('panels/profiler/ProfileDataGrid.ts', UIStrings);
55
- const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
56
- export class ProfileDataGridNode extends DataGrid.DataGrid.DataGridNode<unknown> {
34
+ export class ProfileEntry {
57
35
  searchMatchedSelfColumn: boolean;
58
36
  searchMatchedTotalColumn: boolean;
59
37
  searchMatchedFunctionColumn: boolean;
60
38
  profileNode: CPUProfile.ProfileTreeModel.ProfileNode;
61
39
  tree: ProfileDataGridTree;
62
- childrenByCallUID: Map<string, ProfileDataGridNode>;
40
+ childrenByCallUID: Map<string, ProfileEntry>;
63
41
  lastComparator: unknown;
64
42
  callUID: string;
65
43
  self: number;
@@ -67,16 +45,23 @@ export class ProfileDataGridNode extends DataGrid.DataGrid.DataGridNode<unknown>
67
45
  functionName: string;
68
46
  readonly deoptReason: string;
69
47
  url: Platform.DevToolsPath.UrlString;
70
- linkElement: Element|null;
71
48
  populated: boolean;
72
49
  savedSelf?: number;
73
50
  savedTotal?: number;
74
- savedChildren?: Array<DataGrid.DataGrid.DataGridNode<unknown>>;
51
+ savedChildren?: ProfileEntry[];
75
52
 
76
- constructor(
77
- profileNode: CPUProfile.ProfileTreeModel.ProfileNode, owningTree: ProfileDataGridTree, hasChildren: boolean) {
78
- super(null, hasChildren);
53
+ children: ProfileEntry[] = [];
54
+ parent: ProfileEntry|ProfileDataGridTree|null = null;
55
+ expanded = false;
56
+ private hasChildrenInternal: boolean;
79
57
 
58
+ private savedPosition: {
59
+ parent: ProfileEntry|ProfileDataGridTree,
60
+ index: number,
61
+ }|null = null;
62
+
63
+ constructor(profileNode: CPUProfile.ProfileTreeModel.ProfileNode, owningTree: ProfileDataGridTree,
64
+ hasChildren: boolean) {
80
65
  this.searchMatchedSelfColumn = false;
81
66
  this.searchMatchedTotalColumn = false;
82
67
  this.searchMatchedFunctionColumn = false;
@@ -92,13 +77,12 @@ export class ProfileDataGridNode extends DataGrid.DataGrid.DataGridNode<unknown>
92
77
  this.functionName = UI.UIUtils.beautifyFunctionName(profileNode.functionName);
93
78
  this.deoptReason = profileNode.deoptReason || '';
94
79
  this.url = profileNode.url;
95
- this.linkElement = null;
96
80
 
97
81
  this.populated = false;
82
+ this.hasChildrenInternal = hasChildren;
98
83
  }
99
84
 
100
- static sort<T>(gridNodeGroups: ProfileDataGridNode[][], comparator: (arg0: T, arg1: T) => number, force: boolean):
101
- void {
85
+ static sort<T>(gridNodeGroups: ProfileEntry[][], comparator: (arg0: T, arg1: T) => number, force: boolean): void {
102
86
  for (let gridNodeGroupIndex = 0; gridNodeGroupIndex < gridNodeGroups.length; ++gridNodeGroupIndex) {
103
87
  const gridNodes = gridNodeGroups[gridNodeGroupIndex];
104
88
  const count = gridNodes.length;
@@ -106,12 +90,7 @@ export class ProfileDataGridNode extends DataGrid.DataGrid.DataGridNode<unknown>
106
90
  for (let index = 0; index < count; ++index) {
107
91
  const gridNode = gridNodes[index];
108
92
 
109
- // If the grid node is collapsed, then don't sort children (save operation for later).
110
- // If the grid node has the same sorting as previously, then there is no point in sorting it again.
111
93
  if (!force && (!gridNode.expanded || gridNode.lastComparator === comparator)) {
112
- if (gridNode.children.length) {
113
- gridNode.shouldRefreshChildren = true;
114
- }
115
94
  continue;
116
95
  }
117
96
 
@@ -125,17 +104,13 @@ export class ProfileDataGridNode extends DataGrid.DataGrid.DataGridNode<unknown>
125
104
  // @ts-expect-error
126
105
  children.sort(comparator);
127
106
 
128
- for (let childIndex = 0; childIndex < childCount; ++childIndex) {
129
- children[childIndex].recalculateSiblings(childIndex);
130
- }
131
- gridNodeGroups.push((children as ProfileDataGridNode[]));
107
+ gridNodeGroups.push((children as ProfileEntry[]));
132
108
  }
133
109
  }
134
110
  }
135
111
  }
136
112
 
137
- static merge(container: ProfileDataGridTree|ProfileDataGridNode, child: ProfileDataGridNode, shouldAbsorb: boolean):
138
- void {
113
+ static merge(container: ProfileDataGridTree|ProfileEntry, child: ProfileEntry, shouldAbsorb: boolean): void {
139
114
  container.self += child.self;
140
115
 
141
116
  if (!shouldAbsorb) {
@@ -150,7 +125,7 @@ export class ProfileDataGridNode extends DataGrid.DataGrid.DataGridNode<unknown>
150
125
 
151
126
  for (let index = 0; index < count; ++index) {
152
127
  if (!shouldAbsorb || children[index] !== child) {
153
- container.appendChild((children[index] as ProfileDataGridNode));
128
+ container.appendChild((children[index] as ProfileEntry));
154
129
  }
155
130
  }
156
131
 
@@ -158,7 +133,7 @@ export class ProfileDataGridNode extends DataGrid.DataGrid.DataGridNode<unknown>
158
133
  count = children.length;
159
134
 
160
135
  for (let index = 0; index < count; ++index) {
161
- const orphanedChild = (children[index] as ProfileDataGridNode);
136
+ const orphanedChild = (children[index] as ProfileEntry);
162
137
  const existingChild = container.childrenByCallUID.get(orphanedChild.callUID);
163
138
 
164
139
  if (existingChild) {
@@ -169,7 +144,7 @@ export class ProfileDataGridNode extends DataGrid.DataGrid.DataGridNode<unknown>
169
144
  }
170
145
  }
171
146
 
172
- static populate(container: ProfileDataGridTree|ProfileDataGridNode): void {
147
+ static populate(container: ProfileDataGridTree|ProfileEntry): void {
173
148
  if (container.populated) {
174
149
  return;
175
150
  }
@@ -184,89 +159,49 @@ export class ProfileDataGridNode extends DataGrid.DataGrid.DataGridNode<unknown>
184
159
  }
185
160
  }
186
161
 
187
- override createCell(columnId: string): HTMLElement {
188
- switch (columnId) {
189
- case 'self': {
190
- const cell = this.createValueCell(this.self, this.selfPercent, columnId);
191
- cell.classList.toggle('highlight', this.searchMatchedSelfColumn);
192
- return cell;
193
- }
194
-
195
- case 'total': {
196
- const cell = this.createValueCell(this.total, this.totalPercent, columnId);
197
- cell.classList.toggle('highlight', this.searchMatchedTotalColumn);
198
- return cell;
199
- }
200
-
201
- case 'function': {
202
- const cell = this.createTD(columnId);
203
- cell.classList.toggle('highlight', this.searchMatchedFunctionColumn);
204
- if (this.deoptReason) {
205
- cell.classList.add('not-optimized');
206
- const warningIcon = new Icon();
207
- warningIcon.name = 'warning-filled';
208
- warningIcon.classList.add('profile-warn-marker', 'small');
209
- UI.Tooltip.Tooltip.install(warningIcon, i18nString(UIStrings.notOptimizedS, {PH1: this.deoptReason}));
210
- cell.appendChild(warningIcon);
211
- }
212
- UI.UIUtils.createTextChild(cell, this.functionName);
213
- if (this.profileNode.scriptId === '0') {
214
- return cell;
215
- }
216
- const urlElement = this.tree.formatter.linkifyNode(this);
217
- if (!urlElement) {
218
- return cell;
219
- }
220
- (urlElement as HTMLElement).style.maxWidth = '75%';
221
- cell.appendChild(urlElement);
222
- this.linkElement = urlElement;
223
- return cell;
224
- }
225
- }
226
- return super.createCell(columnId);
162
+ hasChildren(): boolean {
163
+ return this.hasChildrenInternal || this.children.length > 0;
227
164
  }
228
165
 
229
- createValueCell(value: number, percent: number, columnId: string): HTMLElement {
230
- const cell = document.createElement('td');
231
- cell.classList.add('numeric-column');
232
- const div = cell.createChild('div', 'profile-multiple-values');
233
- const valueSpan = div.createChild('span');
234
- const valueText = this.tree.formatter.formatValue(value, this);
235
- valueSpan.textContent = valueText;
236
- const percentSpan = div.createChild('span', 'percent-column');
237
- const percentText = this.tree.formatter.formatPercent(percent, this);
238
- percentSpan.textContent = percentText;
239
- const valueAccessibleText = this.tree.formatter.formatValueAccessibleText(value, this);
240
- this.setCellAccessibleName(
241
- i18nString(UIStrings.genericTextTwoPlaceholders, {PH1: valueAccessibleText, PH2: percentText}), cell, columnId);
242
- return cell;
166
+ setHasChildren(hasChildren: boolean): void {
167
+ this.hasChildrenInternal = hasChildren;
243
168
  }
244
169
 
245
- sort(comparator: (arg0: ProfileDataGridNode, arg1: ProfileDataGridNode) => number, force: boolean): void {
246
- const sortComparator =
247
- (comparator as (arg0: DataGrid.DataGrid.DataGridNode<unknown>, arg1: DataGrid.DataGrid.DataGridNode<unknown>) =>
248
- number);
249
- return ProfileDataGridNode.sort([[this]], sortComparator, force);
170
+ appendChild(child: ProfileEntry): void {
171
+ this.insertChild(child, this.children.length);
250
172
  }
251
173
 
252
- override insertChild(child: DataGrid.DataGrid.DataGridNode<unknown>, index: number): void {
253
- const profileDataGridNode = (child as ProfileDataGridNode);
254
- super.insertChild(profileDataGridNode, index);
255
- this.childrenByCallUID.set(profileDataGridNode.callUID, (profileDataGridNode));
174
+ insertChild(child: ProfileEntry, index: number): void {
175
+ const oldIndex = child.parent?.children.indexOf(child) ?? -1;
176
+ if (child.parent === this && oldIndex !== -1 && oldIndex < index) {
177
+ index--;
178
+ }
179
+ if (child.parent) {
180
+ child.parent.removeChild(child);
181
+ }
182
+ this.children.splice(index, 0, child);
183
+ child.parent = this;
184
+ this.childrenByCallUID.set(child.callUID, child);
256
185
  }
257
186
 
258
- override removeChild(profileDataGridNode: DataGrid.DataGrid.DataGridNode<unknown>): void {
259
- super.removeChild(profileDataGridNode);
260
- this.childrenByCallUID.delete((profileDataGridNode as ProfileDataGridNode).callUID);
187
+ removeChild(child: ProfileEntry): void {
188
+ const index = this.children.indexOf(child);
189
+ if (index !== -1) {
190
+ this.children.splice(index, 1);
191
+ child.parent = null;
192
+ this.childrenByCallUID.delete(child.callUID);
193
+ }
261
194
  }
262
195
 
263
- override removeChildren(): void {
264
- super.removeChildren();
265
-
196
+ removeChildren(): void {
197
+ for (const child of this.children) {
198
+ child.parent = null;
199
+ }
200
+ this.children = [];
266
201
  this.childrenByCallUID.clear();
267
202
  }
268
203
 
269
- findChild(node: CPUProfile.ProfileTreeModel.ProfileNode): ProfileDataGridNode|null {
204
+ findChild(node: CPUProfile.ProfileTreeModel.ProfileNode): ProfileEntry|null {
270
205
  if (!node) {
271
206
  return null;
272
207
  }
@@ -281,17 +216,14 @@ export class ProfileDataGridNode extends DataGrid.DataGrid.DataGridNode<unknown>
281
216
  return this.total / this.tree.total * 100.0;
282
217
  }
283
218
 
284
- override populate(): void {
285
- ProfileDataGridNode.populate(this);
219
+ populate(): void {
220
+ ProfileEntry.populate(this);
286
221
  }
287
222
 
288
223
  populateChildren(): void {
289
224
  // Not implemented.
290
225
  }
291
226
 
292
- // When focusing and collapsing we modify lots of nodes in the tree.
293
- // This allows us to restore them all to their original state when we revert.
294
-
295
227
  save(): void {
296
228
  if (this.savedChildren) {
297
229
  return;
@@ -303,10 +235,6 @@ export class ProfileDataGridNode extends DataGrid.DataGrid.DataGridNode<unknown>
303
235
  this.savedChildren = this.children.slice();
304
236
  }
305
237
 
306
- /**
307
- * When focusing and collapsing we modify lots of nodes in the tree.
308
- * This allows us to restore them all to their original state when we revert.
309
- */
310
238
  restore(): void {
311
239
  if (!this.savedChildren) {
312
240
  return;
@@ -323,32 +251,59 @@ export class ProfileDataGridNode extends DataGrid.DataGrid.DataGridNode<unknown>
323
251
  const count = children.length;
324
252
 
325
253
  for (let index = 0; index < count; ++index) {
326
- (children[index] as ProfileDataGridNode).restore();
254
+ (children[index] as ProfileEntry).restore();
327
255
  this.appendChild(children[index]);
328
256
  }
329
257
  }
330
258
 
331
- merge(child: ProfileDataGridNode, shouldAbsorb: boolean): void {
332
- ProfileDataGridNode.merge(this, child, shouldAbsorb);
259
+ merge(child: ProfileEntry, shouldAbsorb: boolean): void {
260
+ ProfileEntry.merge(this, child, shouldAbsorb);
261
+ }
262
+
263
+ savePosition(): void {
264
+ if (this.savedPosition) {
265
+ return;
266
+ }
267
+
268
+ if (!this.parent) {
269
+ throw new Error('savePosition: Node must have a parent.');
270
+ }
271
+ this.savedPosition = {parent: this.parent, index: this.parent.children.indexOf(this)};
272
+ }
273
+
274
+ restorePosition(): void {
275
+ if (!this.savedPosition) {
276
+ return;
277
+ }
278
+
279
+ if (this.parent !== this.savedPosition.parent) {
280
+ this.savedPosition.parent.insertChild(this, this.savedPosition.index);
281
+ }
282
+
283
+ this.savedPosition = null;
284
+ }
285
+
286
+ sort(comparator: (arg0: ProfileEntry, arg1: ProfileEntry) => number, force: boolean): void {
287
+ return ProfileEntry.sort([[this]], comparator, force);
333
288
  }
334
289
  }
335
290
 
336
291
  export class ProfileDataGridTree implements UI.SearchableView.Searchable {
337
292
  tree: this;
338
293
  self: number;
339
- children: ProfileDataGridNode[];
294
+ children: ProfileEntry[];
340
295
  readonly formatter: Formatter;
341
296
  readonly searchableView: UI.SearchableView.SearchableView;
342
297
  total: number;
343
- lastComparator: ((arg0: ProfileDataGridNode, arg1: ProfileDataGridNode) => number)|null;
344
- childrenByCallUID: Map<string, ProfileDataGridNode>;
298
+ lastComparator: ((arg0: ProfileEntry, arg1: ProfileEntry) => number)|null;
299
+ childrenByCallUID: Map<string, ProfileEntry>;
345
300
  deepSearch: boolean;
346
301
  populated: boolean;
347
302
  searchResults!: Array<{
348
- profileNode: ProfileDataGridNode,
303
+ profileNode: ProfileEntry,
349
304
  }>;
350
305
  savedTotal?: number;
351
- savedChildren?: ProfileDataGridNode[]|null;
306
+ savedChildren?: ProfileEntry[]|null;
352
307
  searchResultIndex = -1;
353
308
 
354
309
  constructor(formatter: Formatter, searchableView: UI.SearchableView.SearchableView, total: number) {
@@ -410,23 +365,42 @@ export class ProfileDataGridTree implements UI.SearchableView.Searchable {
410
365
  return true;
411
366
  }
412
367
 
413
- appendChild(child: ProfileDataGridNode): void {
368
+ appendChild(child: ProfileEntry): void {
414
369
  this.insertChild(child, this.children.length);
415
370
  }
416
371
 
417
- focus(_profileDataGridNode: ProfileDataGridNode): void {
372
+ focus(_profileDataGridNode: ProfileEntry): void {
373
+ }
374
+
375
+ exclude(_profileDataGridNode: ProfileEntry): void {
418
376
  }
419
377
 
420
- exclude(_profileDataGridNode: ProfileDataGridNode): void {
378
+ insertChild(child: ProfileEntry, index: number): void {
379
+ const oldIndex = child.parent?.children.indexOf(child) ?? -1;
380
+ if (child.parent === this && oldIndex !== -1 && oldIndex < index) {
381
+ index--;
382
+ }
383
+ if (child.parent) {
384
+ child.parent.removeChild(child);
385
+ }
386
+ this.children.splice(index, 0, child);
387
+ child.parent = this;
388
+ this.childrenByCallUID.set(child.callUID, child);
421
389
  }
422
390
 
423
- insertChild(child: ProfileDataGridNode, index: number): void {
424
- const childToInsert = (child);
425
- this.children.splice(index, 0, childToInsert);
426
- this.childrenByCallUID.set(childToInsert.callUID, child);
391
+ removeChild(child: ProfileEntry): void {
392
+ const index = this.children.indexOf(child);
393
+ if (index !== -1) {
394
+ this.children.splice(index, 1);
395
+ child.parent = null;
396
+ this.childrenByCallUID.delete(child.callUID);
397
+ }
427
398
  }
428
399
 
429
400
  removeChildren(): void {
401
+ for (const child of this.children) {
402
+ child.parent = null;
403
+ }
430
404
  this.children = [];
431
405
  this.childrenByCallUID.clear();
432
406
  }
@@ -435,7 +409,7 @@ export class ProfileDataGridTree implements UI.SearchableView.Searchable {
435
409
  // Not implemented.
436
410
  }
437
411
 
438
- findChild(node: CPUProfile.ProfileTreeModel.ProfileNode): ProfileDataGridNode|null {
412
+ findChild(node: CPUProfile.ProfileTreeModel.ProfileNode): ProfileEntry|null {
439
413
  if (!node) {
440
414
  return null;
441
415
  }
@@ -445,7 +419,7 @@ export class ProfileDataGridTree implements UI.SearchableView.Searchable {
445
419
  sort<T>(comparator: (arg0: T, arg1: T) => number, force: boolean): void {
446
420
  // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
447
421
  // @ts-expect-error
448
- return ProfileDataGridNode.sort([[this]], comparator, force);
422
+ return ProfileEntry.sort([[this]], comparator, force);
449
423
  }
450
424
 
451
425
  save(): void {
@@ -462,22 +436,24 @@ export class ProfileDataGridTree implements UI.SearchableView.Searchable {
462
436
  return;
463
437
  }
464
438
 
465
- this.children = this.savedChildren;
439
+ this.removeChildren();
440
+
466
441
  if (this.savedTotal) {
467
442
  this.total = this.savedTotal;
468
443
  }
469
444
 
470
- const children = this.children;
445
+ const children = this.savedChildren;
471
446
  const count = children.length;
472
447
 
473
448
  for (let index = 0; index < count; ++index) {
474
449
  (children[index]).restore();
450
+ this.appendChild(children[index]);
475
451
  }
476
452
 
477
453
  this.savedChildren = null;
478
454
  }
479
455
 
480
- matchFunction(searchConfig: UI.SearchableView.SearchConfig): ((arg0: ProfileDataGridNode) => boolean)|null {
456
+ matchFunction(searchConfig: UI.SearchableView.SearchConfig): ((arg0: ProfileEntry) => boolean)|null {
481
457
  const query = searchConfig.query.trim();
482
458
  if (!query.length) {
483
459
  return null;
@@ -508,7 +484,7 @@ export class ProfileDataGridTree implements UI.SearchableView.Searchable {
508
484
 
509
485
  const matcher = Platform.StringUtilities.createPlainTextSearchRegex(query, 'i');
510
486
 
511
- function matchesQuery(profileDataGridNode: ProfileDataGridNode): boolean {
487
+ function matchesQuery(profileDataGridNode: ProfileEntry): boolean {
512
488
  profileDataGridNode.searchMatchedSelfColumn = false;
513
489
  profileDataGridNode.searchMatchedTotalColumn = false;
514
490
  profileDataGridNode.searchMatchedFunctionColumn = false;
@@ -572,7 +548,6 @@ export class ProfileDataGridTree implements UI.SearchableView.Searchable {
572
548
 
573
549
  if (profileDataGridNode.searchMatchedSelfColumn || profileDataGridNode.searchMatchedTotalColumn ||
574
550
  profileDataGridNode.searchMatchedFunctionColumn) {
575
- profileDataGridNode.refresh();
576
551
  return true;
577
552
  }
578
553
 
@@ -591,18 +566,18 @@ export class ProfileDataGridTree implements UI.SearchableView.Searchable {
591
566
  this.searchResults = [];
592
567
  const deepSearch = this.deepSearch;
593
568
 
594
- const walk = (node: ProfileDataGridNode): void => {
569
+ const walk = (node: ProfileEntry): void => {
595
570
  if (matchesQuery(node)) {
596
571
  this.searchResults.push({profileNode: node});
597
572
  }
598
573
  if (deepSearch || node.expanded) {
599
- for (const child of node.children as ProfileDataGridNode[]) {
574
+ for (const child of node.children) {
600
575
  walk(child);
601
576
  }
602
577
  }
603
578
  };
604
579
 
605
- for (const child of this.children as ProfileDataGridNode[]) {
580
+ for (const child of this.children) {
606
581
  walk(child);
607
582
  }
608
583
  this.searchResultIndex = jumpBackwards ? 0 : this.searchResults.length - 1;
@@ -617,7 +592,6 @@ export class ProfileDataGridTree implements UI.SearchableView.Searchable {
617
592
  profileNode.searchMatchedSelfColumn = false;
618
593
  profileNode.searchMatchedTotalColumn = false;
619
594
  profileNode.searchMatchedFunctionColumn = false;
620
- profileNode.refresh();
621
595
  }
622
596
  }
623
597
 
@@ -658,8 +632,6 @@ export class ProfileDataGridTree implements UI.SearchableView.Searchable {
658
632
  if (!searchResult) {
659
633
  return;
660
634
  }
661
- const profileNode = searchResult.profileNode;
662
- profileNode.revealAndSelect();
663
635
  this.searchableView.updateCurrentMatchIndex(index);
664
636
  }
665
637
  }
@@ -667,8 +639,7 @@ export class ProfileDataGridTree implements UI.SearchableView.Searchable {
667
639
  const propertyComparators: Array<Record<string, unknown>> = [{}, {}];
668
640
 
669
641
  export interface Formatter {
670
- formatValue(value: number, node: ProfileDataGridNode): string;
671
- formatValueAccessibleText(value: number, node: ProfileDataGridNode): string;
672
- formatPercent(value: number, node: ProfileDataGridNode): string;
673
- linkifyNode(node: ProfileDataGridNode): Element|null;
642
+ formatValue(value: number, node: ProfileEntry): string;
643
+ formatValueAccessibleText(value: number, node: ProfileEntry): string;
644
+ formatPercent(value: number, node: ProfileEntry): string;
674
645
  }
@@ -10,6 +10,7 @@ import type * as CPUProfile from '../../models/cpu_profile/cpu_profile.js';
10
10
  import type * as NetworkTimeCalculator from '../../models/network_time_calculator/network_time_calculator.js';
11
11
  import * as PerfUI from '../../ui/legacy/components/perf_ui/perf_ui.js';
12
12
  import * as UI from '../../ui/legacy/legacy.js';
13
+ import type {TemplateResult} from '../../ui/lit/lit.js';
13
14
 
14
15
  let colorGeneratorInstance: Common.Color.Generator|null = null;
15
16
 
@@ -82,7 +83,7 @@ export class ProfileFlameChartDataProvider implements PerfUI.FlameChart.FlameCha
82
83
  throw new Error('Not implemented');
83
84
  }
84
85
 
85
- preparePopoverElement(_entryIndex: number): Element|null {
86
+ preparePopoverElement(_entryIndex: number): Element|TemplateResult|null {
86
87
  throw new Error('Not implemented');
87
88
  }
88
89
 
@@ -141,8 +142,9 @@ export class ProfileFlameChart extends
141
142
  searchResults: number[];
142
143
  searchResultIndex = -1;
143
144
 
144
- constructor(searchableView: UI.SearchableView.SearchableView, dataProvider: ProfileFlameChartDataProvider) {
145
- super();
145
+ constructor(searchableView: UI.SearchableView.SearchableView, dataProvider: ProfileFlameChartDataProvider,
146
+ element?: HTMLElement) {
147
+ super(element);
146
148
  this.element.id = 'cpu-flame-chart';
147
149
 
148
150
  this.searchableView = searchableView;
@@ -172,8 +174,18 @@ export class ProfileFlameChart extends
172
174
  this.mainPane.setWindowTimes(windowLeft, windowRight, /* animate */ true);
173
175
  }
174
176
 
175
- selectRange(timeLeft: number, timeRight: number): void {
176
- this.overviewPane.selectRange(timeLeft, timeRight);
177
+ get range(): {left: number, right: number}|undefined {
178
+ return {
179
+ left: this.overviewPane.windowTimeLeft ?? 0,
180
+ right: this.overviewPane.windowTimeRight ?? 0,
181
+ };
182
+ }
183
+
184
+ set range(limits: {left: number, right: number}|undefined) {
185
+ if (!limits) {
186
+ return;
187
+ }
188
+ this.overviewPane.selectRange(limits.left, limits.right);
177
189
  }
178
190
 
179
191
  onEntrySelected(event: Common.EventTarget.EventTargetEvent<void|number>): void {
@@ -43,7 +43,7 @@ import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
43
43
  import {
44
44
  DetachedElementsProfileHeader,
45
45
  DetachedElementsProfileType,
46
- DetachedElementsProfileView
46
+ DetachedElementsProfileView,
47
47
  } from './HeapDetachedElementsView.js';
48
48
  import heapProfilerStyles from './heapProfiler.css.js';
49
49
  import {HeapProfileView, SamplingHeapProfileHeader, SamplingHeapProfileType} from './HeapProfileView.js';
@@ -51,7 +51,7 @@ import {
51
51
  HeapProfileHeader,
52
52
  HeapSnapshotProfileType,
53
53
  HeapSnapshotView,
54
- TrackingHeapSnapshotProfileType
54
+ TrackingHeapSnapshotProfileType,
55
55
  } from './HeapSnapshotView.js';
56
56
  import {
57
57
  type DataDisplayDelegate,