devtools-tracing 1.1.0 → 1.2.0

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 (528) hide show
  1. package/.claude/settings.local.json +14 -0
  2. package/dist/index.d.ts +4 -0
  3. package/dist/index.js +28854 -0
  4. package/package.json +10 -8
  5. package/generate.ts +0 -649
  6. package/index.ts +0 -17
  7. package/lib/extension-api/ExtensionAPI.d.ts +0 -357
  8. package/lib/front_end/core/common/App.ts +0 -7
  9. package/lib/front_end/core/common/AppProvider.ts +0 -32
  10. package/lib/front_end/core/common/Base64.ts +0 -47
  11. package/lib/front_end/core/common/CharacterIdMap.ts +0 -30
  12. package/lib/front_end/core/common/Color.ts +0 -2506
  13. package/lib/front_end/core/common/ColorConverter.ts +0 -402
  14. package/lib/front_end/core/common/ColorUtils.ts +0 -252
  15. package/lib/front_end/core/common/Console.ts +0 -114
  16. package/lib/front_end/core/common/Debouncer.ts +0 -15
  17. package/lib/front_end/core/common/EventTarget.ts +0 -52
  18. package/lib/front_end/core/common/Gzip.ts +0 -74
  19. package/lib/front_end/core/common/JavaScriptMetaData.ts +0 -29
  20. package/lib/front_end/core/common/Lazy.ts +0 -31
  21. package/lib/front_end/core/common/Linkifier.ts +0 -55
  22. package/lib/front_end/core/common/MapWithDefault.ts +0 -26
  23. package/lib/front_end/core/common/Mutex.ts +0 -55
  24. package/lib/front_end/core/common/Object.ts +0 -145
  25. package/lib/front_end/core/common/ParsedURL.ts +0 -554
  26. package/lib/front_end/core/common/Progress.ts +0 -180
  27. package/lib/front_end/core/common/QueryParamHandler.ts +0 -7
  28. package/lib/front_end/core/common/ResolverBase.ts +0 -85
  29. package/lib/front_end/core/common/ResourceType.ts +0 -588
  30. package/lib/front_end/core/common/ReturnToPanel.ts +0 -17
  31. package/lib/front_end/core/common/Revealer.ts +0 -192
  32. package/lib/front_end/core/common/Runnable.ts +0 -41
  33. package/lib/front_end/core/common/SegmentedRange.ts +0 -87
  34. package/lib/front_end/core/common/SettingRegistration.ts +0 -339
  35. package/lib/front_end/core/common/Settings.ts +0 -1497
  36. package/lib/front_end/core/common/SimpleHistoryManager.ts +0 -124
  37. package/lib/front_end/core/common/StringOutputStream.ts +0 -26
  38. package/lib/front_end/core/common/TextDictionary.ts +0 -48
  39. package/lib/front_end/core/common/Throttler.ts +0 -99
  40. package/lib/front_end/core/common/Trie.ts +0 -152
  41. package/lib/front_end/core/common/Worker.ts +0 -60
  42. package/lib/front_end/core/common/common.ts +0 -81
  43. package/lib/front_end/core/host/AidaClient.ts +0 -733
  44. package/lib/front_end/core/host/GdpClient.ts +0 -316
  45. package/lib/front_end/core/host/InspectorFrontendHost.ts +0 -648
  46. package/lib/front_end/core/host/InspectorFrontendHostAPI.ts +0 -551
  47. package/lib/front_end/core/host/Platform.ts +0 -76
  48. package/lib/front_end/core/host/ResourceLoader.ts +0 -282
  49. package/lib/front_end/core/host/UserMetrics.ts +0 -1230
  50. package/lib/front_end/core/host/host.ts +0 -23
  51. package/lib/front_end/core/i18n/ByteUtilities.ts +0 -82
  52. package/lib/front_end/core/i18n/DevToolsLocale.ts +0 -87
  53. package/lib/front_end/core/i18n/NumberFormatter.ts +0 -82
  54. package/lib/front_end/core/i18n/i18n.ts +0 -17
  55. package/lib/front_end/core/i18n/i18nImpl.ts +0 -204
  56. package/lib/front_end/core/i18n/i18nTypes.ts +0 -10
  57. package/lib/front_end/core/i18n/locales.js +0 -14
  58. package/lib/front_end/core/i18n/time-utilities.ts +0 -174
  59. package/lib/front_end/core/platform/ArrayUtilities.ts +0 -271
  60. package/lib/front_end/core/platform/Brand.ts +0 -23
  61. package/lib/front_end/core/platform/Constructor.ts +0 -10
  62. package/lib/front_end/core/platform/DOMUtilities.ts +0 -138
  63. package/lib/front_end/core/platform/DateUtilities.ts +0 -15
  64. package/lib/front_end/core/platform/DevToolsPath.ts +0 -53
  65. package/lib/front_end/core/platform/KeyboardUtilities.ts +0 -38
  66. package/lib/front_end/core/platform/MapUtilities.ts +0 -95
  67. package/lib/front_end/core/platform/MimeType.ts +0 -175
  68. package/lib/front_end/core/platform/NumberUtilities.ts +0 -80
  69. package/lib/front_end/core/platform/StringUtilities.ts +0 -588
  70. package/lib/front_end/core/platform/Timing.ts +0 -17
  71. package/lib/front_end/core/platform/TypedArrayUtilities.ts +0 -189
  72. package/lib/front_end/core/platform/TypescriptUtilities.ts +0 -86
  73. package/lib/front_end/core/platform/UIString.ts +0 -39
  74. package/lib/front_end/core/platform/UserVisibleError.ts +0 -28
  75. package/lib/front_end/core/platform/platform.ts +0 -45
  76. package/lib/front_end/core/protocol_client/ConnectionTransport.ts +0 -26
  77. package/lib/front_end/core/protocol_client/InspectorBackend.ts +0 -1050
  78. package/lib/front_end/core/protocol_client/NodeURL.ts +0 -42
  79. package/lib/front_end/core/protocol_client/protocol_client.ts +0 -13
  80. package/lib/front_end/core/root/Runtime.ts +0 -609
  81. package/lib/front_end/core/root/root.ts +0 -6
  82. package/lib/front_end/core/sdk/AccessibilityModel.ts +0 -353
  83. package/lib/front_end/core/sdk/AnimationModel.ts +0 -1041
  84. package/lib/front_end/core/sdk/AutofillModel.ts +0 -184
  85. package/lib/front_end/core/sdk/CPUProfilerModel.ts +0 -148
  86. package/lib/front_end/core/sdk/CPUThrottlingManager.ts +0 -282
  87. package/lib/front_end/core/sdk/CSSContainerQuery.ts +0 -139
  88. package/lib/front_end/core/sdk/CSSFontFace.ts +0 -40
  89. package/lib/front_end/core/sdk/CSSLayer.ts +0 -30
  90. package/lib/front_end/core/sdk/CSSMatchedStyles.ts +0 -1646
  91. package/lib/front_end/core/sdk/CSSMedia.ts +0 -121
  92. package/lib/front_end/core/sdk/CSSMetadata.ts +0 -1647
  93. package/lib/front_end/core/sdk/CSSModel.ts +0 -1128
  94. package/lib/front_end/core/sdk/CSSProperty.ts +0 -384
  95. package/lib/front_end/core/sdk/CSSPropertyParser.ts +0 -681
  96. package/lib/front_end/core/sdk/CSSPropertyParserMatchers.ts +0 -1395
  97. package/lib/front_end/core/sdk/CSSQuery.ts +0 -72
  98. package/lib/front_end/core/sdk/CSSRule.ts +0 -465
  99. package/lib/front_end/core/sdk/CSSScope.ts +0 -30
  100. package/lib/front_end/core/sdk/CSSStartingStyle.ts +0 -29
  101. package/lib/front_end/core/sdk/CSSStyleDeclaration.ts +0 -313
  102. package/lib/front_end/core/sdk/CSSStyleSheetHeader.ts +0 -196
  103. package/lib/front_end/core/sdk/CSSSupports.ts +0 -33
  104. package/lib/front_end/core/sdk/CategorizedBreakpoint.ts +0 -64
  105. package/lib/front_end/core/sdk/ChildTargetManager.ts +0 -314
  106. package/lib/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +0 -62
  107. package/lib/front_end/core/sdk/Connections.ts +0 -293
  108. package/lib/front_end/core/sdk/ConsoleModel.ts +0 -808
  109. package/lib/front_end/core/sdk/ConsoleModelTypes.ts +0 -15
  110. package/lib/front_end/core/sdk/Cookie.ts +0 -319
  111. package/lib/front_end/core/sdk/CookieModel.ts +0 -239
  112. package/lib/front_end/core/sdk/CookieParser.ts +0 -185
  113. package/lib/front_end/core/sdk/DOMDebuggerModel.ts +0 -787
  114. package/lib/front_end/core/sdk/DOMModel.ts +0 -1961
  115. package/lib/front_end/core/sdk/DebuggerModel.ts +0 -1605
  116. package/lib/front_end/core/sdk/EmulationModel.ts +0 -648
  117. package/lib/front_end/core/sdk/EnhancedTracesParser.ts +0 -515
  118. package/lib/front_end/core/sdk/EventBreakpointsModel.ts +0 -183
  119. package/lib/front_end/core/sdk/FrameAssociated.ts +0 -11
  120. package/lib/front_end/core/sdk/FrameManager.ts +0 -259
  121. package/lib/front_end/core/sdk/HeapProfilerModel.ts +0 -225
  122. package/lib/front_end/core/sdk/HttpReasonPhraseStrings.ts +0 -77
  123. package/lib/front_end/core/sdk/IOModel.ts +0 -91
  124. package/lib/front_end/core/sdk/IsolateManager.ts +0 -257
  125. package/lib/front_end/core/sdk/IssuesModel.ts +0 -70
  126. package/lib/front_end/core/sdk/LayerTreeBase.ts +0 -169
  127. package/lib/front_end/core/sdk/LogModel.ts +0 -56
  128. package/lib/front_end/core/sdk/NetworkManager.ts +0 -2823
  129. package/lib/front_end/core/sdk/NetworkRequest.ts +0 -2253
  130. package/lib/front_end/core/sdk/OverlayColorGenerator.ts +0 -52
  131. package/lib/front_end/core/sdk/OverlayModel.ts +0 -1011
  132. package/lib/front_end/core/sdk/OverlayPersistentHighlighter.ts +0 -522
  133. package/lib/front_end/core/sdk/PageLoad.ts +0 -35
  134. package/lib/front_end/core/sdk/PageResourceLoader.ts +0 -435
  135. package/lib/front_end/core/sdk/PaintProfiler.ts +0 -110
  136. package/lib/front_end/core/sdk/PerformanceMetricsModel.ts +0 -84
  137. package/lib/front_end/core/sdk/PreloadingModel.ts +0 -863
  138. package/lib/front_end/core/sdk/RehydratingConnection.ts +0 -386
  139. package/lib/front_end/core/sdk/RehydratingObject.ts +0 -66
  140. package/lib/front_end/core/sdk/RemoteObject.ts +0 -1160
  141. package/lib/front_end/core/sdk/Resource.ts +0 -232
  142. package/lib/front_end/core/sdk/ResourceTreeModel.ts +0 -1160
  143. package/lib/front_end/core/sdk/RuntimeModel.ts +0 -732
  144. package/lib/front_end/core/sdk/SDKModel.ts +0 -65
  145. package/lib/front_end/core/sdk/ScopeTreeCache.ts +0 -45
  146. package/lib/front_end/core/sdk/ScreenCaptureModel.ts +0 -255
  147. package/lib/front_end/core/sdk/Script.ts +0 -534
  148. package/lib/front_end/core/sdk/SecurityOriginManager.ts +0 -76
  149. package/lib/front_end/core/sdk/ServerSentEvents.ts +0 -80
  150. package/lib/front_end/core/sdk/ServerSentEventsProtocol.ts +0 -122
  151. package/lib/front_end/core/sdk/ServerTiming.ts +0 -260
  152. package/lib/front_end/core/sdk/ServiceWorkerCacheModel.ts +0 -377
  153. package/lib/front_end/core/sdk/ServiceWorkerManager.ts +0 -605
  154. package/lib/front_end/core/sdk/SourceMap.ts +0 -867
  155. package/lib/front_end/core/sdk/SourceMapCache.ts +0 -54
  156. package/lib/front_end/core/sdk/SourceMapFunctionRanges.ts +0 -156
  157. package/lib/front_end/core/sdk/SourceMapManager.ts +0 -239
  158. package/lib/front_end/core/sdk/SourceMapScopeChainEntry.ts +0 -189
  159. package/lib/front_end/core/sdk/SourceMapScopesInfo.ts +0 -508
  160. package/lib/front_end/core/sdk/StorageBucketsModel.ts +0 -204
  161. package/lib/front_end/core/sdk/StorageKeyManager.ts +0 -98
  162. package/lib/front_end/core/sdk/Target.ts +0 -332
  163. package/lib/front_end/core/sdk/TargetManager.ts +0 -453
  164. package/lib/front_end/core/sdk/TraceObject.ts +0 -61
  165. package/lib/front_end/core/sdk/WebAuthnModel.ts +0 -104
  166. package/lib/front_end/core/sdk/sdk.ts +0 -174
  167. package/lib/front_end/entrypoints/formatter_worker/FormatterActions.ts +0 -59
  168. package/lib/front_end/generated/InspectorBackendCommands.js +0 -1617
  169. package/lib/front_end/generated/SupportedCSSProperties.js +0 -7512
  170. package/lib/front_end/generated/protocol-proxy-api.d.ts +0 -5022
  171. package/lib/front_end/generated/protocol.ts +0 -22014
  172. package/lib/front_end/models/bindings/CSSWorkspaceBinding.ts +0 -318
  173. package/lib/front_end/models/bindings/CompilerScriptMapping.ts +0 -536
  174. package/lib/front_end/models/bindings/ContentProviderBasedProject.ts +0 -187
  175. package/lib/front_end/models/bindings/DebuggerLanguagePlugins.ts +0 -1197
  176. package/lib/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -733
  177. package/lib/front_end/models/bindings/DefaultScriptMapping.ts +0 -141
  178. package/lib/front_end/models/bindings/FileUtils.ts +0 -228
  179. package/lib/front_end/models/bindings/LiveLocation.ts +0 -81
  180. package/lib/front_end/models/bindings/NetworkProject.ts +0 -157
  181. package/lib/front_end/models/bindings/PresentationConsoleMessageHelper.ts +0 -312
  182. package/lib/front_end/models/bindings/ResourceMapping.ts +0 -539
  183. package/lib/front_end/models/bindings/ResourceScriptMapping.ts +0 -491
  184. package/lib/front_end/models/bindings/ResourceUtils.ts +0 -103
  185. package/lib/front_end/models/bindings/SASSSourceMapping.ts +0 -222
  186. package/lib/front_end/models/bindings/StylesSourceMapping.ts +0 -316
  187. package/lib/front_end/models/bindings/TempFile.ts +0 -67
  188. package/lib/front_end/models/bindings/bindings.ts +0 -39
  189. package/lib/front_end/models/cpu_profile/CPUProfileDataModel.ts +0 -571
  190. package/lib/front_end/models/cpu_profile/ProfileTreeModel.ts +0 -103
  191. package/lib/front_end/models/cpu_profile/cpu_profile.ts +0 -11
  192. package/lib/front_end/models/formatter/FormatterWorkerPool.ts +0 -219
  193. package/lib/front_end/models/formatter/ScriptFormatter.ts +0 -112
  194. package/lib/front_end/models/formatter/formatter.ts +0 -8
  195. package/lib/front_end/models/source_map_scopes/NamesResolver.ts +0 -765
  196. package/lib/front_end/models/source_map_scopes/ScopeChainModel.ts +0 -84
  197. package/lib/front_end/models/source_map_scopes/source_map_scopes.ts +0 -11
  198. package/lib/front_end/models/stack_trace/StackTrace.ts +0 -53
  199. package/lib/front_end/models/stack_trace/StackTraceImpl.ts +0 -85
  200. package/lib/front_end/models/stack_trace/StackTraceModel.ts +0 -128
  201. package/lib/front_end/models/stack_trace/Trie.ts +0 -163
  202. package/lib/front_end/models/stack_trace/stack_trace.ts +0 -9
  203. package/lib/front_end/models/stack_trace/stack_trace_impl.ts +0 -13
  204. package/lib/front_end/models/text_utils/CodeMirrorUtils.ts +0 -37
  205. package/lib/front_end/models/text_utils/ContentData.ts +0 -199
  206. package/lib/front_end/models/text_utils/ContentProvider.ts +0 -68
  207. package/lib/front_end/models/text_utils/StaticContentProvider.ts +0 -49
  208. package/lib/front_end/models/text_utils/StreamingContentData.ts +0 -108
  209. package/lib/front_end/models/text_utils/Text.ts +0 -90
  210. package/lib/front_end/models/text_utils/TextCursor.ts +0 -44
  211. package/lib/front_end/models/text_utils/TextRange.ts +0 -266
  212. package/lib/front_end/models/text_utils/TextUtils.ts +0 -401
  213. package/lib/front_end/models/text_utils/WasmDisassembly.ts +0 -87
  214. package/lib/front_end/models/text_utils/text_utils.ts +0 -27
  215. package/lib/front_end/models/trace/EntityMapper.ts +0 -141
  216. package/lib/front_end/models/trace/EventsSerializer.ts +0 -101
  217. package/lib/front_end/models/trace/LanternComputationData.ts +0 -438
  218. package/lib/front_end/models/trace/ModelImpl.ts +0 -236
  219. package/lib/front_end/models/trace/Name.ts +0 -136
  220. package/lib/front_end/models/trace/Processor.ts +0 -652
  221. package/lib/front_end/models/trace/Styles.ts +0 -1138
  222. package/lib/front_end/models/trace/extras/FilmStrip.ts +0 -78
  223. package/lib/front_end/models/trace/extras/MainThreadActivity.ts +0 -86
  224. package/lib/front_end/models/trace/extras/ScriptDuplication.ts +0 -236
  225. package/lib/front_end/models/trace/extras/StackTraceForEvent.ts +0 -203
  226. package/lib/front_end/models/trace/extras/ThirdParties.ts +0 -164
  227. package/lib/front_end/models/trace/extras/TraceFilter.ts +0 -62
  228. package/lib/front_end/models/trace/extras/TraceTree.ts +0 -701
  229. package/lib/front_end/models/trace/extras/extras.ts +0 -11
  230. package/lib/front_end/models/trace/handlers/AnimationFramesHandler.ts +0 -128
  231. package/lib/front_end/models/trace/handlers/AnimationHandler.ts +0 -36
  232. package/lib/front_end/models/trace/handlers/AsyncJSCallsHandler.ts +0 -239
  233. package/lib/front_end/models/trace/handlers/AuctionWorkletsHandler.ts +0 -183
  234. package/lib/front_end/models/trace/handlers/DOMStatsHandler.ts +0 -31
  235. package/lib/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +0 -306
  236. package/lib/front_end/models/trace/handlers/FlowsHandler.ts +0 -175
  237. package/lib/front_end/models/trace/handlers/FramesHandler.ts +0 -571
  238. package/lib/front_end/models/trace/handlers/GPUHandler.ts +0 -50
  239. package/lib/front_end/models/trace/handlers/ImagePaintingHandler.ts +0 -183
  240. package/lib/front_end/models/trace/handlers/InitiatorsHandler.ts +0 -193
  241. package/lib/front_end/models/trace/handlers/InvalidationsHandler.ts +0 -168
  242. package/lib/front_end/models/trace/handlers/LargestImagePaintHandler.ts +0 -109
  243. package/lib/front_end/models/trace/handlers/LargestTextPaintHandler.ts +0 -35
  244. package/lib/front_end/models/trace/handlers/LayerTreeHandler.ts +0 -123
  245. package/lib/front_end/models/trace/handlers/LayoutShiftsHandler.ts +0 -573
  246. package/lib/front_end/models/trace/handlers/MemoryHandler.ts +0 -31
  247. package/lib/front_end/models/trace/handlers/MetaHandler.ts +0 -525
  248. package/lib/front_end/models/trace/handlers/ModelHandlers.ts +0 -34
  249. package/lib/front_end/models/trace/handlers/NetworkRequestsHandler.ts +0 -672
  250. package/lib/front_end/models/trace/handlers/PageFramesHandler.ts +0 -52
  251. package/lib/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +0 -460
  252. package/lib/front_end/models/trace/handlers/RendererHandler.ts +0 -428
  253. package/lib/front_end/models/trace/handlers/SamplesHandler.ts +0 -271
  254. package/lib/front_end/models/trace/handlers/ScreenshotsHandler.ts +0 -122
  255. package/lib/front_end/models/trace/handlers/ScriptsHandler.ts +0 -336
  256. package/lib/front_end/models/trace/handlers/SelectorStatsHandler.ts +0 -110
  257. package/lib/front_end/models/trace/handlers/Threads.ts +0 -139
  258. package/lib/front_end/models/trace/handlers/UserInteractionsHandler.ts +0 -400
  259. package/lib/front_end/models/trace/handlers/UserTimingsHandler.ts +0 -233
  260. package/lib/front_end/models/trace/handlers/WarningsHandler.ts +0 -162
  261. package/lib/front_end/models/trace/handlers/WorkersHandler.ts +0 -45
  262. package/lib/front_end/models/trace/handlers/handlers.ts +0 -8
  263. package/lib/front_end/models/trace/handlers/helpers.ts +0 -196
  264. package/lib/front_end/models/trace/handlers/types.ts +0 -75
  265. package/lib/front_end/models/trace/helpers/Extensions.ts +0 -54
  266. package/lib/front_end/models/trace/helpers/Network.ts +0 -129
  267. package/lib/front_end/models/trace/helpers/SamplesIntegrator.ts +0 -544
  268. package/lib/front_end/models/trace/helpers/SyntheticEvents.ts +0 -87
  269. package/lib/front_end/models/trace/helpers/Timing.ts +0 -248
  270. package/lib/front_end/models/trace/helpers/Trace.ts +0 -928
  271. package/lib/front_end/models/trace/helpers/TreeHelpers.ts +0 -320
  272. package/lib/front_end/models/trace/helpers/helpers.ts +0 -11
  273. package/lib/front_end/models/trace/insights/CLSCulprits.ts +0 -668
  274. package/lib/front_end/models/trace/insights/Cache.ts +0 -269
  275. package/lib/front_end/models/trace/insights/Common.ts +0 -453
  276. package/lib/front_end/models/trace/insights/DOMSize.ts +0 -223
  277. package/lib/front_end/models/trace/insights/DocumentLatency.ts +0 -319
  278. package/lib/front_end/models/trace/insights/DuplicatedJavaScript.ts +0 -126
  279. package/lib/front_end/models/trace/insights/FontDisplay.ts +0 -119
  280. package/lib/front_end/models/trace/insights/ForcedReflow.ts +0 -220
  281. package/lib/front_end/models/trace/insights/INPBreakdown.ts +0 -171
  282. package/lib/front_end/models/trace/insights/ImageDelivery.ts +0 -348
  283. package/lib/front_end/models/trace/insights/LCPBreakdown.ts +0 -268
  284. package/lib/front_end/models/trace/insights/LCPDiscovery.ts +0 -237
  285. package/lib/front_end/models/trace/insights/LegacyJavaScript.ts +0 -138
  286. package/lib/front_end/models/trace/insights/Models.ts +0 -22
  287. package/lib/front_end/models/trace/insights/ModernHTTP.ts +0 -257
  288. package/lib/front_end/models/trace/insights/NetworkDependencyTree.ts +0 -726
  289. package/lib/front_end/models/trace/insights/RenderBlocking.ts +0 -257
  290. package/lib/front_end/models/trace/insights/SlowCSSSelector.ts +0 -175
  291. package/lib/front_end/models/trace/insights/Statistics.ts +0 -101
  292. package/lib/front_end/models/trace/insights/ThirdParties.ts +0 -130
  293. package/lib/front_end/models/trace/insights/Viewport.ts +0 -138
  294. package/lib/front_end/models/trace/insights/insights.ts +0 -10
  295. package/lib/front_end/models/trace/insights/types.ts +0 -157
  296. package/lib/front_end/models/trace/lantern/core/LanternError.ts +0 -7
  297. package/lib/front_end/models/trace/lantern/core/NetworkAnalyzer.ts +0 -619
  298. package/lib/front_end/models/trace/lantern/core/core.ts +0 -6
  299. package/lib/front_end/models/trace/lantern/graph/BaseNode.ts +0 -345
  300. package/lib/front_end/models/trace/lantern/graph/CPUNode.ts +0 -80
  301. package/lib/front_end/models/trace/lantern/graph/NetworkNode.ts +0 -101
  302. package/lib/front_end/models/trace/lantern/graph/PageDependencyGraph.ts +0 -636
  303. package/lib/front_end/models/trace/lantern/graph/graph.ts +0 -8
  304. package/lib/front_end/models/trace/lantern/lantern.ts +0 -17
  305. package/lib/front_end/models/trace/lantern/metrics/FirstContentfulPaint.ts +0 -187
  306. package/lib/front_end/models/trace/lantern/metrics/Interactive.ts +0 -88
  307. package/lib/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +0 -92
  308. package/lib/front_end/models/trace/lantern/metrics/MaxPotentialFID.ts +0 -72
  309. package/lib/front_end/models/trace/lantern/metrics/Metric.ts +0 -126
  310. package/lib/front_end/models/trace/lantern/metrics/SpeedIndex.ts +0 -126
  311. package/lib/front_end/models/trace/lantern/metrics/TBTUtils.ts +0 -82
  312. package/lib/front_end/models/trace/lantern/metrics/TotalBlockingTime.ts +0 -112
  313. package/lib/front_end/models/trace/lantern/metrics/metrics.ts +0 -12
  314. package/lib/front_end/models/trace/lantern/simulation/ConnectionPool.ts +0 -150
  315. package/lib/front_end/models/trace/lantern/simulation/Constants.ts +0 -46
  316. package/lib/front_end/models/trace/lantern/simulation/DNSCache.ts +0 -61
  317. package/lib/front_end/models/trace/lantern/simulation/SimulationTimingMap.ts +0 -196
  318. package/lib/front_end/models/trace/lantern/simulation/Simulator.ts +0 -556
  319. package/lib/front_end/models/trace/lantern/simulation/TCPConnection.ts +0 -192
  320. package/lib/front_end/models/trace/lantern/simulation/simulation.ts +0 -10
  321. package/lib/front_end/models/trace/lantern/types/Lantern.ts +0 -220
  322. package/lib/front_end/models/trace/lantern/types/types.ts +0 -5
  323. package/lib/front_end/models/trace/trace.ts +0 -33
  324. package/lib/front_end/models/trace/types/Configuration.ts +0 -110
  325. package/lib/front_end/models/trace/types/Extensions.ts +0 -136
  326. package/lib/front_end/models/trace/types/File.ts +0 -281
  327. package/lib/front_end/models/trace/types/Overlays.ts +0 -138
  328. package/lib/front_end/models/trace/types/Timing.ts +0 -30
  329. package/lib/front_end/models/trace/types/TraceEvents.ts +0 -3277
  330. package/lib/front_end/models/trace/types/types.ts +0 -10
  331. package/lib/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +0 -240
  332. package/lib/front_end/models/trace_source_maps_resolver/trace_source_maps_resolver.ts +0 -5
  333. package/lib/front_end/models/workspace/FileManager.ts +0 -97
  334. package/lib/front_end/models/workspace/IgnoreListManager.ts +0 -628
  335. package/lib/front_end/models/workspace/SearchConfig.ts +0 -149
  336. package/lib/front_end/models/workspace/UISourceCode.ts +0 -698
  337. package/lib/front_end/models/workspace/WorkspaceImpl.ts +0 -339
  338. package/lib/front_end/models/workspace/workspace.ts +0 -17
  339. package/lib/front_end/panels/timeline/TimelineUIUtils.ts +0 -1029
  340. package/lib/front_end/panels/timeline/extensions/ExtensionUI.ts +0 -49
  341. package/lib/front_end/panels/timeline/extensions/extensions.ts +0 -9
  342. package/lib/front_end/third_party/codemirror.next/LICENSE +0 -21
  343. package/lib/front_end/third_party/codemirror.next/README.chromium +0 -30
  344. package/lib/front_end/third_party/codemirror.next/bundle-tsconfig.json +0 -24
  345. package/lib/front_end/third_party/codemirror.next/bundle.ts +0 -135
  346. package/lib/front_end/third_party/codemirror.next/chunk/angular.js +0 -2
  347. package/lib/front_end/third_party/codemirror.next/chunk/angular.js.map +0 -1
  348. package/lib/front_end/third_party/codemirror.next/chunk/codemirror.js +0 -2
  349. package/lib/front_end/third_party/codemirror.next/chunk/codemirror.js.map +0 -1
  350. package/lib/front_end/third_party/codemirror.next/chunk/cpp.js +0 -2
  351. package/lib/front_end/third_party/codemirror.next/chunk/cpp.js.map +0 -1
  352. package/lib/front_end/third_party/codemirror.next/chunk/css.js +0 -2
  353. package/lib/front_end/third_party/codemirror.next/chunk/html.js +0 -4
  354. package/lib/front_end/third_party/codemirror.next/chunk/java.js +0 -2
  355. package/lib/front_end/third_party/codemirror.next/chunk/java.js.map +0 -1
  356. package/lib/front_end/third_party/codemirror.next/chunk/javascript.js +0 -2
  357. package/lib/front_end/third_party/codemirror.next/chunk/legacy.js +0 -2
  358. package/lib/front_end/third_party/codemirror.next/chunk/legacy.js.map +0 -1
  359. package/lib/front_end/third_party/codemirror.next/chunk/less.js +0 -2
  360. package/lib/front_end/third_party/codemirror.next/chunk/less.js.map +0 -1
  361. package/lib/front_end/third_party/codemirror.next/chunk/markdown.js +0 -2
  362. package/lib/front_end/third_party/codemirror.next/chunk/markdown.js.map +0 -1
  363. package/lib/front_end/third_party/codemirror.next/chunk/php.js +0 -2
  364. package/lib/front_end/third_party/codemirror.next/chunk/php.js.map +0 -1
  365. package/lib/front_end/third_party/codemirror.next/chunk/python.js +0 -2
  366. package/lib/front_end/third_party/codemirror.next/chunk/python.js.map +0 -1
  367. package/lib/front_end/third_party/codemirror.next/chunk/sass.js +0 -2
  368. package/lib/front_end/third_party/codemirror.next/chunk/sass.js.map +0 -1
  369. package/lib/front_end/third_party/codemirror.next/chunk/svelte.js +0 -2
  370. package/lib/front_end/third_party/codemirror.next/chunk/svelte.js.map +0 -1
  371. package/lib/front_end/third_party/codemirror.next/chunk/vue.js +0 -2
  372. package/lib/front_end/third_party/codemirror.next/chunk/vue.js.map +0 -1
  373. package/lib/front_end/third_party/codemirror.next/chunk/wast.js +0 -2
  374. package/lib/front_end/third_party/codemirror.next/chunk/wast.js.map +0 -1
  375. package/lib/front_end/third_party/codemirror.next/chunk/xml.js +0 -2
  376. package/lib/front_end/third_party/codemirror.next/chunk/xml.js.map +0 -1
  377. package/lib/front_end/third_party/codemirror.next/codemirror.next.d.ts +0 -8057
  378. package/lib/front_end/third_party/codemirror.next/codemirror.next.js +0 -2
  379. package/lib/front_end/third_party/codemirror.next/codemirror.next.js.map +0 -1
  380. package/lib/front_end/third_party/codemirror.next/package.json +0 -43
  381. package/lib/front_end/third_party/codemirror.next/rebuild.sh +0 -6
  382. package/lib/front_end/third_party/codemirror.next/rollup.config.mjs +0 -49
  383. package/lib/front_end/third_party/i18n/LICENSE +0 -202
  384. package/lib/front_end/third_party/i18n/README.chromium +0 -15
  385. package/lib/front_end/third_party/i18n/i18n-impl.ts +0 -61
  386. package/lib/front_end/third_party/i18n/i18n.ts +0 -11
  387. package/lib/front_end/third_party/i18n/localized-string-set.ts +0 -129
  388. package/lib/front_end/third_party/intl-messageformat/LICENSE +0 -33
  389. package/lib/front_end/third_party/intl-messageformat/README.chromium +0 -24
  390. package/lib/front_end/third_party/intl-messageformat/intl-messageformat-tsconfig.json +0 -16
  391. package/lib/front_end/third_party/intl-messageformat/intl-messageformat.ts +0 -6
  392. package/lib/front_end/third_party/intl-messageformat/package/LICENSE.md +0 -33
  393. package/lib/front_end/third_party/intl-messageformat/package/README.md +0 -3
  394. package/lib/front_end/third_party/intl-messageformat/package/index.d.ts +0 -6
  395. package/lib/front_end/third_party/intl-messageformat/package/index.d.ts.map +0 -1
  396. package/lib/front_end/third_party/intl-messageformat/package/index.js +0 -13
  397. package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.d.ts +0 -5
  398. package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.js +0 -1710
  399. package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.iife.js +0 -1815
  400. package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts +0 -6
  401. package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts.map +0 -1
  402. package/lib/front_end/third_party/intl-messageformat/package/lib/index.js +0 -10
  403. package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts +0 -34
  404. package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts.map +0 -1
  405. package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.js +0 -229
  406. package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts +0 -28
  407. package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts.map +0 -1
  408. package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.js +0 -48
  409. package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts +0 -34
  410. package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts.map +0 -1
  411. package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.js +0 -179
  412. package/lib/front_end/third_party/intl-messageformat/package/package.json +0 -42
  413. package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts +0 -34
  414. package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts.map +0 -1
  415. package/lib/front_end/third_party/intl-messageformat/package/src/core.js +0 -230
  416. package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts +0 -28
  417. package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts.map +0 -1
  418. package/lib/front_end/third_party/intl-messageformat/package/src/error.js +0 -51
  419. package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts +0 -34
  420. package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts.map +0 -1
  421. package/lib/front_end/third_party/intl-messageformat/package/src/formatters.js +0 -182
  422. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/error.d.ts +0 -79
  423. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/index.d.ts +0 -15
  424. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/parser.d.ts +0 -153
  425. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/types.d.ts +0 -139
  426. package/lib/front_end/third_party/legacy-javascript/LICENSE +0 -202
  427. package/lib/front_end/third_party/legacy-javascript/README.chromium +0 -13
  428. package/lib/front_end/third_party/legacy-javascript/legacy-javascript-tsconfig.json +0 -8
  429. package/lib/front_end/third_party/legacy-javascript/legacy-javascript.ts +0 -3
  430. package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.d.ts +0 -18
  431. package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.js +0 -943
  432. package/lib/front_end/third_party/legacy-javascript/package.json +0 -8
  433. package/lib/front_end/third_party/legacy-javascript/rebuild.sh +0 -9
  434. package/lib/front_end/third_party/source-map-scopes-codec/LICENSE +0 -26
  435. package/lib/front_end/third_party/source-map-scopes-codec/README.chromium +0 -31
  436. package/lib/front_end/third_party/source-map-scopes-codec/package/CONTRIBUTING.md +0 -33
  437. package/lib/front_end/third_party/source-map-scopes-codec/package/LICENSE +0 -26
  438. package/lib/front_end/third_party/source-map-scopes-codec/package/README.md +0 -64
  439. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts +0 -62
  440. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts.map +0 -1
  441. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts +0 -37
  442. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts.map +0 -1
  443. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts +0 -29
  444. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts.map +0 -1
  445. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts +0 -8
  446. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts.map +0 -1
  447. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts +0 -6
  448. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts.map +0 -1
  449. package/lib/front_end/third_party/source-map-scopes-codec/package/deno.json +0 -21
  450. package/lib/front_end/third_party/source-map-scopes-codec/package/package.json +0 -14
  451. package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js +0 -196
  452. package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js.map +0 -1
  453. package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.ts +0 -262
  454. package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js +0 -235
  455. package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js.map +0 -1
  456. package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.ts +0 -359
  457. package/lib/front_end/third_party/source-map-scopes-codec/package/src/codec.js +0 -39
  458. package/lib/front_end/third_party/source-map-scopes-codec/package/src/codec.js.map +0 -1
  459. package/lib/front_end/third_party/source-map-scopes-codec/package/src/codec.ts +0 -53
  460. package/lib/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js +0 -438
  461. package/lib/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js.map +0 -1
  462. package/lib/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.ts +0 -539
  463. package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js +0 -23
  464. package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js.map +0 -1
  465. package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.ts +0 -35
  466. package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js +0 -257
  467. package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js.map +0 -1
  468. package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.ts +0 -348
  469. package/lib/front_end/third_party/source-map-scopes-codec/package/src/mod.js +0 -8
  470. package/lib/front_end/third_party/source-map-scopes-codec/package/src/mod.js.map +0 -1
  471. package/lib/front_end/third_party/source-map-scopes-codec/package/src/mod.ts +0 -20
  472. package/lib/front_end/third_party/source-map-scopes-codec/package/src/scopes-tsconfig.json +0 -8
  473. package/lib/front_end/third_party/source-map-scopes-codec/package/src/scopes.d.ts +0 -184
  474. package/lib/front_end/third_party/source-map-scopes-codec/package/src/util.js +0 -9
  475. package/lib/front_end/third_party/source-map-scopes-codec/package/src/util.js.map +0 -1
  476. package/lib/front_end/third_party/source-map-scopes-codec/package/src/util.ts +0 -12
  477. package/lib/front_end/third_party/source-map-scopes-codec/package/src/vlq.js +0 -82
  478. package/lib/front_end/third_party/source-map-scopes-codec/package/src/vlq.js.map +0 -1
  479. package/lib/front_end/third_party/source-map-scopes-codec/package/src/vlq.ts +0 -99
  480. package/lib/front_end/third_party/source-map-scopes-codec/source-map-scopes-codec.ts +0 -5
  481. package/lib/front_end/third_party/third-party-web/LICENSE +0 -20
  482. package/lib/front_end/third_party/third-party-web/README.chromium +0 -13
  483. package/lib/front_end/third_party/third-party-web/lib/nostats-subset.d.ts +0 -2
  484. package/lib/front_end/third_party/third-party-web/lib/nostats-subset.js +0 -149
  485. package/lib/front_end/third_party/third-party-web/package/LICENSE +0 -20
  486. package/lib/front_end/third_party/third-party-web/package/README.md +0 -929
  487. package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive-nostats.json +0 -1
  488. package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive.json +0 -1
  489. package/lib/front_end/third_party/third-party-web/package/dist/entities-nostats.json +0 -1
  490. package/lib/front_end/third_party/third-party-web/package/dist/entities.json +0 -1
  491. package/lib/front_end/third_party/third-party-web/package/facades.md +0 -46
  492. package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.d.ts +0 -1
  493. package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.js +0 -1
  494. package/lib/front_end/third_party/third-party-web/package/httparchive-subset.d.ts +0 -1
  495. package/lib/front_end/third_party/third-party-web/package/httparchive-subset.js +0 -1
  496. package/lib/front_end/third_party/third-party-web/package/lib/__snapshots__/index.test.js.snap +0 -1006
  497. package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.js +0 -139
  498. package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.test.js +0 -44
  499. package/lib/front_end/third_party/third-party-web/package/lib/entities.test.js +0 -27
  500. package/lib/front_end/third_party/third-party-web/package/lib/index.d.ts +0 -34
  501. package/lib/front_end/third_party/third-party-web/package/lib/index.js +0 -3
  502. package/lib/front_end/third_party/third-party-web/package/lib/index.test.js +0 -246
  503. package/lib/front_end/third_party/third-party-web/package/lib/markdown/faqs.partial.md +0 -36
  504. package/lib/front_end/third_party/third-party-web/package/lib/markdown/goals.partial.md +0 -9
  505. package/lib/front_end/third_party/third-party-web/package/lib/markdown/methodology.partial.md +0 -5
  506. package/lib/front_end/third_party/third-party-web/package/lib/markdown/template.md +0 -151
  507. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-02-01.md +0 -1
  508. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-03-01.md +0 -1
  509. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-06.md +0 -1
  510. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-13.md +0 -14
  511. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2021-01-01.md +0 -1
  512. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2024-07-01.md +0 -3
  513. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.d.ts +0 -1
  514. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.js +0 -3
  515. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.d.ts +0 -1
  516. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.js +0 -3
  517. package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.d.ts +0 -1
  518. package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.js +0 -3
  519. package/lib/front_end/third_party/third-party-web/package/nostats-subset.d.ts +0 -1
  520. package/lib/front_end/third_party/third-party-web/package/nostats-subset.js +0 -1
  521. package/lib/front_end/third_party/third-party-web/package/package.json +0 -46
  522. package/lib/front_end/third_party/third-party-web/package.json +0 -8
  523. package/lib/front_end/third_party/third-party-web/rebuild.sh +0 -13
  524. package/lib/front_end/third_party/third-party-web/third-party-web-tsconfig.json +0 -8
  525. package/lib/front_end/third_party/third-party-web/third-party-web.ts +0 -3
  526. package/lib/front_end/ui/legacy/theme_support/ThemeSupport.ts +0 -222
  527. package/lib/front_end/ui/legacy/theme_support/theme_support.ts +0 -5
  528. package/patches/chrome-devtools-frontend+1.0.1533544.patch +0 -1716
