chrome-devtools-frontend 1.0.1656897 → 1.0.1657855

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 (113) hide show
  1. package/.agents/skills/devtools-ux-writing-refactor/SKILL.md +125 -0
  2. package/.agents/skills/repro-flaky-tests/SKILL.md +53 -0
  3. package/AUTHORS +2 -0
  4. package/docs/get_the_code.md +6 -6
  5. package/front_end/Images/src/ads.svg +1 -0
  6. package/front_end/Tests.js +1 -1
  7. package/front_end/core/common/ResourceType.ts +19 -19
  8. package/front_end/core/common/Revealer.ts +15 -15
  9. package/front_end/core/common/SettingRegistration.ts +19 -19
  10. package/front_end/core/common/Settings.ts +0 -8
  11. package/front_end/core/host/Platform.ts +4 -0
  12. package/front_end/core/sdk/CSSMetadata.ts +121 -16
  13. package/front_end/core/sdk/CSSModel.ts +3 -0
  14. package/front_end/core/sdk/DOMModel.ts +37 -8
  15. package/front_end/core/sdk/DebuggerModel.ts +5 -4
  16. package/front_end/core/sdk/EmulationModel.ts +6 -4
  17. package/front_end/core/sdk/NetworkManager.ts +22 -17
  18. package/front_end/core/sdk/RuntimeModel.ts +1 -1
  19. package/front_end/core/sdk/TargetManager.ts +10 -0
  20. package/front_end/design_system_tokens.css +6 -0
  21. package/front_end/entrypoints/devtools_app/devtools_app.ts +1 -1
  22. package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +13 -4
  23. package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +23 -4
  24. package/front_end/entrypoints/formatter_worker/HTMLFormatter.ts +7 -6
  25. package/front_end/entrypoints/inspector_main/InspectorMain.ts +1 -11
  26. package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +1 -1
  27. package/front_end/entrypoints/main/GlobalAiButton.ts +29 -35
  28. package/front_end/entrypoints/main/MainImpl.ts +7 -34
  29. package/front_end/entrypoints/main/main-meta.ts +9 -9
  30. package/front_end/entrypoints/node_app/app/NodeConnectionsPanel.ts +7 -8
  31. package/front_end/entrypoints/node_app/app/NodeMain.ts +3 -3
  32. package/front_end/entrypoints/node_app/node_app.ts +7 -7
  33. package/front_end/foundation/Universe.ts +60 -1
  34. package/front_end/generated/InspectorBackendCommands.ts +1 -1
  35. package/front_end/generated/protocol.ts +4 -0
  36. package/front_end/models/ai_assistance/AiUtils.ts +6 -6
  37. package/front_end/models/bindings/CSSWorkspaceBinding.ts +8 -5
  38. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +13 -15
  39. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +6 -3
  40. package/front_end/models/bindings/FileUtils.ts +11 -12
  41. package/front_end/models/emulation/DeviceModeModel.ts +56 -37
  42. package/front_end/models/emulation/EmulatedDevices.ts +3 -3
  43. package/front_end/models/live-metrics/LiveMetrics.ts +47 -23
  44. package/front_end/models/project_settings/ProjectSettingsModel.ts +2 -37
  45. package/front_end/models/workspace/FileManager.ts +9 -6
  46. package/front_end/models/workspace_diff/WorkspaceDiff.ts +23 -12
  47. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +2 -1
  48. package/front_end/panels/application/ApplicationPanelSidebar.ts +9 -1
  49. package/front_end/panels/application/BackgroundServiceView.ts +2 -1
  50. package/front_end/panels/application/IndexedDBViews.ts +52 -23
  51. package/front_end/panels/application/ServiceWorkersView.ts +9 -20
  52. package/front_end/panels/application/components/AdsView.ts +1 -1
  53. package/front_end/panels/application/components/StorageMetadataView.ts +7 -2
  54. package/front_end/panels/application/resourcesSidebar.css +5 -0
  55. package/front_end/panels/common/BadgeNotification.ts +1 -1
  56. package/front_end/panels/console/ConsoleContextSelector.ts +3 -3
  57. package/front_end/panels/console/ConsoleInsightTeaser.ts +2 -1
  58. package/front_end/panels/console/ConsolePinPane.ts +10 -10
  59. package/front_end/panels/console/ConsolePrompt.ts +4 -4
  60. package/front_end/panels/console/ConsoleSidebar.ts +7 -7
  61. package/front_end/panels/console/ConsoleView.ts +44 -43
  62. package/front_end/panels/console/ConsoleViewMessage.ts +40 -40
  63. package/front_end/panels/console/console-meta.ts +34 -34
  64. package/front_end/panels/coverage/CoverageView.ts +1 -1
  65. package/front_end/panels/developer_resources/DeveloperResourcesListView.ts +19 -20
  66. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +6 -8
  67. package/front_end/panels/developer_resources/developer_resources-meta.ts +2 -2
  68. package/front_end/panels/elements/ElementsTreeElement.ts +253 -144
  69. package/front_end/panels/elements/ElementsTreeOutline.ts +3 -2
  70. package/front_end/panels/elements/components/AdornerManager.ts +1 -0
  71. package/front_end/panels/emulation/DeviceModeToolbar.ts +19 -19
  72. package/front_end/panels/explain/components/ConsoleInsight.ts +2 -1
  73. package/front_end/panels/media/EventDisplayTable.ts +2 -2
  74. package/front_end/panels/media/EventTimelineView.ts +4 -4
  75. package/front_end/panels/media/MainView.ts +4 -4
  76. package/front_end/panels/media/PlayerDetailView.ts +5 -5
  77. package/front_end/panels/media/PlayerListView.ts +1 -1
  78. package/front_end/panels/media/PlayerMessagesView.ts +12 -12
  79. package/front_end/panels/media/PlayerPropertiesView.ts +17 -17
  80. package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +13 -12
  81. package/front_end/panels/mobile_throttling/ThrottlingManager.ts +8 -7
  82. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +6 -7
  83. package/front_end/panels/mobile_throttling/mobile_throttling-meta.ts +3 -2
  84. package/front_end/panels/network/NetworkLogView.ts +2 -1
  85. package/front_end/panels/network/NetworkWaterfallColumn.ts +1 -3
  86. package/front_end/panels/network/RequestConditionsDrawer.ts +2 -2
  87. package/front_end/panels/network/networkPanel.css +1 -0
  88. package/front_end/panels/network/networkTimingTable.css +1 -1
  89. package/front_end/panels/profiler/HeapSnapshotView.ts +2 -1
  90. package/front_end/panels/profiler/ProfileView.ts +2 -1
  91. package/front_end/panels/protocol_monitor/JSONEditor.ts +10 -10
  92. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +28 -32
  93. package/front_end/panels/protocol_monitor/protocol_monitor-meta.ts +1 -1
  94. package/front_end/panels/recorder/RecorderController.ts +1 -0
  95. package/front_end/panels/recorder/RecorderEvents.ts +8 -0
  96. package/front_end/panels/settings/components/SyncSection.ts +2 -1
  97. package/front_end/panels/timeline/AppenderUtils.ts +12 -4
  98. package/front_end/panels/timeline/ThreadAppender.ts +3 -3
  99. package/front_end/panels/timeline/TimelinePanel.ts +5 -5
  100. package/front_end/panels/timeline/timelineFlameChartView.css +2 -1
  101. package/front_end/panels/webauthn/WebauthnPane.ts +10 -10
  102. package/front_end/third_party/chromium/README.chromium +1 -1
  103. package/front_end/third_party/chromium/ahem/ahem.js +792 -0
  104. package/front_end/tsconfig.json +7 -1
  105. package/front_end/ui/components/dialogs/shortcutDialog.css +15 -12
  106. package/front_end/ui/legacy/ActionRegistration.ts +1 -1
  107. package/front_end/ui/legacy/InspectorView.ts +1 -1
  108. package/front_end/ui/legacy/Treeoutline.ts +15 -0
  109. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +109 -23
  110. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +5 -0
  111. package/front_end/ui/legacy/theme_support/ThemeSupport.ts +2 -2
  112. package/front_end/ui/visual_logging/KnownContextValues.ts +4 -0
  113. package/package.json +1 -1
