chrome-devtools-frontend 1.0.1571007 → 1.0.1572937

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 (168) hide show
  1. package/agents/prompts/README.md +18 -0
  2. package/agents/prompts/devtools-imports.md +47 -0
  3. package/agents/prompts/verification.md +27 -0
  4. package/front_end/Images/geminiInDevTools.png +0 -0
  5. package/front_end/Images/geminiInDevTools_2x.png +0 -0
  6. package/front_end/Images/src/database-off.svg +1 -0
  7. package/front_end/Images/src/lock-person.svg +1 -1
  8. package/front_end/core/common/Debouncer.ts +10 -1
  9. package/front_end/core/common/SettingRegistration.ts +1 -1
  10. package/front_end/core/host/AidaClient.ts +8 -0
  11. package/front_end/core/host/InspectorFrontendHostAPI.ts +0 -6
  12. package/front_end/core/host/UserMetrics.ts +1 -31
  13. package/front_end/core/root/ExperimentNames.ts +30 -0
  14. package/front_end/core/root/Runtime.ts +47 -48
  15. package/front_end/core/root/root.ts +2 -0
  16. package/front_end/core/sdk/CSSModel.ts +36 -13
  17. package/front_end/core/sdk/CSSProperty.ts +1 -1
  18. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +9 -0
  19. package/front_end/core/sdk/CookieModel.ts +2 -1
  20. package/front_end/core/sdk/DOMModel.ts +1 -1
  21. package/front_end/core/sdk/DebuggerModel.ts +1 -1
  22. package/front_end/core/sdk/OverlayModel.ts +3 -2
  23. package/front_end/core/sdk/SourceMap.ts +1 -1
  24. package/front_end/devtools_compatibility.js +0 -6
  25. package/front_end/entrypoints/main/MainImpl.ts +44 -24
  26. package/front_end/entrypoints/main/main-meta.ts +1 -1
  27. package/front_end/generated/SupportedCSSProperties.js +6 -14
  28. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +0 -180
  29. package/front_end/models/ai_assistance/ai_assistance.ts +0 -2
  30. package/front_end/models/breakpoints/BreakpointManager.ts +3 -3
  31. package/front_end/models/issues_manager/ContrastCheckTrigger.ts +2 -2
  32. package/front_end/models/javascript_metadata/NativeFunctions.js +8 -0
  33. package/front_end/models/source_map_scopes/NamesResolver.ts +1 -1
  34. package/front_end/models/trace/EventsSerializer.ts +5 -1
  35. package/front_end/models/trace/ModelImpl.ts +0 -4
  36. package/front_end/models/trace/types/TraceEvents.ts +4 -0
  37. package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +1 -1
  38. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +1 -1
  39. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +8 -63
  40. package/front_end/panels/ai_assistance/PatchWidget.ts +10 -15
  41. package/front_end/panels/ai_assistance/SelectWorkspaceDialog.ts +5 -4
  42. package/front_end/panels/ai_assistance/aiAssistancePanel.css +0 -16
  43. package/front_end/panels/ai_assistance/ai_assistance.ts +0 -1
  44. package/front_end/panels/ai_assistance/components/ChatMessage.ts +3 -2
  45. package/front_end/panels/ai_assistance/components/ChatView.ts +123 -108
  46. package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +1 -145
  47. package/front_end/panels/application/DeviceBoundSessionsModel.ts +23 -1
  48. package/front_end/panels/application/DeviceBoundSessionsTreeElement.ts +23 -0
  49. package/front_end/panels/application/FrameDetailsView.ts +12 -10
  50. package/front_end/panels/application/components/BackForwardCacheView.ts +6 -8
  51. package/front_end/panels/application/components/BounceTrackingMitigationsView.ts +4 -3
  52. package/front_end/panels/application/components/ProtocolHandlersView.ts +5 -6
  53. package/front_end/panels/application/components/ReportsGrid.ts +9 -9
  54. package/front_end/panels/application/components/SharedStorageAccessGrid.ts +5 -4
  55. package/front_end/panels/application/components/TrustTokensView.ts +4 -6
  56. package/front_end/panels/application/preloading/PreloadingView.ts +9 -8
  57. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +237 -230
  58. package/front_end/panels/application/preloading/components/PreloadingGrid.ts +3 -2
  59. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +6 -10
  60. package/front_end/panels/application/resourcesSidebar.css +8 -0
  61. package/front_end/panels/autofill/AutofillView.ts +4 -3
  62. package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +3 -5
  63. package/front_end/panels/common/AiCodeCompletionTeaser.ts +5 -5
  64. package/front_end/panels/common/AiCodeGenerationTeaser.ts +35 -4
  65. package/front_end/panels/common/BadgeNotification.ts +17 -14
  66. package/front_end/panels/common/GdpSignUpDialog.ts +5 -6
  67. package/front_end/panels/common/GeminiRebrandPromoDialog.ts +192 -0
  68. package/front_end/panels/common/aiCodeGenerationTeaser.css +16 -1
  69. package/front_end/panels/common/common.ts +1 -0
  70. package/front_end/panels/common/geminiRebrandPromoDialog.css +47 -0
  71. package/front_end/panels/console/ConsoleInsightTeaser.ts +10 -11
  72. package/front_end/panels/console/ErrorStackParser.ts +11 -16
  73. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +2 -2
  74. package/front_end/panels/css_overview/CSSOverviewModel.ts +1 -1
  75. package/front_end/panels/elements/ComputedStyleModel.ts +16 -65
  76. package/front_end/panels/elements/ComputedStyleWidget.ts +3 -3
  77. package/front_end/panels/elements/ElementsPanel.ts +35 -5
  78. package/front_end/panels/elements/ElementsSidebarPane.ts +1 -1
  79. package/front_end/panels/elements/ElementsTreeOutline.ts +1 -1
  80. package/front_end/panels/elements/PlatformFontsWidget.ts +1 -1
  81. package/front_end/panels/elements/StylePropertiesSection.ts +16 -8
  82. package/front_end/panels/elements/StylePropertyTreeElement.ts +67 -32
  83. package/front_end/panels/elements/StylesSidebarPane.ts +28 -11
  84. package/front_end/panels/elements/components/CSSHintDetailsView.ts +3 -2
  85. package/front_end/panels/elements/components/CSSPropertyDocsView.ts +3 -2
  86. package/front_end/panels/elements/elements-meta.ts +1 -1
  87. package/front_end/panels/emulation/DeviceModeWrapper.ts +101 -62
  88. package/front_end/panels/explain/components/ConsoleInsight.ts +27 -23
  89. package/front_end/panels/explain/components/consoleInsight.css +1 -1
  90. package/front_end/panels/issues/IssueView.ts +6 -6
  91. package/front_end/panels/network/RequestConditionsDrawer.ts +4 -3
  92. package/front_end/panels/network/RequestCookiesView.ts +3 -4
  93. package/front_end/panels/network/RequestTimingView.ts +6 -10
  94. package/front_end/panels/network/components/HeaderSectionRow.ts +3 -2
  95. package/front_end/panels/network/components/RequestHeaderSection.ts +3 -1
  96. package/front_end/panels/network/components/RequestHeadersView.css +2 -2
  97. package/front_end/panels/network/components/RequestHeadersView.ts +7 -6
  98. package/front_end/panels/profiler/HeapProfileView.ts +3 -3
  99. package/front_end/panels/profiler/HeapSnapshotView.ts +2 -2
  100. package/front_end/panels/profiler/profiler-meta.ts +3 -3
  101. package/front_end/panels/protocol_monitor/protocol_monitor-meta.ts +1 -1
  102. package/front_end/panels/recorder/RecorderController.ts +7 -13
  103. package/front_end/panels/recorder/components/CreateRecordingView.ts +6 -6
  104. package/front_end/panels/recorder/components/RecordingView.ts +0 -38
  105. package/front_end/panels/recorder/components/ReplaySection.ts +0 -14
  106. package/front_end/panels/recorder/components/StepEditor.ts +2 -40
  107. package/front_end/panels/recorder/recorderController.css +4 -4
  108. package/front_end/panels/security/CookieControlsView.ts +2 -2
  109. package/front_end/panels/security/CookieReportView.ts +21 -21
  110. package/front_end/panels/security/cookieControlsView.css +1 -1
  111. package/front_end/panels/security/cookieReportView.css +1 -1
  112. package/front_end/panels/settings/AISettingsTab.ts +13 -15
  113. package/front_end/panels/settings/components/SyncSection.ts +4 -3
  114. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +4 -12
  115. package/front_end/panels/settings/settings-meta.ts +1 -1
  116. package/front_end/panels/sources/BreakpointEditDialog.ts +4 -3
  117. package/front_end/panels/sources/CallStackSidebarPane.ts +4 -1
  118. package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +1 -1
  119. package/front_end/panels/sources/NavigatorView.ts +4 -4
  120. package/front_end/panels/sources/SourcesPanel.ts +7 -4
  121. package/front_end/panels/sources/components/HeadersView.ts +2 -2
  122. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +3 -2
  123. package/front_end/panels/timeline/ThreadAppender.ts +2 -1
  124. package/front_end/panels/timeline/TimelineController.ts +4 -3
  125. package/front_end/panels/timeline/TimelinePanel.ts +7 -4
  126. package/front_end/panels/timeline/TimelineUIUtils.ts +2 -2
  127. package/front_end/panels/timeline/components/ExportTraceOptions.ts +4 -4
  128. package/front_end/panels/timeline/components/FieldSettingsDialog.ts +13 -6
  129. package/front_end/panels/timeline/components/LiveMetricsView.ts +13 -9
  130. package/front_end/panels/timeline/components/exportTraceOptions.css +1 -1
  131. package/front_end/panels/timeline/components/fieldSettingsDialog.css +1 -1
  132. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +2 -19
  133. package/front_end/panels/timeline/components/insights/InsightRenderer.ts +3 -4
  134. package/front_end/panels/timeline/components/insights/baseInsightComponent.css +0 -5
  135. package/front_end/panels/timeline/components/liveMetricsView.css +1 -1
  136. package/front_end/panels/whats_new/ReleaseNoteView.ts +4 -3
  137. package/front_end/third_party/chromium/README.chromium +1 -1
  138. package/front_end/ui/components/buttons/button.css +4 -0
  139. package/front_end/ui/components/markdown_view/CodeBlock.ts +3 -6
  140. package/front_end/ui/components/markdown_view/MarkdownLink.ts +3 -4
  141. package/front_end/ui/components/panel_feedback/PanelFeedback.ts +3 -4
  142. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +10 -7
  143. package/front_end/ui/components/panel_feedback/panelFeedback.css +2 -2
  144. package/front_end/ui/components/panel_feedback/previewToggle.css +2 -2
  145. package/front_end/ui/components/text_editor/AiCodeGenerationParser.ts +27 -8
  146. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +36 -6
  147. package/front_end/ui/kit/link/Link.ts +1 -14
  148. package/front_end/ui/legacy/ActionRegistration.ts +1 -1
  149. package/front_end/ui/legacy/ContextMenu.ts +2 -2
  150. package/front_end/ui/legacy/EmptyWidget.ts +3 -3
  151. package/front_end/ui/legacy/LinkContextMenuProvider.ts +42 -0
  152. package/front_end/ui/legacy/ViewRegistration.ts +1 -1
  153. package/front_end/ui/legacy/XLink.ts +0 -27
  154. package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +1 -1
  155. package/front_end/ui/legacy/components/color_picker/ContrastOverlay.ts +5 -4
  156. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +2 -2
  157. package/front_end/ui/legacy/components/perf_ui/perf_ui-meta.ts +1 -1
  158. package/front_end/ui/legacy/inspectorCommon.css +2 -1
  159. package/front_end/ui/legacy/legacy.ts +3 -1
  160. package/front_end/ui/visual_logging/KnownContextValues.ts +4 -1
  161. package/front_end/ui/visual_logging/LoggingDriver.ts +3 -0
  162. package/package.json +1 -1
  163. package/front_end/models/ai_assistance/ArtifactsManager.ts +0 -67
  164. package/front_end/panels/ai_assistance/components/ArtifactsViewer.ts +0 -183
  165. package/front_end/panels/ai_assistance/components/CollapsibleAssistanceContentWidget.ts +0 -89
  166. package/front_end/panels/ai_assistance/components/PerformanceAgentFlameChart.ts +0 -133
  167. package/front_end/panels/ai_assistance/components/artifactsViewer.css +0 -15
  168. package/front_end/panels/ai_assistance/components/collapsibleAssistanceContentWidget.css +0 -32
