chrome-devtools-frontend 1.0.1515796 → 1.0.1516909

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 (163) hide show
  1. package/docs/contributing/infrastructure.md +131 -82
  2. package/front_end/Tests.js +3 -29
  3. package/front_end/core/common/Progress.ts +73 -55
  4. package/front_end/core/host/GdpClient.ts +1 -1
  5. package/front_end/core/host/UserMetrics.ts +5 -2
  6. package/front_end/core/protocol_client/InspectorBackend.ts +2 -0
  7. package/front_end/core/root/Runtime.ts +0 -1
  8. package/front_end/core/sdk/CSSMatchedStyles.ts +12 -10
  9. package/front_end/core/sdk/CSSModel.ts +1 -31
  10. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +27 -7
  11. package/front_end/core/sdk/DebuggerModel.ts +1 -31
  12. package/front_end/core/sdk/EnhancedTracesParser.ts +81 -50
  13. package/front_end/core/sdk/NetworkManager.ts +1 -31
  14. package/front_end/core/sdk/NetworkRequest.ts +1 -31
  15. package/front_end/core/sdk/RehydratingConnection.snapshot.txt +1003 -0
  16. package/front_end/core/sdk/RehydratingConnection.ts +13 -18
  17. package/front_end/core/sdk/RehydratingObject.ts +8 -31
  18. package/front_end/core/sdk/RemoteObject.ts +1 -31
  19. package/front_end/core/sdk/ResourceTreeModel.ts +1 -31
  20. package/front_end/core/sdk/RuntimeModel.ts +1 -31
  21. package/front_end/core/sdk/ServiceWorkerManager.ts +1 -31
  22. package/front_end/core/sdk/SourceMap.ts +1 -31
  23. package/front_end/core/sdk/TraceObject.ts +8 -3
  24. package/front_end/entrypoints/main/MainImpl.ts +1 -3
  25. package/front_end/models/ai_assistance/AiHistoryStorage.ts +1 -3
  26. package/front_end/models/ai_assistance/ConversationHandler.ts +4 -6
  27. package/front_end/models/ai_assistance/agents/AiAgent.ts +4 -1
  28. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +110 -76
  29. package/front_end/models/ai_assistance/agents/PerformanceAnnotationsAgent.ts +2 -2
  30. package/front_end/models/ai_assistance/agents/StylingAgent.ts +2 -2
  31. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +178 -85
  32. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +308 -218
  33. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +100 -100
  34. package/front_end/models/ai_assistance/data_formatters/UnitFormatters.ts +10 -1
  35. package/front_end/models/ai_assistance/performance/AIContext.ts +19 -21
  36. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +24 -8
  37. package/front_end/models/badges/UserBadges.ts +38 -3
  38. package/front_end/models/bindings/ContentProviderBasedProject.ts +6 -4
  39. package/front_end/models/breakpoints/BreakpointManager.ts +3 -3
  40. package/front_end/models/formatter/FormatterWorkerPool.ts +3 -3
  41. package/front_end/models/har/Writer.ts +11 -11
  42. package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +3 -3
  43. package/front_end/models/persistence/IsolatedFileSystem.ts +4 -4
  44. package/front_end/models/persistence/IsolatedFileSystemManager.ts +7 -7
  45. package/front_end/models/persistence/PersistenceImpl.ts +8 -8
  46. package/front_end/models/persistence/PlatformFileSystem.ts +1 -1
  47. package/front_end/models/trace/ModelImpl.ts +2 -16
  48. package/front_end/models/trace/Processor.ts +15 -9
  49. package/front_end/models/trace/handlers/AuctionWorkletsHandler.ts +4 -4
  50. package/front_end/models/trace/handlers/FramesHandler.ts +2 -2
  51. package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +7 -10
  52. package/front_end/models/trace/handlers/MetaHandler.ts +11 -9
  53. package/front_end/models/trace/handlers/ScreenshotsHandler.ts +1 -1
  54. package/front_end/models/trace/handlers/ScriptsHandler.ts +5 -5
  55. package/front_end/models/trace/handlers/UserInteractionsHandler.ts +2 -14
  56. package/front_end/models/trace/handlers/UserTimingsHandler.ts +3 -4
  57. package/front_end/models/trace/insights/CLSCulprits.ts +1 -1
  58. package/front_end/models/trace/insights/DocumentLatency.ts +3 -4
  59. package/front_end/models/trace/insights/DuplicatedJavaScript.ts +1 -1
  60. package/front_end/models/trace/insights/INPBreakdown.ts +1 -1
  61. package/front_end/models/trace/insights/ImageDelivery.ts +1 -1
  62. package/front_end/models/trace/insights/LCPBreakdown.ts +1 -1
  63. package/front_end/models/trace/insights/LCPDiscovery.ts +1 -1
  64. package/front_end/models/trace/insights/ModernHTTP.ts +1 -1
  65. package/front_end/models/trace/insights/NetworkDependencyTree.ts +1 -1
  66. package/front_end/models/trace/insights/RenderBlocking.ts +1 -1
  67. package/front_end/models/trace/insights/types.ts +2 -0
  68. package/front_end/models/trace/types/TraceEvents.ts +41 -64
  69. package/front_end/models/trace_source_maps_resolver/trace_source_maps_resolver.ts +1 -1
  70. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +21 -99
  71. package/front_end/panels/application/ServiceWorkersView.ts +0 -1
  72. package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +2 -3
  73. package/front_end/panels/common/BadgeNotification.ts +46 -10
  74. package/front_end/panels/common/GdpSignUpDialog.ts +6 -3
  75. package/front_end/panels/console/ConsoleView.ts +23 -28
  76. package/front_end/panels/console/ConsoleViewport.ts +2 -2
  77. package/front_end/panels/console/consoleView.css +11 -1
  78. package/front_end/panels/coverage/CoverageView.ts +2 -2
  79. package/front_end/panels/elements/ComputedStyleWidget.ts +1 -2
  80. package/front_end/panels/elements/ElementsTreeOutline.ts +2 -2
  81. package/front_end/panels/elements/LayoutPane.ts +1 -1
  82. package/front_end/panels/elements/StyleEditorWidget.ts +8 -19
  83. package/front_end/panels/elements/StylePropertyTreeElement.ts +39 -25
  84. package/front_end/panels/elements/StylesSidebarPane.ts +2 -2
  85. package/front_end/panels/elements/stylePropertiesTreeOutline.css +4 -3
  86. package/front_end/panels/layer_viewer/Layers3DView.ts +2 -2
  87. package/front_end/panels/layers/LayerTreeModel.ts +3 -3
  88. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +4 -4
  89. package/front_end/panels/network/NetworkLogView.ts +6 -2
  90. package/front_end/panels/network/NetworkLogViewColumns.ts +3 -3
  91. package/front_end/panels/network/NetworkSearchScope.ts +6 -6
  92. package/front_end/panels/search/SearchResultsPane.ts +32 -47
  93. package/front_end/panels/search/SearchView.ts +58 -80
  94. package/front_end/panels/settings/components/SyncSection.ts +7 -2
  95. package/front_end/panels/sources/OutlineQuickOpen.ts +3 -1
  96. package/front_end/panels/sources/SourcesSearchScope.ts +4 -4
  97. package/front_end/panels/sources/TabbedEditorContainer.ts +5 -5
  98. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +10 -5
  99. package/front_end/panels/timeline/TimelineFlameChartView.ts +18 -15
  100. package/front_end/panels/timeline/TimelinePanel.ts +41 -22
  101. package/front_end/panels/timeline/TimelineUIUtils.ts +13 -8
  102. package/front_end/panels/timeline/TracingLayerTree.ts +4 -5
  103. package/front_end/panels/timeline/components/ExportTraceOptions.ts +37 -22
  104. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +17 -7
  105. package/front_end/third_party/axe-core/README.chromium +1 -0
  106. package/front_end/third_party/codemirror/README.chromium +1 -0
  107. package/front_end/third_party/codemirror.next/README.chromium +1 -0
  108. package/front_end/third_party/csp_evaluator/README.chromium +1 -0
  109. package/front_end/third_party/diff/README.chromium +1 -0
  110. package/front_end/third_party/i18n/README.chromium +1 -0
  111. package/front_end/third_party/intl-messageformat/README.chromium +1 -0
  112. package/front_end/third_party/json5/README.chromium +1 -0
  113. package/front_end/third_party/legacy-javascript/README.chromium +1 -0
  114. package/front_end/third_party/lighthouse/README.chromium +1 -0
  115. package/front_end/third_party/lit/README.chromium +1 -0
  116. package/front_end/third_party/marked/README.chromium +1 -0
  117. package/front_end/third_party/puppeteer/README.chromium +2 -2
  118. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Realm.d.ts +2 -2
  119. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js +0 -20
  120. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js.map +1 -1
  121. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.d.ts +1 -1
  122. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.js +1 -1
  123. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  124. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +1 -1
  125. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +1 -1
  126. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  127. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  128. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +2 -23
  129. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js +0 -20
  130. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js.map +1 -1
  131. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.d.ts +1 -1
  132. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.js +1 -1
  133. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +1 -1
  134. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +1 -1
  135. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  136. package/front_end/third_party/puppeteer/package/package.json +1 -1
  137. package/front_end/third_party/puppeteer/package/src/cdp/Accessibility.ts +1 -21
  138. package/front_end/third_party/puppeteer/package/src/generated/version.ts +1 -1
  139. package/front_end/third_party/puppeteer/package/src/revisions.ts +1 -1
  140. package/front_end/third_party/puppeteer-replay/README.chromium +1 -0
  141. package/front_end/third_party/third-party-web/README.chromium +1 -0
  142. package/front_end/third_party/vscode.web-custom-data/README.chromium +1 -0
  143. package/front_end/third_party/wasmparser/README.chromium +1 -0
  144. package/front_end/third_party/web-vitals/README.chromium +1 -0
  145. package/front_end/ui/components/text_editor/config.ts +30 -1
  146. package/front_end/ui/components/tooltips/Tooltip.ts +18 -4
  147. package/front_end/ui/legacy/ContextMenu.ts +2 -2
  148. package/front_end/ui/legacy/GlassPane.ts +7 -3
  149. package/front_end/ui/legacy/ProgressIndicator.ts +29 -16
  150. package/front_end/ui/legacy/TabbedPane.ts +2 -2
  151. package/front_end/ui/legacy/Treeoutline.ts +10 -5
  152. package/front_end/ui/legacy/UIUtils.ts +42 -10
  153. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +14 -14
  154. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +6 -6
  155. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +3 -29
  156. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +14 -14
  157. package/front_end/ui/visual_logging/KnownContextValues.ts +7 -0
  158. package/inspector_overlay/highlight_common.ts +1 -27
  159. package/inspector_overlay/highlight_grid_common.ts +1 -27
  160. package/inspector_overlay/tool_highlight.ts +1 -27
  161. package/inspector_overlay/tool_persistent.ts +1 -27
  162. package/inspector_overlay/tool_source_order.ts +1 -27
  163. package/package.json +1 -1