@@ -1,1041 +0,0 @@
1
- // Copyright 2014 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import * as Common from '../../core/common/common.js';
6
- import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
7
- import * as Protocol from '../../generated/protocol.js';
8
-
9
- import {DeferredDOMNode, type DOMNode} from './DOMModel.js';
10
- import {RemoteObject} from './RemoteObject.js';
11
- import {Events as ResourceTreeModelEvents, ResourceTreeModel} from './ResourceTreeModel.js';
12
- import {Events as RuntimeModelEvents, type EventTypes as RuntimeModelEventTypes, RuntimeModel} from './RuntimeModel.js';
13
- import {SDKModel} from './SDKModel.js';
14
- import {Capability, type Target} from './Target.js';
15
-
16
- const DEVTOOLS_ANIMATIONS_WORLD_NAME = 'devtools_animations';
17
- const REPORT_SCROLL_POSITION_BINDING_NAME = '__devtools_report_scroll_position__';
18
-
19
- const getScrollListenerNameInPage = (id: number): string => `__devtools_scroll_listener_${id}__`;
20
-
21
- type ScrollListener = (param: {scrollLeft: number, scrollTop: number}) => void;
22
- type BindingListener =
23
- (ev: Common.EventTarget.EventTargetEvent<Protocol.Runtime.BindingCalledEvent, RuntimeModelEventTypes>) => void;
24
-
25
- async function resolveToObjectInWorld(domNode: DOMNode, worldName: string): Promise<RemoteObject|null> {
26
- const resourceTreeModel = domNode.domModel().target().model(ResourceTreeModel) as ResourceTreeModel;
27
- const pageAgent = domNode.domModel().target().pageAgent();
28
- for (const frame of resourceTreeModel.frames()) {
29
- // This returns previously created world if it exists for the frame.
30
- const {executionContextId} = await pageAgent.invoke_createIsolatedWorld({frameId: frame.id, worldName});
31
- const object = await domNode.resolveToObject(undefined, executionContextId);
32
- if (object) {
33
- return object;
34
- }
35
- }
36
- return null;
37
- }
38
-
39
- /**
40
- * Provides an extension over `DOMNode` that gives it additional
41
- * capabilities for animation debugging, mainly:
42
- * - getting a node's scroll information (scroll offsets and scroll range).
43
- * - updating a node's scroll offset.
44
- * - tracking the node's scroll offsets with event listeners.
45
- *
46
- * It works by running functions on the target page, see `DOMNode`s `callFunction` method
47
- * for more details on how a function is called on the target page.
48
- *
49
- * For listening to events on the target page and getting notified on the devtools frontend
50
- * side, we're adding a binding to the page `__devtools_report_scroll_position__` in a world `devtools_animation`
51
- * we've created. Then, we're setting scroll listeners of the `node` in the same world which calls the binding
52
- * itself with the scroll offsets.
53
- */
54
- export class AnimationDOMNode {
55
- #domNode: DOMNode;
56
- #scrollListenersById = new Map<number, ScrollListener>();
57
- #scrollBindingListener?: BindingListener;
58
-
59
- static lastAddedListenerId = 0;
60
-
61
- constructor(domNode: DOMNode) {
62
- this.#domNode = domNode;
63
- }
64
-
65
- async #addReportScrollPositionBinding(): Promise<void> {
66
- // The binding is already added so we don't need to add it again.
67
- if (this.#scrollBindingListener) {
68
- return;
69
- }
70
-
71
- this.#scrollBindingListener = ev => {
72
- const {name, payload} = ev.data;
73
- if (name !== REPORT_SCROLL_POSITION_BINDING_NAME) {
74
- return;
75
- }
76
-
77
- const {scrollTop, scrollLeft, id} = JSON.parse(payload) as {scrollTop: number, scrollLeft: number, id: number};
78
- const scrollListener = this.#scrollListenersById.get(id);
79
- if (!scrollListener) {
80
- return;
81
- }
82
-
83
- scrollListener({scrollTop, scrollLeft});
84
- };
85
-
86
- const runtimeModel = this.#domNode.domModel().target().model(RuntimeModel) as RuntimeModel;
87
- await runtimeModel.addBinding({
88
- name: REPORT_SCROLL_POSITION_BINDING_NAME,
89
- executionContextName: DEVTOOLS_ANIMATIONS_WORLD_NAME,
90
- });
91
- runtimeModel.addEventListener(RuntimeModelEvents.BindingCalled, this.#scrollBindingListener);
92
- }
93
-
94
- async #removeReportScrollPositionBinding(): Promise<void> {
95
- // There isn't any binding added yet.
96
- if (!this.#scrollBindingListener) {
97
- return;
98
- }
99
-
100
- const runtimeModel = this.#domNode.domModel().target().model(RuntimeModel) as RuntimeModel;
101
- await runtimeModel.removeBinding({
102
- name: REPORT_SCROLL_POSITION_BINDING_NAME,
103
- });
104
- runtimeModel.removeEventListener(RuntimeModelEvents.BindingCalled, this.#scrollBindingListener);
105
- this.#scrollBindingListener = undefined;
106
- }
107
-
108
- async addScrollEventListener(onScroll: ({scrollLeft, scrollTop}: {scrollLeft: number, scrollTop: number}) => void):
109
- Promise<number|null> {
110
- AnimationDOMNode.lastAddedListenerId++;
111
- const id = AnimationDOMNode.lastAddedListenerId;
112
- this.#scrollListenersById.set(id, onScroll);
113
- // Add the binding for reporting scroll events from the page if it doesn't exist.
114
- if (!this.#scrollBindingListener) {
115
- await this.#addReportScrollPositionBinding();
116
- }
117
-
118
- const object = await resolveToObjectInWorld(this.#domNode, DEVTOOLS_ANIMATIONS_WORLD_NAME);
119
- if (!object) {
120
- return null;
121
- }
122
-
123
- await object.callFunction(scrollListenerInPage, [
124
- id,
125
- REPORT_SCROLL_POSITION_BINDING_NAME,
126
- getScrollListenerNameInPage(id),
127
- ].map(arg => RemoteObject.toCallArgument(arg)));
128
- object.release();
129
- return id;
130
-
131
- function scrollListenerInPage(
132
- this: HTMLElement|Document, id: number, reportScrollPositionBindingName: string,
133
- scrollListenerNameInPage: string): void {
134
- if ('scrollingElement' in this && !this.scrollingElement) {
135
- return;
136
- }
137
-
138
- const scrollingElement = ('scrollingElement' in this ? this.scrollingElement : this) as HTMLElement;
139
- // @ts-expect-error We're setting a custom field on `Element` or `Document` for retaining the function on the page.
140
- this[scrollListenerNameInPage] = () => {
141
- // @ts-expect-error `reportScrollPosition` binding is injected to the page before calling the function.
142
- globalThis[reportScrollPositionBindingName](
143
- JSON.stringify({scrollTop: scrollingElement.scrollTop, scrollLeft: scrollingElement.scrollLeft, id}));
144
- };
145
-
146
- // @ts-expect-error We've already defined the function used below.
147
- this.addEventListener('scroll', this[scrollListenerNameInPage], true);
148
- }
149
- }
150
-
151
- async removeScrollEventListener(id: number): Promise<void> {
152
- const object = await resolveToObjectInWorld(this.#domNode, DEVTOOLS_ANIMATIONS_WORLD_NAME);
153
- if (!object) {
154
- return;
155
- }
156
-
157
- await object.callFunction(
158
- removeScrollListenerInPage, [getScrollListenerNameInPage(id)].map(arg => RemoteObject.toCallArgument(arg)));
159
- object.release();
160
-
161
- this.#scrollListenersById.delete(id);
162
- // There aren't any scroll listeners remained on the page
163
- // so we remove the binding.
164
- if (this.#scrollListenersById.size === 0) {
165
- await this.#removeReportScrollPositionBinding();
166
- }
167
-
168
- function removeScrollListenerInPage(this: HTMLElement|Document, scrollListenerNameInPage: string): void {
169
- // @ts-expect-error We've already set this custom field while adding scroll listener.
170
- this.removeEventListener('scroll', this[scrollListenerNameInPage]);
171
- // @ts-expect-error We've already set this custom field while adding scroll listener.
172
- delete this[scrollListenerNameInPage];
173
- }
174
- }
175
-
176
- async scrollTop(): Promise<number|null> {
177
- return await this.#domNode.callFunction(scrollTopInPage).then(res => res?.value ?? null);
178
-
179
- function scrollTopInPage(this: Element|Document): number {
180
- if ('scrollingElement' in this) {
181
- if (!this.scrollingElement) {
182
- return 0;
183
- }
184
-
185
- return this.scrollingElement.scrollTop;
186
- }
187
- return this.scrollTop;
188
- }
189
- }
190
-
191
- async scrollLeft(): Promise<number|null> {
192
- return await this.#domNode.callFunction(scrollLeftInPage).then(res => res?.value ?? null);
193
-
194
- function scrollLeftInPage(this: Element|Document): number {
195
- if ('scrollingElement' in this) {
196
- if (!this.scrollingElement) {
197
- return 0;
198
- }
199
-
200
- return this.scrollingElement.scrollLeft;
201
- }
202
- return this.scrollLeft;
203
- }
204
- }
205
-
206
- async setScrollTop(offset: number): Promise<void> {
207
- await this.#domNode.callFunction(setScrollTopInPage, [offset]);
208
-
209
- function setScrollTopInPage(this: Element|Document, offsetInPage: number): void {
210
- if ('scrollingElement' in this) {
211
- if (!this.scrollingElement) {
212
- return;
213
- }
214
-
215
- this.scrollingElement.scrollTop = offsetInPage;
216
- } else {
217
- this.scrollTop = offsetInPage;
218
- }
219
- }
220
- }
221
-
222
- async setScrollLeft(offset: number): Promise<void> {
223
- await this.#domNode.callFunction(setScrollLeftInPage, [offset]);
224
-
225
- function setScrollLeftInPage(this: Element|Document, offsetInPage: number): void {
226
- if ('scrollingElement' in this) {
227
- if (!this.scrollingElement) {
228
- return;
229
- }
230
-
231
- this.scrollingElement.scrollLeft = offsetInPage;
232
- } else {
233
- this.scrollLeft = offsetInPage;
234
- }
235
- }
236
- }
237
-
238
- async verticalScrollRange(): Promise<number|null> {
239
- return await this.#domNode.callFunction(verticalScrollRangeInPage).then(res => res?.value ?? null);
240
-
241
- function verticalScrollRangeInPage(this: Element|Document): number {
242
- if ('scrollingElement' in this) {
243
- if (!this.scrollingElement) {
244
- return 0;
245
- }
246
-
247
- return this.scrollingElement.scrollHeight - this.scrollingElement.clientHeight;
248
- }
249
-
250
- return this.scrollHeight - this.clientHeight;
251
- }
252
- }
253
-
254
- async horizontalScrollRange(): Promise<number|null> {
255
- return await this.#domNode.callFunction(horizontalScrollRangeInPage).then(res => res?.value ?? null);
256
-
257
- function horizontalScrollRangeInPage(this: Element|Document): number {
258
- if ('scrollingElement' in this) {
259
- if (!this.scrollingElement) {
260
- return 0;
261
- }
262
-
263
- return this.scrollingElement.scrollWidth - this.scrollingElement.clientWidth;
264
- }
265
-
266
- return this.scrollWidth - this.clientWidth;
267
- }
268
- }
269
- }
270
-
271
- function shouldGroupAnimations(firstAnimation: AnimationImpl, anim: AnimationImpl): boolean {
272
- const firstAnimationTimeline = firstAnimation.viewOrScrollTimeline();
273
- const animationTimeline = anim.viewOrScrollTimeline();
274
- if (firstAnimationTimeline) {
275
- // This is a SDA group so check whether the animation's
276
- // scroll container and scroll axis is the same with the first animation.
277
- return Boolean(
278
- animationTimeline && firstAnimationTimeline.sourceNodeId === animationTimeline.sourceNodeId &&
279
- firstAnimationTimeline.axis === animationTimeline.axis);
280
- }
281
- // This is a non-SDA group so check whether the coming animation
282
- // is a time based one too and if so, compare their start times.
283
- return !animationTimeline && firstAnimation.startTime() === anim.startTime();
284
- }
285
-
286
- export class AnimationModel extends SDKModel<EventTypes> {
287
- readonly runtimeModel: RuntimeModel;
288
- readonly agent: ProtocolProxyApi.AnimationApi;
289
- #animationsById = new Map<string, AnimationImpl>();
290
- readonly animationGroups = new Map<string, AnimationGroup>();
291
- #pendingAnimations = new Set<string>();
292
- playbackRate = 1;
293
- #flushPendingAnimations: () => void;
294
-
295
- constructor(target: Target) {
296
- super(target);
297
- this.runtimeModel = (target.model(RuntimeModel) as RuntimeModel);
298
- this.agent = target.animationAgent();
299
- target.registerAnimationDispatcher(new AnimationDispatcher(this));
300
-
301
- if (!target.suspended()) {
302
- void this.agent.invoke_enable();
303
- }
304
-
305
- const resourceTreeModel = (target.model(ResourceTreeModel) as ResourceTreeModel);
306
- resourceTreeModel.addEventListener(ResourceTreeModelEvents.PrimaryPageChanged, this.reset, this);
307
-
308
- this.#flushPendingAnimations = Common.Debouncer.debounce(() => {
309
- while (this.#pendingAnimations.size) {
310
- this.matchExistingGroups(this.createGroupFromPendingAnimations());
311
- }
312
- }, 100);
313
- }
314
-
315
- private reset(): void {
316
- this.#animationsById.clear();
317
- this.animationGroups.clear();
318
- this.#pendingAnimations.clear();
319
- this.dispatchEventToListeners(Events.ModelReset);
320
- }
321
-
322
- async devicePixelRatio(): Promise<number> {
323
- const evaluateResult = await this.target().runtimeAgent().invoke_evaluate({expression: 'window.devicePixelRatio'});
324
- if (evaluateResult?.result.type === 'number') {
325
- return evaluateResult?.result.value as number ?? 1;
326
- }
327
-
328
- return 1;
329
- }
330
-
331
- async getAnimationGroupForAnimation(name: string, nodeId: Protocol.DOM.NodeId): Promise<AnimationGroup|null> {
332
- for (const animationGroup of this.animationGroups.values()) {
333
- for (const animation of animationGroup.animations()) {
334
- if (animation.name() === name) {
335
- const animationNode = await animation.source().node();
336
- if (animationNode?.id === nodeId) {
337
- return animationGroup;
338
- }
339
- }
340
- }
341
- }
342
-
343
- return null;
344
- }
345
-
346
- animationCanceled(id: string): void {
347
- this.#pendingAnimations.delete(id);
348
- }
349
-
350
- async animationUpdated(payload: Protocol.Animation.Animation): Promise<void> {
351
- let foundAnimationGroup: AnimationGroup|undefined;
352
- let foundAnimation: AnimationImpl|undefined;
353
- for (const animationGroup of this.animationGroups.values()) {
354
- foundAnimation = animationGroup.animations().find(animation => animation.id() === payload.id);
355
- if (foundAnimation) {
356
- foundAnimationGroup = animationGroup;
357
- break;
358
- }
359
- }
360
-
361
- if (!foundAnimation || !foundAnimationGroup) {
362
- return;
363
- }
364
-
365
- await foundAnimation.setPayload(payload);
366
- this.dispatchEventToListeners(Events.AnimationGroupUpdated, foundAnimationGroup);
367
- }
368
-
369
- async animationStarted(payload: Protocol.Animation.Animation): Promise<void> {
370
- // We are not interested in animations without effect or target.
371
- if (!payload.source?.backendNodeId) {
372
- return;
373
- }
374
-
375
- const animation = await AnimationImpl.parsePayload(this, payload);
376
- // Ignore Web Animations custom effects & groups.
377
- const keyframesRule = animation.source().keyframesRule();
378
- if (animation.type() === 'WebAnimation' && keyframesRule && keyframesRule.keyframes().length === 0) {
379
- this.#pendingAnimations.delete(animation.id());
380
- } else {
381
- this.#animationsById.set(animation.id(), animation);
382
- this.#pendingAnimations.add(animation.id());
383
- }
384
-
385
- this.#flushPendingAnimations();
386
- }
387
-
388
- private matchExistingGroups(incomingGroup: AnimationGroup): boolean {
389
- let matchedGroup: AnimationGroup|null = null;
390
- for (const group of this.animationGroups.values()) {
391
- if (group.matches(incomingGroup)) {
392
- matchedGroup = group;
393
- group.rebaseTo(incomingGroup);
394
- break;
395
- }
396
-
397
- if (group.shouldInclude(incomingGroup)) {
398
- matchedGroup = group;
399
- group.appendAnimations(incomingGroup.animations());
400
- break;
401
- }
402
- }
403
-
404
- if (!matchedGroup) {
405
- this.animationGroups.set(incomingGroup.id(), incomingGroup);
406
- this.dispatchEventToListeners(Events.AnimationGroupStarted, incomingGroup);
407
- } else {
408
- this.dispatchEventToListeners(Events.AnimationGroupUpdated, matchedGroup);
409
- }
410
- return Boolean(matchedGroup);
411
- }
412
-
413
- private createGroupFromPendingAnimations(): AnimationGroup {
414
- console.assert(this.#pendingAnimations.size > 0);
415
- const firstAnimationId = this.#pendingAnimations.values().next().value as string;
416
- this.#pendingAnimations.delete(firstAnimationId);
417
-
418
- const firstAnimation = this.#animationsById.get(firstAnimationId);
419
- if (!firstAnimation) {
420
- throw new Error('Unable to locate first animation');
421
- }
422
-
423
- const groupedAnimations = [firstAnimation];
424
- const remainingAnimations = new Set<string>();
425
-
426
- for (const id of this.#pendingAnimations) {
427
- const anim = this.#animationsById.get(id) as AnimationImpl;
428
- if (shouldGroupAnimations(firstAnimation, anim)) {
429
- groupedAnimations.push(anim);
430
- } else {
431
- remainingAnimations.add(id);
432
- }
433
- }
434
-
435
- this.#pendingAnimations = remainingAnimations;
436
- // Show the first starting animation at the top of the animations of the animation group.
437
- groupedAnimations.sort((anim1, anim2) => anim1.startTime() - anim2.startTime());
438
- return new AnimationGroup(this, firstAnimationId, groupedAnimations);
439
- }
440
-
441
- setPlaybackRate(playbackRate: number): void {
442
- this.playbackRate = playbackRate;
443
- void this.agent.invoke_setPlaybackRate({playbackRate});
444
- }
445
-
446
- async releaseAllAnimations(): Promise<void> {
447
- const animationIds = [...this.animationGroups.values()].flatMap(
448
- animationGroup => animationGroup.animations().map(animation => animation.id()));
449
- await this.agent.invoke_releaseAnimations({animations: animationIds});
450
- }
451
-
452
- releaseAnimations(animations: string[]): void {
453
- void this.agent.invoke_releaseAnimations({animations});
454
- }
455
-
456
- override async suspendModel(): Promise<void> {
457
- await this.agent.invoke_disable().then(() => this.reset());
458
- }
459
-
460
- override async resumeModel(): Promise<void> {
461
- await this.agent.invoke_enable();
462
- }
463
- }
464
-
465
- export enum Events {
466
- /* eslint-disable @typescript-eslint/naming-convention -- Used by web_tests. */
467
- AnimationGroupStarted = 'AnimationGroupStarted',
468
- AnimationGroupUpdated = 'AnimationGroupUpdated',
469
- ModelReset = 'ModelReset',
470
- /* eslint-enable @typescript-eslint/naming-convention */
471
- }
472
-
473
- export interface EventTypes {
474
- [Events.AnimationGroupStarted]: AnimationGroup;
475
- [Events.AnimationGroupUpdated]: AnimationGroup;
476
- [Events.ModelReset]: void;
477
- }
478
-
479
- export class AnimationImpl {
480
- readonly #animationModel: AnimationModel;
481
- #payload!: Protocol.Animation
482
- .Animation; // Assertion is safe because only way to create `AnimationImpl` is to use `parsePayload` which calls `setPayload` and sets the value.
483
- #source!:
484
- AnimationEffect; // Assertion is safe because only way to create `AnimationImpl` is to use `parsePayload` which calls `setPayload` and sets the value.
485
- #playState?: string;
486
-
487
- private constructor(animationModel: AnimationModel) {
488
- this.#animationModel = animationModel;
489
- }
490
-
491
- static async parsePayload(animationModel: AnimationModel, payload: Protocol.Animation.Animation):
492
- Promise<AnimationImpl> {
493
- const animation = new AnimationImpl(animationModel);
494
- await animation.setPayload(payload);
495
- return animation;
496
- }
497
-
498
- async setPayload(payload: Protocol.Animation.Animation): Promise<void> {
499
- // TODO(b/40929569): Remove normalizing by devicePixelRatio after the attached bug is resolved.
500
- if (payload.viewOrScrollTimeline) {
501
- const devicePixelRatio = await this.#animationModel.devicePixelRatio();
502
- if (payload.viewOrScrollTimeline.startOffset) {
503
- payload.viewOrScrollTimeline.startOffset /= devicePixelRatio;
504
- }
505
-
506
- if (payload.viewOrScrollTimeline.endOffset) {
507
- payload.viewOrScrollTimeline.endOffset /= devicePixelRatio;
508
- }
509
- }
510
-
511
- this.#payload = payload;
512
- if (this.#source && payload.source) {
513
- this.#source.setPayload(payload.source);
514
- } else if (!this.#source && payload.source) {
515
- this.#source = new AnimationEffect(this.#animationModel, payload.source);
516
- }
517
- }
518
-
519
- // `startTime` and `duration` is represented as the
520
- // percentage of the view timeline range that starts at `startOffset`px
521
- // from the scroll container and ends at `endOffset`px of the scroll container.
522
- // This takes a percentage of the timeline range and returns the absolute
523
- // pixels values as a scroll offset of the scroll container.
524
- private percentageToPixels(percentage: number, viewOrScrollTimeline: Protocol.Animation.ViewOrScrollTimeline):
525
- number {
526
- const {startOffset, endOffset} = viewOrScrollTimeline;
527
- if (startOffset === undefined || endOffset === undefined) {
528
- // We don't expect this situation to occur since after an animation is started
529
- // we expect the scroll offsets to be resolved and provided correctly. If `startOffset`
530
- // or `endOffset` is not provided in a viewOrScrollTimeline; we can assume that there is a bug here
531
- // so it's fine to throw an error.
532
- throw new Error('startOffset or endOffset does not exist in viewOrScrollTimeline');
533
- }
534
-
535
- return (endOffset - startOffset) * (percentage / 100);
536
- }
537
-
538
- viewOrScrollTimeline(): Protocol.Animation.ViewOrScrollTimeline|undefined {
539
- return this.#payload.viewOrScrollTimeline;
540
- }
541
-
542
- id(): string {
543
- return this.#payload.id;
544
- }
545
-
546
- name(): string {
547
- return this.#payload.name;
548
- }
549
-
550
- paused(): boolean {
551
- return this.#payload.pausedState;
552
- }
553
-
554
- playState(): string {
555
- return this.#playState || this.#payload.playState;
556
- }
557
-
558
- playbackRate(): number {
559
- return this.#payload.playbackRate;
560
- }
561
-
562
- // For scroll driven animations, it returns the pixel offset in the scroll container
563
- // For time animations, it returns milliseconds.
564
- startTime(): number {
565
- const viewOrScrollTimeline = this.viewOrScrollTimeline();
566
- if (viewOrScrollTimeline) {
567
- return this.percentageToPixels(
568
- this.playbackRate() > 0 ? this.#payload.startTime : 100 - this.#payload.startTime,
569
- viewOrScrollTimeline) +
570
- (this.viewOrScrollTimeline()?.startOffset ?? 0);
571
- }
572
-
573
- return this.#payload.startTime;
574
- }
575
-
576
- // For scroll driven animations, it returns the duration in pixels (i.e. after how many pixels of scroll the animation is going to end)
577
- // For time animations, it returns milliseconds.
578
- iterationDuration(): number {
579
- const viewOrScrollTimeline = this.viewOrScrollTimeline();
580
- if (viewOrScrollTimeline) {
581
- return this.percentageToPixels(this.source().duration(), viewOrScrollTimeline);
582
- }
583
-
584
- return this.source().duration();
585
- }
586
-
587
- // For scroll driven animations, it returns the duration in pixels (i.e. after how many pixels of scroll the animation is going to end)
588
- // For time animations, it returns milliseconds.
589
- endTime(): number {
590
- if (!this.source().iterations) {
591
- return Infinity;
592
- }
593
-
594
- if (this.viewOrScrollTimeline()) {
595
- return this.startTime() + this.iterationDuration() * this.source().iterations();
596
- }
597
-
598
- return this.startTime() + this.source().delay() + this.source().duration() * this.source().iterations() +
599
- this.source().endDelay();
600
- }
601
-
602
- // For scroll driven animations, it returns the duration in pixels (i.e. after how many pixels of scroll the animation is going to end)
603
- // For time animations, it returns milliseconds.
604
- finiteDuration(): number {
605
- const iterations = Math.min(this.source().iterations(), 3);
606
- if (this.viewOrScrollTimeline()) {
607
- return this.iterationDuration() * iterations;
608
- }
609
-
610
- return this.source().delay() + this.source().duration() * iterations;
611
- }
612
-
613
- // For scroll driven animations, it returns the duration in pixels (i.e. after how many pixels of scroll the animation is going to end)
614
- // For time animations, it returns milliseconds.
615
- currentTime(): number {
616
- const viewOrScrollTimeline = this.viewOrScrollTimeline();
617
- if (viewOrScrollTimeline) {
618
- return this.percentageToPixels(this.#payload.currentTime, viewOrScrollTimeline);
619
- }
620
-
621
- return this.#payload.currentTime;
622
- }
623
-
624
- source(): AnimationEffect {
625
- return this.#source;
626
- }
627
-
628
- type(): Protocol.Animation.AnimationType {
629
- return this.#payload.type;
630
- }
631
-
632
- overlaps(animation: AnimationImpl): boolean {
633
- // Infinite animations
634
- if (!this.source().iterations() || !animation.source().iterations()) {
635
- return true;
636
- }
637
-
638
- const firstAnimation = this.startTime() < animation.startTime() ? this : animation;
639
- const secondAnimation = firstAnimation === this ? animation : this;
640
- return firstAnimation.endTime() >= secondAnimation.startTime();
641
- }
642
-
643
- // Utility method for returning `delay` for time based animations
644
- // and `startTime` in pixels for scroll driven animations. It is used to
645
- // find the exact starting time of the first keyframe for both cases.
646
- delayOrStartTime(): number {
647
- if (this.viewOrScrollTimeline()) {
648
- return this.startTime();
649
- }
650
-
651
- return this.source().delay();
652
- }
653
-
654
- setTiming(duration: number, delay: number): void {
655
- void this.#source.node().then(node => {
656
- if (!node) {
657
- throw new Error('Unable to find node');
658
- }
659
- this.updateNodeStyle(duration, delay, node);
660
- });
661
- this.#source.durationInternal = duration;
662
- this.#source.delayInternal = delay;
663
- void this.#animationModel.agent.invoke_setTiming({animationId: this.id(), duration, delay});
664
- }
665
-
666
- private updateNodeStyle(duration: number, delay: number, node: DOMNode): void {
667
- let animationPrefix;
668
- if (this.type() === Protocol.Animation.AnimationType.CSSTransition) {
669
- animationPrefix = 'transition-';
670
- } else if (this.type() === Protocol.Animation.AnimationType.CSSAnimation) {
671
- animationPrefix = 'animation-';
672
- } else {
673
- return;
674
- }
675
-
676
- if (!node.id) {
677
- throw new Error('Node has no id');
678
- }
679
-
680
- const cssModel = node.domModel().cssModel();
681
- cssModel.setEffectivePropertyValueForNode(node.id, animationPrefix + 'duration', duration + 'ms');
682
- cssModel.setEffectivePropertyValueForNode(node.id, animationPrefix + 'delay', delay + 'ms');
683
- }
684
-
685
- async remoteObjectPromise(): Promise<RemoteObject|null> {
686
- const payload = await this.#animationModel.agent.invoke_resolveAnimation({animationId: this.id()});
687
- if (!payload) {
688
- return null;
689
- }
690
-
691
- return this.#animationModel.runtimeModel.createRemoteObject(payload.remoteObject);
692
- }
693
-
694
- cssId(): string {
695
- return this.#payload.cssId || '';
696
- }
697
- }
698
-
699
- export class AnimationEffect {
700
- #animationModel: AnimationModel;
701
- #payload!: Protocol.Animation
702
- .AnimationEffect; // Assertion is safe because `setPayload` call in `constructor` sets the value.
703
- delayInternal!: number; // Assertion is safe because `setPayload` call in `constructor` sets the value.
704
- durationInternal!: number; // Assertion is safe because `setPayload` call in `constructor` sets the value.
705
- #keyframesRule: KeyframesRule|undefined;
706
- #deferredNode?: DeferredDOMNode;
707
- constructor(animationModel: AnimationModel, payload: Protocol.Animation.AnimationEffect) {
708
- this.#animationModel = animationModel;
709
- this.setPayload(payload);
710
- }
711
-
712
- setPayload(payload: Protocol.Animation.AnimationEffect): void {
713
- this.#payload = payload;
714
- if (!this.#keyframesRule && payload.keyframesRule) {
715
- this.#keyframesRule = new KeyframesRule(payload.keyframesRule);
716
- } else if (this.#keyframesRule && payload.keyframesRule) {
717
- this.#keyframesRule.setPayload(payload.keyframesRule);
718
- }
719
-
720
- this.delayInternal = payload.delay;
721
- this.durationInternal = payload.duration;
722
- }
723
-
724
- delay(): number {
725
- return this.delayInternal;
726
- }
727
-
728
- endDelay(): number {
729
- return this.#payload.endDelay;
730
- }
731
-
732
- iterations(): number {
733
- // Animations with zero duration, zero delays and infinite iterations can't be shown.
734
- if (!this.delay() && !this.endDelay() && !this.duration()) {
735
- return 0;
736
- }
737
- return this.#payload.iterations || Infinity;
738
- }
739
-
740
- duration(): number {
741
- return this.durationInternal;
742
- }
743
-
744
- direction(): string {
745
- return this.#payload.direction;
746
- }
747
-
748
- fill(): string {
749
- return this.#payload.fill;
750
- }
751
-
752
- node(): Promise<DOMNode|null> {
753
- if (!this.#deferredNode) {
754
- this.#deferredNode = new DeferredDOMNode(this.#animationModel.target(), this.backendNodeId());
755
- }
756
- return this.#deferredNode.resolvePromise();
757
- }
758
-
759
- deferredNode(): DeferredDOMNode {
760
- return new DeferredDOMNode(this.#animationModel.target(), this.backendNodeId());
761
- }
762
-
763
- backendNodeId(): Protocol.DOM.BackendNodeId {
764
- return this.#payload.backendNodeId as Protocol.DOM.BackendNodeId;
765
- }
766
-
767
- keyframesRule(): KeyframesRule|null {
768
- return this.#keyframesRule || null;
769
- }
770
-
771
- easing(): string {
772
- return this.#payload.easing;
773
- }
774
- }
775
-
776
- export class KeyframesRule {
777
- #payload!: Protocol.Animation
778
- .KeyframesRule; // Assertion is safe because `setPayload` call in `constructor` sets the value.;
779
- #keyframes!: KeyframeStyle[]; // Assertion is safe because `setPayload` call in `constructor` sets the value.;
780
- constructor(payload: Protocol.Animation.KeyframesRule) {
781
- this.setPayload(payload);
782
- }
783
-
784
- setPayload(payload: Protocol.Animation.KeyframesRule): void {
785
- this.#payload = payload;
786
- if (!this.#keyframes) {
787
- this.#keyframes = this.#payload.keyframes.map(keyframeStyle => new KeyframeStyle(keyframeStyle));
788
- } else {
789
- this.#payload.keyframes.forEach((keyframeStyle, index) => {
790
- this.#keyframes[index]?.setPayload(keyframeStyle);
791
- });
792
- }
793
- }
794
-
795
- name(): string|undefined {
796
- return this.#payload.name;
797
- }
798
-
799
- keyframes(): KeyframeStyle[] {
800
- return this.#keyframes;
801
- }
802
- }
803
-
804
- export class KeyframeStyle {
805
- #payload!:
806
- Protocol.Animation.KeyframeStyle; // Assertion is safe because `setPayload` call in `constructor` sets the value.
807
- #offset!: string; // Assertion is safe because `setPayload` call in `constructor` sets the value.
808
- constructor(payload: Protocol.Animation.KeyframeStyle) {
809
- this.setPayload(payload);
810
- }
811
-
812
- setPayload(payload: Protocol.Animation.KeyframeStyle): void {
813
- this.#payload = payload;
814
- this.#offset = payload.offset;
815
- }
816
-
817
- offset(): string {
818
- return this.#offset;
819
- }
820
-
821
- setOffset(offset: number): void {
822
- this.#offset = offset * 100 + '%';
823
- }
824
-
825
- offsetAsNumber(): number {
826
- return parseFloat(this.#offset) / 100;
827
- }
828
-
829
- easing(): string {
830
- return this.#payload.easing;
831
- }
832
- }
833
-
834
- export class AnimationGroup {
835
- readonly #animationModel: AnimationModel;
836
- readonly #id: string;
837
- #scrollNode: AnimationDOMNode|undefined;
838
- #animations: AnimationImpl[];
839
- #paused: boolean;
840
- constructor(animationModel: AnimationModel, id: string, animations: AnimationImpl[]) {
841
- this.#animationModel = animationModel;
842
- this.#id = id;
843
- this.#animations = animations;
844
- this.#paused = false;
845
- }
846
-
847
- isScrollDriven(): boolean {
848
- return Boolean(this.#animations[0]?.viewOrScrollTimeline());
849
- }
850
-
851
- id(): string {
852
- return this.#id;
853
- }
854
-
855
- animations(): AnimationImpl[] {
856
- return this.#animations;
857
- }
858
-
859
- release(): void {
860
- this.#animationModel.animationGroups.delete(this.id());
861
- this.#animationModel.releaseAnimations(this.animationIds());
862
- }
863
-
864
- private animationIds(): string[] {
865
- function extractId(animation: AnimationImpl): string {
866
- return animation.id();
867
- }
868
-
869
- return this.#animations.map(extractId);
870
- }
871
-
872
- startTime(): number {
873
- return this.#animations[0].startTime();
874
- }
875
-
876
- // For scroll driven animations, it returns the duration in pixels (i.e. after how many pixels of scroll the animation is going to end)
877
- // For time animations, it returns milliseconds.
878
- groupDuration(): number {
879
- let duration = 0;
880
- for (const anim of this.#animations) {
881
- duration = Math.max(duration, anim.delayOrStartTime() + anim.iterationDuration());
882
- }
883
- return duration;
884
- }
885
-
886
- // For scroll driven animations, it returns the duration in pixels (i.e. after how many pixels of scroll the animation is going to end)
887
- // For time animations, it returns milliseconds.
888
- finiteDuration(): number {
889
- let maxDuration = 0;
890
- for (let i = 0; i < this.#animations.length; ++i) {
891
- maxDuration = Math.max(maxDuration, this.#animations[i].finiteDuration());
892
- }
893
- return maxDuration;
894
- }
895
-
896
- scrollOrientation(): Protocol.DOM.ScrollOrientation|null {
897
- const timeline = this.#animations[0]?.viewOrScrollTimeline();
898
- if (!timeline) {
899
- return null;
900
- }
901
-
902
- return timeline.axis;
903
- }
904
-
905
- async scrollNode(): Promise<AnimationDOMNode|null> {
906
- if (this.#scrollNode) {
907
- return this.#scrollNode;
908
- }
909
-
910
- if (!this.isScrollDriven()) {
911
- return null;
912
- }
913
-
914
- const sourceNodeId = this.#animations[0]?.viewOrScrollTimeline()?.sourceNodeId;
915
- if (!sourceNodeId) {
916
- return null;
917
- }
918
-
919
- const deferredScrollNode = new DeferredDOMNode(this.#animationModel.target(), sourceNodeId);
920
- const scrollNode = await deferredScrollNode.resolvePromise();
921
- if (!scrollNode) {
922
- return null;
923
- }
924
-
925
- this.#scrollNode = new AnimationDOMNode(scrollNode);
926
- return this.#scrollNode;
927
- }
928
-
929
- seekTo(currentTime: number): void {
930
- void this.#animationModel.agent.invoke_seekAnimations({animations: this.animationIds(), currentTime});
931
- }
932
-
933
- paused(): boolean {
934
- return this.#paused;
935
- }
936
-
937
- togglePause(paused: boolean): void {
938
- if (paused === this.#paused) {
939
- return;
940
- }
941
- this.#paused = paused;
942
- void this.#animationModel.agent.invoke_setPaused({animations: this.animationIds(), paused});
943
- }
944
-
945
- currentTimePromise(): Promise<number> {
946
- let longestAnim: AnimationImpl|null = null;
947
- for (const anim of this.#animations) {
948
- if (!longestAnim || anim.endTime() > longestAnim.endTime()) {
949
- longestAnim = anim;
950
- }
951
- }
952
- if (!longestAnim) {
953
- throw new Error('No longest animation found');
954
- }
955
-
956
- return this.#animationModel.agent.invoke_getCurrentTime({id: longestAnim.id()})
957
- .then(({currentTime}) => currentTime || 0);
958
- }
959
-
960
- matches(group: AnimationGroup): boolean {
961
- function extractId(anim: AnimationImpl): string {
962
- const timelineId = (anim.viewOrScrollTimeline()?.sourceNodeId ?? '') + (anim.viewOrScrollTimeline()?.axis ?? '');
963
- const regularId =
964
- anim.type() === Protocol.Animation.AnimationType.WebAnimation ? anim.type() + anim.id() : anim.cssId();
965
-
966
- return regularId + timelineId;
967
- }
968
-
969
- if (this.#animations.length !== group.#animations.length) {
970
- return false;
971
- }
972
- const left = this.#animations.map(extractId).sort();
973
- const right = group.#animations.map(extractId).sort();
974
- for (let i = 0; i < left.length; i++) {
975
- if (left[i] !== right[i]) {
976
- return false;
977
- }
978
- }
979
- return true;
980
- }
981
-
982
- shouldInclude(group: AnimationGroup): boolean {
983
- // We want to include the animations coming from the incoming group
984
- // inside this group if they were to be grouped if the events came at the same time.
985
- const [firstIncomingAnimation] = group.#animations;
986
- const [firstAnimation] = this.#animations;
987
- return shouldGroupAnimations(firstAnimation, firstIncomingAnimation);
988
- }
989
-
990
- appendAnimations(animations: AnimationImpl[]): void {
991
- this.#animations.push(...animations);
992
- }
993
-
994
- rebaseTo(group: AnimationGroup): void {
995
- this.#animationModel.releaseAnimations(this.animationIds());
996
- this.#animations = group.#animations;
997
- this.#scrollNode = undefined;
998
- }
999
- }
1000
-
1001
- export class AnimationDispatcher implements ProtocolProxyApi.AnimationDispatcher {
1002
- readonly #animationModel: AnimationModel;
1003
- constructor(animationModel: AnimationModel) {
1004
- this.#animationModel = animationModel;
1005
- }
1006
-
1007
- animationCreated(_event: Protocol.Animation.AnimationCreatedEvent): void {
1008
- // Previously this event was used to batch the animations into groups
1009
- // and we were waiting for animationStarted events to be sent for
1010
- // all the created animations and until then we weren't creating any
1011
- // groups. This was allowing us to not miss any animations that were
1012
- // going to be in the same group. However, now we're not using this event
1013
- // to do batching and instead:
1014
- // * We debounce the flush calls so that if the animationStarted events
1015
- // for the same animation group come in different times; we create one
1016
- // group for them.
1017
- // * Even though an animation group is created and rendered for some animations
1018
- // that have the same startTime (or same timeline & scroll axis for SDAs), now
1019
- // whenever an `animationStarted` event comes we check whether there is a group
1020
- // we can add the related animation. If so, we add it and emit `animationGroupUpdated`
1021
- // event. So that, all the animations that were supposed to be in the same group
1022
- // will be in the same group.
1023
- }
1024
-
1025
- animationCanceled({id}: Protocol.Animation.AnimationCanceledEvent): void {
1026
- this.#animationModel.animationCanceled(id);
1027
- }
1028
-
1029
- animationStarted({animation}: Protocol.Animation.AnimationStartedEvent): void {
1030
- void this.#animationModel.animationStarted(animation);
1031
- }
1032
-
1033
- animationUpdated({animation}: Protocol.Animation.AnimationUpdatedEvent): void {
1034
- void this.#animationModel.animationUpdated(animation);
1035
- }
1036
- }
1037
-
1038
- SDKModel.register(AnimationModel, {capabilities: Capability.DOM, autostart: true});
1039
- export interface Request {
1040
- endTime: number;
1041
- }