chrome-devtools-frontend 1.0.974080 → 1.0.975442

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 (125) hide show
  1. package/config/gni/devtools_grd_files.gni +5 -0
  2. package/config/gni/devtools_image_files.gni +1 -0
  3. package/front_end/Images/src/ic_layers_16x16.svg +11 -0
  4. package/front_end/core/host/UserMetrics.ts +2 -1
  5. package/front_end/core/i18n/locales/af.json +74 -29
  6. package/front_end/core/i18n/locales/am.json +74 -29
  7. package/front_end/core/i18n/locales/ar.json +74 -29
  8. package/front_end/core/i18n/locales/as.json +74 -29
  9. package/front_end/core/i18n/locales/az.json +74 -29
  10. package/front_end/core/i18n/locales/be.json +74 -29
  11. package/front_end/core/i18n/locales/bg.json +74 -29
  12. package/front_end/core/i18n/locales/bn.json +74 -29
  13. package/front_end/core/i18n/locales/bs.json +75 -30
  14. package/front_end/core/i18n/locales/ca.json +74 -29
  15. package/front_end/core/i18n/locales/cs.json +74 -29
  16. package/front_end/core/i18n/locales/cy.json +74 -29
  17. package/front_end/core/i18n/locales/da.json +74 -29
  18. package/front_end/core/i18n/locales/de.json +76 -31
  19. package/front_end/core/i18n/locales/el.json +76 -31
  20. package/front_end/core/i18n/locales/en-GB.json +74 -29
  21. package/front_end/core/i18n/locales/en-US.json +13 -1
  22. package/front_end/core/i18n/locales/en-XL.json +13 -1
  23. package/front_end/core/i18n/locales/es-419.json +74 -29
  24. package/front_end/core/i18n/locales/es.json +74 -29
  25. package/front_end/core/i18n/locales/et.json +74 -29
  26. package/front_end/core/i18n/locales/eu.json +76 -31
  27. package/front_end/core/i18n/locales/fa.json +74 -29
  28. package/front_end/core/i18n/locales/fi.json +75 -30
  29. package/front_end/core/i18n/locales/fil.json +74 -29
  30. package/front_end/core/i18n/locales/fr-CA.json +74 -29
  31. package/front_end/core/i18n/locales/fr.json +74 -29
  32. package/front_end/core/i18n/locales/gl.json +81 -36
  33. package/front_end/core/i18n/locales/gu.json +74 -29
  34. package/front_end/core/i18n/locales/he.json +74 -29
  35. package/front_end/core/i18n/locales/hi.json +74 -29
  36. package/front_end/core/i18n/locales/hr.json +74 -29
  37. package/front_end/core/i18n/locales/hu.json +74 -29
  38. package/front_end/core/i18n/locales/hy.json +74 -29
  39. package/front_end/core/i18n/locales/id.json +74 -29
  40. package/front_end/core/i18n/locales/is.json +74 -29
  41. package/front_end/core/i18n/locales/it.json +74 -29
  42. package/front_end/core/i18n/locales/ja.json +74 -29
  43. package/front_end/core/i18n/locales/ka.json +74 -29
  44. package/front_end/core/i18n/locales/kk.json +74 -29
  45. package/front_end/core/i18n/locales/km.json +74 -29
  46. package/front_end/core/i18n/locales/kn.json +74 -29
  47. package/front_end/core/i18n/locales/ko.json +74 -29
  48. package/front_end/core/i18n/locales/ky.json +74 -29
  49. package/front_end/core/i18n/locales/lo.json +74 -29
  50. package/front_end/core/i18n/locales/lt.json +74 -29
  51. package/front_end/core/i18n/locales/lv.json +74 -29
  52. package/front_end/core/i18n/locales/mk.json +75 -30
  53. package/front_end/core/i18n/locales/ml.json +74 -29
  54. package/front_end/core/i18n/locales/mn.json +74 -29
  55. package/front_end/core/i18n/locales/mr.json +74 -29
  56. package/front_end/core/i18n/locales/ms.json +74 -29
  57. package/front_end/core/i18n/locales/my.json +74 -29
  58. package/front_end/core/i18n/locales/ne.json +74 -29
  59. package/front_end/core/i18n/locales/nl.json +74 -29
  60. package/front_end/core/i18n/locales/no.json +74 -29
  61. package/front_end/core/i18n/locales/or.json +75 -30
  62. package/front_end/core/i18n/locales/pa.json +74 -29
  63. package/front_end/core/i18n/locales/pl.json +74 -29
  64. package/front_end/core/i18n/locales/pt-PT.json +74 -29
  65. package/front_end/core/i18n/locales/pt.json +74 -29
  66. package/front_end/core/i18n/locales/ro.json +74 -29
  67. package/front_end/core/i18n/locales/ru.json +78 -33
  68. package/front_end/core/i18n/locales/si.json +74 -29
  69. package/front_end/core/i18n/locales/sk.json +74 -29
  70. package/front_end/core/i18n/locales/sl.json +74 -29
  71. package/front_end/core/i18n/locales/sq.json +74 -29
  72. package/front_end/core/i18n/locales/sr-Latn.json +74 -29
  73. package/front_end/core/i18n/locales/sr.json +74 -29
  74. package/front_end/core/i18n/locales/sv.json +74 -29
  75. package/front_end/core/i18n/locales/sw.json +74 -29
  76. package/front_end/core/i18n/locales/ta.json +74 -29
  77. package/front_end/core/i18n/locales/te.json +75 -30
  78. package/front_end/core/i18n/locales/th.json +74 -29
  79. package/front_end/core/i18n/locales/tr.json +74 -29
  80. package/front_end/core/i18n/locales/uk.json +74 -29
  81. package/front_end/core/i18n/locales/ur.json +74 -29
  82. package/front_end/core/i18n/locales/uz.json +74 -29
  83. package/front_end/core/i18n/locales/vi.json +74 -29
  84. package/front_end/core/i18n/locales/zh-HK.json +74 -29
  85. package/front_end/core/i18n/locales/zh-TW.json +74 -29
  86. package/front_end/core/i18n/locales/zh.json +74 -29
  87. package/front_end/core/i18n/locales/zu.json +74 -29
  88. package/front_end/core/root/Runtime.ts +1 -0
  89. package/front_end/core/sdk/CSSLayer.ts +30 -0
  90. package/front_end/core/sdk/CSSModel.ts +5 -0
  91. package/front_end/core/sdk/CSSRule.ts +3 -0
  92. package/front_end/core/sdk/DOMModel.ts +3 -3
  93. package/front_end/core/sdk/sdk.ts +2 -0
  94. package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +3 -0
  95. package/front_end/entrypoints/formatter_worker/Substitute.ts +536 -0
  96. package/front_end/entrypoints/formatter_worker/formatter_worker.ts +2 -0
  97. package/front_end/entrypoints/main/MainImpl.ts +5 -0
  98. package/front_end/generated/InspectorBackendCommands.js +11 -9
  99. package/front_end/generated/protocol-mapping.d.ts +13 -0
  100. package/front_end/generated/protocol-proxy-api.d.ts +15 -0
  101. package/front_end/generated/protocol.ts +71 -9
  102. package/front_end/models/issues_manager/IssuesManager.ts +6 -0
  103. package/front_end/models/javascript_metadata/NativeFunctions.js +87 -19
  104. package/front_end/panels/console/ConsolePrompt.ts +9 -4
  105. package/front_end/panels/elements/LayersWidget.ts +167 -0
  106. package/front_end/panels/elements/StylesSidebarPane.ts +71 -3
  107. package/front_end/panels/elements/elements-meta.ts +15 -2
  108. package/front_end/panels/elements/elements.ts +2 -0
  109. package/front_end/panels/elements/layersWidget.css +28 -0
  110. package/front_end/panels/elements/stylesSidebarPane.css +4 -0
  111. package/front_end/panels/lighthouse/LighthouseController.ts +3 -3
  112. package/front_end/panels/timeline/timelineStatusDialog.css +1 -0
  113. package/front_end/third_party/acorn/estree-legacy.d.ts +1 -0
  114. package/front_end/ui/components/text_editor/cursor_tooltip.ts +2 -1
  115. package/front_end/ui/components/text_editor/javascript.ts +10 -3
  116. package/front_end/ui/legacy/Toolbar.ts +25 -13
  117. package/package.json +1 -1
  118. package/scripts/build/assert_grd.py +1 -1
  119. package/scripts/build/assert_third_party_readmes.py +1 -1
  120. package/scripts/build/build_inspector_overlay.py +1 -1
  121. package/scripts/build/code_generator_frontend.py +1 -1
  122. package/scripts/build/efficiently_recompile.py +1 -1
  123. package/scripts/build/generate_aria.py +2 -0
  124. package/scripts/build/generate_devtools_grd.py +1 -5
  125. package/scripts/build/generate_supported_css.py +6 -5