@@ -205,7 +205,6 @@ class ColorRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.ColorMatc
205
205
  swatch.renderColor(color);
206
206
  const valueElement = document.createElement('span');
207
207
  valueElement.textContent = match.text;
208
- swatch.append(valueElement);
209
208
 
210
209
  swatch.addEventListener(
211
210
  InlineEditor.ColorSwatch.ColorChangedEvent.eventName, (event: InlineEditor.ColorSwatch.ColorChangedEvent) => {
@@ -214,7 +213,7 @@ class ColorRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.ColorMatc
214
213
  });
215
214
 
216
215
  context.addControl('color', swatch);
217
- return [swatch];
216
+ return [swatch, valueElement];
218
217
  }
219
218
 
220
219
  matcher(): SDK.CSSPropertyParserMatchers.ColorMatcher {
@@ -1830,7 +1830,7 @@ export class ElementsTreeOutline extends
1830
1830
 
1831
1831
  console.assert(!treeElement.isClosingTag());
1832
1832
 
1833
- this.innerUpdateChildren(treeElement);
1833
+ this.#updateChildren(treeElement);
1834
1834
  }
1835
1835
 
1836
1836
  insertChildElement(
@@ -1858,7 +1858,7 @@ export class ElementsTreeOutline extends
1858
1858
  }
