chrome-devtools-frontend 1.0.1601661 → 1.0.1602543

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 (119) hide show
  1. package/.agents/skills/version-control/SKILL.md +71 -0
  2. package/AUTHORS +1 -0
  3. package/front_end/core/common/Settings.ts +1 -871
  4. package/front_end/core/common/VersionController.ts +880 -0
  5. package/front_end/core/common/common.ts +2 -0
  6. package/front_end/core/host/InspectorFrontendHostStub.ts +0 -5
  7. package/front_end/core/platform/HostRuntime.ts +9 -3
  8. package/front_end/core/protocol_client/InspectorBackend.ts +8 -0
  9. package/front_end/core/root/Runtime.ts +5 -8
  10. package/front_end/core/sdk/DOMModel.ts +5 -4
  11. package/front_end/core/sdk/Target.ts +5 -0
  12. package/front_end/core/sdk/WebMCPModel.ts +98 -0
  13. package/front_end/core/sdk/sdk.ts +2 -0
  14. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +13 -19
  15. package/front_end/entrypoints/inspector_main/InspectorMain.ts +1 -1
  16. package/front_end/entrypoints/main/GlobalAiButton.ts +1 -1
  17. package/front_end/generated/InspectorBackendCommands.ts +6 -5
  18. package/front_end/generated/protocol.ts +36 -3
  19. package/front_end/models/ai_assistance/AiConversation.ts +3 -3
  20. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +217 -9
  21. package/front_end/models/ai_assistance/agents/AiAgent.ts +14 -1
  22. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +19 -4
  23. package/front_end/models/ai_assistance/agents/NetworkAgent.ts +7 -1
  24. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +14 -2
  25. package/front_end/models/ai_assistance/agents/StylingAgent.ts +0 -23
  26. package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +7 -7
  27. package/front_end/models/javascript_metadata/NativeFunctions.js +4 -0
  28. package/front_end/models/lighthouse/RunTypes.ts +3 -1
  29. package/front_end/models/live-metrics/LiveMetrics.ts +51 -31
  30. package/front_end/panels/accessibility/ARIAAttributesView.ts +2 -2
  31. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +9 -2
  32. package/front_end/panels/ai_assistance/components/ChatInput.ts +3 -2
  33. package/front_end/panels/ai_assistance/components/ChatMessage.ts +84 -27
  34. package/front_end/panels/ai_assistance/components/chatMessage.css +31 -2
  35. package/front_end/panels/application/AppManifestView.ts +2 -2
  36. package/front_end/panels/application/BackgroundServiceView.ts +9 -9
  37. package/front_end/panels/application/FrameDetailsView.ts +4 -13
  38. package/front_end/panels/application/IndexedDBViews.ts +1 -1
  39. package/front_end/panels/application/KeyValueStorageItemsView.ts +4 -4
  40. package/front_end/panels/application/ServiceWorkerCacheViews.ts +3 -3
  41. package/front_end/panels/application/components/PermissionsPolicySection.ts +1 -1
  42. package/front_end/panels/application/components/permissionsPolicySection.css +54 -52
  43. package/front_end/panels/application/frameDetailsReportView.css +13 -1
  44. package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +2 -1
  45. package/front_end/panels/console_counters/WarningErrorCounter.ts +7 -14
  46. package/front_end/panels/elements/CSSValueTraceView.ts +9 -1
  47. package/front_end/panels/elements/NodeStackTraceWidget.ts +2 -1
  48. package/front_end/panels/elements/PropertiesWidget.ts +14 -13
  49. package/front_end/panels/elements/PropertyRenderer.ts +10 -9
  50. package/front_end/panels/elements/StandaloneStylesContainer.ts +15 -2
  51. package/front_end/panels/elements/StylePropertyTreeElement.ts +22 -1
  52. package/front_end/panels/elements/StylesSidebarPane.ts +34 -25
  53. package/front_end/panels/elements/stylePropertiesTreeOutline.css +5 -0
  54. package/front_end/panels/issues/AffectedSelectivePermissionsInterventionView.ts +2 -2
  55. package/front_end/panels/lighthouse/LighthouseController.ts +4 -1
  56. package/front_end/panels/media/EventDisplayTable.ts +3 -2
  57. package/front_end/panels/network/EventSourceMessagesView.ts +2 -2
  58. package/front_end/panels/network/RequestPayloadView.ts +2 -2
  59. package/front_end/panels/network/ResourceChunkView.ts +1 -1
  60. package/front_end/panels/profiler/HeapDetachedElementsView.ts +9 -4
  61. package/front_end/panels/profiler/HeapProfileView.ts +8 -4
  62. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +40 -33
  63. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +1 -1
  64. package/front_end/panels/profiler/HeapSnapshotProxy.ts +1 -1
  65. package/front_end/panels/profiler/HeapSnapshotView.ts +12 -18
  66. package/front_end/panels/profiler/LiveHeapProfileView.ts +3 -4
  67. package/front_end/panels/profiler/ProfileHeader.ts +5 -11
  68. package/front_end/panels/profiler/ProfileView.ts +1 -1
  69. package/front_end/panels/recorder/RecorderController.ts +4 -3
  70. package/front_end/panels/recorder/components/CreateRecordingView.ts +2 -1
  71. package/front_end/panels/recorder/components/RecordingView.ts +2 -2
  72. package/front_end/panels/recorder/models/RecordingPlayer.ts +3 -0
  73. package/front_end/panels/security/SecurityPanel.ts +3 -3
  74. package/front_end/panels/sensors/SensorsView.ts +149 -125
  75. package/front_end/panels/timeline/EventsTimelineTreeView.ts +2 -2
  76. package/front_end/panels/timeline/TimelineDetailsView.ts +6 -37
  77. package/front_end/panels/timeline/TimelineTreeView.ts +19 -17
  78. package/front_end/panels/timeline/TimelineUIUtils.ts +0 -118
  79. package/front_end/panels/timeline/components/IgnoreListSetting.ts +1 -1
  80. package/front_end/panels/timeline/components/SidebarInsightsTab.ts +2 -2
  81. package/front_end/panels/timeline/components/TimelineRangeSummaryView.ts +162 -9
  82. package/front_end/panels/timeline/components/timelineRangeSummaryView.css +22 -8
  83. package/front_end/panels/webauthn/WebauthnPane.ts +52 -0
  84. package/front_end/panels/whats_new/ReleaseNoteText.ts +10 -10
  85. package/front_end/panels/whats_new/resources/WNDT.md +6 -6
  86. package/front_end/third_party/chromium/README.chromium +1 -1
  87. package/front_end/third_party/puppeteer/README.chromium +2 -2
  88. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  89. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js +4 -0
  90. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js.map +1 -1
  91. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +2 -2
  92. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +2 -2
  93. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  94. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  95. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  96. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +3 -3
  97. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  98. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js +4 -0
  99. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js.map +1 -1
  100. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +2 -2
  101. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +2 -2
  102. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  103. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  104. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  105. package/front_end/third_party/puppeteer/package/package.json +1 -1
  106. package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +8 -0
  107. package/front_end/third_party/puppeteer/package/src/revisions.ts +2 -2
  108. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  109. package/front_end/ui/legacy/Toolbar.ts +25 -3
  110. package/front_end/ui/legacy/Treeoutline.ts +7 -3
  111. package/front_end/ui/legacy/UIUtils.ts +13 -11
  112. package/front_end/ui/legacy/Widget.ts +40 -40
  113. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +1 -1
  114. package/front_end/ui/legacy/components/data_grid/SortableDataGrid.ts +2 -2
  115. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +39 -23
  116. package/front_end/ui/legacy/components/perf_ui/GCActionDelegate.ts +20 -4
  117. package/front_end/ui/legacy/treeoutline.css +4 -0
  118. package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
  119. package/package.json +1 -1