@@ -113,11 +113,7 @@ export function registerCommands(inspectorBackend) {
113
113
  ['nodes']);
114
114
  inspectorBackend.registerCommand(
115
115
  'Accessibility.getFullAXTree',
116
- [
117
- {'name': 'depth', 'type': 'number', 'optional': true},
118
- {'name': 'max_depth', 'type': 'number', 'optional': true},
119
- {'name': 'frameId', 'type': 'string', 'optional': true}
120
- ],
116
+ [{'name': 'depth', 'type': 'number', 'optional': true}, {'name': 'frameId', 'type': 'string', 'optional': true}],
121
117
  ['nodes']);
122
118
  inspectorBackend.registerCommand(
123
119
  'Accessibility.getRootAXNode', [{'name': 'frameId', 'type': 'string', 'optional': true}], ['node']);
@@ -211,6 +207,7 @@ export function registerCommands(inspectorBackend) {
211
207
  MixedContentWarning: 'MixedContentWarning'
212
208
  });
213
209
  inspectorBackend.registerEnum('Audits.MixedContentResourceType', {
210
+ AttributionSrc: 'AttributionSrc',
214
211
  Audio: 'Audio',
215
212
  Beacon: 'Beacon',
216
213
  CSPReport: 'CSPReport',
@@ -520,6 +517,8 @@ export function registerCommands(inspectorBackend) {
520
517
  'CSS.getPlatformFontsForNode', [{'name': 'nodeId', 'type': 'number', 'optional': false}], ['fonts']);
521
518
  inspectorBackend.registerCommand(
522
519
  'CSS.getStyleSheetText', [{'name': 'styleSheetId', 'type': 'string', 'optional': false}], ['text']);
520
+ inspectorBackend.registerCommand(
521
+ 'CSS.getLayersForNode', [{'name': 'nodeId', 'type': 'number', 'optional': false}], ['rootLayer']);
523
522
  inspectorBackend.registerCommand(
524
523
  'CSS.trackComputedStyleUpdates', [{'name': 'propertiesToTrack', 'type': 'object', 'optional': false}], []);
525
524
  inspectorBackend.registerCommand('CSS.takeComputedStyleUpdates', [], ['nodeIds']);
@@ -656,10 +655,11 @@ export function registerCommands(inspectorBackend) {
656
655
  ScrollbarCorner: 'scrollbar-corner',
657
656
  Resizer: 'resizer',
658
657
  InputListButton: 'input-list-button',
659
- Transition: 'transition',
660
- TransitionContainer: 'transition-container',
661
- TransitionOldContent: 'transition-old-content',
662
- TransitionNewContent: 'transition-new-content'
658
+ PageTransition: 'page-transition',
659
+ PageTransitionContainer: 'page-transition-container',
660
+ PageTransitionImageWrapper: 'page-transition-image-wrapper',
661
+ PageTransitionOutgoingImage: 'page-transition-outgoing-image',
662
+ PageTransitionIncomingImage: 'page-transition-incoming-image'
663
663
  });
664
664
  inspectorBackend.registerEnum('DOM.ShadowRootType', {UserAgent: 'user-agent', Open: 'open', Closed: 'closed'});
665
665
  inspectorBackend.registerEnum(
@@ -1153,6 +1153,8 @@ export function registerCommands(inspectorBackend) {
1153
1153
  {'name': 'userAgentMetadata', 'type': 'object', 'optional': true}
1154
1154
  ],
1155
1155
  []);
1156
+ inspectorBackend.registerCommand(
1157
+ 'Emulation.setAutomationOverride', [{'name': 'enabled', 'type': 'boolean', 'optional': false}], []);
1156
1158
 
1157
1159
  // HeadlessExperimental.
1158
1160
  inspectorBackend.registerEnum('HeadlessExperimental.ScreenshotParamsFormat', {Jpeg: 'jpeg', Png: 'png'});
@@ -976,6 +976,14 @@ export namespace ProtocolMapping {
976
976
  */
977
977
  'CSS.getStyleSheetText':
978
978
  {paramsType: [Protocol.CSS.GetStyleSheetTextRequest]; returnType: Protocol.CSS.GetStyleSheetTextResponse;};
979
+ /**
980
+ * Returns all layers parsed by the rendering engine for the tree scope of a node.
981
+ * Given a DOM element identified by nodeId, getLayersForNode returns the root
982
+ * layer for the nearest ancestor document or shadow root. The layer root contains
983
+ * the full layer tree for the tree scope and their ordering.
984
+ */
985
+ 'CSS.getLayersForNode':
986
+ {paramsType: [Protocol.CSS.GetLayersForNodeRequest]; returnType: Protocol.CSS.GetLayersForNodeResponse;};
979
987
  /**
980
988
  * Starts tracking the given computed styles for updates. The specified array of properties
981
989
  * replaces the one previously specified. Pass empty array to disable tracking.
@@ -1593,6 +1601,11 @@ export namespace ProtocolMapping {
1593
1601
  * Allows overriding user agent with the given string.
1594
1602
  */
1595
1603
  'Emulation.setUserAgentOverride': {paramsType: [Protocol.Emulation.SetUserAgentOverrideRequest]; returnType: void;};
1604
+ /**
1605
+ * Allows overriding the automation flag.
1606
+ */
1607
+ 'Emulation.setAutomationOverride':
1608
+ {paramsType: [Protocol.Emulation.SetAutomationOverrideRequest]; returnType: void;};
1596
1609
  /**
1597
1610
  * Sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a
1598
1611
  * screenshot from the resulting frame. Requires that the target was created with enabled
@@ -592,6 +592,15 @@ declare namespace ProtocolProxyApi {
592
592
  invoke_getStyleSheetText(params: Protocol.CSS.GetStyleSheetTextRequest):
593
593
  Promise<Protocol.CSS.GetStyleSheetTextResponse>;
594
594
 
595
+ /**
596
+ * Returns all layers parsed by the rendering engine for the tree scope of a node.
597
+ * Given a DOM element identified by nodeId, getLayersForNode returns the root
598
+ * layer for the nearest ancestor document or shadow root. The layer root contains
599
+ * the full layer tree for the tree scope and their ordering.
600
+ */
601
+ invoke_getLayersForNode(params: Protocol.CSS.GetLayersForNodeRequest):
602
+ Promise<Protocol.CSS.GetLayersForNodeResponse>;
603
+
595
604
  /**
596
605
  * Starts tracking the given computed styles for updates. The specified array of properties
597
606
  * replaces the one previously specified. Pass empty array to disable tracking.
@@ -1468,6 +1477,12 @@ declare namespace ProtocolProxyApi {
1468
1477
  */
1469
1478
  invoke_setUserAgentOverride(params: Protocol.Emulation.SetUserAgentOverrideRequest):
1470
1479
  Promise<Protocol.ProtocolResponseWithError>;
1480
+
1481
+ /**
1482
+ * Allows overriding the automation flag.
1483
+ */
1484
+ invoke_setAutomationOverride(params: Protocol.Emulation.SetAutomationOverrideRequest):
1485
+ Promise<Protocol.ProtocolResponseWithError>;
1471
1486
  }
1472
1487
  export interface EmulationDispatcher {
1473
1488
  /**
@@ -307,10 +307,6 @@ export namespace Accessibility {
307
307
  * If omitted, the full tree is returned.
308
308
  */
309
309
  depth?: integer;
310
- /**
311
- * Deprecated. This parameter has been renamed to `depth`. If depth is not provided, max_depth will be used.
312
- */
313
- max_depth?: integer;
314
310
  /**
315
311
  * The frame for whose document the AX tree should be retrieved.
316
312
  * If omited, the root frame is used.
@@ -758,6 +754,7 @@ export namespace Audits {
758
754
  }
759
755
 
760
756
  export const enum MixedContentResourceType {
757
+ AttributionSrc = 'AttributionSrc',
761
758
  Audio = 'Audio',
762
759
  Beacon = 'Beacon',
763
760
  CSPReport = 'CSPReport',
@@ -1059,7 +1056,7 @@ export namespace Audits {
1059
1056
  /**
1060
1057
  * Represents the failure reason when a federated authentication reason fails.
1061
1058
  * Should be updated alongside RequestIdTokenStatus in
1062
- * third_party/blink/public/mojom/webid/federated_auth_request.mojom to include
1059
+ * third_party/blink/public/mojom/devtools/inspector_issue.mojom to include
1063
1060
  * all cases except for success.
1064
1061
  */
1065
1062
  export const enum FederatedAuthRequestIssueReason {
@@ -1924,6 +1921,11 @@ export namespace CSS {
1924
1921
  * The array enumerates @supports at-rules starting with the innermost one, going outwards.
1925
1922
  */
1926
1923
  supports?: CSSSupports[];
1924
+ /**
1925
+ * Cascade layer array. Contains the layer hierarchy that this rule belongs to starting
1926
+ * with the innermost layer and going outwards.
1927
+ */
1928
+ layers?: CSSLayer[];
1927
1929
  }
1928
1930
 
1929
1931
  /**
@@ -2185,6 +2187,44 @@ export namespace CSS {
2185
2187
  styleSheetId?: StyleSheetId;
2186
2188
  }
2187
2189
 
2190
+ /**
2191
+ * CSS Layer at-rule descriptor.
2192
+ */
2193
+ export interface CSSLayer {
2194
+ /**
2195
+ * Layer name.
2196
+ */
2197
+ text: string;
2198
+ /**
2199
+ * The associated rule header range in the enclosing stylesheet (if
2200
+ * available).
2201
+ */
2202
+ range?: SourceRange;
2203
+ /**
2204
+ * Identifier of the stylesheet containing this object (if exists).
2205
+ */
2206
+ styleSheetId?: StyleSheetId;
2207
+ }
2208
+
2209
+ /**
2210
+ * CSS Layer data.
2211
+ */
2212
+ export interface CSSLayerData {
2213
+ /**
2214
+ * Layer name.
2215
+ */
2216
+ name: string;
2217
+ /**
2218
+ * Direct sub-layers
2219
+ */
2220
+ subLayers?: CSSLayerData[];
2221
+ /**
2222
+ * Layer order. The order determines the order of the layer in the cascade order.
2223
+ * A higher number has higher priority in the cascade order.
2224
+ */
2225
+ order: number;
2226
+ }
2227
+
2188
2228
  /**
2189
2229
  * Information about amount of glyphs that were rendered with given font.
2190
2230
  */
@@ -2495,6 +2535,14 @@ export namespace CSS {
2495
2535
  text: string;
2496
2536
  }
2497
2537
 
2538
+ export interface GetLayersForNodeRequest {
2539
+ nodeId: DOM.NodeId;
2540
+ }
2541
+
2542
+ export interface GetLayersForNodeResponse extends ProtocolResponseWithError {
2543
+ rootLayer: CSSLayerData;
2544
+ }
2545
+
2498
2546
  export interface TrackComputedStyleUpdatesRequest {
2499
2547
  propertiesToTrack: CSSComputedStyleProperty[];
2500
2548
  }
@@ -2951,10 +2999,11 @@ export namespace DOM {
2951
2999
  ScrollbarCorner = 'scrollbar-corner',
2952
3000
  Resizer = 'resizer',
2953
3001
  InputListButton = 'input-list-button',
2954
- Transition = 'transition',
2955
- TransitionContainer = 'transition-container',
2956
- TransitionOldContent = 'transition-old-content',
2957
- TransitionNewContent = 'transition-new-content',
3002
+ PageTransition = 'page-transition',
3003
+ PageTransitionContainer = 'page-transition-container',
3004
+ PageTransitionImageWrapper = 'page-transition-image-wrapper',
3005
+ PageTransitionOutgoingImage = 'page-transition-outgoing-image',
3006
+ PageTransitionIncomingImage = 'page-transition-incoming-image',
2958
3007
  }
2959
3008
 
2960
3009
  /**
@@ -5351,6 +5400,13 @@ export namespace Emulation {
5351
5400
  */
5352
5401
  userAgentMetadata?: UserAgentMetadata;
5353
5402
  }
5403
+
5404
+ export interface SetAutomationOverrideRequest {
5405
+ /**
5406
+ * Whether the override should be enabled.
5407
+ */
5408
+ enabled: boolean;
5409
+ }
5354
5410
  }
5355
5411
 
5356
5412
  /**
@@ -10813,6 +10869,12 @@ export namespace Page {
10813
10869
  * Not restored reason
10814
10870
  */
10815
10871
  reason: BackForwardCacheNotRestoredReason;
10872
+ /**
10873
+ * Context associated with the reason. The meaning of this context is
10874
+ * dependent on the reason:
10875
+ * - EmbedderExtensionSentMessageToCachedFrame: the extension ID.
10876
+ */
10877
+ context?: string;
10816
10878
  }