@@ -267,7 +267,7 @@ export class CSSOverviewModel extends SDK.SDKModel.SDKModel<void> {
267
267
  const formattedTextColor = formatColor(blendedTextColor);
268
268
  const formattedBackgroundColor = formatColor(blendedBackgroundColor.asLegacyColor());
269
269
  const key = `${formattedTextColor}_${formattedBackgroundColor}`;
270
- if (Root.Runtime.experiments.isEnabled('apca')) {
270
+ if (Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.APCA)) {
271
271
  const contrastRatio = contrastInfo.contrastRatioAPCA();
272
272
  const threshold = contrastInfo.contrastRatioAPCAThreshold();
273
273
  const passes = contrastRatio && threshold ? Math.abs(contrastRatio) >= threshold : false;
@@ -3,92 +3,42 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as Common from '../../core/common/common.js';
6
- import * as Root from '../../core/root/root.js';
7
6
  import * as SDK from '../../core/sdk/sdk.js';
8
- import * as UI from '../../ui/legacy/legacy.js';
9
-
10
- import {ComputedStyleWidget} from './ComputedStyleWidget.js';
11
- import {StylesSidebarPane} from './StylesSidebarPane.js';
12
7
 
8
+ /**
9
+ * A thin wrapper around the CSS Model to gather up changes in CSS files that
10
+ * could impact a node's computed styles.
11
+ * Callers are expected to initiate tracking of the Node themselves via the CSS
12
+ * Model trackComputedStyleUpdatesForNode method.
13
+ */
13
14
  export class ComputedStyleModel extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
14
15
  #node: SDK.DOMModel.DOMNode|null;
15
16
  #cssModel: SDK.CSSModel.CSSModel|null;
16
17
  private eventListeners: Common.EventTarget.EventDescriptor[];
17
18
  private frameResizedTimer?: number;
18
19
  private computedStylePromise?: Promise<ComputedStyle|null>;
19
- private currentTrackedNodeId?: number;
20
20
 
21
- constructor() {
21
+ constructor(node?: SDK.DOMModel.DOMNode|null) {
22
22
  super();
23
23
  this.#cssModel = null;
24
24
  this.eventListeners = [];
25
- this.#node = UI.Context.Context.instance().flavor(SDK.DOMModel.DOMNode);
26
-
27
- UI.Context.Context.instance().addFlavorChangeListener(SDK.DOMModel.DOMNode, this.onNodeChanged, this);
28
- UI.Context.Context.instance().addFlavorChangeListener(
29
- StylesSidebarPane, this.evaluateTrackingComputedStyleUpdatesForNode, this);
30
- UI.Context.Context.instance().addFlavorChangeListener(
31
- ComputedStyleWidget, this.evaluateTrackingComputedStyleUpdatesForNode, this);
25
+ this.#node = node ?? null;
32
26
  }
33
27
 
34
- dispose(): void {
35
- UI.Context.Context.instance().removeFlavorChangeListener(SDK.DOMModel.DOMNode, this.onNodeChanged, this);
36
- UI.Context.Context.instance().removeFlavorChangeListener(
37
- StylesSidebarPane, this.evaluateTrackingComputedStyleUpdatesForNode, this);
38
- UI.Context.Context.instance().removeFlavorChangeListener(
39
- ComputedStyleWidget, this.evaluateTrackingComputedStyleUpdatesForNode, this);
28
+ get node(): SDK.DOMModel.DOMNode|null {
29
+ return this.#node;
40
30
  }
41
31
 
42
- node(): SDK.DOMModel.DOMNode|null {
43
- return this.#node;
32
+ set node(node: SDK.DOMModel.DOMNode|null) {
33
+ this.#node = node;
34
+ this.updateModel(this.#node ? this.#node.domModel().cssModel() : null);
35
+ this.onCSSModelChanged(null);
44
36
  }
45
37
 
46
38
  cssModel(): SDK.CSSModel.CSSModel|null {
47
39
  return this.#cssModel?.isEnabled() ? this.#cssModel : null;
48
40
  }
49
41
 
50
- // This is a debounced method because the user might be navigated from Styles tab to Computed Style tab and vice versa.
51
- // For that case, we want to only run this function once.
52
- private evaluateTrackingComputedStyleUpdatesForNode = Common.Debouncer.debounce((): void => {
53
- if (!this.#node) {
54
- // There isn't a node selected now, so let's stop tracking computed style updates for the previously tracked node.
55
- if (this.currentTrackedNodeId) {
56
- void this.cssModel()?.trackComputedStyleUpdatesForNode(undefined);
57
- this.currentTrackedNodeId = undefined;
58
- }
59
- return;
60
- }
61
-
62
- const isComputedStyleWidgetVisible = Boolean(UI.Context.Context.instance().flavor(ComputedStyleWidget));
63
- const isStylesTabVisible = Boolean(UI.Context.Context.instance().flavor(StylesSidebarPane));
64
- const shouldTrackComputedStyleUpdates = isComputedStyleWidgetVisible ||
65
- (isStylesTabVisible && Root.Runtime.hostConfig.devToolsAnimationStylesInStylesTab?.enabled);
66
- // There is a selected node but not the computed style widget nor the styles tab is visible.
67
- // If there is a previously tracked node let's stop tracking computed style updates for that node.
68
- if (!shouldTrackComputedStyleUpdates) {
69
- if (this.currentTrackedNodeId) {
70
- void this.cssModel()?.trackComputedStyleUpdatesForNode(undefined);
71
- this.currentTrackedNodeId = undefined;
72
- }
73
- return;
74
- }
75
-
76
- // Either computed style widget or styles tab is visible
77
- // if the currently tracked node id is not the same as the selected node
78
- // let's start tracking the currently selected node.
79
- if (this.currentTrackedNodeId !== this.#node.id) {
80
- void this.cssModel()?.trackComputedStyleUpdatesForNode(this.#node.id);
81
- this.currentTrackedNodeId = this.#node.id;
82
- }
83
- }, 100);
84
-
85
- private onNodeChanged(event: Common.EventTarget.EventTargetEvent<SDK.DOMModel.DOMNode|null>): void {
86
- this.#node = event.data;
87
- this.updateModel(this.#node ? this.#node.domModel().cssModel() : null);
88
- this.onCSSModelChanged(null);
89
- this.evaluateTrackingComputedStyleUpdatesForNode();
90
- }
91
-
92
42
  private updateModel(cssModel: SDK.CSSModel.CSSModel|null): void {
93
43
  if (this.#cssModel === cssModel) {
94
44
  return;
@@ -97,6 +47,7 @@ export class ComputedStyleModel extends Common.ObjectWrapper.ObjectWrapper<Event
97
47
  this.#cssModel = cssModel;
98
48
  const domModel = cssModel ? cssModel.domModel() : null;
99
49
  const resourceTreeModel = cssModel ? cssModel.target().model(SDK.ResourceTreeModel.ResourceTreeModel) : null;
50
+
100
51
  if (cssModel && domModel && resourceTreeModel) {
101
52
  this.eventListeners = [
102
53
  cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetAdded, this.onCSSModelChanged, this),
@@ -155,7 +106,7 @@ export class ComputedStyleModel extends Common.ObjectWrapper.ObjectWrapper<Event
155
106
  }
156
107
 
157
108
  private elementNode(): SDK.DOMModel.DOMNode|null {
158
- const node = this.node();
109
+ const node = this.node;
159
110
  if (!node) {
160
111
  return null;
161
112
  }
@@ -319,7 +319,7 @@ export class ComputedStyleWidget extends UI.Widget.VBox {
319
319
  return link;
320
320
  }
321
321
  return null;
322
- }, () => this.computedStyleModel.node());
322
+ }, () => this.computedStyleModel.node);
323
323
 
324
324
  const fontsWidget = new PlatformFontsWidget(this.computedStyleModel);
325
325
  fontsWidget.show(this.contentElement);
@@ -356,7 +356,7 @@ export class ComputedStyleWidget extends UI.Widget.VBox {
356
356
  }
357
357
 
358
358
  private async fetchMatchedCascade(): Promise<SDK.CSSMatchedStyles.CSSMatchedStyles|null> {
359
- const node = this.computedStyleModel.node();
359
+ const node = this.computedStyleModel.node;
360
360
  if (!node || !this.computedStyleModel.cssModel()) {
361
361
  return null;
362
362
  }
@@ -370,7 +370,7 @@ export class ComputedStyleWidget extends UI.Widget.VBox {
370
370
 
371
371
  function validateStyles(this: ComputedStyleWidget, matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles|null):
372
372
  SDK.CSSMatchedStyles.CSSMatchedStyles|null {
373
- return matchedStyles && matchedStyles.node() === this.computedStyleModel.node() ? matchedStyles : null;
373
+ return matchedStyles && matchedStyles.node() === this.computedStyleModel.node ? matchedStyles : null;
374
374
  }
375
375
  }
376
376
 
@@ -199,6 +199,8 @@ const createAccessibilityTreeToggleButton = (isActive: boolean): HTMLElement =>
199
199
 
200
200
  let elementsPanelInstance: ElementsPanel;
201
201
 
202
+ export const DEFAULT_COMPUTED_STYLES_DEBOUNCE_MS = 100;
203
+
202
204
  export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.Searchable,
203
205
  SDK.TargetManager.SDKModelObserver<SDK.DOMModel.DOMModel>,
204
206
  UI.View.ViewLocationResolver {
@@ -240,6 +242,7 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
240
242
 
241
243
  private cssStyleTrackerByCSSModel: Map<SDK.CSSModel.CSSModel, SDK.CSSModel.CSSPropertyTracker>;
242
244
  #domTreeWidget: DOMTreeWidget;
245
+ #computedStyleModel: ComputedStyleModel;
243
246
 
244
247
  getTreeOutlineForTesting(): ElementsTreeOutline|undefined {
245
248
  return this.#domTreeWidget.getTreeOutlineForTesting();
@@ -263,7 +266,7 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
263
266
  this.mainContainer = document.createElement('div');
264
267
  this.domTreeContainer = document.createElement('div');
265
268
  const crumbsContainer = document.createElement('div');
266
- if (Root.Runtime.experiments.isEnabled('full-accessibility-tree')) {
269
+ if (Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.FULL_ACCESSIBILITY_TREE)) {
267
270
  this.initializeFullAccessibilityTreeView();
268
271
  }
269
272
  this.mainContainer.appendChild(this.domTreeContainer);
@@ -299,10 +302,20 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
299
302
 
300
303
  crumbsContainer.appendChild(this.breadcrumbs);
301
304
 
302
- const computedStyleModel = new ComputedStyleModel();
303
- this.stylesWidget = new StylesSidebarPane(computedStyleModel);
304
- this.computedStyleWidget = new ComputedStyleWidget(computedStyleModel);
305
- this.metricsWidget = new MetricsSidebarPane(computedStyleModel);
305
+ this.#computedStyleModel = new ComputedStyleModel(UI.Context.Context.instance().flavor(SDK.DOMModel.DOMNode));
306
+ UI.Context.Context.instance().addFlavorChangeListener(SDK.DOMModel.DOMNode, event => {
307
+ this.#computedStyleModel.node = event.data;
308
+ this.evaluateTrackingComputedStyleUpdatesForNode();
309
+ });
310
+
311
+ UI.Context.Context.instance().addFlavorChangeListener(
312
+ StylesSidebarPane, this.evaluateTrackingComputedStyleUpdatesForNode, this);
313
+ UI.Context.Context.instance().addFlavorChangeListener(
314
+ ComputedStyleWidget, this.evaluateTrackingComputedStyleUpdatesForNode, this);
315
+
316
+ this.stylesWidget = new StylesSidebarPane(this.#computedStyleModel);
317
+ this.computedStyleWidget = new ComputedStyleWidget(this.#computedStyleModel);
318
+ this.metricsWidget = new MetricsSidebarPane(this.#computedStyleModel);
306
319
 
307
320
  Common.Settings.Settings.instance()
308
321
  .moduleSetting('sidebar-position')
@@ -343,6 +356,23 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
343
356
  }
344
357
  }
345
358
 
359
+ // This is a debounced method because the user might be navigated from Styles tab to Computed Style tab and vice versa.
360
+ // For that case, we want to only run this function once.
361
+ private evaluateTrackingComputedStyleUpdatesForNode = Common.Debouncer.debounce((): void => {
362
+ const selectedNode = UI.Context.Context.instance().flavor(SDK.DOMModel.DOMNode);
363
+ if (!selectedNode) {
364
+ return;
365
+ }
366
+
367
+ const isComputedStyleWidgetVisible = Boolean(UI.Context.Context.instance().flavor(ComputedStyleWidget));
368
+ const isStylesTabVisible = Boolean(UI.Context.Context.instance().flavor(StylesSidebarPane));
369
+ const shouldTrackComputedStyleUpdates = isComputedStyleWidgetVisible ||
370
+ (isStylesTabVisible && Root.Runtime.hostConfig.devToolsAnimationStylesInStylesTab?.enabled);
371
+
372
+ void selectedNode.domModel()?.cssModel()?.trackComputedStyleUpdatesForNode(
373
+ shouldTrackComputedStyleUpdates ? selectedNode.id : undefined);
374
+ }, 100);
375
+
346
376
  private handleElementExpanded(): void {
347
377
  if (Annotations.AnnotationRepository.annotationsEnabled()) {
348
378
  void PanelCommon.AnnotationManager.instance().resolveAnnotationsOfType(Annotations.AnnotationType.ELEMENT_NODE);
@@ -21,7 +21,7 @@ export class ElementsSidebarPane extends UI.Widget.VBox {
21
21
  }
22
22
 
23
23
  node(): SDK.DOMModel.DOMNode|null {
24
- return this.computedStyleModelInternal.node();
24
+ return this.computedStyleModelInternal.node;
25
25
  }
26
26
 
27
27
  cssModel(): SDK.CSSModel.CSSModel|null {
@@ -606,7 +606,7 @@ export class ElementsTreeOutline extends
606
606
  return html`
607
607
  <div class="squiggles-content-item">
608
608
  <devtools-icon .name=${issueKindIconName} @click=${openIssueEvent}></devtools-icon>
609
- <x-link class="link" @click=${openIssueEvent}>${i18nString(UIStrings.viewIssue)}</x-link>
609
+ <devtools-link class="link" @click=${openIssueEvent}>${i18nString(UIStrings.viewIssue)}</devtools-link>
610
610
  <span>${elementIssueDetails.tooltip}</span>
611
611
  </div>`;})}
612
612
  </div>`, popover.contentElement);
@@ -93,7 +93,7 @@ export class PlatformFontsWidget extends UI.Widget.VBox {
93
93
 
94
94
  override async performUpdate(): Promise<void> {
95
95
  const cssModel = this.sharedModel.cssModel();
96
- const node = this.sharedModel.node();
96
+ const node = this.sharedModel.node;
97
97
  if (!node || !cssModel) {
98
98
  this.#view({platformFonts: null}, {}, this.contentElement);
99
99
  return;
@@ -128,6 +128,7 @@ export class StylePropertiesSection {
128
128
  readonly matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles;
129
129
  private computedStyles: Map<string, string>|null;
130
130
  private parentsComputedStyles: Map<string, string>|null;
131
+ private computedStyleExtraFields: Protocol.CSS.ComputedStyleExtraFields|null;
131
132
  editable: boolean;
132
133
  private hoverTimer: number|null = null;
133
134
  private willCauseCancelEditing = false;
@@ -168,7 +169,8 @@ export class StylePropertiesSection {
168
169
  constructor(
169
170
  parentPane: StylesSidebarPane, matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles,
170
171
  style: SDK.CSSStyleDeclaration.CSSStyleDeclaration, sectionIdx: number, computedStyles: Map<string, string>|null,
171
- parentsComputedStyles: Map<string, string>|null, customHeaderText?: string) {
172
+ parentsComputedStyles: Map<string, string>|null,
173
+ computedStyleExtraFields: Protocol.CSS.ComputedStyleExtraFields|null, customHeaderText?: string) {
172
174
  this.#customHeaderText = customHeaderText;
173
175
  this.parentPane = parentPane;
174
176
  this.sectionIdx = sectionIdx;
@@ -176,6 +178,7 @@ export class StylePropertiesSection {
176
178
  this.matchedStyles = matchedStyles;
177
179
  this.computedStyles = computedStyles;
178
180
  this.parentsComputedStyles = parentsComputedStyles;
181
+ this.computedStyleExtraFields = computedStyleExtraFields;
179
182
  this.editable = Boolean(style.styleSheetId && style.range);
180
183
  this.originalPropertiesCount = style.leadingProperties().length;
181
184
  this.customPopulateCallback = () => this.populateStyle(this.styleInternal, this.propertiesTreeOutline);
@@ -257,7 +260,7 @@ export class StylePropertiesSection {
257
260
  UI.ARIAUtils.setHidden(this.newStyleRuleToolbar, true);
258
261
  }
259
262
 
260
- if (Root.Runtime.experiments.isEnabled('font-editor') && this.editable) {
263
+ if (Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.FONT_EDITOR) && this.editable) {
261
264
  this.fontEditorToolbar = this.#styleRuleElement.createChild('devtools-toolbar', 'sidebar-pane-section-toolbar');
262
265
  this.fontEditorSectionManager = new FontEditorSectionManager(this.parentPane.swatchPopoverHelper(), this);
263
266
  this.fontEditorButton =
@@ -330,6 +333,10 @@ export class StylePropertiesSection {
330
333
  this.parentsComputedStyles = parentsComputedStyles;
331
334
  }
332
335
 
336
+ setComputedStyleExtraFields(computedStyleExtraFields: Protocol.CSS.ComputedStyleExtraFields|null): void {
337
+ this.computedStyleExtraFields = computedStyleExtraFields;
338
+ }
339
+
333
340
  updateAuthoringHint(): void {
334
341
  let child = this.propertiesTreeOutline.firstChild();
335
342
  while (child) {
@@ -1165,6 +1172,7 @@ export class StylePropertiesSection {
1165
1172
  });
1166
1173
  item.setComputedStyles(this.computedStyles);
1167
1174
  item.setParentsComputedStyles(this.parentsComputedStyles);
1175
+ item.setComputedStyleExtraFields(this.computedStyleExtraFields);
1168
1176
  parent.appendChild(item);
1169
1177
  }
1170
1178
 
@@ -1677,7 +1685,7 @@ export class BlankStylePropertiesSection extends StylePropertiesSection {
1677
1685
  insertAfterStyle: SDK.CSSStyleDeclaration.CSSStyleDeclaration, sectionIdx: number) {
1678
1686
  const cssModel = (stylesPane.cssModel() as SDK.CSSModel.CSSModel);
1679
1687
  const rule = SDK.CSSRule.CSSStyleRule.createDummyRule(cssModel, defaultSelectorText);
1680
- super(stylesPane, matchedStyles, rule.style, sectionIdx, null, null);
1688
+ super(stylesPane, matchedStyles, rule.style, sectionIdx, null, null, null);
1681
1689
  this.normal = false;
1682
1690
  this.ruleLocation = ruleLocation;
1683
1691
  this.styleSheetHeader = styleSheetHeader;
@@ -1779,7 +1787,7 @@ export class RegisteredPropertiesSection extends StylePropertiesSection {
1779
1787
  stylesPane: StylesSidebarPane, matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles,
1780
1788
  style: SDK.CSSStyleDeclaration.CSSStyleDeclaration, sectionIdx: number, propertyName: string,
1781
1789
  expandedByDefault: boolean) {
1782
- super(stylesPane, matchedStyles, style, sectionIdx, null, null, propertyName);
1790
+ super(stylesPane, matchedStyles, style, sectionIdx, null, null, null, propertyName);
1783
1791
  if (!expandedByDefault) {
1784
1792
  this.element.classList.add('hidden');
1785
1793
  }
@@ -1814,7 +1822,7 @@ export class FunctionRuleSection extends StylePropertiesSection {
1814
1822
  stylesPane: StylesSidebarPane, matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles,
1815
1823
  style: SDK.CSSStyleDeclaration.CSSStyleDeclaration, children: SDK.CSSRule.CSSNestedStyle[], sectionIdx: number,
1816
1824
  functionName: string, expandedByDefault: boolean) {
1817
- super(stylesPane, matchedStyles, style, sectionIdx, null, null, functionName);
1825
+ super(stylesPane, matchedStyles, style, sectionIdx, null, null, null, functionName);
1818
1826
  if (!expandedByDefault) {
1819
1827
  this.element.classList.add('hidden');
1820
1828
  }
@@ -1876,7 +1884,7 @@ export class AtRuleSection extends StylePropertiesSection {
1876
1884
  constructor(
1877
1885
  stylesPane: StylesSidebarPane, matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles,
1878
1886
  style: SDK.CSSStyleDeclaration.CSSStyleDeclaration, sectionIdx: number, expandedByDefault: boolean) {
1879
- super(stylesPane, matchedStyles, style, sectionIdx, null, null);
1887
+ super(stylesPane, matchedStyles, style, sectionIdx, null, null, null);
1880
1888
  this.selectorElement.className = 'font-palette-values-key';
1881
1889
  if (!expandedByDefault) {
1882
1890
  this.element.classList.add('hidden');
@@ -1888,7 +1896,7 @@ export class PositionTryRuleSection extends StylePropertiesSection {
1888
1896
  constructor(
1889
1897
  stylesPane: StylesSidebarPane, matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles,
1890
1898
  style: SDK.CSSStyleDeclaration.CSSStyleDeclaration, sectionIdx: number, active: boolean) {
1891
- super(stylesPane, matchedStyles, style, sectionIdx, null, null);
1899
+ super(stylesPane, matchedStyles, style, sectionIdx, null, null, null);
1892
1900
  this.selectorElement.className = 'position-try-values-key';
1893
1901
  this.propertiesTreeOutline.element.classList.toggle('no-affect', !active);
1894
1902
  }
@@ -1898,7 +1906,7 @@ export class KeyframePropertiesSection extends StylePropertiesSection {
1898
1906
  constructor(
1899
1907
  stylesPane: StylesSidebarPane, matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles,
1900
1908
  style: SDK.CSSStyleDeclaration.CSSStyleDeclaration, sectionIdx: number) {
1901
- super(stylesPane, matchedStyles, style, sectionIdx, null, null);
1909
+ super(stylesPane, matchedStyles, style, sectionIdx, null, null, null);
1902
1910
  this.selectorElement.className = 'keyframe-key';
1903
1911
  }
1904
1912