@@ -329,8 +329,8 @@ export class SensorsView extends UI.Widget.VBox {
329
329
  }
330
330
  })}
331
331
  >
332
- <!-- @ts-ignore -->
333
332
  <div class="latlong-group">
333
+ <!-- @ts-ignore -->
334
334
  <input
335
335
  id="latitude-input"
336
336
  type="number"
@@ -347,8 +347,8 @@ export class SensorsView extends UI.Widget.VBox {
347
347
  >
348
348
  <label class="latlong-title" for="latitude-input">${i18nString(UIStrings.latitude)}</label>
349
349
  </div>
350
- <!-- @ts-ignore -->
351
350
  <div class="latlong-group">
351
+ <!-- @ts-ignore -->
352
352
  <input
353
353
  id="longitude-input"
354
354
  type="number"
@@ -397,8 +397,8 @@ export class SensorsView extends UI.Widget.VBox {
397
397
  <label class="locale-title" for="locale-input">${i18nString(UIStrings.locale)}</label>
398
398
  <div class="locale-error" ${Directives.ref((el: Element | undefined) => { if (el) { this.localeError = el as HTMLElement; } })}></div>
399
399
  </div>
400
- <!-- @ts-ignore -->
401
400
  <div class="latlong-group">
401
+ <!-- @ts-ignore -->
402
402
  <input
403
403
  id="accuracy-input"
404
404
  type="number"
@@ -593,10 +593,6 @@ export class SensorsView extends UI.Widget.VBox {
593
593
  private createDeviceOrientationSection(): void {
594
594
  const orientationGroup = this.contentElement.createChild('section', 'sensors-group');
595
595
  orientationGroup.setAttribute('jslog', `${VisualLogging.section('device-orientation')}`);
596
- const orientationTitle = UI.UIUtils.createLabel(i18nString(UIStrings.orientation), 'sensors-group-title');
597
- orientationGroup.appendChild(orientationTitle);
598
- const orientationContent = orientationGroup.createChild('div', 'orientation-content');
599
- const fields = orientationContent.createChild('div', 'orientation-fields');
600
596
 
601
597
  const orientationOffOption = {
602
598
  title: i18nString(UIStrings.off),
@@ -622,46 +618,142 @@ export class SensorsView extends UI.Widget.VBox {
622
618
  {title: i18nString(UIStrings.displayDown), orientation: '[0, -180, 0]', jslogContext: 'displayUp-down'},
623
619
  ],
624
620
  }];
625
- this.orientationSelectElement = this.contentElement.createChild('select');
626
- this.orientationSelectElement.setAttribute('jslog', `${VisualLogging.dropDown().track({change: true})}`);
627
- UI.ARIAUtils.bindLabelToControl(orientationTitle, this.orientationSelectElement);
628
- this.orientationSelectElement.appendChild(UI.UIUtils.createOption(
629
- orientationOffOption.title, orientationOffOption.orientation, orientationOffOption.jslogContext));
630
- this.orientationSelectElement.appendChild(
631
- UI.UIUtils.createOption(customOrientationOption.title, customOrientationOption.orientation, 'custom'));
632
-
633
- for (let i = 0; i < orientationGroups.length; ++i) {
634
- const groupElement = this.orientationSelectElement.createChild('optgroup');
635
- groupElement.label = orientationGroups[i].title;
636
- const group = orientationGroups[i].value;
637
- for (let j = 0; j < group.length; ++j) {
638
- groupElement.appendChild(UI.UIUtils.createOption(group[j].title, group[j].orientation, group[j].jslogContext));
639
- }
640
- }
641
- this.orientationSelectElement.selectedIndex = 0;
642
- fields.appendChild(this.orientationSelectElement);
643
- this.orientationSelectElement.addEventListener('change', this.orientationSelectChanged.bind(this));
644
-
645
- this.deviceOrientationFieldset = this.createDeviceOrientationOverrideElement(this.deviceOrientation);
646
- this.stageElement = orientationContent.createChild('div', 'orientation-stage');
647
- this.stageElement.setAttribute('jslog', `${VisualLogging.preview().track({drag: true})}`);
648
- this.orientationLayer = this.stageElement.createChild('div', 'orientation-layer');
649
- this.boxElement = this.orientationLayer.createChild('section', 'orientation-box orientation-element');
650
-
651
- this.boxElement.createChild('section', 'orientation-front orientation-element');
652
- this.boxElement.createChild('section', 'orientation-top orientation-element');
653
- this.boxElement.createChild('section', 'orientation-back orientation-element');
654
- this.boxElement.createChild('section', 'orientation-left orientation-element');
655
- this.boxElement.createChild('section', 'orientation-right orientation-element');
656
- this.boxElement.createChild('section', 'orientation-bottom orientation-element');
657
-
658
- UI.UIUtils.installDragHandle(this.stageElement, this.onBoxDragStart.bind(this), event => {
659
- this.onBoxDrag(event);
660
- }, null, '-webkit-grabbing', '-webkit-grab');
661
-
662
- fields.appendChild(this.deviceOrientationFieldset);
621
+
622
+ // clang-format off
623
+ // eslint-disable-next-line @devtools/no-lit-render-outside-of-view
624
+ render(
625
+ html`
626
+ <label class="sensors-group-title" for="orientation-select">${i18nString(UIStrings.orientation)}</label>
627
+ <div class="orientation-content">
628
+ <div class="orientation-fields">
629
+ <select
630
+ id="orientation-select"
631
+ ${Directives.ref((el: Element | undefined) => {
632
+ if (el) {
633
+ this.orientationSelectElement = el as HTMLSelectElement;
634
+ }
635
+ })}
636
+ @change=${this.orientationSelectChanged.bind(this)}
637
+ jslog=${VisualLogging.dropDown().track({change: true})}
638
+ >
639
+ <option value=${orientationOffOption.orientation} jslog=${VisualLogging.item(orientationOffOption.jslogContext)}>${orientationOffOption.title}</option>
640
+ <option value=${customOrientationOption.orientation} jslog=${VisualLogging.item('custom')}>${customOrientationOption.title}</option>
641
+ ${orientationGroups.map(group => html`
642
+ <optgroup label=${group.title}>
643
+ ${group.value.map(preset => html`
644
+ <option value=${preset.orientation} jslog=${VisualLogging.item(preset.jslogContext)}>${preset.title}</option>
645
+ `)}
646
+ </optgroup>
647
+ `)}
648
+ </select>
649
+ <fieldset
650
+ class="device-orientation-override-section"
651
+ ${Directives.ref((el: Element | undefined) => {
652
+ if (el) {
653
+ this.deviceOrientationFieldset = el as HTMLFieldSetElement;
654
+ }
655
+ })}
656
+ >
657
+ <div class="orientation-inputs-cell">
658
+ <div class="orientation-axis-input-container">
659
+ <!-- @ts-ignore -->
660
+ <input
661
+ id="alpha-input"
662
+ type="number"
663
+ min="0"
664
+ max="359.9999"
665
+ step="any"
666
+ required
667
+ ${Directives.ref((el: Element | undefined) => { if (el) { this.alphaElement = el as HTMLInputElement; } })}
668
+ @change=${this.#onOrientationChange.bind(this)}
669
+ @keydown=${this.#onOrientationKeyDown.bind(this)}
670
+ @focus=${this.#onOrientationFocus.bind(this)}
671
+ >
672
+ <label for="alpha-input">${i18nString(UIStrings.alpha)}</label>
673
+ </div>
674
+ <div class="orientation-axis-input-container">
675
+ <!-- @ts-ignore -->
676
+ <input
677
+ id="beta-input"
678
+ type="number"
679
+ min="-180"
680
+ max="179.9999"
681
+ step="any"
682
+ required
683
+ ${Directives.ref((el: Element | undefined) => { if (el) { this.betaElement = el as HTMLInputElement; } })}
684
+ @change=${this.#onOrientationChange.bind(this)}
685
+ @keydown=${this.#onOrientationKeyDown.bind(this)}
686
+ @focus=${this.#onOrientationFocus.bind(this)}
687
+ >
688
+ <label for="beta-input">${i18nString(UIStrings.beta)}</label>
689
+ </div>
690
+ <div class="orientation-axis-input-container">
691
+ <!-- @ts-ignore -->
692
+ <input
693
+ id="gamma-input"
694
+ type="number"
695
+ min="-90"
696
+ max="89.9999"
697
+ step="any"
698
+ required
699
+ ${Directives.ref((el: Element | undefined) => { if (el) { this.gammaElement = el as HTMLInputElement; } })}
700
+ @change=${this.#onOrientationChange.bind(this)}
701
+ @keydown=${this.#onOrientationKeyDown.bind(this)}
702
+ @focus=${this.#onOrientationFocus.bind(this)}
703
+ >
704
+ <label for="gamma-input">${i18nString(UIStrings.gamma)}</label>
705
+ </div>
706
+ <devtools-button
707
+ .variant=${Buttons.Button.Variant.OUTLINED}
708
+ class="orientation-reset-button"
709
+ type="reset"
710
+ aria-label=${i18nString(UIStrings.resetDeviceOrientation)}
711
+ @click=${this.resetDeviceOrientation.bind(this)}
712
+ jslog=${VisualLogging.action('sensors.reset-device-orientiation').track({click: true})}
713
+ >
714
+ ${i18nString(UIStrings.reset)}
715
+ </devtools-button>
716
+ </div>
717
+ </fieldset>
718
+ </div>
719
+ <div
720
+ class="orientation-stage"
721
+ jslog=${VisualLogging.preview().track({drag: true})}
722
+ ${Directives.ref((el: Element | undefined) => {
723
+ if (el && !this.stageElement) {
724
+ this.stageElement = el as HTMLElement;
725
+ UI.UIUtils.installDragHandle(this.stageElement, this.onBoxDragStart.bind(this), event => {
726
+ this.onBoxDrag(event);
727
+ }, null, '-webkit-grabbing', '-webkit-grab');
728
+ }
729
+ })}
730
+ >
731
+ <div class="orientation-layer" ${Directives.ref((el: Element | undefined) => { if (el) { this.orientationLayer = el as HTMLDivElement; } })}>
732
+ <section
733
+ class="orientation-box orientation-element"
734
+ ${Directives.ref((el: Element | undefined) => { if (el) { this.boxElement = el as HTMLElement; } })}
735
+ >
736
+ <section class="orientation-front orientation-element"></section>
737
+ <section class="orientation-top orientation-element"></section>
738
+ <section class="orientation-back orientation-element"></section>
739
+ <section class="orientation-left orientation-element"></section>
740
+ <section class="orientation-right orientation-element"></section>
741
+ <section class="orientation-bottom orientation-element"></section>
742
+ </section>
743
+ </div>
744
+ </div>
745
+ </div>
746
+ `,
747
+ orientationGroup
748
+ );
749
+ // clang-format on
750
+
663
751
  this.enableOrientationFields(true);
664
752
  this.setBoxOrientation(this.deviceOrientation, false);
753
+
754
+ this.alphaElement.value = String(this.deviceOrientation.alpha);
755
+ this.betaElement.value = String(this.deviceOrientation.beta);
756
+ this.gammaElement.value = String(this.deviceOrientation.gamma);
665
757
  }
666
758
 
667
759
  private createPressureSection(): void {
@@ -751,9 +843,9 @@ export class SensorsView extends UI.Widget.VBox {
751
843
  // Even though the angles in |deviceOrientation| will not be rounded
752
844
  // here, their precision will be rounded by CSS when we change
753
845
  // |this.orientationLayer.style| in setBoxOrientation().
754
- this.#setOrientationInputValue(this.alphaElement, String(roundAngle(deviceOrientation.alpha)));
755
- this.#setOrientationInputValue(this.betaElement, String(roundAngle(deviceOrientation.beta)));
756
- this.#setOrientationInputValue(this.gammaElement, String(roundAngle(deviceOrientation.gamma)));
846
+ this.alphaElement.value = String(roundAngle(deviceOrientation.alpha));
847
+ this.betaElement.value = String(roundAngle(deviceOrientation.beta));
848
+ this.gammaElement.value = String(roundAngle(deviceOrientation.gamma));
757
849
  }
758
850
 
759
851
  const animate = modificationSource !== DeviceOrientationModificationSource.USER_DRAG;
@@ -767,17 +859,9 @@ export class SensorsView extends UI.Widget.VBox {
767
859
  {PH1: deviceOrientation.alpha, PH2: deviceOrientation.beta, PH3: deviceOrientation.gamma}));
768
860
  }
769
861
 
770
- #onOrientationInput(event: Event): void {
771
- const input = event.currentTarget as HTMLInputElement;
772
- const valid = this.#validateOrientationInput(input, input.value);
773
- input.classList.toggle('error-input', !valid);
774
- }
775
-
776
862
  #onOrientationChange(event: Event): void {