10817
10879
 
10818
10880
  export interface BackForwardCacheNotRestoredExplanationTree {
@@ -117,6 +117,12 @@ const issueCodeHandlers = new Map<
117
117
  */
118
118
  function createIssuesFromProtocolIssue(
119
119
  issuesModel: SDK.IssuesModel.IssuesModel, inspectorIssue: Protocol.Audits.InspectorIssue): Issue[] {
120
+ if (inspectorIssue.code.toString() === 'CookieIssue') {
121
+ // TODO: backward compatibility for the next chromium roll
122
+ const details = inspectorIssue.details as {cookieIssueDetails: Protocol.Audits.SameSiteCookieIssueDetails};
123
+ inspectorIssue.code = Protocol.Audits.InspectorIssueCode.SameSiteCookieIssue;
124
+ inspectorIssue.details.sameSiteCookieIssueDetails = details.cookieIssueDetails;
125
+ }
120
126
  const handler = issueCodeHandlers.get(inspectorIssue.code);
121
127
  if (handler) {
122
128
  return handler(issuesModel, inspectorIssue);
@@ -2634,7 +2634,7 @@ export const NativeFunctions = [
2634
2634
  },
2635
2635
  {
2636
2636
  name: 'transitionWhile',
2637
- signatures: [['newNavigationAction']]
2637
+ signatures: [['newNavigationAction','?options']]
2638
2638
  },
2639
2639
  {
2640
2640
  name: 'updateCurrent',
@@ -2783,6 +2783,10 @@ export const NativeFunctions = [
2783
2783
  name: 'CSSKeywordValue',
2784
2784
  signatures: [['keyword']]
2785
2785
  },
2786
+ {
2787
+ name: 'CSSMathClamp',
2788
+ signatures: [['lower','value','upper']]
2789
+ },
2786
2790
  {
2787
2791
  name: 'CSSMathInvert',
2788
2792
  signatures: [['arg']]
@@ -2907,6 +2911,14 @@ export const NativeFunctions = [
2907
2911
  name: 'vh',
2908
2912
  signatures: [['value']]
2909
2913
  },
2914
+ {
2915
+ name: 'vi',
2916
+ signatures: [['value']]
2917
+ },
2918
+ {
2919
+ name: 'vb',
2920
+ signatures: [['value']]
2921
+ },
2910
2922
  {
2911
2923
  name: 'vmin',
2912
2924
  signatures: [['value']]
@@ -2915,6 +2927,78 @@ export const NativeFunctions = [
2915
2927
  name: 'vmax',
2916
2928
  signatures: [['value']]
2917
2929
  },
2930
+ {
2931
+ name: 'svw',
2932
+ signatures: [['value']]
2933
+ },
2934
+ {
2935
+ name: 'svh',
2936
+ signatures: [['value']]
2937
+ },
2938
+ {
2939
+ name: 'svi',
2940
+ signatures: [['value']]
2941
+ },
2942
+ {
2943
+ name: 'svb',
2944
+ signatures: [['value']]
2945
+ },
2946
+ {
2947
+ name: 'svmin',
2948
+ signatures: [['value']]
2949
+ },
2950
+ {
2951
+ name: 'svmax',
2952
+ signatures: [['value']]
2953
+ },
2954
+ {
2955
+ name: 'lvw',
2956
+ signatures: [['value']]
2957
+ },
2958
+ {
2959
+ name: 'lvh',
2960
+ signatures: [['value']]
2961
+ },
2962
+ {
2963
+ name: 'lvi',
2964
+ signatures: [['value']]
2965
+ },
2966
+ {
2967
+ name: 'lvb',
2968
+ signatures: [['value']]
2969
+ },
2970
+ {
2971
+ name: 'lvmin',
2972
+ signatures: [['value']]
2973
+ },
2974
+ {
2975
+ name: 'lvmax',
2976
+ signatures: [['value']]
2977
+ },
2978
+ {
2979
+ name: 'dvw',
2980
+ signatures: [['value']]
2981
+ },
2982
+ {
2983
+ name: 'dvh',
2984
+ signatures: [['value']]
2985
+ },
2986
+ {
2987
+ name: 'dvi',
2988
+ signatures: [['value']]
2989
+ },
2990
+ {
2991
+ name: 'dvb',
2992
+ signatures: [['value']]
2993
+ },
2994
+ {
2995
+ name: 'dvmin',
2996
+ signatures: [['value']]
2997
+ },
2998
+ {
2999
+ name: 'dvmax',
3000
+ signatures: [['value']]
3001
+ },
2918
3002
  {
2919
3003
  name: 'qw',
2920
3004
  signatures: [['value']]
@@ -3625,14 +3709,6 @@ export const NativeFunctions = [
3625
3709
  name: 'dispatchEvent',
3626
3710
  signatures: [['event']]
3627
3711
  },
3628
- {
3629
- name: 'Event',
3630
- signatures: [['type','?eventInitDict']]
3631
- },
3632
- {
3633
- name: 'initEvent',
3634
- signatures: [['type','?bubbles','?cancelable']]
3635
- },
3636
3712
  {
3637
3713
  name: 'MutationObserver',
3638
3714
  signatures: [['callback']]
@@ -4513,7 +4589,8 @@ export const NativeFunctions = [
4513
4589
  },
4514
4590
  {
4515
4591
  name: 'end',
4516
- signatures: [['index']]
4592
+ signatures: [['index']],
4593
+ receiver: 'TimeRanges'
4517
4594
  },
4518
4595
  {
4519
4596
  name: 'getTrackById',
@@ -6659,11 +6736,6 @@ export const NativeFunctions = [
6659
6736
  name: 'requestAll',
6660
6737
  signatures: [['permissions']]
6661
6738
  },
6662
- {
6663
- name: 'requestPictureInPicture',
6664
- signatures: [['?options']],
6665
- receiver: 'HTMLElement'
6666
- },
6667
6739
  {
6668
6740
  name: 'PictureInPictureEvent',
6669
6741
  signatures: [['type','eventInitDict']]
@@ -8544,10 +8616,6 @@ export const NativeFunctions = [
8544
8616
  name: 'requestAdapter',
8545
8617
  signatures: [['?options']]
8546
8618
  },
8547
- {
8548
- name: 'provide',
8549
- signatures: [['?id_token']]
8550
- },
8551
8619
  {
8552
8620
  name: 'MIDIConnectionEvent',
8553
8621
  signatures: [['type','?eventInitDict']]
@@ -41,6 +41,10 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
41
41
  private readonly eagerEvalSetting: Common.Settings.Setting<boolean>;
42
42
  private previewRequestForTest: Promise<void>|null;
43
43
  private highlightingNode: boolean;
44
+ // The CodeMirror state field that controls whether the argument hints are showing.
45
+ // If they are, the escape key will clear them. However, if they aren't, then the
46
+ // console drawer should be hidden as a whole.
47
+ #argumentHintsState: CodeMirror.StateField<CodeMirror.Tooltip|null>;
44
48
 
45
49
  constructor() {
46
50
  super();
@@ -70,13 +74,15 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
70
74
  this.element.tabIndex = 0;
71
75
  this.previewRequestForTest = null;
72
76
  this.highlightingNode = false;
77
+ const argumentHints = TextEditor.JavaScript.argumentHints();
78
+ this.#argumentHintsState = argumentHints[0];
73
79
 
74
80
  const editorState = CodeMirror.EditorState.create({
75
81
  doc: this.initialText,
76
82
  extensions: [
77
83
  CodeMirror.keymap.of(this.editorKeymap()),
78
84
  CodeMirror.EditorView.updateListener.of(update => this.editorUpdate(update)),
79
- TextEditor.JavaScript.argumentHints(),
85
+ argumentHints,
80
86
  TextEditor.JavaScript.completion(),
81
87
  TextEditor.Config.showCompletionHint,
82
88
  CodeMirror.javascript.javascript(),
@@ -212,8 +218,7 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
212
218
  {
213
219
  key: 'Escape',
214
220
  run: (): boolean => {
215
- TextEditor.JavaScript.closeArgumentsHintsTooltip(this.editor.editor);
216
- return true;
221
+ return TextEditor.JavaScript.closeArgumentsHintsTooltip(this.editor.editor, this.#argumentHintsState);
217
222
  },
218
223
  },
219
224
  {
@@ -266,7 +271,7 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
266
271
  private async handleEnter(): Promise<void> {
267
272
  if (await this.enterWillEvaluate()) {
268
273
  this.appendCommand(this.text(), true);
269
- TextEditor.JavaScript.closeArgumentsHintsTooltip(this.editor.editor);
274
+ TextEditor.JavaScript.closeArgumentsHintsTooltip(this.editor.editor, this.#argumentHintsState);
270
275
  this.editor.dispatch({
271
276
  changes: {from: 0, to: this.editor.state.doc.length},
272
277
  scrollIntoView: true,
@@ -0,0 +1,167 @@
1
+ // Copyright (c) 2022 The Chromium Authors. All rights reserved.
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 i18n from '../../core/i18n/i18n.js';
6
+ import * as SDK from '../../core/sdk/sdk.js';
7
+ import * as UI from '../../ui/legacy/legacy.js';
8
+ import type * as Protocol from '../../generated/protocol.js';
9
+ import * as TreeOutline from '../../ui/components/tree_outline/tree_outline.js';
10
+
11
+ import {ElementsPanel} from './ElementsPanel.js';
12
+ import layersWidgetStyles from './layersWidget.css.js';
13
+ import * as IconButton from '../../ui/components/icon_button/icon_button.js';
14
+
15
+ const UIStrings = {
16
+ /**
17
+ * @description Title of a section in the Element State Pane Widget of the Elements panel.
18
+ * The widget shows the layers present in the context of the currently selected node.
19
+ * */
20
+ cssLayersTitle: 'CSS layers',
21
+ /**
22
+ * @description Tooltip text in Element State Pane Widget of the Elements panel.
23
+ * For a button that opens a tool that shows the layers present in the current document.
24
+ */
25
+ toggleCSSLayers: 'Toggle CSS Layers view',
26
+ };
27
+ const str_ = i18n.i18n.registerUIStrings('panels/elements/LayersWidget.ts', UIStrings);
28
+ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
29
+
30
+ let layersWidgetInstance: LayersWidget;
31
+
32
+ export class LayersWidget extends UI.Widget.Widget {
33
+ private cssModel?: SDK.CSSModel.CSSModel|null;
34
+ private layerTreeComponent = new TreeOutline.TreeOutline.TreeOutline<string>();
35
+
36
+ constructor() {
37
+ super(true);
38
+
39
+ this.contentElement.className = 'styles-layers-pane';
40
+ UI.UIUtils.createTextChild(this.contentElement.createChild('div'), i18nString(UIStrings.cssLayersTitle));
41
+
42
+ this.contentElement.appendChild(this.layerTreeComponent);
43
+
44
+ UI.Context.Context.instance().addFlavorChangeListener(SDK.DOMModel.DOMNode, this.update, this);
45
+ }
46
+
47
+ private updateModel(cssModel: SDK.CSSModel.CSSModel|null): void {
48
+ if (this.cssModel === cssModel) {
49
+ return;
50
+ }
51
+ if (this.cssModel) {
52
+ this.cssModel.removeEventListener(SDK.CSSModel.Events.StyleSheetChanged, this.update, this);
53
+ }
54
+ this.cssModel = cssModel;
55
+ if (this.cssModel) {
56
+ this.cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetChanged, this.update, this);
57
+ }
58
+ }
59
+
60
+ async wasShown(): Promise<void> {
61
+ super.wasShown();
62
+ this.registerCSSFiles([layersWidgetStyles]);
63
+ return this.update();
64
+ }
65
+
66
+ private async update(): Promise<void> {
67
+ if (!this.isShowing()) {
68
+ return;
69
+ }
70
+
71
+ let node = UI.Context.Context.instance().flavor(SDK.DOMModel.DOMNode);
72
+ if (node) {
73
+ node = node.enclosingElementOrSelf();
74
+ }
75
+ if (!node) {
76
+ // do something meaningful?
77
+ return;
78
+ }
79
+
80
+ this.updateModel(node.domModel().cssModel());
81
+ if (!this.cssModel) {
82
+ return;
83
+ }
84
+ const makeTreeNode = (parentId: string) =>
85
+ (layer: Protocol.CSS.CSSLayerData): TreeOutline.TreeOutlineUtils.TreeNode<string> => {
86
+ const subLayers = layer.subLayers;
87
+ const treeNodeData = layer.order + ': ' + layer.name;
88
+ const id = parentId ? parentId + '.' + layer.name : layer.name;
89
+ if (!subLayers) {
90
+ return {treeNodeData, id};
91
+ }
92
+ return {
93
+ treeNodeData,
94
+ id,
95
+ children: (): Promise<TreeOutline.TreeOutlineUtils.TreeNode<string>[]> =>
96
+ Promise.resolve(subLayers.sort((layer1, layer2) => layer1.order - layer2.order).map(makeTreeNode(id))),
97
+ };
98
+ };
99
+ const rootLayer = await this.cssModel.rootLayerPromise(node.id);
100
+ this.layerTreeComponent.data = {
101
+ defaultRenderer: TreeOutline.TreeOutline.defaultRenderer,
102
+ tree: [makeTreeNode('')(rootLayer)],
103
+ };
104
+
105
+ // We only expand the first 5 user-defined layers to not make the
106
+ // view too overwhelming.
107
+ await this.layerTreeComponent.expandRecursively(5);
108
+ }
109
+
110
+ async revealLayer(layerName: string): Promise<void> {
111
+ if (!this.isShowing()) {
112
+ ElementsPanel.instance().showToolbarPane(this, ButtonProvider.instance().item());
113
+ }
114
+ await this.update();
115
+ return this.layerTreeComponent.expandToAndSelectTreeNodeId('implicit outer layer.' + layerName);
116
+ }
117
+
118
+ static instance(opts: {
119
+ forceNew: boolean|null,
120
+ }|undefined = {forceNew: null}): LayersWidget {
121
+ const {forceNew} = opts;
122
+ if (!layersWidgetInstance || forceNew) {
123
+ layersWidgetInstance = new LayersWidget();
124
+ }
125
+
126
+ return layersWidgetInstance;
127
+ }
128
+ }
129
+
130
+ let buttonProviderInstance: ButtonProvider;
131
+
132
+ export class ButtonProvider implements UI.Toolbar.Provider {
133
+ private readonly button: UI.Toolbar.ToolbarToggle;
134
+ private constructor() {
135
+ const layersIcon = new IconButton.Icon.Icon();
136
+ layersIcon.data = {
137
+ iconName: 'ic_layers_16x16',
138
+ color: 'var(--color-text-secondary)',
139
+ width: '13px',
140
+ height: '13px',
141
+ };
142
+ this.button = new UI.Toolbar.ToolbarToggle(i18nString(UIStrings.toggleCSSLayers), layersIcon);
143
+ this.button.setVisible(false);
144
+ this.button.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this.clicked, this);
145
+ this.button.element.classList.add('monospace');
146
+ }
147
+
148
+ static instance(opts: {
149
+ forceNew: boolean|null,
150
+ } = {forceNew: null}): ButtonProvider {
151
+ const {forceNew} = opts;
152
+ if (!buttonProviderInstance || forceNew) {
153
+ buttonProviderInstance = new ButtonProvider();
154
+ }
155
+
156
+ return buttonProviderInstance;
157
+ }
158
+
159
+ private clicked(): void {
160
+ const view = LayersWidget.instance();
161
+ ElementsPanel.instance().showToolbarPane(!view.isShowing() ? view : null, this.button);
162
+ }
163
+
164
+ item(): UI.Toolbar.ToolbarToggle {
165
+ return this.button;
166
+ }
167
+ }