chrome-devtools-frontend 1.0.1535712 → 1.0.1536371

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 (77) hide show
  1. package/docs/contributing/images/issues-nearestslo.png +0 -0
  2. package/docs/contributing/issues.md +17 -21
  3. package/front_end/core/common/Console.ts +1 -8
  4. package/front_end/core/common/ParsedURL.ts +10 -20
  5. package/front_end/core/common/SegmentedRange.ts +1 -2
  6. package/front_end/core/common/StringOutputStream.ts +1 -4
  7. package/front_end/core/i18n/i18nImpl.ts +0 -24
  8. package/front_end/core/sdk/AnimationModel.ts +1 -2
  9. package/front_end/core/sdk/CSSMatchedStyles.ts +2 -2
  10. package/front_end/core/sdk/CSSModel.ts +1 -1
  11. package/front_end/core/sdk/CSSProperty.ts +3 -6
  12. package/front_end/core/sdk/CSSStyleDeclaration.ts +4 -4
  13. package/front_end/core/sdk/DebuggerModel.ts +1 -2
  14. package/front_end/core/sdk/EnhancedTracesParser.ts +4 -0
  15. package/front_end/core/sdk/SourceMap.ts +2 -3
  16. package/front_end/entrypoints/node_app/NodeConnectionsPanel.ts +2 -1
  17. package/front_end/generated/InspectorBackendCommands.js +1 -2
  18. package/front_end/generated/SupportedCSSProperties.js +19 -0
  19. package/front_end/generated/protocol.ts +0 -27
  20. package/front_end/panels/accessibility/AccessibilityNodeView.ts +18 -17
  21. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +9 -12
  22. package/front_end/panels/ai_assistance/components/ChatView.ts +5 -4
  23. package/front_end/panels/application/AppManifestView.ts +7 -6
  24. package/front_end/panels/application/ApplicationPanelSidebar.ts +4 -4
  25. package/front_end/panels/application/OpenedWindowDetailsView.ts +6 -6
  26. package/front_end/panels/application/StorageView.ts +9 -8
  27. package/front_end/panels/application/components/BackForwardCacheView.ts +333 -314
  28. package/front_end/panels/application/components/ProtocolHandlersView.ts +3 -2
  29. package/front_end/panels/application/preloading/components/PreloadingDisabledInfobar.ts +2 -1
  30. package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +8 -8
  31. package/front_end/panels/common/BadgeNotification.ts +2 -1
  32. package/front_end/panels/common/GdpSignUpDialog.ts +2 -1
  33. package/front_end/panels/console/ConsoleInsightTeaser.ts +8 -2
  34. package/front_end/panels/console/ConsolePinPane.ts +12 -7
  35. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +9 -9
  36. package/front_end/panels/elements/ComputedStyleWidget.ts +7 -7
  37. package/front_end/panels/elements/EventListenersWidget.ts +9 -9
  38. package/front_end/panels/elements/NodeStackTraceWidget.ts +6 -6
  39. package/front_end/panels/elements/PlatformFontsWidget.ts +5 -5
  40. package/front_end/panels/elements/PropertiesWidget.ts +8 -8
  41. package/front_end/panels/layer_viewer/Layers3DView.ts +2 -1
  42. package/front_end/panels/layer_viewer/PaintProfilerView.ts +3 -3
  43. package/front_end/panels/network/RequestCookiesView.ts +2 -1
  44. package/front_end/panels/network/RequestTimingView.ts +2 -1
  45. package/front_end/panels/recorder/RecorderController.ts +34 -23
  46. package/front_end/panels/recorder/components/CreateRecordingView.ts +249 -240
  47. package/front_end/panels/security/CookieControlsView.ts +2 -1
  48. package/front_end/panels/security/CookieReportView.ts +3 -2
  49. package/front_end/panels/settings/AISettingsTab.ts +2 -1
  50. package/front_end/panels/settings/KeybindsSettingsTab.ts +6 -0
  51. package/front_end/panels/settings/components/SyncSection.ts +2 -1
  52. package/front_end/panels/sources/DebuggerPausedMessage.ts +4 -3
  53. package/front_end/panels/sources/ResourceOriginPlugin.ts +3 -2
  54. package/front_end/panels/sources/SourcesNavigator.ts +2 -1
  55. package/front_end/panels/sources/TabbedEditorContainer.ts +3 -2
  56. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +9 -9
  57. package/front_end/panels/timeline/TimelineUIUtils.ts +3 -2
  58. package/front_end/panels/timeline/components/DetailsView.ts +5 -4
  59. package/front_end/panels/timeline/components/FieldSettingsDialog.ts +2 -1
  60. package/front_end/panels/timeline/components/LiveMetricsView.ts +5 -4
  61. package/front_end/panels/timeline/components/MetricCompareStrings.ts +25 -24
  62. package/front_end/panels/timeline/components/insights/LCPDiscovery.ts +2 -1
  63. package/front_end/third_party/chromium/README.chromium +1 -1
  64. package/front_end/ui/components/docs/tooltip/basic.ts +1 -1
  65. package/front_end/ui/components/tooltips/Tooltip.ts +32 -17
  66. package/front_end/ui/i18n/i18n.ts +31 -0
  67. package/front_end/ui/legacy/SoftDropDown.ts +1 -12
  68. package/front_end/ui/legacy/ViewManager.ts +2 -4
  69. package/front_end/ui/legacy/Widget.ts +33 -17
  70. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +2 -1
  71. package/front_end/ui/legacy/legacy.ts +0 -2
  72. package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
  73. package/mcp/mcp.ts +1 -0
  74. package/package.json +1 -1
  75. package/front_end/ui/components/docs/recorder_create_recording_view/basic.html +0 -20
  76. package/front_end/ui/components/docs/recorder_create_recording_view/basic.ts +0 -27
  77. package/front_end/ui/legacy/ThrottledWidget.ts +0 -48