1859
1859
  }
1860
1860
 
1861
- private innerUpdateChildren(treeElement: ElementsTreeElement): void {
1861
+ #updateChildren(treeElement: ElementsTreeElement): void {
1862
1862
  if (this.treeElementsBeingUpdated.has(treeElement)) {
1863
1863
  return;
1864
1864
  }
@@ -284,7 +284,7 @@ const DEFAULT_VIEW: View = (input, output, target) => {
284
284
  render(html`
285
285
  <div style="min-width: min-content;" jslog=${VisualLogging.pane('layout').track({resize: true})}>
286
286
  <style>${layoutPaneStyles}</style>
287
- <style>${UI.inspectorCommonStyles}</style>
287
+ <style>@scope to (devtools-widget > *) { ${UI.inspectorCommonStyles} }</style>
288
288
  <details open>
289
289
  <summary class="header"
290
290
  @keydown=${input.onSummaryKeyDown}
@@ -3,7 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
  /* eslint-disable rulesdir/no-imperative-dom-api */
5
5
 
6
- import * as Buttons from '../../ui/components/buttons/buttons.js';
6
+ import * as IconButton from '../../ui/components/icon_button/icon_button.js';
7
7
  import * as UI from '../../ui/legacy/legacy.js';
8
8
 
9
9
  import type * as ElementsComponents from './components/components.js';
@@ -120,7 +120,9 @@ export class StyleEditorWidget extends UI.Widget.VBox {
120
120
  static createTriggerButton(
121
121
  pane: StylesSidebarPane, section: StylePropertiesSection, editorClass: {new(): Editor}, buttonTitle: string,
122
122
  triggerKey: string): HTMLElement {
123
- const triggerButton = createButton(buttonTitle);
123
+ const triggerButton = IconButton.Icon.create('flex-wrap', 'styles-pane-button');
124
+ triggerButton.title = buttonTitle;
125
+ triggerButton.role = 'button';
124
126
 
125
127
  triggerButton.onclick = async event => {
126
128
  event.stopPropagation();
@@ -146,28 +148,15 @@ export class StyleEditorWidget extends UI.Widget.VBox {
146
148
  scrollerElement.addEventListener('scroll', onScroll);
147
149
  }
148
150
  };
151
+ triggerButton.onmouseup = event => {
152
+ // Stop propagation to prevent the property editor from being activated.
153
+ event.stopPropagation();
154
+ };
149
155
 
150
156
  return triggerButton;
151
157
  }
152
158
  }
153
159
 
154
- function createButton(buttonTitle: string): Buttons.Button.Button {
155
- const button = new Buttons.Button.Button();
156
- button.data = {
157
- variant: Buttons.Button.Variant.ICON,
158
- size: Buttons.Button.Size.SMALL,
159
- iconName: 'flex-wrap',
160
- title: buttonTitle,
161
- jslogContext: 'flex-wrap',
162
- };
163
- button.classList.add('styles-pane-button');
164
- button.onmouseup = event => {
165
- // Stop propagation to prevent the property editor from being activated.
166
- event.stopPropagation();
167
- };
168
- return button;
169
- }
170
-
171
160
  function ensureTreeElementForProperty(section: StylePropertiesSection, propertyName: string): StylePropertyTreeElement {
172
161
  const target = section.propertiesTreeOutline.rootElement().children().find(
173
162
  child => child instanceof StylePropertyTreeElement && child.property.name === propertyName);
@@ -1046,13 +1046,6 @@ export class LinkableNameRenderer extends rendererBase(SDK.CSSPropertyParserMatc
1046
1046
  ruleBlock: '@position-try',
1047
1047
  isDefined: Boolean(this.#matchedStyles.positionTryRules().find(pt => pt.name().text === match.text)),
1048
1048
  };
1049
- case SDK.CSSPropertyParserMatchers.LinkableNameProperties.FUNCTION:
1050
- return {
1051
- jslogContext: 'css-function',
1052
- metric: null,
1053
- ruleBlock: '@function',
1054
- isDefined: Boolean(this.#matchedStyles.getRegisteredFunction(match.text)),
1055
- };
1056
1049
  }
1057
1050
  }
1058
1051
 
@@ -1065,15 +1058,7 @@ export class LinkableNameRenderer extends rendererBase(SDK.CSSPropertyParserMatc
1065
1058
  isDefined,
1066
1059
  onLinkActivate: (): void => {
1067
1060
  metric && Host.userMetrics.swatchActivated(metric);
1068
- if (match.propertyName === SDK.CSSPropertyParserMatchers.LinkableNameProperties.FUNCTION) {
1069
- const functionName = this.#matchedStyles.getRegisteredFunction(match.text);
1070
- if (!functionName) {
1071
- return;
1072
- }
1073
- this.#stylesPane.jumpToFunctionDefinition(functionName);
1074
- } else {
1075
- this.#stylesPane.jumpToSectionBlock(`${ruleBlock} ${match.text}`);
1076
- }
1061
+ this.#stylesPane.jumpToSectionBlock(`${ruleBlock} ${match.text}`);
1077
1062
  },
1078
1063
  jslogContext,
1079
1064
  };
@@ -1609,7 +1594,7 @@ export class LengthRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.L
1609
1594
  }
1610
1595
 
1611
1596
  // clang-format off
1612
- export class MathFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.MathFunctionMatch) {
1597
+ export class BaseFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.BaseFunctionMatch) {
1613
1598
  // clang-format on
1614
1599
  readonly #stylesPane: StylesSidebarPane;
1615
1600
  readonly #matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles;
@@ -1627,7 +1612,7 @@ export class MathFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatc
1627
1612
  this.#propertyName = propertyName;
1628
1613
  }
1629
1614
 
1630
- override render(match: SDK.CSSPropertyParserMatchers.MathFunctionMatch, context: RenderingContext): Node[] {
1615
+ override render(match: SDK.CSSPropertyParserMatchers.BaseFunctionMatch<string>, context: RenderingContext): Node[] {
1631
1616
  const childTracingContexts = context.tracing?.evaluation(match.args, {match, context});
1632
1617
  const renderedArgs = match.args.map((arg, idx) => {
1633
1618
  const span = document.createElement('span');
@@ -1651,7 +1636,7 @@ export class MathFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatc
1651
1636
  if (evaluation) {
1652
1637
  return evaluation;
1653
1638
  }
1654
- } else if (!match.isArithmeticFunctionCall()) {
1639
+ } else if (match instanceof SDK.CSSPropertyParserMatchers.MathFunctionMatch && !match.isArithmeticFunctionCall()) {
1655
1640
  void this.applyMathFunction(renderedArgs, match, context);
1656
1641
  }
1657
1642
 
@@ -1659,7 +1644,7 @@ export class MathFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatc
1659
1644
  }
1660
1645
 
1661
1646
  async applyEvaluation(
1662
- span: HTMLSpanElement, match: SDK.CSSPropertyParserMatchers.MathFunctionMatch,
1647
+ span: HTMLSpanElement, match: SDK.CSSPropertyParserMatchers.BaseFunctionMatch<string>,
1663
1648
  context: RenderingContext): Promise<boolean> {
1664
1649
  const value = context.matchedResult.getComputedText(match.node, match => {
1665
1650
  if (match instanceof SDK.CSSPropertyParserMatchers.RelativeColorChannelMatch) {
@@ -1678,7 +1663,7 @@ export class MathFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatc
1678
1663
  }
1679
1664
 
1680
1665
  async applyMathFunction(
1681
- renderedArgs: HTMLElement[], match: SDK.CSSPropertyParserMatchers.MathFunctionMatch,
1666
+ renderedArgs: HTMLElement[], match: SDK.CSSPropertyParserMatchers.BaseFunctionMatch<string>,
1682
1667
  context: RenderingContext): Promise<void> {
1683
1668
  // To understand which argument was selected by the function, we evaluate the function as well as all the arguments
1684
1669
  // and compare the function result to the values of all its arguments. Evaluating the arguments eliminates nested
@@ -1701,6 +1686,14 @@ export class MathFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatc
1701
1686
  }
1702
1687
  }
1703
1688
 
1689
+ export class MathFunctionRenderer extends BaseFunctionRenderer {
1690
+ override readonly matchType = SDK.CSSPropertyParserMatchers.MathFunctionMatch;
1691
+ }
1692
+
1693
+ export class CustomFunctionRenderer extends BaseFunctionRenderer {
1694
+ override readonly matchType = SDK.CSSPropertyParserMatchers.CustomFunctionMatch;
1695
+ }
1696
+
1704
1697
  // clang-format off
1705
1698
  export class AnchorFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.AnchorFunctionMatch) {
1706
1699
  // clang-format on
@@ -1871,6 +1864,7 @@ export function getPropertyRenderers(
1871
1864
  new PositionTryRenderer(matchedStyles),
1872
1865
  new LengthRenderer(stylesPane, propertyName, treeElement),
1873
1866
  new MathFunctionRenderer(stylesPane, matchedStyles, computedStyles, propertyName, treeElement),
1867
+ new CustomFunctionRenderer(stylesPane, matchedStyles, computedStyles, propertyName, treeElement),
1874
1868
  new AutoBaseRenderer(computedStyles),
1875
1869
  new BinOpRenderer(),
1876
1870
  new RelativeColorChannelRenderer(treeElement),
@@ -2264,15 +2258,15 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
2264
2258
  return;
2265
2259
  }
2266
2260
  this.lastComputedValue = computedValue;
2267
- this.innerUpdateTitle();
2261
+ this.#updateTitle();
2268
2262
  }
2269
2263
 
2270
2264
  updateTitle(): void {
2271
2265
  this.lastComputedValue = this.#computeCSSExpression(this.property.ownerStyle, this.property.value);
2272
- this.innerUpdateTitle();
2266
+ this.#updateTitle();
2273
2267
  }
2274
2268
 
2275
- private innerUpdateTitle(): void {
2269
+ #updateTitle(): void {
2276
2270
  this.#tooltipKeyCounts.clear();
2277
2271
  this.updateState();
2278
2272
  if (this.isExpandable()) {
@@ -2460,6 +2454,26 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
2460
2454
  return container;
2461
2455
  }
2462
2456
 
2457
+ #getLinkableFunction(functionName: string, matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles):
2458
+ InlineEditor.LinkSwatch.LinkSwatch {
2459
+ const swatch = new InlineEditor.LinkSwatch.LinkSwatch();
2460
+ const registeredFunction = matchedStyles.getRegisteredFunction(functionName);
2461
+ const isDefined = Boolean(registeredFunction);
2462
+ swatch.data = {
2463
+ jslogContext: 'css-function',
2464
+ text: functionName,
2465
+ tooltip: isDefined ? undefined : {title: i18nString(UIStrings.sIsNotDefined, {PH1: functionName})},
2466
+ isDefined,
2467
+ onLinkActivate: (): void => {
2468
+ if (!registeredFunction) {
2469
+ return;
2470
+ }
2471
+ this.#parentPane.jumpToFunctionDefinition(registeredFunction);
2472
+ },
2473
+ };
2474
+ return swatch;
2475
+ }
2476
+
2463
2477
  getTracingTooltip(
2464
2478
  functionName: string, node: CodeMirror.SyntaxNode, matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles,
2465
2479
  computedStyles: Map<string, string>, context: RenderingContext): Lit.TemplateResult {
@@ -2474,7 +2488,7 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
2474
2488
  const tooltipId = this.getTooltipId(`${functionName}-trace`);
2475
2489
  // clang-format off
2476
2490
  return html`
2477
- <span tabIndex=-1 class=tracing-anchor aria-details=${tooltipId}>${functionName}</span>
2491
+ <span tabIndex=-1 class=tracing-anchor aria-details=${tooltipId}>${functionName.startsWith('--') ? this.#getLinkableFunction(functionName, matchedStyles) : functionName}</span>
2478
2492
  <devtools-tooltip
2479
2493
  id=${tooltipId}
2480
2494
  use-hotkey
@@ -623,10 +623,10 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
623
623
  }
624
624
 
625
625
  override onResize(): void {
626
- void this.resizeThrottler.schedule(this.innerResize.bind(this));
626
+ void this.resizeThrottler.schedule(this.#resize.bind(this));
627
627
  }
628
628
 
629
- private innerResize(): Promise<void> {
629
+ #resize(): Promise<void> {
630
630
  const width = this.contentElement.getBoundingClientRect().width + 'px';
631
631
  this.allSections().forEach(section => {
632
632
  section.propertiesTreeOutline.element.style.width = width;
@@ -220,13 +220,14 @@ devtools-icon.icon-link {
220
220
  }
221
221
 
222
222
  .styles-pane-button {
223
- height: 15px;
224
- margin: 0 0 0 6px;
223
+ width: var(--sys-size-8);
224
+ height: var(--sys-size-8);
225
+ margin-left: var(--sys-size-4);
225
226
  position: absolute;
226
- top: -1px;
227
227
  display: inline-flex;
228
228
  align-items: center;
229
229
  justify-content: center;
230
+ user-select: none;
230
231
  }
231
232
  /* Matched styles */
232
233
 
@@ -735,12 +735,12 @@ export class Layers3DView extends Common.ObjectWrapper.eventMixin<EventTypes, ty
735
735
  this.updateScheduled = true;
736
736
  requestAnimationFrame(() => requestAnimationFrame(() => {
737
737
  this.updateScheduled = false;
738
- this.innerUpdate();
738
+ this.#update();
739
739
  }));
740
740
  }
741
741
  }
742
742
 
743
- private innerUpdate(): void {
743
+ #update(): void {
744
744
  if (!this.layerTree?.root()) {
745
745
  this.failBanner.show(this.contentElement);
746
746
  return;
@@ -138,7 +138,7 @@ export class AgentLayerTree extends SDK.LayerTreeBase.LayerTreeBase {
138
138
 
139
139
  async setLayers(payload: Protocol.LayerTree.Layer[]|null): Promise<void> {
140
140
  if (!payload) {
141
- this.innerSetLayers(payload);
141
+ this.#setLayers(payload);
142
142
  return;
143
143
  }
144
144
  const idsToResolve = new Set<Protocol.DOM.BackendNodeId>();
@@ -150,10 +150,10 @@ export class AgentLayerTree extends SDK.LayerTreeBase.LayerTreeBase {
150
150
  idsToResolve.add(backendNodeId);
151
151
  }
152
152
  await this.resolveBackendNodeIds(idsToResolve);
153
- this.innerSetLayers(payload);
153
+ this.#setLayers(payload);
154
154
  }
155
155
 
156
- private innerSetLayers(layers: Protocol.LayerTree.Layer[]|null): void {
156
+ #setLayers(layers: Protocol.LayerTree.Layer[]|null): void {
157
157
  this.setRoot(null);
158
158
  this.setContentRoot(null);
159
159
  // Payload will be null when not in the composited mode.
@@ -400,8 +400,8 @@ export class CPUThrottlingCard {
400
400
  }
401
401
 
402
402
  private async runCalibration(): Promise<void> {
403
- this.progress.setWorked(0);
404
- this.progress.setTotalWork(1);
403
+ this.progress.worked = 0;
404
+ this.progress.totalWork = 1;
405
405
 
406
406
  this.controller = new CalibrationController();
407
407
 
@@ -412,7 +412,7 @@ export class CPUThrottlingCard {
412
412
  }
413
413
 
414
414
  for await (const result of this.controller.iterator()) {
415
- this.progress.setWorked(result.progress);
415
+ this.progress.worked = result.progress;
416
416
  }
417
417
  } catch (e) {
418
418
  console.error(e);
@@ -424,7 +424,7 @@ export class CPUThrottlingCard {
424
424
  if (result && (result.low || result.mid)) {
425
425
  this.setting.set(result);
426
426
  // Let the user bask in the glory of a 100% progress bar, for a bit.
427
- this.progress.setWorked(1);
427
+ this.progress.worked = 1;
428
428
  await new Promise(resolve => setTimeout(resolve, 200));
429
429
  }
430
430
 
@@ -1963,7 +1963,7 @@ export class NetworkLogView extends Common.ObjectWrapper.eventMixin<EventTypes,
1963
1963
 
1964
1964
  const progressIndicator = this.progressBarContainer.createChild('devtools-progress');
1965
1965
  await HAR.Writer.Writer.write(stream, this.harRequests(), options, progressIndicator);
1966
- progressIndicator.done();
1966
+ progressIndicator.done = true;
1967
1967
  void stream.close();
1968
1968
  }
1969
1969
 
@@ -2391,6 +2391,10 @@ export class NetworkLogView extends Common.ObjectWrapper.eventMixin<EventTypes,
2391
2391
  Lastly we replace new lines with ^ and TWO new lines because the first
2392
2392
  new line is there to enact the escape command the second is the character
2393
2393
  to escape (in this case new line).
2394
+
2395
+ All other whitespace characters are replaced with a single space, as there
2396
+ is no way to enter their literal values in a command line, and they do break
2397
+ the command allowing for injection.
2394
2398
  */
2395
2399
  const encapsChars = '^"';
2396
2400
  return encapsChars +
@@ -2398,7 +2402,7 @@ export class NetworkLogView extends Common.ObjectWrapper.eventMixin<EventTypes,
2398
2402
  .replace(/"/g, '\\"')
2399
2403
  .replace(/[^a-zA-Z0-9\s_\-:=+~'\/.',?;()*`]/g, '^$&')
2400
2404
  .replace(/%(?=[a-zA-Z0-9_])/g, '%^')
2401
- .replace(/[^\S \r\n]/g, '^$&')
2405
+ .replace(/[^\S \r\n]/g, ' ')
2402
2406
  .replace(/\r?\n|\r/g, '^\n\n') +
2403
2407
  encapsChars;
2404
2408
  }
@@ -279,7 +279,7 @@ export class NetworkLogViewColumns {
279
279
 
280
280
  this.updateColumns();
281
281
  this.#dataGrid.addEventListener(DataGrid.DataGrid.Events.SORTING_CHANGED, this.sortHandler, this);
282
- this.#dataGrid.setHeaderContextMenuCallback(this.innerHeaderContextMenu.bind(this));
282
+ this.#dataGrid.setHeaderContextMenuCallback(this.#headerContextMenu.bind(this));
283
283
 
284
284
  this.activeWaterfallSortId = WaterfallSortIds.StartTime;
285
285
  this.#dataGrid.markColumnAsSortedBy(INITIAL_SORT_COLUMN, DataGrid.DataGrid.Order.Ascending);
@@ -405,7 +405,7 @@ export class NetworkLogViewColumns {
405
405
  this.waterfallHeaderElement.addEventListener('click', waterfallHeaderClicked.bind(this));
406
406
  this.waterfallHeaderElement.addEventListener('contextmenu', event => {
407
407
  const contextMenu = new UI.ContextMenu.ContextMenu(event);
408
- this.innerHeaderContextMenu(contextMenu);
408
+ this.#headerContextMenu(contextMenu);
409
409
  void contextMenu.show();
410
410
  });
411
411
  this.waterfallHeaderElement.createChild('div', 'hover-layer');
@@ -627,7 +627,7 @@ export class NetworkLogViewColumns {
627
627
  return fragment;
628
628
  }
629
629
 
630
- private innerHeaderContextMenu(contextMenu: UI.ContextMenu.SubMenu): void {
630
+ #headerContextMenu(contextMenu: UI.ContextMenu.SubMenu): void {
631
631
  const columnConfigs = this.columns.filter(columnConfig => columnConfig.hideable);
632
632
  const nonRequestResponseHeaders =
633
633
  columnConfigs.filter(columnConfig => !columnConfig.isRequestHeader && !columnConfig.isResponseHeader);
@@ -29,7 +29,7 @@ export class NetworkSearchScope implements Search.SearchScope.SearchScope {
29
29
 
30
30
  performIndexing(progress: Common.Progress.Progress): void {
31
31
  queueMicrotask(() => {
32
- progress.done();
32
+ progress.done = true;
33
33
  });
34
34
  }
35
35
 
@@ -40,14 +40,14 @@ export class NetworkSearchScope implements Search.SearchScope.SearchScope {
40
40
  const promises = [];
41
41
  const requests =
42
42
  this.#networkLog.requests().filter(request => searchConfig.filePathMatchesFileQuery(request.url()));
43
- progress.setTotalWork(requests.length);
43
+ progress.totalWork = requests.length;
44
44
  for (const request of requests) {
45
45
  const promise = this.searchRequest(searchConfig, request, progress);
46
46
  promises.push(promise);
47
47
  }
48
48
  const resultsWithNull = await Promise.all(promises);
49
49
  const results = (resultsWithNull.filter(result => result !== null));
50
- if (progress.isCanceled()) {
50
+ if (progress.canceled) {
51
51
  searchFinishedCallback(false);
52
52
  return;
53
53
  }
@@ -56,7 +56,7 @@ export class NetworkSearchScope implements Search.SearchScope.SearchScope {
56
56
  searchResultCallback(result);
57
57
  }
58
58
  }
59
- progress.done();
59
+ progress.done = true;
60
60
  searchFinishedCallback(true);
61
61
  }
62
62
 
@@ -64,7 +64,7 @@ export class NetworkSearchScope implements Search.SearchScope.SearchScope {
64
64
  searchConfig: Workspace.SearchConfig.SearchConfig, request: SDK.NetworkRequest.NetworkRequest,
65
65
  progress: Common.Progress.Progress): Promise<NetworkSearchResult|null> {
66
66
  const bodyMatches = await NetworkSearchScope.#responseBodyMatches(searchConfig, request);
67
- if (progress.isCanceled()) {
67
+ if (progress.canceled) {
68
68
  return null;
69
69
  }
70
70
  const locations = [];
@@ -84,7 +84,7 @@ export class NetworkSearchScope implements Search.SearchScope.SearchScope {
84
84
  for (const match of bodyMatches) {
85
85
  locations.push(NetworkForward.UIRequestLocation.UIRequestLocation.bodyMatch(request, match));
86
86
  }
87
- progress.incrementWorked();
87
+ ++progress.worked;
88
88
  return new NetworkSearchResult(request, locations);
89
89
 
90
90
  function headerMatchesQuery(header: SDK.NetworkRequest.NameValue): boolean {
@@ -2,14 +2,15 @@
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
  /* eslint-disable rulesdir/no-imperative-dom-api */
5
+ /* eslint-disable rulesdir/no-lit-render-outside-of-view */
5
6
 
6
7
  import * as Common from '../../core/common/common.js';
7
8
  import * as i18n from '../../core/i18n/i18n.js';
8
9
  import * as Platform from '../../core/platform/platform.js';
9
10
  import * as TextUtils from '../../models/text_utils/text_utils.js';
10
11
  import type * as Workspace from '../../models/workspace/workspace.js';
11
- import * as Components from '../../ui/legacy/components/utils/utils.js';
12
12
  import * as UI from '../../ui/legacy/legacy.js';
13
+ import {html, render} from '../../ui/lit/lit.js';
13
14
 
14
15
  import searchResultsPaneStyles from './searchResultsPane.css.js';
15
16
  import type {SearchResult} from './SearchScope.js';
@@ -137,31 +138,23 @@ export class SearchResultsTreeElement extends UI.TreeOutline.TreeElement {
137
138
 
138
139
  private updateSearchMatches(): void {
139
140
  this.listItemElement.classList.add('search-result');
140
-
141
- const fileNameSpan = span(this.searchResult.label(), 'search-result-file-name');
142
- fileNameSpan.appendChild(span('\u2014', 'search-result-dash'));
143
- fileNameSpan.appendChild(span(this.searchResult.description(), 'search-result-qualifier'));
141
+ // clang-format off
142
+ render(html`
143
+ <span class="search-result-file-name">${this.searchResult.label()}
144
+ <span class="search-result-dash">${'\u2014'}</span>
145
+ <span class="search-result-qualifier">${this.searchResult.description()}</span>
146
+ </span>
147
+ <span class="search-result-matches-count"
148
+ aria-label=${i18nString(UIStrings.matchesCountS, {PH1: this.searchResult.matchesCount()})}>
149
+ ${this.searchResult.matchesCount()}
150
+ </span>`,
151
+ this.listItemElement);
152
+ // clang-format on
144
153
 
145
154
  this.tooltip = this.searchResult.description();
146
- this.listItemElement.appendChild(fileNameSpan);
147
- const matchesCountSpan = document.createElement('span');
148
- matchesCountSpan.className = 'search-result-matches-count';
149
-
150
- matchesCountSpan.textContent = `${this.searchResult.matchesCount()}`;
151
- UI.ARIAUtils.setLabel(
152
- matchesCountSpan, i18nString(UIStrings.matchesCountS, {PH1: this.searchResult.matchesCount()}));
153
-
154
- this.listItemElement.appendChild(matchesCountSpan);
155
155
  if (this.expanded) {
156
156
  this.updateMatchesUI();
157
157
  }
158
-
159
- function span(text: string, className: string): Element {
160
- const span = document.createElement('span');
161
- span.className = className;
162
- span.textContent = text;
163
- return span;
164
- }
165
158
  }
166
159
 
167
160
  private appendSearchMatches(fromIndex: number, toIndex: number): void {
@@ -195,28 +188,29 @@ export class SearchResultsTreeElement extends UI.TreeOutline.TreeElement {
195
188
  ({lineSegment: lineContent, matchRanges} = lineSegmentForMultipleMatches(lineContent, matchRanges));
196
189
  }
197
190
 
198
- const anchor = Components.Linkifier.Linkifier.linkifyRevealable(
199
- searchResult.matchRevealable(i), '', undefined, undefined, undefined, 'search-match');
200
- anchor.classList.add('search-match-link');
201
- anchor.tabIndex = 0;
202
- const labelSpan = document.createElement('span');
203
- labelSpan.classList.add('search-match-line-number');
204
191
  const resultLabel = searchResult.matchLabel(i);
205
- labelSpan.textContent = resultLabel;
206
- if (typeof resultLabel === 'number' && !isNaN(resultLabel)) {
207
- UI.ARIAUtils.setLabel(labelSpan, i18nString(UIStrings.lineS, {PH1: resultLabel}));
208
- } else {
209
- UI.ARIAUtils.setLabel(labelSpan, resultLabel);
210
- }
211
- anchor.appendChild(labelSpan);
212
-
213
- const contentSpan = this.createContentSpan(lineContent, matchRanges);
214
- anchor.appendChild(contentSpan);
215
192
 
216
193
  const searchMatchElement = new UI.TreeOutline.TreeElement();
217
194
  this.appendChild(searchMatchElement);
195
+ // clang-format off
196
+ render(html`
197
+ <button class="devtools-link text-button link-style search-match-link"
198
+ jslog="Link; context: search-match; track: click" role="link" tabindex="0"
199
+ @click=${() => void Common.Revealer.reveal(searchResult.matchRevealable(i))}>
200
+ <span class="search-match-line-number"
201
+ aria-label=${typeof resultLabel === 'number' && !isNaN(resultLabel)
202
+ ? i18nString(UIStrings.lineS, {PH1: resultLabel}) : resultLabel}>
203
+ ${resultLabel}
204
+ </span>
205
+ <span class="search-match-content" aria-label="${lineContent} line">
206
+ ${lineContent}
207
+ </span>
208
+ </button>`,
209
+ searchMatchElement.listItemElement);
210
+ // clang-format on
211
+ const contentSpan = searchMatchElement.listItemElement.querySelector('.search-match-content') as HTMLElement;
212
+ UI.UIUtils.highlightRangesWithStyleClass(contentSpan, matchRanges, 'highlighted-search-result');
218
213
  searchMatchElement.listItemElement.className = 'search-match';
219
- searchMatchElement.listItemElement.appendChild(anchor);
220
214
  searchMatchElement.listItemElement.addEventListener('keydown', event => {
221
215
  if (event.key === 'Enter') {
222
216
  event.consume(true);
@@ -237,15 +231,6 @@ export class SearchResultsTreeElement extends UI.TreeOutline.TreeElement {
237
231
  this.showMoreMatchesElementSelected.bind(this, showMoreMatchesTreeElement, startMatchIndex);
238
232
  }
239
233
 
240
- private createContentSpan(lineContent: string, matchRanges: TextUtils.TextRange.SourceRange[]): Element {
241
- const contentSpan = document.createElement('span');
242
- contentSpan.className = 'search-match-content';
243
- contentSpan.textContent = lineContent;
244
- UI.ARIAUtils.setLabel(contentSpan, `${lineContent} line`);
245
- UI.UIUtils.highlightRangesWithStyleClass(contentSpan, matchRanges, 'highlighted-search-result');
246
- return contentSpan;
247
- }
248
-
249
234
  private regexMatchRanges(lineContent: string, regex: RegExp): TextUtils.TextRange.SourceRange[] {
250
235
  regex.lastIndex = 0;
251
236
  let match;