@@ -45,6 +45,7 @@ import * as SDK from '../../core/sdk/sdk.js';
45
45
  import * as Protocol from '../../generated/protocol.js';
46
46
  import * as AIAssistance from '../../models/ai_assistance/ai_assistance.js';
47
47
  import * as Badges from '../../models/badges/badges.js';
48
+ import * as Bindings from '../../models/bindings/bindings.js';
48
49
  import type * as Elements from '../../models/elements/elements.js';
49
50
  import type * as IssuesManager from '../../models/issues_manager/issues_manager.js';
50
51
  import * as TextUtils from '../../models/text_utils/text_utils.js';
@@ -144,6 +145,11 @@ const UIStrings = {
144
145
  * @description Text to paste an element, paste should be used as a verb
145
146
  */
146
147
  paste: 'Paste',
148
+ /**
149
+ * @description Context menu item in the Edit as HTML editor that selects the editor's entire
150
+ * contents. "Select all" should be used as a verb.
151
+ */
152
+ selectAll: 'Select all',
147
153
  /**
148
154
  * @description Text in Elements Tree Element of the Elements panel, copy should be used as a verb
149
155
  */
@@ -302,6 +308,11 @@ const UIStrings = {
302
308
  * @description Label of an adorner next to the html node in the Elements panel.
303
309
  */
304
310
  viewSourceCode: 'View source code',
311
+ /**
312
+ * @description Label of an adorner in the Elements panel. When clicked, it reveals
313
+ * the definition of the custom element in the Sources panel.
314
+ */
315
+ showCustomElementDefinition: 'Show custom element definition',
305
316
  /**
306
317
  * @description Context menu item in Elements panel to assess visibility of an element via AI.
307
318
  */
@@ -444,6 +455,8 @@ export interface ViewInput {
444
455
  onViewSourceAdornerClick: () => void;
445
456
  onSlotAdornerClick: (e: Event) => void;
446
457
  showSlotAdorner: boolean;
458
+ showCustomElementAdorner: boolean;
459
+ onCustomElementAdornerClick: (e: Event) => void;
447
460
  slotName?: string;
448
461
  showStartingStyleAdorner: boolean;
449
462
  startingStyleAdornerActive: boolean;
@@ -961,7 +974,8 @@ export const DEFAULT_VIEW = (input: ViewInput, output: ViewOutput, target: HTMLE
961
974
  const hasAdorners = !!input.adProvenance || input.showContainerAdorner || input.showFlexAdorner ||
962
975
  input.showGridAdorner || input.showGridLanesAdorner || input.showMediaAdorner || input.showPopoverAdorner ||
963
976
  input.showTopLayerAdorner || input.showViewSourceAdorner || input.showScrollAdorner ||
964
- input.showScrollSnapAdorner || input.showSlotAdorner || input.showStartingStyleAdorner;
977
+ input.showScrollSnapAdorner || input.showSlotAdorner || input.showStartingStyleAdorner ||
978
+ input.showCustomElementAdorner;
965
979
  const gutterContainerClasses = {
966
980
  'has-decorations': input.decorations.length || input.descendantDecorations.length,
967
981
  'gutter-container': true,
@@ -1004,6 +1018,18 @@ export const DEFAULT_VIEW = (input: ViewInput, output: ViewOutput, target: HTMLE
1004
1018
  ${adornerRef()}>
1005
1019
  <span>${ElementsComponents.AdornerManager.RegisteredAdorners.VIEW_SOURCE}</span>
1006
1020
  </devtools-adorner>` : nothing}
1021
+ ${input.showCustomElementAdorner ? html`<devtools-adorner
1022
+ class="custom-element clickable"
1023
+ role=button
1024
+ tabindex=0
1025
+ .name=${ElementsComponents.AdornerManager.RegisteredAdorners.CUSTOM_ELEMENT}
1026
+ jslog=${VisualLogging.adorner(ElementsComponents.AdornerManager.RegisteredAdorners.CUSTOM_ELEMENT).track({ click: true })}
1027
+ aria-label=${i18nString(UIStrings.showCustomElementDefinition)}
1028
+ @click=${input.onCustomElementAdornerClick}
1029
+ @keydown=${handleAdornerKeydown(input.onCustomElementAdornerClick)}
1030
+ ${adornerRef()}>
1031
+ <span>${ElementsComponents.AdornerManager.RegisteredAdorners.CUSTOM_ELEMENT}</span>
1032
+ </devtools-adorner>` : nothing}
1007
1033
  ${input.showContainerAdorner ? html`<devtools-adorner
1008
1034
  class=clickable
1009
1035
  role=button
@@ -1191,6 +1217,9 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
1191
1217
  #hovered: boolean;
1192
1218
  private editing: EditorHandles|null;
1193
1219
  #editorRef?: TextEditor.TextEditor.TextEditor;
1220
+ // True while the Edit as HTML editor's own context menu is open, so that the
1221
+ // focusout caused by the menu taking focus does not commit the edit.
1222
+ #editAsHtmlMenuOpen = false;
1194
1223
  #editorState: CodeMirror.EditorState|null = null;
1195
1224
  #editorWidth: number|null = null;
1196
1225
  expandAllButtonElement: UI.TreeOutline.TreeElement|null;
@@ -1333,50 +1362,53 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
1333
1362
  return;
1334
1363
  }
1335
1364
  const output: ViewOutput = {};
1336
- DEFAULT_VIEW(
1337
- {
1338
- node: !clearNode ? this.nodeInternal : null,
1339
- isClosingTag: this.isClosingTag(),
1340
- expanded: this.expanded,
1341
- isExpandable: this.isExpandable(),
1342
- isXMLMimeType: Boolean(this.treeOutline?.isXMLMimeType),
1343
- updateRecord: this.#updateRecord,
1344
- onHighlightSearchResults: () => this.#highlightSearchResults(),
1345
- onExpand: () => this.expand(),
1346
-
1347
- containerAdornerActive: this.#containerAdornerActive,
1348
- adProvenance: this.nodeInternal.adProvenance(),
1349
- adTooltipId: this.#adTooltipId,
1350
- target: this.nodeInternal.domModel().target(),
1351
- showContainerAdorner: Boolean(this.#layout?.containerType) && !this.isClosingTag(),
1352
- containerType: this.#layout?.containerType,
1353
- showFlexAdorner: Boolean(this.#layout?.isFlex) && !this.isClosingTag(),
1354
- flexAdornerActive: this.#flexAdornerActive,
1355
- showGridAdorner: Boolean(this.#layout?.isGrid) && !this.isClosingTag(),
1356
- showGridLanesAdorner: Boolean(this.#layout?.isGridLanes) && !this.isClosingTag(),
1357
- showMediaAdorner: this.node().isMediaNode() && !this.isClosingTag(),
1358
- showPopoverAdorner: Boolean(Root.Runtime.hostConfig.devToolsAllowPopoverForcing?.enabled) &&
1359
- Boolean(this.node().attributes().find(attr => attr.name === 'popover')) && !this.isClosingTag(),
1360
- showTopLayerAdorner: this.node().topLayerIndex() !== -1 && !this.isClosingTag(),
1361
- gridAdornerActive: this.#gridAdornerActive,
1362
- popoverAdornerActive: this.#popoverAdornerActive,
1363
- isSubgrid: Boolean(this.#layout?.isSubgrid),
1364
- showViewSourceAdorner: this.nodeInternal.isRootNode() && isOpeningTag(this.tagTypeContext),
1365
- showScrollAdorner: ((this.node().nodeName() === 'HTML' && this.node().ownerDocument?.isScrollable()) ||
1366
- (this.node().nodeName() !== '#document' && this.node().isScrollable())) &&
1367
- !this.isClosingTag(),
1368
- decorations: this.#decorations,
1369
- descendantDecorations: this.expanded ? [] : this.#descendantDecorations,
1370
- decorationsTooltip: this.#decorationsTooltip,
1371
- indent: this.computeLeftIndent(),
1372
- showScrollSnapAdorner: Boolean(this.#layout?.hasScroll) && !this.isClosingTag(),
1373
- scrollSnapAdornerActive: this.#scrollSnapAdornerActive,
1374
- showSlotAdorner: Boolean(this.nodeInternal.assignedSlot) && !this.isClosingTag(),
1375
- showStartingStyleAdorner: this.nodeInternal.affectedByStartingStyles() && !this.isClosingTag(),
1376
- startingStyleAdornerActive: this.#startingStyleAdornerActive,
1377
- onStartingStyleAdornerClick:
1378
- this.treeOutline?.disableEdits ? () => {} : (event: Event) => this.#onStartingStyleAdornerClick(event),
1379
- onSlotAdornerClick: () => {
1365
+ DEFAULT_VIEW({
1366
+ node: !clearNode ? this.nodeInternal : null,
1367
+ isClosingTag: this.isClosingTag(),
1368
+ expanded: this.expanded,
1369
+ isExpandable: this.isExpandable(),
1370
+ isXMLMimeType: Boolean(this.treeOutline?.isXMLMimeType),
1371
+ updateRecord: this.#updateRecord,
1372
+ onHighlightSearchResults: () => this.#highlightSearchResults(),
1373
+ onExpand: () => this.expand(),
1374
+
1375
+ containerAdornerActive: this.#containerAdornerActive,
1376
+ adProvenance: this.nodeInternal.adProvenance(),
1377
+ adTooltipId: this.#adTooltipId,
1378
+ target: this.nodeInternal.domModel().target(),
1379
+ showContainerAdorner: Boolean(this.#layout?.containerType) && !this.isClosingTag(),
1380
+ containerType: this.#layout?.containerType,
1381
+ showFlexAdorner: Boolean(this.#layout?.isFlex) && !this.isClosingTag(),
1382
+ flexAdornerActive: this.#flexAdornerActive,
1383
+ showGridAdorner: Boolean(this.#layout?.isGrid) && !this.isClosingTag(),
1384
+ showGridLanesAdorner: Boolean(this.#layout?.isGridLanes) && !this.isClosingTag(),
1385
+ showMediaAdorner: this.node().isMediaNode() && !this.isClosingTag(),
1386
+ showPopoverAdorner: Boolean(Root.Runtime.hostConfig.devToolsAllowPopoverForcing?.enabled) &&
1387
+ Boolean(this.node().attributes().find(attr => attr.name === 'popover')) && !this.isClosingTag(),
1388
+ showTopLayerAdorner: this.node().topLayerIndex() !== -1 && !this.isClosingTag(),
1389
+ gridAdornerActive: this.#gridAdornerActive,
1390
+ popoverAdornerActive: this.#popoverAdornerActive,
1391
+ isSubgrid: Boolean(this.#layout?.isSubgrid),
1392
+ showViewSourceAdorner: this.nodeInternal.isRootNode() && isOpeningTag(this.tagTypeContext),
1393
+ showScrollAdorner: ((this.node().nodeName() === 'HTML' && this.node().ownerDocument?.isScrollable()) ||
1394
+ (this.node().nodeName() !== '#document' && this.node().isScrollable())) &&
1395
+ !this.isClosingTag(),
1396
+ decorations: this.#decorations,
1397
+ descendantDecorations: this.expanded ? [] : this.#descendantDecorations,
1398
+ decorationsTooltip: this.#decorationsTooltip,
1399
+ indent: this.computeLeftIndent(),
1400
+ showScrollSnapAdorner: Boolean(this.#layout?.hasScroll) && !this.isClosingTag(),
1401
+ scrollSnapAdornerActive: this.#scrollSnapAdornerActive,
1402
+ showSlotAdorner: Boolean(this.nodeInternal.assignedSlot) && !this.isClosingTag(),
1403
+ showCustomElementAdorner: this.node().isCustomElement() && !this.isClosingTag(),
1404
+ onCustomElementAdornerClick:
1405
+ this.treeOutline?.disableEdits ? () => {} : (event: Event) => void this.#onCustomElementAdornerClick(event),
1406
+ showStartingStyleAdorner: this.nodeInternal.affectedByStartingStyles() && !this.isClosingTag(),
1407
+ startingStyleAdornerActive: this.#startingStyleAdornerActive,
1408
+ onStartingStyleAdornerClick:
1409
+ this.treeOutline?.disableEdits ? () => {} : (event: Event) => this.#onStartingStyleAdornerClick(event),
1410
+ onSlotAdornerClick:
1411
+ () => {
1380
1412
  if (this.nodeInternal.assignedSlot) {
1381
1413
  const deferredNode = this.nodeInternal.assignedSlot.deferredNode;
1382
1414
  deferredNode.resolve(node => {
@@ -1384,47 +1416,45 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
1384
1416
  });
1385
1417
  }
1386
1418
  },
1387
- topLayerIndex: this.node().topLayerIndex(),
1388
- onViewSourceAdornerClick: this.treeOutline?.disableEdits ? () => {} : this.revealHTMLInSources.bind(this),
1389
- onGutterClick: this.showContextMenu.bind(this),
1390
- onContainerAdornerClick:
1391
- this.treeOutline?.disableEdits ? () => {} : (event: Event) => this.#onContainerAdornerClick(event),
1392
- onFlexAdornerClick: this.treeOutline?.disableEdits ? () => {} :
1393
- (event: Event) => this.#onFlexAdornerClick(event),
1394
- onGridAdornerClick: this.treeOutline?.disableEdits ? () => {} :
1395
- (event: Event) => this.#onGridAdornerClick(event),
1396
- onMediaAdornerClick: this.treeOutline?.disableEdits ? () => {} :
1397
- (event: Event) => this.#onMediaAdornerClick(event),
1398
- onPopoverAdornerClick: this.treeOutline?.disableEdits ? () => {} :
1399
- (event: Event) => this.#onPopoverAdornerClick(event),
1400
- onScrollSnapAdornerClick:
1401
- this.treeOutline?.disableEdits ? () => {} : (event: Event) => this.#onScrollSnapAdornerClick(event),
1402
- onTopLayerAdornerClick: this.treeOutline?.disableEdits ? () => {} :
1403
- () => {
1404
- if (!this.treeOutline) {
1405
- return;
1406
- }
1407
- this.treeOutline.revealInTopLayer(this.node());
1408
- },
1409
- isHovered: this.#hovered,
1410
- isSelected: this.selected,
1411
- showAiButton: Boolean(this.#hovered || this.selected) && this.node().nodeType() === Node.ELEMENT_NODE &&
1412
- this.isAiButtonEnabled() && (this.treeOutline as ElementsTreeOutline)?.showAIButton,
1413
- aiButtonTitle: this.isAiButtonEnabled() ?
1414
- UI.ActionRegistry.ActionRegistry.instance().getAction('freestyler.elements-floating-button').title() :
1415
- undefined,
1416
- onAiButtonClick: (ev: Event) => {
1417
- ev.stopPropagation();
1418
- this.select(true, false);
1419
- const action = UI.ActionRegistry.ActionRegistry.instance().getAction('freestyler.elements-floating-button');
1420
- if (action) {
1421
- void action.execute();
1422
- }
1423
- },
1424
- editorState: this.#editorState,
1425
- editorWidth: this.#editorWidth,
1426
- },
1427
- output, this.listItemElement);
1419
+ topLayerIndex: this.node().topLayerIndex(),
1420
+ onViewSourceAdornerClick: this.treeOutline?.disableEdits ? () => {} : this.revealHTMLInSources.bind(this),
1421
+ onGutterClick: this.showContextMenu.bind(this),
1422
+ onContainerAdornerClick: this.treeOutline?.disableEdits ? () => {} :
1423
+ (event: Event) => this.#onContainerAdornerClick(event),
1424
+ onFlexAdornerClick: this.treeOutline?.disableEdits ? () => {} : (event: Event) => this.#onFlexAdornerClick(event),
1425
+ onGridAdornerClick: this.treeOutline?.disableEdits ? () => {} : (event: Event) => this.#onGridAdornerClick(event),
1426
+ onMediaAdornerClick: this.treeOutline?.disableEdits ? () => {} :
1427
+ (event: Event) => this.#onMediaAdornerClick(event),
1428
+ onPopoverAdornerClick: this.treeOutline?.disableEdits ? () => {} :
1429
+ (event: Event) => this.#onPopoverAdornerClick(event),
1430
+ onScrollSnapAdornerClick:
1431
+ this.treeOutline?.disableEdits ? () => {} : (event: Event) => this.#onScrollSnapAdornerClick(event),
1432
+ onTopLayerAdornerClick: this.treeOutline?.disableEdits ? () => {} :
1433
+ () => {
1434
+ if (!this.treeOutline) {
1435
+ return;
1436
+ }
1437
+ this.treeOutline.revealInTopLayer(this.node());
1438
+ },
1439
+ isHovered: this.#hovered,
1440
+ isSelected: this.selected,
1441
+ showAiButton: Boolean(this.#hovered || this.selected) && this.node().nodeType() === Node.ELEMENT_NODE &&
1442
+ this.isAiButtonEnabled() && (this.treeOutline as ElementsTreeOutline)?.showAIButton,
1443
+ aiButtonTitle: this.isAiButtonEnabled() ?
1444
+ UI.ActionRegistry.ActionRegistry.instance().getAction('freestyler.elements-floating-button').title() :
1445
+ undefined,
1446
+ onAiButtonClick: (ev: Event) => {
1447
+ ev.stopPropagation();
1448
+ this.select(true, false);
1449
+ const action = UI.ActionRegistry.ActionRegistry.instance().getAction('freestyler.elements-floating-button');
1450
+ if (action) {
1451
+ void action.execute();
1452
+ }
1453
+ },
1454
+ editorState: this.#editorState,
1455
+ editorWidth: this.#editorWidth,
1456
+ },
1457
+ output, this.listItemElement);
1428
1458
 
1429
1459
  this.#contentElement = output.contentElement;
1430
1460
  this.#editorRef = output.editorRef;
@@ -1527,6 +1557,10 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
1527
1557
  return !isOpeningTag(this.tagTypeContext);
1528
1558
  }
1529
1559
 
1560
+ isDisplayContents(): boolean {
1561
+ return Boolean(this.#layout?.isContents);
1562
+ }
1563
+
1530
1564
  node(): SDK.DOMModel.DOMNode {
1531
1565
  return this.nodeInternal;
1532
1566
  }
@@ -1732,63 +1766,64 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
1732
1766
  // ElementsPanel.
1733
1767
  // We do not change the ElementsTreeElement state in case the
1734
1768
  // element is bound again.
1735
- DEFAULT_VIEW(
1736
- {
1737
- node: null,
1738
- isClosingTag: false,
1739
- expanded: false,
1740
- isExpandable: false,
1741
- isXMLMimeType: false,
1742
- updateRecord: null,
1743
- onHighlightSearchResults: () => {},
1744
- onExpand: () => {},
1745
- containerAdornerActive: false,
1746
- adProvenance: undefined,
1747
- target: undefined,
1748
- adTooltipId: '',
1749
- showContainerAdorner: false,
1750
- containerType: this.#layout?.containerType,
1751
- showFlexAdorner: false,
1752
- flexAdornerActive: false,
1753
- showGridAdorner: false,
1754
- showGridLanesAdorner: false,
1755
- showMediaAdorner: false,
1756
- showPopoverAdorner: false,
1757
- showTopLayerAdorner: false,
1758
- gridAdornerActive: false,
1759
- popoverAdornerActive: false,
1760
- isSubgrid: false,
1761
- showViewSourceAdorner: false,
1762
- showScrollAdorner: false,
1763
- showScrollSnapAdorner: false,
1764
- scrollSnapAdornerActive: false,
1765
- showSlotAdorner: false,
1766
- showStartingStyleAdorner: false,
1767
- startingStyleAdornerActive: false,
1768
- onStartingStyleAdornerClick: () => {},
1769
- onSlotAdornerClick: () => {},
1770
- topLayerIndex: -1,
1771
- onViewSourceAdornerClick: () => {},
1772
- onGutterClick: () => {},
1773
- onContainerAdornerClick: () => {},
1774
- onFlexAdornerClick: () => {},
1775
- onGridAdornerClick: () => {},
1776
- onMediaAdornerClick: () => {},
1777
- onPopoverAdornerClick: () => {},
1778
- onScrollSnapAdornerClick: () => {},
1779
- onTopLayerAdornerClick: () => {},
1780
- isHovered: false,
1781
- isSelected: false,
1782
- showAiButton: false,
1783
- onAiButtonClick: () => {},
1784
- decorations: [],
1785
- descendantDecorations: [],
1786
- decorationsTooltip: '',
1787
- indent: 0,
1788
- editorState: null,
1789
- editorWidth: null,
1790
- },
1791
- {}, this.listItemElement);
1769
+ DEFAULT_VIEW({
1770
+ node: null,
1771
+ isClosingTag: false,
1772
+ expanded: false,
1773
+ isExpandable: false,
1774
+ isXMLMimeType: false,
1775
+ updateRecord: null,
1776
+ onHighlightSearchResults: () => {},
1777
+ onExpand: () => {},
1778
+ containerAdornerActive: false,
1779
+ adProvenance: undefined,
1780
+ target: undefined,
1781
+ adTooltipId: '',
1782
+ showContainerAdorner: false,
1783
+ containerType: this.#layout?.containerType,
1784
+ showFlexAdorner: false,
1785
+ flexAdornerActive: false,
1786
+ showGridAdorner: false,
1787
+ showGridLanesAdorner: false,
1788
+ showMediaAdorner: false,
1789
+ showPopoverAdorner: false,
1790
+ showTopLayerAdorner: false,
1791
+ gridAdornerActive: false,
1792
+ popoverAdornerActive: false,
1793
+ isSubgrid: false,
1794
+ showViewSourceAdorner: false,
1795
+ showScrollAdorner: false,
1796
+ showScrollSnapAdorner: false,
1797
+ scrollSnapAdornerActive: false,
1798
+ showSlotAdorner: false,
1799
+ showCustomElementAdorner: false,
1800
+ showStartingStyleAdorner: false,
1801
+ startingStyleAdornerActive: false,
1802
+ onStartingStyleAdornerClick: () => {},
1803
+ onSlotAdornerClick: () => {},
1804
+ onCustomElementAdornerClick: () => {},
1805
+ topLayerIndex: -1,
1806
+ onViewSourceAdornerClick: () => {},
1807
+ onGutterClick: () => {},
1808
+ onContainerAdornerClick: () => {},
1809
+ onFlexAdornerClick: () => {},
1810
+ onGridAdornerClick: () => {},
1811
+ onMediaAdornerClick: () => {},
1812
+ onPopoverAdornerClick: () => {},
1813
+ onScrollSnapAdornerClick: () => {},
1814
+ onTopLayerAdornerClick: () => {},
1815
+ isHovered: false,
1816
+ isSelected: false,
1817
+ showAiButton: false,
1818
+ onAiButtonClick: () => {},
1819
+ decorations: [],
1820
+ descendantDecorations: [],
1821
+ decorationsTooltip: '',
1822
+ indent: 0,
1823
+ editorState: null,
1824
+ editorWidth: null,
1825
+ },
1826
+ {}, this.listItemElement);
1792
1827
  }
1793
1828
 
1794
1829
  override onunbind(): void {
@@ -2664,7 +2699,7 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
2664
2699
  }),
2665
2700
  CodeMirror.EditorView.domEventHandlers({
2666
2701
  focusout: event => {
2667
- if (!this.#editorRef) {
2702
+ if (!this.#editorRef || this.#editAsHtmlMenuOpen) {
2668
2703
  return;
2669
2704
  }
2670
2705
  // The relatedTarget is null when no element gains focus, e.g. switching windows.
@@ -2673,6 +2708,42 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
2673
2708
  this.editing?.commit();
2674
2709
  }
2675
2710
  },
2711
+ contextmenu: (event, view) => {
2712
+ // The editor virtualizes its content, so the browser's native
2713
+ // "Select all" only reaches the rendered lines. Show a menu whose
2714
+ // "Select all" spans the whole document, like Ctrl/Cmd+A.
2715
+ event.consume(true);
2716
+ const {from, to, empty} = view.state.selection.main;
2717
+ const copy = (): void =>
2718
+ Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(view.state.sliceDoc(from, to));
2719
+ const contextMenu = new UI.ContextMenu.ContextMenu(event, {
2720
+ onSoftMenuClosed: () => {
2721
+ this.#editAsHtmlMenuOpen = false;
2722
+ },
2723
+ });
2724
+ contextMenu.clipboardSection().appendItem(i18nString(UIStrings.cut), () => {
2725
+ copy();
2726
+ view.dispatch({changes: {from, to, insert: ''}});
2727
+ view.focus();
2728
+ }, {disabled: empty, jslogContext: 'cut'});
2729
+ contextMenu.clipboardSection().appendItem(i18nString(UIStrings.copy), () => {
2730
+ copy();
2731
+ view.focus();
2732
+ }, {disabled: empty, jslogContext: 'copy'});
2733
+ contextMenu.clipboardSection().appendItem(i18nString(UIStrings.paste), () => {
2734
+ void navigator.clipboard.readText().then(text => {
2735
+ view.dispatch(view.state.replaceSelection(text));
2736
+ view.focus();
2737
+ });
2738
+ }, {jslogContext: 'paste'});
2739
+ contextMenu.editSection().appendItem(i18nString(UIStrings.selectAll), () => {
2740
+ view.dispatch({selection: {anchor: 0, head: view.state.doc.length}});
2741
+ view.focus();
2742
+ }, {jslogContext: 'select-all'});
2743
+ this.#editAsHtmlMenuOpen = true;
2744
+ void contextMenu.show();
2745
+ return true;
2746
+ },
2676
2747
  }),
2677
2748
  ],
2678
2749
  });
@@ -3211,6 +3282,44 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
3211
3282
  this.#startingStyleAdornerActive = !this.#startingStyleAdornerActive;
3212
3283
  this.performUpdate();
3213
3284
  }
3285
+
3286
+ async #onCustomElementAdornerClick(event: Event): Promise<void> {
3287
+ event.stopPropagation();
3288
+ const node = this.node();
3289
+ const object = await node.resolveToObject('');
3290
+ if (!object) {
3291
+ return;
3292
+ }
3293
+ let constructorObject: SDK.RemoteObject.RemoteObject|null = null;
3294
+ try {
3295
+ const result = await object.callFunction(function(this: Element): unknown {
3296
+ const selector = this.getAttribute('is') || this.tagName.toLowerCase();
3297
+ return (typeof customElements !== 'undefined' && customElements.get(selector)) || this.constructor;
3298
+ });
3299
+ constructorObject = result.object;
3300
+ } finally {
3301
+ object.release();
3302
+ }
3303
+ if (!constructorObject) {
3304
+ return;
3305
+ }
3306
+ try {
3307
+ if (constructorObject.type === 'function') {
3308
+ const functionDetails =
3309
+ await SDK.RemoteObject.RemoteFunction.objectAsFunction(constructorObject).targetFunctionDetails();
3310
+ if (functionDetails?.location) {
3311
+ const uiLocation =
3312
+ await Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().rawLocationToUILocation(
3313
+ functionDetails.location);
3314
+ if (uiLocation) {
3315
+ void Common.Revealer.reveal(uiLocation);
3316
+ }
3317
+ }
3318
+ }
3319
+ } finally {
3320
+ constructorObject.release();
3321
+ }
3322
+ }
3214
3323
  }
3215
3324
 
3216
3325
  export const InitialChildrenLimit = 500;
@@ -1387,8 +1387,9 @@ export class ElementsTreeOutline extends
1387
1387
 
1388
1388
  private highlightTreeElement(element: UI.TreeOutline.TreeElement, showInfo: boolean): void {
1389
1389
  if (element instanceof ElementsTreeElement) {
1390
- element.node().domModel().overlayModel().highlightInOverlay(
1391
- {node: element.node(), selectorList: undefined}, 'all', showInfo);
1390
+ const selectorList = element.isDisplayContents() ? '*' : undefined;
1391
+ element.node().domModel().overlayModel().highlightInOverlay({node: element.node(), selectorList}, 'all',
1392
+ showInfo);
1392
1393
  return;
1393
1394
  }
1394
1395
 
@@ -12,6 +12,7 @@ type AdornerSettingsMap = Map<string, boolean>;
12
12
  export enum RegisteredAdorners {
13
13
  AD = 'ad',
14
14
  CONTAINER = 'container',
15
+ CUSTOM_ELEMENT = 'custom-element',
15
16
  FLEX = 'flex',
16
17
  GRID = 'grid',
17
18
  GRID_LANES = 'grid-lanes',
@@ -506,22 +506,24 @@ export class DeviceModeToolbar extends UI.Widget.Widget {
506
506
 
507
507
  const device = this.model.device();
508
508
 
509
- if (this.model.type() === EmulationModel.DeviceModeModel.Type.Device && device) {
510
- this.lastMode.set(device, (this.model.mode() as EmulationModel.EmulatedDevices.Mode));
511
- }
509
+ if (this.model.type() !== EmulationModel.DeviceModeModel.Type.None) {
510
+ if (this.model.type() === EmulationModel.DeviceModeModel.Type.Device && device) {
511
+ this.lastMode.set(device, (this.model.mode() as EmulationModel.EmulatedDevices.Mode));
512
+ }
512
513
 
513
- const value = this.persistenceSetting.get();
514
- const currentMode = this.model.mode();
515
- if (device) {
516
- value.device = device.title;
517
- value.orientation = currentMode ? currentMode.orientation : '';
518
- value.mode = currentMode ? currentMode.title : '';
519
- } else {
520
- value.device = '';
521
- value.orientation = '';
522
- value.mode = '';
514
+ const value = this.persistenceSetting.get();
515
+ const currentMode = this.model.mode();
516
+ if (device) {
517
+ value.device = device.title;
518
+ value.orientation = currentMode ? currentMode.orientation : '';
519
+ value.mode = currentMode ? currentMode.title : '';
520
+ } else {
521
+ value.device = '';
522
+ value.orientation = '';
523
+ value.mode = '';
524
+ }
525
+ this.persistenceSetting.set(value);
523
526
  }
524
- this.persistenceSetting.set(value);
525
527
 
526
528
  let modeButtonTitle = i18nString(UIStrings.rotate);
527
529
  let modeButtonDisabled = false;
@@ -760,10 +762,8 @@ export class DeviceModeToolbar extends UI.Widget.Widget {
760
762
 
761
763
  private appendOptionsMenuItems(contextMenu: UI.ContextMenu.ContextMenu): void {
762
764
  const model = this.model;
763
- appendToggleItem(
764
- contextMenu.headerSection(), this.deviceOutlineSetting, i18nString(UIStrings.hideDeviceFrame),
765
- i18nString(UIStrings.showDeviceFrame), model.type() !== EmulationModel.DeviceModeModel.Type.Device,
766
- 'device-frame');
765
+ appendToggleItem(contextMenu.headerSection(), this.deviceOutlineSetting, i18nString(UIStrings.hideDeviceFrame),
766
+ i18nString(UIStrings.showDeviceFrame), !model.canShowDeviceFrame(), 'device-frame');
767
767
  appendToggleItem(
768
768
  contextMenu.headerSection(), this.showMediaInspectorSetting, i18nString(UIStrings.hideMediaQueries),
769
769
  i18nString(UIStrings.showMediaQueries), undefined, 'media-queries');
@@ -792,7 +792,7 @@ export class DeviceModeToolbar extends UI.Widget.Widget {
792
792
  disabled = model.type() === EmulationModel.DeviceModeModel.Type.None;
793
793
  }
794
794
 
795
- const isEnabled = setting.get();
795
+ const isEnabled = Boolean(setting.get() && !disabled);
796
796
  const jslogContext = `${context}-${isEnabled ? 'disable' : 'enable'}`;
797
797
  section.appendItem(
798
798
  isEnabled ? title1 : title2, setting.set.bind(setting, !setting.get()), {disabled, jslogContext});
@@ -861,7 +861,8 @@ export class ConsoleInsight extends UI.Widget.Widget {
861
861
  // on -> entrypoints are shown, and console insights can be generated
862
862
  #getConsoleInsightsEnabledSetting(): Common.Settings.Setting<boolean>|undefined {
863
863
  try {
864
- return Common.Settings.moduleSetting('console-insights-enabled') as Common.Settings.Setting<boolean>;
864
+ return Common.Settings.Settings.instance().moduleSetting('console-insights-enabled') as
865
+ Common.Settings.Setting<boolean>;
865
866
  } catch {
866
867
  return;
867
868
  }
@@ -15,7 +15,7 @@ import type {PlayerEvent} from './MediaModel.js';
15
15
 
16
16
  const UIStrings = {
17
17
  /**
18
- * @description Text for timestamps of items
18
+ * @description Text for timestamps of items.
19
19
  */
20
20
  timestamp: 'Timestamp',
21
21
  /**
@@ -23,7 +23,7 @@ const UIStrings = {
23
23
  */
24
24
  eventName: 'Event name',
25
25
  /**
26
- * @description Text for the value of something
26
+ * @description Text for the value of something.
27
27
  */
28
28
  value: 'Value',
29
29
  /**
@@ -20,13 +20,13 @@ const NO_NORMALIZED_TIMESTAMP = -1.5;
20
20
 
21
21
  const UIStrings = {
22
22
  /**
23
- * @description Title of the 'Playback Status' button
23
+ * @description Title of the 'Playback status' button.
24
24
  */
25
- playbackStatus: 'Playback Status',
25
+ playbackStatus: 'Playback status',
26
26
  /**
27
- * @description Title of the 'Buffering Status' button
27
+ * @description Title of the 'Buffering status' button.
28
28
  */
29
- bufferingStatus: 'Buffering Status',
29
+ bufferingStatus: 'Buffering status',
30
30
  } as const;
31
31
  const str_ = i18n.i18n.registerUIStrings('panels/media/EventTimelineView.ts', UIStrings);
32
32
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);