@@ -167,6 +167,7 @@ const proposedRectForSimpleTooltip =
167
167
 
168
168
  export type TooltipVariant = 'simple'|'rich';
169
169
  export type PaddingMode = 'small'|'large';
170
+ export type TooltipTrigger = 'hover'|'click'|'both';
170
171
 
171
172
  export interface TooltipProperties {
172
173
  id: string;
@@ -174,6 +175,7 @@ export interface TooltipProperties {
174
175
  padding?: PaddingMode;
175
176
  anchor?: HTMLElement;
176
177
  jslogContext?: string;
178
+ trigger?: TooltipTrigger;
177
179
  }
178
180
 
179
181
  /**
@@ -182,7 +184,7 @@ export interface TooltipProperties {
182
184
  * @property hoverDelay - reflects the `"hover-delay"` attribute.
183
185
  * @property variant - reflects the `"variant"` attribute.
184
186
  * @property padding - reflects the `"padding"` attribute.
185
- * @property useClick - reflects the `"click"` attribute.
187
+ * @property trigger - reflects the `"trigger"` attribute.
186
188
  * @property verticalDistanceIncrease - reflects the `"vertical-distance-increase"` attribute.
187
189
  * @property preferSpanLeft - reflects the `"prefer-span-left"` attribute.
188
190
  * @attribute id - Id of the tooltip. Used for searching an anchor element with aria-describedby.
@@ -190,17 +192,19 @@ export interface TooltipProperties {
190
192
  * @attribute variant - Variant of the tooltip, `"simple"` for strings only, inverted background,
191
193
  * `"rich"` for interactive content, background according to theme's surface.
192
194
  * @attribute padding - Which padding to use, defaults to `"small"`. Use `"large"` for richer content.
193
- * @attribute use-click - If present, the tooltip will be shown on click instead of on hover.
195
+ * @attribute trigger - Specifies which action triggers the tooltip. `"hover"` is the default. `"click"` means the
196
+ * tooltip will be shown on click instead of hover. `"both"` means both hover and click trigger the
197
+ * tooltip.
194
198
  * @attribute vertical-distance-increase - The tooltip is moved vertically this many pixels further away from its anchor.
195
199
  * @attribute prefer-span-left - If present, the tooltip's preferred position is `"span-left"` (The right
196
200
  * side of the tooltip and its anchor are aligned. The tooltip expands to the left from
197
201
  * there.). Applies to rich tooltips only.
198
202
  * @attribute use-hotkey - If present, the tooltip will be shown on hover but not when receiving focus.
199
- * Requires a hotkey to open when fosed (Alt-down). When `"use-click"` is present
200
- * as well, use-click takes precedence.
203
+ * Requires a hotkey to open when fosed (Alt-down). When `"trigger"` is present
204
+ * as well, `"trigger"` takes precedence.
201
205
  */
202
206
  export class Tooltip extends HTMLElement {
203
- static readonly observedAttributes = ['id', 'variant', 'jslogcontext'];
207
+ static readonly observedAttributes = ['id', 'variant', 'jslogcontext', 'trigger'];
204
208
  static lastOpenedTooltipId: string|null = null;
205
209
 
206
210
  readonly #shadow = this.attachShadow({mode: 'open'});
@@ -231,16 +235,20 @@ export class Tooltip extends HTMLElement {
231
235
  }
232
236
  }
233
237
 
234
- get useClick(): boolean {
235
- return this.hasAttribute('use-click') ?? false;
236
- }
237
- set useClick(useClick: boolean) {
238
- if (useClick) {
239
- this.setAttribute('use-click', '');
240
- } else {
241
- this.removeAttribute('use-click');
238
+ get trigger(): TooltipTrigger {
239
+ switch (this.getAttribute('trigger')) {
240
+ case 'click':
241
+ return 'click';
242
+ case 'both':
243
+ return 'both';
244
+ case 'hover':
245
+ default:
246
+ return 'hover';
242
247
  }
243
248
  }
249
+ set trigger(trigger: TooltipTrigger) {
250
+ this.setAttribute('trigger', trigger);
251
+ }
244
252
 
245
253
  get hoverDelay(): number {
246
254
  return this.hasAttribute('hover-delay') ? Number(this.getAttribute('hover-delay')) : 300;
@@ -297,7 +305,7 @@ export class Tooltip extends HTMLElement {
297
305
 
298
306
  constructor(properties?: TooltipProperties) {
299
307
  super();
300
- const {id, variant, padding, jslogContext, anchor} = properties ?? {};
308
+ const {id, variant, padding, jslogContext, anchor, trigger} = properties ?? {};
301
309
  if (id) {
302
310
  this.id = id;
303
311
  }
@@ -317,6 +325,9 @@ export class Tooltip extends HTMLElement {
317
325
  }
318
326
  this.#anchor = anchor;
319
327
  }
328
+ if (trigger) {
329
+ this.trigger = trigger;
330
+ }
320
331
  }
321
332
 
322
333
  attributeChangedCallback(name: string, oldValue: string, newValue: string): void {
@@ -463,7 +474,7 @@ export class Tooltip extends HTMLElement {
463
474
  if (!this.hasAttribute('role')) {
464
475
  this.setAttribute('role', 'tooltip');
465
476
  }
466
- this.setAttribute('popover', this.useClick ? 'auto' : 'manual');
477
+ this.setAttribute('popover', this.trigger === 'hover' ? 'manual' : 'auto');
467
478
  this.#updateJslog();
468
479
  }
469
480
 
@@ -474,6 +485,9 @@ export class Tooltip extends HTMLElement {
474
485
  #setClosing = (event: Event): void => {
475
486
  if ((event as ToggleEvent).newState === 'closed') {
476
487
  this.#closing = true;
488
+ if (this.#timeout) {
489
+ window.clearTimeout(this.#timeout);
490
+ }
477
491
  }
478
492
  };
479
493
 
@@ -521,9 +535,10 @@ export class Tooltip extends HTMLElement {
521
535
  // as we always want to support ESC to close.
522
536
  this.#anchor.addEventListener('keydown', this.#keyDown);
523
537
 
524
- if (this.useClick) {
538
+ if (this.trigger === 'click' || this.trigger === 'both') {
525
539
  this.#anchor.addEventListener('click', this.toggle);
526
- } else {
540
+ }
541
+ if (this.trigger === 'hover' || this.trigger === 'both') {
527
542
  this.#anchor.addEventListener('mouseenter', this.showTooltip);
528
543
  if (!this.useHotkey) {
529
544
  this.#anchor.addEventListener('focus', this.showTooltip);
@@ -0,0 +1,31 @@
1
+ // Copyright 2025 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
+ /* eslint-disable @devtools/no-imperative-dom-api */
6
+
7
+ import * as I18n from '../../core/i18n/i18n.js';
8
+ import type * as ThirdPartyI18n from '../../third_party/i18n/i18n.js';
9
+
10
+ /**
11
+ * Returns a span element that may contains other DOM element as placeholders
12
+ */
13
+ export function getFormatLocalizedString(
14
+ registeredStrings: ThirdPartyI18n.LocalizedStringSet.RegisteredFileStrings, stringId: string,
15
+ placeholders: Record<string, Object>): HTMLSpanElement {
16
+ const formatter = registeredStrings.getLocalizedStringSetFor(I18n.DevToolsLocale.DevToolsLocale.instance().locale)
17
+ .getMessageFormatterFor(stringId);
18
+
19
+ const element = document.createElement('span');
20
+ for (const icuElement of formatter.getAst()) {
21
+ if (icuElement.type === /* argumentElement */ 1) {
22
+ const placeholderValue = placeholders[icuElement.value];
23
+ if (placeholderValue) {
24
+ element.append(placeholderValue as Node | string);
25
+ }
26
+ } else if ('value' in icuElement) {
27
+ element.append(String(icuElement.value));
28
+ }
29
+ }
30
+ return element;
31
+ }
@@ -38,7 +38,6 @@ export class SoftDropDown<T> implements ListDelegate<T> {
38
38
  private list: ListControl<T>;
39
39
  private rowHeight: number;
40
40
  private width: number;
41
- private listWasShowing200msAgo: boolean;
42
41
 
43
42
  constructor(model: ListModel<T>, delegate: Delegate<T>, jslogContext?: string) {
44
43
  this.delegate = delegate;
@@ -79,9 +78,8 @@ export class SoftDropDown<T> implements ListDelegate<T> {
79
78
  'jslog',
80
79
  `${VisualLogging.menu().parent('mapped').track({resize: true, keydown: 'ArrowUp|ArrowDown|PageUp|PageDown'})}`);
81
80
 
82
- this.listWasShowing200msAgo = false;
83
81
  this.element.addEventListener('mousedown', event => {
84
- if (this.listWasShowing200msAgo) {
82
+ if (this.glassPane.isShowing()) {
85
83
  this.hide(event);
86
84
  } else if (!this.element.disabled) {
87
85
  this.show(event);
@@ -96,9 +94,6 @@ export class SoftDropDown<T> implements ListDelegate<T> {
96
94
  return;
97
95
  }
98
96
 
99
- if (!this.listWasShowing200msAgo) {
100
- return;
101
- }
102
97
  this.selectHighlightedItem();
103
98
  if (event.target instanceof Element && event.target?.parentElement) {
104
99
  // hide() will consume the mouseup event and click won't be triggered
@@ -122,9 +117,6 @@ export class SoftDropDown<T> implements ListDelegate<T> {
122
117
  this.list.selectItem(this.selectedItem);
123
118
  }
124
119
  event.consume(true);
125
- window.setTimeout(() => {
126
- this.listWasShowing200msAgo = true;
127
- }, 200);
128
120
  }
129
121
 
130
122
  private updateGlasspaneSize(): void {
@@ -134,9 +126,6 @@ export class SoftDropDown<T> implements ListDelegate<T> {
134
126
  }
135
127
 
136
128
  private hide(event: Event): void {
137
- window.setTimeout(() => {
138
- this.listWasShowing200msAgo = false;
139
- }, 200);
140
129
  this.glassPane.hide();
141
130
  this.list.selectItem(null);
142
131
  ARIAUtils.setExpanded(this.element, false);
@@ -164,14 +164,12 @@ export interface EventTypes {
164
164
  }
165
165
 
166
166
  export class ViewManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
167
- readonly views: Map<string, View>;
168
- private readonly locationNameByViewId: Map<string, string>;
167
+ readonly views = new Map<string, View>();
168
+ private readonly locationNameByViewId = new Map<string, string>();
169
169
  private readonly locationOverrideSetting: Common.Settings.Setting<Record<string, string>>;
170
170
 
171
171
  private constructor() {
172
172
  super();
173
- this.views = new Map();
174
- this.locationNameByViewId = new Map();
175
173
 
176
174
  // Read override setting for location
177
175
  this.locationOverrideSetting = Common.Settings.Settings.instance().createSetting('views-location-override', {});
@@ -125,6 +125,14 @@ export class WidgetElement<WidgetT extends Widget> extends HTMLElement {
125
125
  widget.show(this.parentElement as HTMLElement, undefined, /* suppressOrphanWidgetError= */ true);
126
126
  }
127
127
 
128
+ disconnectedCallback(): void {
129
+ const widget = Widget.get(this);
130
+ if (widget) {
131
+ widget.setHideOnDetach();
132
+ widget.detach();
133
+ }
134
+ }
135
+
128
136
  override appendChild<T extends Node>(child: T): T {
129
137
  if (child instanceof HTMLElement && child.tagName !== 'STYLE') {
130
138
  Widget.getOrCreateWidget(child).show(this);
@@ -264,7 +272,6 @@ export class Widget {
264
272
  #notificationDepth = 0;
265
273
  #invalidationsSuspended = 0;
266
274
  #parentWidget: Widget|null = null;
267
- #defaultFocusedElement?: Element|null;
268
275
  #cachedConstraints?: Geometry.Constraints;
269
276
  #constraints?: Geometry.Constraints;
270
277
  #invalidationsRequested?: boolean;
@@ -724,7 +731,13 @@ export class Widget {
724
731
  }
725
732
 
726
733
  setDefaultFocusedElement(element: Element|null): void {
727
- this.#defaultFocusedElement = element;
734
+ const defaultFocusedElement = this.getDefaultFocusedElement();
735
+ if (defaultFocusedElement) {
736
+ defaultFocusedElement.removeAttribute('autofocus');
737
+ }
738
+ if (element) {
739
+ element.setAttribute('autofocus', '');
740
+ }
728
741
  }
729
742
 
730
743
  setDefaultFocusedChild(child: Widget): void {
@@ -732,21 +745,28 @@ export class Widget {
732
745
  this.defaultFocusedChild = child;
733
746
  }
734
747
 
735
- focus(): void {
736
- if (!this.isShowing()) {
737
- return;
748
+ getDefaultFocusedElement(): HTMLElement|null {
749
+ const autofocusElement = this.contentElement.hasAttribute('autofocus') ?
750
+ this.contentElement :
751
+ this.contentElement.querySelector<HTMLElement>('[autofocus]');
752
+ let widgetElement: Element|null = autofocusElement;
753
+ while (widgetElement) {
754
+ const widget = Widget.get(widgetElement);
755
+ if (widget) {
756
+ return widget === this ? autofocusElement : null;
757
+ }
758
+ widgetElement = widgetElement.parentElementOrShadowHost();
738
759
  }
760
+ return null;
761
+ }
739
762
 
740
- if (this.#shadowRoot?.delegatesFocus && this.contentElement.querySelector('[autofocus]')) {
741
- this.element.focus();
763
+ focus(): void {
764
+ if (!this.isShowing()) {
742
765
  return;
743
766
  }
744
-
745
- const element = (this.#defaultFocusedElement as HTMLElement | null);
746
- if (element) {
747
- if (!element.hasFocus()) {
748
- element.focus();
749
- }
767
+ const autofocusElement = this.getDefaultFocusedElement();
768
+ if (autofocusElement) {
769
+ autofocusElement.focus();
750
770
  return;
751
771
  }
752
772
 
@@ -759,10 +779,6 @@ export class Widget {
759
779
  return;
760
780
  }
761
781
  }
762
- let child = this.contentElement.traverseNextNode(this.contentElement);
763
- while (child) {
764
- child = child.traverseNextNode(this.contentElement);
765
- }
766
782
  }
767
783
  }
768
784
 
@@ -35,6 +35,7 @@ import * as i18n from '../../../../core/i18n/i18n.js';
35
35
  import * as Platform from '../../../../core/platform/platform.js';
36
36
  import * as SDK from '../../../../core/sdk/sdk.js';
37
37
  import * as TextUtils from '../../../../models/text_utils/text_utils.js';
38
+ import * as uiI18n from '../../../../ui/i18n/i18n.js';
38
39
  import * as IconButton from '../../../components/icon_button/icon_button.js';
39
40
  import * as TextEditor from '../../../components/text_editor/text_editor.js';
40
41
  import * as VisualLogging from '../../../visual_logging/visual_logging.js';
@@ -438,7 +439,7 @@ export class ObjectPropertiesSection extends UI.TreeOutline.TreeOutlineInShadow
438
439
  wrapperElement.classList.add('error');
439
440
  wrapperElement.classList.add('value');
440
441
  wrapperElement.appendChild(
441
- i18n.i18n.getFormatLocalizedString(str_, UIStrings.exceptionS, {PH1: propertyValue.element}));
442
+ uiI18n.getFormatLocalizedString(str_, UIStrings.exceptionS, {PH1: propertyValue.element}));
442
443
  propertyValue.element = wrapperElement;
443
444
  }
444
445
  propertyValue.element.classList.add('value');
@@ -42,7 +42,6 @@ import * as SuggestBox from './SuggestBox.js';
42
42
  import * as TabbedPane from './TabbedPane.js';
43
43
  import * as TargetCrashedScreen from './TargetCrashedScreen.js';
44
44
  import * as TextPrompt from './TextPrompt.js';
45
- import * as ThrottledWidget from './ThrottledWidget.js';
46
45
  import * as Toolbar from './Toolbar.js';
47
46
  import * as Tooltip from './Tooltip.js';
48
47
  import * as TreeOutline from './Treeoutline.js';
@@ -95,7 +94,6 @@ export {
95
94
  TabbedPane,
96
95
  TargetCrashedScreen,
97
96
  TextPrompt,
98
- ThrottledWidget,
99
97
  Toolbar,
100
98
  Tooltip,
101
99
  TreeOutline,
@@ -849,6 +849,7 @@ export const knownContextValues = new Set([
849
849
  'console-group-similar-false',
850
850
  'console-history-autocomplete',
851
851
  'console-history-autocomplete-false',
852
+ 'console-insight-teaser',
852
853
  'console-insight-teasers-enabled',
853
854
  'console-insights',
854
855
  'console-insights-enabled',
@@ -3162,6 +3163,7 @@ export const knownContextValues = new Set([
3162
3163
  'row-rule-color',
3163
3164
  'row-rule-outset',
3164
3165
  'row-rule-style',
3166
+ 'row-rule-visibility-items',
3165
3167
  'row-rule-width',
3166
3168
  'rp-id',
3167
3169
  'rpId',
@@ -3686,6 +3688,7 @@ export const knownContextValues = new Set([
3686
3688
  'targets',
3687
3689
  'task-duration',
3688
3690
  'te',
3691
+ 'teaser-info-tooltip',
3689
3692
  'terms-of-service',
3690
3693
  'terms-of-service-accepted',
3691
3694
  'terms-of-service.console-insights',
package/mcp/mcp.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
+ export * as I18n from '../front_end/core/i18n/i18n.js';
5
6
  export {ConnectionTransport} from '../front_end/core/protocol_client/ConnectionTransport.js';
6
7
  export {
7
8
  PerformanceInsightFormatter
package/package.json CHANGED
@@ -102,5 +102,5 @@
102
102
  "flat-cache": "6.1.12"
103
103
  }
104
104
  },
105
- "version": "1.0.1535712"
105
+ "version": "1.0.1536371"
106
106
  }
@@ -1,20 +0,0 @@
1
- <!--
2
- Copyright 2023 The Chromium Authors
3
- Use of this source code is governed by a BSD-style license that can be
4
- found in the LICENSE file.
5
- -->
6
- <!DOCTYPE html>
7
- <html>
8
-
9
- <head>
10
- <meta charset="UTF-8" />
11
- <meta name="viewport" content="width=device-width" />
12
- <title>Recorder: CreateRecordingView</title>
13
- </head>
14
-
15
- <body>
16
- <div id="container"></div>
17
- <script src="./basic.js" type="module"></script>
18
- </body>
19
-
20
- </html>
@@ -1,27 +0,0 @@
1
- // Copyright 2023 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 ComponentHelpers from '../../../../../front_end/ui/components/helpers/helpers.js';
6
- import * as RecorderComponents from '../../../../panels/recorder/components/components.js';
7
- import * as FrontendHelpers from '../../../../testing/EnvironmentHelpers.js';
8
-
9
- await ComponentHelpers.ComponentServerSetup.setup();
10
- await FrontendHelpers.initializeGlobalVars();
11
- async function initializeGlobalActions(): Promise<void> {
12
- const UI = await import('../../../../../front_end/ui/legacy/legacy.js');
13
- const actionRegistry = UI.ActionRegistry.ActionRegistry.instance();
14
- UI.ShortcutRegistry.ShortcutRegistry.instance({
15
- forceNew: true,
16
- actionRegistry,
17
- });
18
- }
19
-
20
- await initializeGlobalActions();
21
-
22
- const component1 = new RecorderComponents.CreateRecordingView.CreateRecordingView();
23
- document.getElementById('container')?.appendChild(component1);
24
-
25
- const component2 = new RecorderComponents.CreateRecordingView.CreateRecordingView();
26
- document.getElementById('container')?.appendChild(component2);
27
- component2.shadowRoot?.querySelector('devtools-control-button')?.click();
@@ -1,48 +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
-
7
- import {VBox} from './Widget.js';
8
-
9
- export class ThrottledWidget extends VBox {
10
- private readonly updateThrottler: Common.Throttler.Throttler;
11
- private updateWhenVisible: boolean;
12
- protected lastUpdatePromise: Promise<void> = Promise.resolve();
13
-
14
- constructor(useShadowDom?: boolean, timeout?: number) {
15
- super({useShadowDom});
16
- this.updateThrottler = new Common.Throttler.Throttler(timeout === undefined ? 100 : timeout);
17
- this.updateWhenVisible = false;
18
- }
19
-
20
- protected doUpdate(): Promise<void> {
21
- return Promise.resolve();
22
- }
23
-
24
- update(): void {
25
- this.updateWhenVisible = !this.isShowing();
26
- if (this.updateWhenVisible) {
27
- return;
28
- }
29
- this.lastUpdatePromise = this.updateThrottler.schedule(() => {
30
- if (this.isShowing()) {
31
- return this.doUpdate();
32
- }
33
- this.updateWhenVisible = true;
34
- return Promise.resolve();
35
- });
36
- }
37
-
38
- override get updateComplete(): Promise<boolean> {
39
- return this.updateThrottler.processCompleted?.then(result => Boolean(result)) || Promise.resolve(false);
40
- }
41
-
42
- override wasShown(): void {
43
- super.wasShown();
44
- if (this.updateWhenVisible) {
45
- this.update();
46
- }
47
- }
48
- }