777
863
  const input = event.currentTarget as HTMLInputElement;
778
- const valid = this.#validateOrientationInput(input, input.value);
779
- input.classList.toggle('error-input', !valid);
780
- if (valid) {
864
+ if (input.checkValidity()) {
781
865
  this.applyDeviceOrientationUserInput();
782
866
  }
783
867
  }
@@ -785,8 +869,7 @@ export class SensorsView extends UI.Widget.VBox {
785
869
  #onOrientationKeyDown(event: KeyboardEvent): void {
786
870
  const input = event.currentTarget as HTMLInputElement;
787
871
  if (event.key === 'Enter') {
788
- const valid = this.#validateOrientationInput(input, input.value);
789
- if (valid) {
872
+ if (input.checkValidity()) {
790
873
  this.applyDeviceOrientationUserInput();
791
874
  }
792
875
  event.preventDefault();
@@ -797,10 +880,13 @@ export class SensorsView extends UI.Widget.VBox {
797
880
  if (value === null) {
798
881
  return;
799
882
  }
800
- const stringValue = String(value);
801
- const valid = this.#validateOrientationInput(input, stringValue);
802
- if (valid) {
803
- this.#setOrientationInputValue(input, stringValue);
883
+ const prevValue = input.value;
884
+ input.value = String(value);
885
+ if (input.checkValidity()) {
886
+ this.applyDeviceOrientationUserInput();
887
+ } else {
888
+ // If ArrowUp/ArrowDown adjusts the value out of bounds, we reset it.
889
+ input.value = prevValue;
804
890
  }
805
891
  event.preventDefault();
806
892
  }
@@ -810,68 +896,6 @@ export class SensorsView extends UI.Widget.VBox {
810
896
  input.select();
811
897
  }
812
898
 
813
- #validateOrientationInput(input: HTMLInputElement, value: string): boolean {
814
- if (input === this.alphaElement) {
815
- return SDK.EmulationModel.DeviceOrientation.alphaAngleValidator(value);
816
- }
817
- if (input === this.betaElement) {
818
- return SDK.EmulationModel.DeviceOrientation.betaAngleValidator(value);
819
- }
820
- if (input === this.gammaElement) {
821
- return SDK.EmulationModel.DeviceOrientation.gammaAngleValidator(value);
822
- }
823
- return false;
824
- }
825
-
826
- #setOrientationInputValue(input: HTMLInputElement, value: string): void {
827
- if (input.value === value) {
828
- return;
829
- }
830
- input.value = value;
831
- const valid = this.#validateOrientationInput(input, value);
832
- input.classList.toggle('error-input', !valid);
833
- }
834
-
835
- private createDeviceOrientationOverrideElement(deviceOrientation: SDK.EmulationModel.DeviceOrientation):
836
- HTMLFieldSetElement {
837
- const fieldsetElement = document.createElement('fieldset');
838
- fieldsetElement.classList.add('device-orientation-override-section');
839
- const cellElement = fieldsetElement.createChild('td', 'orientation-inputs-cell');
840
-
841
- this.alphaElement = UI.UIUtils.createInput('', 'number', 'alpha');
842
- this.alphaElement.setAttribute('step', 'any');
843
- this.#setupAxisInput(cellElement, this.alphaElement, i18nString(UIStrings.alpha));
844
- this.#setOrientationInputValue(this.alphaElement, String(deviceOrientation.alpha));
845
-
846
- this.betaElement = UI.UIUtils.createInput('', 'number', 'beta');
847
- this.betaElement.setAttribute('step', 'any');
848
- this.#setupAxisInput(cellElement, this.betaElement, i18nString(UIStrings.beta));
849
- this.#setOrientationInputValue(this.betaElement, String(deviceOrientation.beta));
850
-
851
- this.gammaElement = UI.UIUtils.createInput('', 'number', 'gamma');
852
- this.gammaElement.setAttribute('step', 'any');
853
- this.#setupAxisInput(cellElement, this.gammaElement, i18nString(UIStrings.gamma));
854
- this.#setOrientationInputValue(this.gammaElement, String(deviceOrientation.gamma));
855
-
856
- const resetButton = UI.UIUtils.createTextButton(
857
- i18nString(UIStrings.reset), this.resetDeviceOrientation.bind(this),
858
- {className: 'orientation-reset-button', jslogContext: 'sensors.reset-device-orientiation'});
859
- UI.ARIAUtils.setLabel(resetButton, i18nString(UIStrings.resetDeviceOrientation));
860
- resetButton.setAttribute('type', 'reset');
861
- cellElement.appendChild(resetButton);
862
- return fieldsetElement;
863
- }
864
-
865
- #setupAxisInput(parentElement: Element, input: HTMLInputElement, label: string): void {
866
- const div = parentElement.createChild('div', 'orientation-axis-input-container');
867
- div.appendChild(input);
868
- div.appendChild(UI.UIUtils.createLabel(label, /* className */ '', input));
869
- input.addEventListener('change', this.#onOrientationChange.bind(this), false);
870
- input.addEventListener('input', this.#onOrientationInput.bind(this), false);
871
- input.addEventListener('keydown', this.#onOrientationKeyDown.bind(this), false);
872
- input.addEventListener('focus', this.#onOrientationFocus.bind(this), false);
873
- }
874
-
875
899
  private setBoxOrientation(deviceOrientation: SDK.EmulationModel.DeviceOrientation, animate: boolean): void {
876
900
  if (animate) {
877
901
  this.stageElement.classList.add('is-animating');
@@ -87,13 +87,13 @@ export class EventsTimelineTreeView extends TimelineTreeView {
87
87
  }
88
88
 
89
89
  override populateColumns(columns: DataGrid.DataGrid.ColumnDescriptor[]): void {
90
- columns.push(({
90
+ columns.push({
91
91
  id: 'start-time',
92
92
  title: i18nString(UIStrings.startTime),
93
93
  width: '80px',
94
94
  fixedWidth: true,
95
95
  sortable: true,
96
- } as DataGrid.DataGrid.ColumnDescriptor));
96
+ });
97
97
  super.populateColumns(columns);
98
98
  columns.filter(c => c.fixedWidth).forEach(c => {
99
99
  c.width = '80px';
@@ -657,48 +657,17 @@ class SummaryView extends UI.Widget.Widget {
657
657
  }
658
658
 
659
659
  function generateRangeSummaryDetails(input: SummaryViewInput): LitTemplate {
660
- const {parsedTrace, selectedRange} = input;
661
-
662
- if (!selectedRange || !parsedTrace) {
663
- return nothing;
664
- }
665
-
666
- const minBoundsMilli = Trace.Helpers.Timing.microToMilli(parsedTrace.data.Meta.traceBounds.min);
667
- const {events, startTime, endTime, thirdPartyTree} = selectedRange;
668
- const aggregatedStats = TimelineUIUtils.statsForTimeRange(events, startTime, endTime);
669
- const startOffset = startTime - minBoundsMilli;
670
- const endOffset = endTime - minBoundsMilli;
671
-
672
- let total = 0;
673
- for (const categoryName in aggregatedStats) {
674
- total += aggregatedStats[categoryName];
675
- }
676
-
677
- const categories: TimelineComponents.TimelineSummary.CategoryData[] = [];
678
- for (const categoryName in Trace.Styles.getCategoryStyles()) {
679
- const category = Trace.Styles.getCategoryStyles()[categoryName as keyof Trace.Styles.CategoryPalette];
680
- if (category.name === Trace.Styles.EventCategory.IDLE) {
681
- continue;
682
- }
683
- const value = aggregatedStats[category.name];
684
- if (!value) {
685
- continue;
686
- }
687
- categories.push({value, color: category.getCSSValue(), title: category.title});
688
- }
689
- categories.sort((a, b) => b.value - a.value);
690
-
691
660
  // clang-format off
692
661
  return html`
693
662
  <devtools-widget
694
663
  ${widget(TimelineComponents.TimelineRangeSummaryView.TimelineRangeSummaryView, {
695
664
  data: {
696
- rangeStart: startOffset,
697
- rangeEnd: endOffset,
698
- total,
699
- categories,
700
- thirdPartyTreeTemplate: html`<devtools-performance-third-party-tree-view
701
- .treeView=${thirdPartyTree}></devtools-performance-third-party-tree-view>`,
665
+ parsedTrace: input.parsedTrace,
666
+ events: input.selectedRange?.events,
667
+ startTime: input.selectedRange?.startTime,
668
+ endTime: input.selectedRange?.endTime,
669
+ thirdPartyTreeTemplate: input.selectedRange?.thirdPartyTree ? html`<devtools-performance-third-party-tree-view
670
+ .treeView=${input.selectedRange?.thirdPartyTree}></devtools-performance-third-party-tree-view>` : nothing,
702
671
  } as TimelineComponents.TimelineRangeSummaryView.TimelineRangeSummaryViewData,
703
672
  })}
704
673
  ></devtools-widget>`;
@@ -264,9 +264,9 @@ export class TimelineTreeView extends
264
264
  this.textFilterInternal = new TimelineRegExp();
265
265
 
266
266
  this.currentThreadSetting = Common.Settings.Settings.instance().createSetting('timeline-tree-current-thread', 0);
267
- this.currentThreadSetting.addChangeListener(this.refreshTree, this);
267
+ this.currentThreadSetting.addChangeListener(() => this.refreshTree());
268
268
 
269
- const columns = ([] as DataGrid.DataGrid.ColumnDescriptor[]);
269
+ const columns: DataGrid.DataGrid.ColumnDescriptor[] = [];
270
270
  this.populateColumns(columns);
271
271
 
272
272
  this.splitWidget = new UI.SplitWidget.SplitWidget(true, true, 'timeline-tree-view-details-split-widget');
@@ -403,8 +403,15 @@ export class TimelineTreeView extends
403
403
  }
404
404
  }
405
405
 
406
- refreshTree(): void {
407
- if (!this.element.parentElement) {
406
+ /**
407
+ * Refreshes the tree. By default, it will only do this
408
+ * if the tree is mounted into the DOM - as in the UI we
409
+ * have multiple trees and we only want to refresh the
410
+ * active one. Pass `true` into this function to force a
411
+ * refresh regardless.
412
+ */
413
+ refreshTree(forceRefresh = false): void {
414
+ if (!this.element.parentElement && !forceRefresh) {
408
415
  // This function can be called in different views (Bottom-Up and
409
416
  // Call Tree) by the same single event whenever the group-by
410
417
  // dropdown changes value. Thus, we bail out whenever the view is
@@ -462,15 +469,10 @@ export class TimelineTreeView extends
462
469
  }
463
470
 
464
471
  populateColumns(columns: DataGrid.DataGrid.ColumnDescriptor[]): void {
472
+ columns.push({id: 'self', title: i18nString(UIStrings.selfTime), width: '120px', fixedWidth: true, sortable: true});
465
473
  columns.push(
466
- ({id: 'self', title: i18nString(UIStrings.selfTime), width: '120px', fixedWidth: true, sortable: true} as
467
- DataGrid.DataGrid.ColumnDescriptor));
468
- columns.push(
469
- ({id: 'total', title: i18nString(UIStrings.totalTime), width: '120px', fixedWidth: true, sortable: true} as
470
- DataGrid.DataGrid.ColumnDescriptor));
471
- columns.push(
472
- ({id: 'activity', title: i18nString(UIStrings.activity), disclosure: true, sortable: true} as
473
- DataGrid.DataGrid.ColumnDescriptor));
474
+ {id: 'total', title: i18nString(UIStrings.totalTime), width: '120px', fixedWidth: true, sortable: true});
475
+ columns.push({id: 'activity', title: i18nString(UIStrings.activity), disclosure: true, sortable: true});
474
476
  }
475
477
 
476
478
  sortingChanged(): void {
@@ -959,7 +961,7 @@ export class AggregatedTimelineTreeView extends TimelineTreeView {
959
961
  super();
960
962
  this.groupBySetting = Common.Settings.Settings.instance().createSetting(
961
963
  'timeline-tree-group-by', AggregatedTimelineTreeView.GroupBy.None);
962
- this.groupBySetting.addChangeListener(this.refreshTree.bind(this));
964
+ this.groupBySetting.addChangeListener(() => this.refreshTree());
963
965
  this.init();
964
966
  this.stackView = new TimelineStackView(this);
965
967
  this.stackView.addEventListener(TimelineStackView.Events.SELECTION_CHANGED, this.onStackViewSelectionChanged, this);
@@ -1297,10 +1299,10 @@ export class TimelineStackView extends
1297
1299
  const header = this.element.createChild('div', 'timeline-stack-view-header');
1298
1300
  header.textContent = i18nString(UIStrings.heaviestStack);
1299
1301
  this.treeView = treeView;
1300
- const columns = ([
1301
- {id: 'total', title: i18nString(UIStrings.totalTime), fixedWidth: true, width: '110px'},
1302
- {id: 'activity', title: i18nString(UIStrings.activity)},
1303
- ] as DataGrid.DataGrid.ColumnDescriptor[]);
1302
+ const columns: DataGrid.DataGrid.ColumnDescriptor[] = [
1303
+ {id: 'total', title: i18nString(UIStrings.totalTime), fixedWidth: true, width: '110px', sortable: false},
1304
+ {id: 'activity', title: i18nString(UIStrings.activity), sortable: false},
1305
+ ];
1304
1306
  this.dataGrid = new DataGrid.ViewportDataGrid.ViewportDataGrid({
1305
1307
  displayName: i18nString(UIStrings.timelineStack),
1306
1308
  columns,
@@ -1541,124 +1541,6 @@ export class TimelineUIUtils {
1541
1541
  return contentHelper.fragment;
1542
1542
  }
1543
1543
 
1544
- static statsForTimeRange(
1545
- events: Trace.Types.Events.Event[], startTime: Trace.Types.Timing.Milli,
1546
- endTime: Trace.Types.Timing.Milli): TimeRangeCategoryStats {
1547
- if (!events.length) {
1548
- return {idle: endTime - startTime};
1549
- }
1550
-
1551
- buildRangeStatsCacheIfNeeded(events);
1552
- const aggregatedStats = subtractStats(aggregatedStatsAtTime(endTime), aggregatedStatsAtTime(startTime));
1553
- const aggregatedTotal = Object.values(aggregatedStats).reduce((a, b) => a + b, 0);
1554
- aggregatedStats['idle'] = Math.max(0, endTime - startTime - aggregatedTotal);
1555
- return aggregatedStats;
1556
-
1557
- function aggregatedStatsAtTime(time: number): TimeRangeCategoryStats {
1558
- const stats: TimeRangeCategoryStats = {};
1559
- // @ts-expect-error TODO(crbug.com/1011811): Remove symbol usage.
1560
- const cache = events[categoryBreakdownCacheSymbol];
1561
- for (const category in cache) {
1562
- const categoryCache = cache[category];
1563
- const index =
1564
- Platform.ArrayUtilities.upperBound(categoryCache.time, time, Platform.ArrayUtilities.DEFAULT_COMPARATOR);
1565
- let value;
1566
- if (index === 0) {
1567
- value = 0;
1568
- } else if (index === categoryCache.time.length) {
1569
- value = categoryCache.value[categoryCache.value.length - 1];
1570
- } else {
1571
- const t0 = categoryCache.time[index - 1];
1572
- const t1 = categoryCache.time[index];
1573
- const v0 = categoryCache.value[index - 1];
1574
- const v1 = categoryCache.value[index];
1575
- value = v0 + (v1 - v0) * (time - t0) / (t1 - t0);
1576
- }
1577
- stats[category] = value;
1578
- }
1579
- return stats;
1580
- }
1581
-
1582
- function subtractStats(a: TimeRangeCategoryStats, b: TimeRangeCategoryStats): TimeRangeCategoryStats {
1583
- const result = Object.assign({}, a);
1584
- for (const key in b) {
1585
- result[key] -= b[key];
1586
- }
1587
- return result;
1588
- }
1589
-
1590
- function buildRangeStatsCacheIfNeeded(events: Trace.Types.Events.Event[]): void {
1591
- // @ts-expect-error TODO(crbug.com/1011811): Remove symbol usage.
1592
- if (events[categoryBreakdownCacheSymbol]) {
1593
- return;
1594
- }
1595
-
1596
- // aggregatedStats is a map by categories. For each category there's an array
1597
- // containing sorted time points which records accumulated value of the category.
1598
- const aggregatedStats: Record<string, {
1599
- time: number[],
1600
- value: number[],
1601
- }> = {};
1602
- const categoryStack: string[] = [];
1603
- let lastTime = 0;
1604
- Trace.Helpers.Trace.forEachEvent(events, {
1605
- onStartEvent,
1606
- onEndEvent,
1607
- });
1608
-
1609
- function updateCategory(category: string, time: number): void {
1610
- let statsArrays: {
1611
- time: number[],
1612
- value: number[],
1613
- } = aggregatedStats[category];
1614
- if (!statsArrays) {
1615
- statsArrays = {time: [], value: []};
1616
- aggregatedStats[category] = statsArrays;
1617
- }
1618
- if (statsArrays.time.length && statsArrays.time[statsArrays.time.length - 1] === time || lastTime > time) {
1619
- return;
1620
- }
1621
- const lastValue = statsArrays.value.length > 0 ? statsArrays.value[statsArrays.value.length - 1] : 0;
1622
- statsArrays.value.push(lastValue + time - lastTime);
1623
- statsArrays.time.push(time);
1624
- }
1625
-
1626
- function categoryChange(from: string|null, to: string|null, time: number): void {
1627
- if (from) {
1628
- updateCategory(from, time);
1629
- }
1630
- lastTime = time;
1631
- if (to) {
1632
- updateCategory(to, time);
1633
- }
1634
- }
1635
-
1636
- function onStartEvent(e: Trace.Types.Events.Event): void {
1637
- const {startTime} = Trace.Helpers.Timing.eventTimingsMilliSeconds(e);
1638
- const category = Trace.Styles.getEventStyle(e.name as Trace.Types.Events.Name)?.category.name ||
1639
- Trace.Styles.getCategoryStyles().other.name;
1640
- const parentCategory = categoryStack.length ? categoryStack[categoryStack.length - 1] : null;
1641
- if (category !== parentCategory) {
1642
- categoryChange(parentCategory || null, category, startTime);
1643
- }
1644
- categoryStack.push(category);
1645
- }
1646
-
1647
- function onEndEvent(e: Trace.Types.Events.Event): void {
1648
- const {endTime} = Trace.Helpers.Timing.eventTimingsMilliSeconds(e);
1649
- const category = categoryStack.pop();
1650
- const parentCategory = categoryStack.length ? categoryStack[categoryStack.length - 1] : null;
1651
- if (category !== parentCategory) {
1652
- categoryChange(category || null, parentCategory || null, endTime || 0);
1653
- }
1654
- }
1655
-
1656
- const obj = (events as Object);
1657
- // @ts-expect-error TODO(crbug.com/1011811): Remove symbol usage.
1658
- obj[categoryBreakdownCacheSymbol] = aggregatedStats;
1659
- }
1660
- }
1661
-
1662
1544
  private static renderEventJson(event: Trace.Types.Events.Event, contentHelper: TimelineDetailsContentHelper): void {
1663
1545
  contentHelper.addSection(i18nString(UIStrings.traceEvent));
1664
1546
 
@@ -167,7 +167,7 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
167
167
  export class IgnoreListSetting extends UI.Widget.Widget {
168
168
  static createWidgetElement(): UI.Widget.WidgetElement<IgnoreListSetting> {
169
169
  const widgetElement = document.createElement('devtools-widget') as UI.Widget.WidgetElement<IgnoreListSetting>;
170
- widgetElement.widgetConfig = UI.Widget.widgetConfig(IgnoreListSetting);
170
+ new IgnoreListSetting(widgetElement);
171
171
  return widgetElement;
172
172
  }
173
173
 
@@ -14,7 +14,7 @@ import sidebarInsightsTabStyles from './sidebarInsightsTab.css.js';
14
14
  import {SidebarSingleInsightSet, type SidebarSingleInsightSetData} from './SidebarSingleInsightSet.js';
15
15
 
16
16
  const {html} = Lit;
17
- const {widgetConfig} = UI.Widget;
17
+ const {widget} = UI.Widget;
18
18
 
19
19
  interface ViewInput {
20
20
  parsedTrace: Trace.TraceModel.ParsedTrace;
@@ -67,7 +67,7 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
67
67
  const contents = html`
68
68
  <devtools-widget
69
69
  data-insight-set-key=${id}
70
- .widgetConfig=${widgetConfig(SidebarSingleInsightSet, {data})}
70
+ ${widget(SidebarSingleInsightSet, {data})}
71
71
  ></devtools-widget>
72
72
  `;
73
73