chrome-devtools-frontend 1.0.927127 → 1.0.928589

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 (144) hide show
  1. package/AUTHORS +1 -0
  2. package/config/gni/all_devtools_files.gni +0 -1
  3. package/config/gni/devtools_grd_files.gni +30 -4
  4. package/config/gni/devtools_image_files.gni +1 -0
  5. package/front_end/Images/src/ic_preview_feature.svg +3 -0
  6. package/front_end/Tests.js +2 -3
  7. package/front_end/core/common/Settings.ts +26 -45
  8. package/front_end/core/host/UserMetrics.ts +2 -2
  9. package/front_end/core/i18n/locales/en-US.json +60 -15
  10. package/front_end/core/i18n/locales/en-XL.json +60 -15
  11. package/front_end/core/platform/keyboard-utilities.ts +1 -0
  12. package/front_end/core/root/Runtime.ts +62 -61
  13. package/front_end/core/sdk/AccessibilityModel.ts +73 -73
  14. package/front_end/core/sdk/CPUProfileDataModel.ts +14 -14
  15. package/front_end/core/sdk/CPUProfilerModel.ts +33 -33
  16. package/front_end/core/sdk/CPUThrottlingManager.ts +8 -8
  17. package/front_end/core/sdk/CSSFontFace.ts +10 -10
  18. package/front_end/core/sdk/CSSMatchedStyles.ts +114 -114
  19. package/front_end/core/sdk/CSSMedia.ts +22 -22
  20. package/front_end/core/sdk/CSSMetadata.ts +53 -49
  21. package/front_end/core/sdk/CSSModel.ts +139 -135
  22. package/front_end/core/sdk/CSSProperty.ts +18 -18
  23. package/front_end/core/sdk/CSSRule.ts +15 -15
  24. package/front_end/core/sdk/CSSStyleDeclaration.ts +49 -47
  25. package/front_end/core/sdk/CSSStyleSheetHeader.ts +12 -12
  26. package/front_end/core/sdk/ChildTargetManager.ts +41 -40
  27. package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +10 -10
  28. package/front_end/core/sdk/Connections.ts +81 -81
  29. package/front_end/core/sdk/ConsoleModel.ts +68 -68
  30. package/front_end/core/sdk/Cookie.ts +48 -48
  31. package/front_end/core/sdk/CookieModel.ts +13 -13
  32. package/front_end/core/sdk/CookieParser.ts +45 -45
  33. package/front_end/core/sdk/DOMDebuggerModel.ts +131 -131
  34. package/front_end/core/sdk/DOMModel.ts +264 -252
  35. package/front_end/core/sdk/DebuggerModel.ts +209 -205
  36. package/front_end/core/sdk/EmulationModel.ts +76 -76
  37. package/front_end/core/sdk/FilmStripModel.ts +29 -29
  38. package/front_end/core/sdk/FrameManager.ts +43 -42
  39. package/front_end/core/sdk/HeapProfilerModel.ts +36 -36
  40. package/front_end/core/sdk/IsolateManager.ts +82 -82
  41. package/front_end/core/sdk/IssuesModel.ts +6 -6
  42. package/front_end/core/sdk/LayerTreeBase.ts +37 -37
  43. package/front_end/core/sdk/LogModel.ts +5 -5
  44. package/front_end/core/sdk/NetworkManager.ts +229 -225
  45. package/front_end/core/sdk/NetworkRequest.ts +368 -360
  46. package/front_end/core/sdk/OverlayColorGenerator.ts +9 -9
  47. package/front_end/core/sdk/OverlayModel.ts +155 -153
  48. package/front_end/core/sdk/OverlayPersistentHighlighter.ts +100 -101
  49. package/front_end/core/sdk/PageResourceLoader.ts +30 -30
  50. package/front_end/core/sdk/PaintProfiler.ts +16 -16
  51. package/front_end/core/sdk/PerformanceMetricsModel.ts +12 -12
  52. package/front_end/core/sdk/ProfileTreeModel.ts +3 -3
  53. package/front_end/core/sdk/RemoteObject.ts +108 -104
  54. package/front_end/core/sdk/Resource.ts +85 -84
  55. package/front_end/core/sdk/ResourceTreeModel.ts +150 -145
  56. package/front_end/core/sdk/RuntimeModel.ts +38 -34
  57. package/front_end/core/sdk/SDKModel.ts +3 -3
  58. package/front_end/core/sdk/ScreenCaptureModel.ts +19 -19
  59. package/front_end/core/sdk/Script.ts +29 -29
  60. package/front_end/core/sdk/SecurityOriginManager.ts +19 -19
  61. package/front_end/core/sdk/ServerTiming.ts +2 -2
  62. package/front_end/core/sdk/ServiceWorkerCacheModel.ts +43 -43
  63. package/front_end/core/sdk/ServiceWorkerManager.ts +72 -68
  64. package/front_end/core/sdk/SourceMap.ts +40 -36
  65. package/front_end/core/sdk/SourceMapManager.ts +57 -57
  66. package/front_end/core/sdk/Target.ts +64 -63
  67. package/front_end/core/sdk/TargetManager.ts +60 -56
  68. package/front_end/core/sdk/TracingManager.ts +39 -39
  69. package/front_end/core/sdk/TracingModel.ts +125 -125
  70. package/front_end/core/sdk/WebAuthnModel.ts +9 -9
  71. package/front_end/entrypoints/lighthouse_worker/{LighthouseService.js → LighthouseService.ts} +20 -45
  72. package/front_end/entrypoints/lighthouse_worker/{lighthouse_worker.js → lighthouse_worker.ts} +0 -0
  73. package/front_end/entrypoints/main/MainImpl.ts +7 -2
  74. package/front_end/legacy_test_runner/elements_test_runner/ElementsTestRunner.js +4 -4
  75. package/front_end/legacy_test_runner/sdk_test_runner/sdk_test_runner.js +1 -1
  76. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -6
  77. package/front_end/models/issues_manager/GenericIssue.ts +86 -0
  78. package/front_end/models/issues_manager/Issue.ts +24 -0
  79. package/front_end/models/issues_manager/IssuesManager.ts +18 -6
  80. package/front_end/models/issues_manager/descriptions/genericCrossOriginPortalPostMessageError.md +3 -0
  81. package/front_end/models/issues_manager/issues_manager.ts +2 -0
  82. package/front_end/models/javascript_metadata/NativeFunctions.js +5422 -1
  83. package/front_end/panels/console/ConsoleSidebar.ts +0 -3
  84. package/front_end/panels/elements/ElementsTreeElement.ts +53 -61
  85. package/front_end/panels/elements/ElementsTreeOutline.ts +0 -1
  86. package/front_end/panels/elements/components/LayoutPane.ts +5 -1
  87. package/front_end/panels/issues/GenericIssueDetailsView.ts +68 -0
  88. package/front_end/panels/issues/IssueAggregator.ts +16 -0
  89. package/front_end/panels/issues/IssueKindView.ts +95 -0
  90. package/front_end/panels/issues/IssueView.ts +6 -0
  91. package/front_end/panels/issues/IssuesPane.ts +81 -18
  92. package/front_end/panels/issues/issuesTree.css +8 -3
  93. package/front_end/panels/lighthouse/LighthouseController.ts +3 -1
  94. package/front_end/panels/network/NetworkItemView.ts +1 -1
  95. package/front_end/panels/network/networkLogView.css +5 -0
  96. package/front_end/panels/sensors/LocationsSettingsTab.ts +1 -1
  97. package/front_end/panels/settings/SettingsScreen.ts +1 -0
  98. package/front_end/panels/settings/settingsScreen.css +24 -0
  99. package/front_end/panels/snippets/SnippetsQuickOpen.ts +8 -3
  100. package/front_end/panels/sources/TabbedEditorContainer.ts +1 -1
  101. package/front_end/panels/sources/sources-meta.ts +22 -7
  102. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  103. package/front_end/third_party/codemirror.next/package.json +4 -4
  104. package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +137 -0
  105. package/front_end/ui/components/code_highlighter/codeHighlighter.css +51 -0
  106. package/front_end/ui/components/code_highlighter/code_highlighter.ts +11 -0
  107. package/front_end/ui/components/docs/text_editor/basic.html +28 -0
  108. package/front_end/ui/components/docs/text_editor/basic.ts +14 -0
  109. package/front_end/ui/components/docs/text_prompt/basic.html +35 -0
  110. package/front_end/ui/components/docs/text_prompt/basic.ts +19 -0
  111. package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +1 -0
  112. package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +17 -0
  113. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -0
  114. package/front_end/ui/components/text_editor/TextEditor.ts +161 -0
  115. package/front_end/ui/components/text_editor/config.ts +264 -0
  116. package/front_end/{panels/console/components/components.ts → ui/components/text_editor/text_editor.ts} +2 -5
  117. package/front_end/ui/components/text_editor/theme.ts +113 -0
  118. package/front_end/ui/components/text_prompt/TextPrompt.ts +144 -0
  119. package/front_end/ui/components/text_prompt/textPrompt.css +33 -0
  120. package/front_end/ui/components/text_prompt/text_prompt.ts +9 -0
  121. package/front_end/ui/legacy/ARIAUtils.ts +14 -11
  122. package/front_end/ui/legacy/TabbedPane.ts +32 -3
  123. package/front_end/ui/legacy/UIUtils.ts +3 -1
  124. package/front_end/ui/legacy/View.ts +6 -0
  125. package/front_end/ui/legacy/ViewManager.ts +5 -1
  126. package/front_end/ui/legacy/ViewRegistration.ts +5 -0
  127. package/front_end/ui/legacy/XLink.ts +1 -1
  128. package/front_end/ui/legacy/closeButton.css +6 -0
  129. package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +8 -3
  130. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +38 -38
  131. package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +10 -4
  132. package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +23 -6
  133. package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +14 -16
  134. package/front_end/ui/legacy/filter.css +1 -0
  135. package/front_end/ui/legacy/tabbedPane.css +24 -0
  136. package/front_end/ui/legacy/toolbar.css +5 -0
  137. package/inspector_overlay/main.ts +2 -1
  138. package/inspector_overlay/tool_screenshot.ts +8 -1
  139. package/package.json +1 -1
  140. package/scripts/build/rollup.config.js +9 -0
  141. package/scripts/migration/class-fields/migrate.js +56 -0
  142. package/scripts/migration/class-fields/package.json +5 -0
  143. package/front_end/panels/console/components/SidebarDeprecation.ts +0 -58
  144. package/front_end/panels/console/components/sidebarDeprecation.css +0 -17
@@ -13,46 +13,46 @@ import {CSSStyleDeclaration, Type} from './CSSStyleDeclaration.js';
13
13
  import type {DOMNode} from './DOMModel.js';
14
14
 
15
15
  export class CSSMatchedStyles {
16
- private readonly cssModelInternal: CSSModel;
17
- private readonly nodeInternal: DOMNode;
18
- private readonly addedStyles: Map<CSSStyleDeclaration, DOMNode>;
19
- private readonly matchingSelectors: Map<number, Map<string, boolean>>;
20
- private readonly keyframesInternal: CSSKeyframesRule[];
21
- private readonly nodeForStyleInternal: Map<CSSStyleDeclaration, DOMNode|null>;
22
- private readonly inheritedStyles: Set<CSSStyleDeclaration>;
23
- private readonly mainDOMCascade: DOMInheritanceCascade;
24
- private readonly pseudoDOMCascades: Map<Protocol.DOM.PseudoType, DOMInheritanceCascade>;
25
- private readonly styleToDOMCascade: Map<CSSStyleDeclaration, DOMInheritanceCascade>;
16
+ readonly #cssModelInternal: CSSModel;
17
+ readonly #nodeInternal: DOMNode;
18
+ readonly #addedStyles: Map<CSSStyleDeclaration, DOMNode>;
19
+ readonly #matchingSelectors: Map<number, Map<string, boolean>>;
20
+ readonly #keyframesInternal: CSSKeyframesRule[];
21
+ readonly #nodeForStyleInternal: Map<CSSStyleDeclaration, DOMNode|null>;
22
+ readonly #inheritedStyles: Set<CSSStyleDeclaration>;
23
+ readonly #mainDOMCascade: DOMInheritanceCascade;
24
+ readonly #pseudoDOMCascades: Map<Protocol.DOM.PseudoType, DOMInheritanceCascade>;
25
+ readonly #styleToDOMCascade: Map<CSSStyleDeclaration, DOMInheritanceCascade>;
26
26
 
27
27
  constructor(
28
28
  cssModel: CSSModel, node: DOMNode, inlinePayload: Protocol.CSS.CSSStyle|null,
29
29
  attributesPayload: Protocol.CSS.CSSStyle|null, matchedPayload: Protocol.CSS.RuleMatch[],
30
30
  pseudoPayload: Protocol.CSS.PseudoElementMatches[], inheritedPayload: Protocol.CSS.InheritedStyleEntry[],
31
31
  animationsPayload: Protocol.CSS.CSSKeyframesRule[]) {
32
- this.cssModelInternal = cssModel;
33
- this.nodeInternal = node;
34
- this.addedStyles = new Map();
35
- this.matchingSelectors = new Map();
36
- this.keyframesInternal = [];
32
+ this.#cssModelInternal = cssModel;
33
+ this.#nodeInternal = node;
34
+ this.#addedStyles = new Map();
35
+ this.#matchingSelectors = new Map();
36
+ this.#keyframesInternal = [];
37
37
  if (animationsPayload) {
38
- this.keyframesInternal = animationsPayload.map(rule => new CSSKeyframesRule(cssModel, rule));
38
+ this.#keyframesInternal = animationsPayload.map(rule => new CSSKeyframesRule(cssModel, rule));
39
39
  }
40
40
 
41
- this.nodeForStyleInternal = new Map();
42
- this.inheritedStyles = new Set();
41
+ this.#nodeForStyleInternal = new Map();
42
+ this.#inheritedStyles = new Set();
43
43
 
44
44
  matchedPayload = cleanUserAgentPayload(matchedPayload);
45
45
  for (const inheritedResult of inheritedPayload) {
46
46
  inheritedResult.matchedCSSRules = cleanUserAgentPayload(inheritedResult.matchedCSSRules);
47
47
  }
48
48
 
49
- this.mainDOMCascade = this.buildMainCascade(inlinePayload, attributesPayload, matchedPayload, inheritedPayload);
50
- this.pseudoDOMCascades = this.buildPseudoCascades(pseudoPayload);
49
+ this.#mainDOMCascade = this.buildMainCascade(inlinePayload, attributesPayload, matchedPayload, inheritedPayload);
50
+ this.#pseudoDOMCascades = this.buildPseudoCascades(pseudoPayload);
51
51
 
52
- this.styleToDOMCascade = new Map();
53
- for (const domCascade of Array.from(this.pseudoDOMCascades.values()).concat(this.mainDOMCascade)) {
52
+ this.#styleToDOMCascade = new Map();
53
+ for (const domCascade of Array.from(this.#pseudoDOMCascades.values()).concat(this.#mainDOMCascade)) {
54
54
  for (const style of domCascade.styles()) {
55
- this.styleToDOMCascade.set(style, domCascade);
55
+ this.#styleToDOMCascade.set(style, domCascade);
56
56
  }
57
57
  }
58
58
 
@@ -125,68 +125,68 @@ export class CSSMatchedStyles {
125
125
  if (!attributesPayload) {
126
126
  return;
127
127
  }
128
- const style = new CSSStyleDeclaration(this.cssModelInternal, null, attributesPayload, Type.Attributes);
129
- this.nodeForStyleInternal.set(style, this.nodeInternal);
128
+ const style = new CSSStyleDeclaration(this.#cssModelInternal, null, attributesPayload, Type.Attributes);
129
+ this.#nodeForStyleInternal.set(style, this.#nodeInternal);
130
130
  nodeStyles.push(style);
131
131
  }
132
132
 
133
133
  // Inline style has the greatest specificity.
134
- if (inlinePayload && this.nodeInternal.nodeType() === Node.ELEMENT_NODE) {
135
- const style = new CSSStyleDeclaration(this.cssModelInternal, null, inlinePayload, Type.Inline);
136
- this.nodeForStyleInternal.set(style, this.nodeInternal);
134
+ if (inlinePayload && this.#nodeInternal.nodeType() === Node.ELEMENT_NODE) {
135
+ const style = new CSSStyleDeclaration(this.#cssModelInternal, null, inlinePayload, Type.Inline);
136
+ this.#nodeForStyleInternal.set(style, this.#nodeInternal);
137
137
  nodeStyles.push(style);
138
138
  }
139
139
 
140
140
  // Add rules in reverse order to match the cascade order.
141
141
  let addedAttributesStyle;
142
142
  for (let i = matchedPayload.length - 1; i >= 0; --i) {
143
- const rule = new CSSStyleRule(this.cssModelInternal, matchedPayload[i].rule);
143
+ const rule = new CSSStyleRule(this.#cssModelInternal, matchedPayload[i].rule);
144
144
  if ((rule.isInjected() || rule.isUserAgent()) && !addedAttributesStyle) {
145
145
  // Show element's Style Attributes after all author rules.
146
146
  addedAttributesStyle = true;
147
147
  addAttributesStyle.call(this);
148
148
  }
149
- this.nodeForStyleInternal.set(rule.style, this.nodeInternal);
149
+ this.#nodeForStyleInternal.set(rule.style, this.#nodeInternal);
150
150
  nodeStyles.push(rule.style);
151
- this.addMatchingSelectors(this.nodeInternal, rule, matchedPayload[i].matchingSelectors);
151
+ this.addMatchingSelectors(this.#nodeInternal, rule, matchedPayload[i].matchingSelectors);
152
152
  }
153
153
 
154
154
  if (!addedAttributesStyle) {
155
155
  addAttributesStyle.call(this);
156
156
  }
157
- nodeCascades.push(new NodeCascade(this, nodeStyles, false /* isInherited */));
157
+ nodeCascades.push(new NodeCascade(this, nodeStyles, false /* #isInherited */));
158
158
 
159
159
  // Walk the node structure and identify styles with inherited properties.
160
- let parentNode: (DOMNode|null) = this.nodeInternal.parentNode;
160
+ let parentNode: (DOMNode|null) = this.#nodeInternal.parentNode;
161
161
  for (let i = 0; parentNode && inheritedPayload && i < inheritedPayload.length; ++i) {
162
162
  const inheritedStyles = [];
163
163
  const entryPayload = inheritedPayload[i];
164
164
  const inheritedInlineStyle = entryPayload.inlineStyle ?
165
- new CSSStyleDeclaration(this.cssModelInternal, null, entryPayload.inlineStyle, Type.Inline) :
165
+ new CSSStyleDeclaration(this.#cssModelInternal, null, entryPayload.inlineStyle, Type.Inline) :
166
166
  null;
167
167
  if (inheritedInlineStyle && this.containsInherited(inheritedInlineStyle)) {
168
- this.nodeForStyleInternal.set(inheritedInlineStyle, parentNode);
168
+ this.#nodeForStyleInternal.set(inheritedInlineStyle, parentNode);
169
169
  inheritedStyles.push(inheritedInlineStyle);
170
- this.inheritedStyles.add(inheritedInlineStyle);
170
+ this.#inheritedStyles.add(inheritedInlineStyle);
171
171
  }
172
172
 
173
173
  const inheritedMatchedCSSRules = entryPayload.matchedCSSRules || [];
174
174
  for (let j = inheritedMatchedCSSRules.length - 1; j >= 0; --j) {
175
- const inheritedRule = new CSSStyleRule(this.cssModelInternal, inheritedMatchedCSSRules[j].rule);
175
+ const inheritedRule = new CSSStyleRule(this.#cssModelInternal, inheritedMatchedCSSRules[j].rule);
176
176
  this.addMatchingSelectors(parentNode, inheritedRule, inheritedMatchedCSSRules[j].matchingSelectors);
177
177
  if (!this.containsInherited(inheritedRule.style)) {
178
178
  continue;
179
179
  }
180
180
  if (containsStyle(nodeStyles, inheritedRule.style) ||
181
- containsStyle(this.inheritedStyles, inheritedRule.style)) {
181
+ containsStyle(this.#inheritedStyles, inheritedRule.style)) {
182
182
  continue;
183
183
  }
184
- this.nodeForStyleInternal.set(inheritedRule.style, parentNode);
184
+ this.#nodeForStyleInternal.set(inheritedRule.style, parentNode);
185
185
  inheritedStyles.push(inheritedRule.style);
186
- this.inheritedStyles.add(inheritedRule.style);
186
+ this.#inheritedStyles.add(inheritedRule.style);
187
187
  }
188
188
  parentNode = parentNode.parentNode;
189
- nodeCascades.push(new NodeCascade(this, inheritedStyles, true /* isInherited */));
189
+ nodeCascades.push(new NodeCascade(this, inheritedStyles, true /* #isInherited */));
190
190
  }
191
191
 
192
192
  return new DOMInheritanceCascade(nodeCascades);
@@ -214,18 +214,18 @@ export class CSSMatchedStyles {
214
214
  for (let i = 0; i < pseudoPayload.length; ++i) {
215
215
  const entryPayload = pseudoPayload[i];
216
216
  // PseudoElement nodes are not created unless "content" css property is set.
217
- const pseudoElement = this.nodeInternal.pseudoElements().get(entryPayload.pseudoType) || null;
217
+ const pseudoElement = this.#nodeInternal.pseudoElements().get(entryPayload.pseudoType) || null;
218
218
  const pseudoStyles = [];
219
219
  const rules = entryPayload.matches || [];
220
220
  for (let j = rules.length - 1; j >= 0; --j) {
221
- const pseudoRule = new CSSStyleRule(this.cssModelInternal, rules[j].rule);
221
+ const pseudoRule = new CSSStyleRule(this.#cssModelInternal, rules[j].rule);
222
222
  pseudoStyles.push(pseudoRule.style);
223
- this.nodeForStyleInternal.set(pseudoRule.style, pseudoElement);
223
+ this.#nodeForStyleInternal.set(pseudoRule.style, pseudoElement);
224
224
  if (pseudoElement) {
225
225
  this.addMatchingSelectors(pseudoElement, pseudoRule, rules[j].matchingSelectors);
226
226
  }
227
227
  }
228
- const nodeCascade = new NodeCascade(this, pseudoStyles, false /* isInherited */);
228
+ const nodeCascade = new NodeCascade(this, pseudoStyles, false /* #isInherited */);
229
229
  pseudoCascades.set(entryPayload.pseudoType, new DOMInheritanceCascade([nodeCascade]));
230
230
  }
231
231
  return pseudoCascades;
@@ -240,11 +240,11 @@ export class CSSMatchedStyles {
240
240
  }
241
241
 
242
242
  node(): DOMNode {
243
- return this.nodeInternal;
243
+ return this.#nodeInternal;
244
244
  }
245
245
 
246
246
  cssModel(): CSSModel {
247
- return this.cssModelInternal;
247
+ return this.#cssModelInternal;
248
248
  }
249
249
 
250
250
  hasMatchingSelectors(rule: CSSStyleRule): boolean {
@@ -257,7 +257,7 @@ export class CSSMatchedStyles {
257
257
  if (!node || typeof node.id !== 'number') {
258
258
  return [];
259
259
  }
260
- const map = this.matchingSelectors.get(node.id);
260
+ const map = this.#matchingSelectors.get(node.id);
261
261
  if (!map) {
262
262
  return [];
263
263
  }
@@ -289,7 +289,7 @@ export class CSSMatchedStyles {
289
289
  // We assume that "matching" property does not ever change during the
290
290
  // MatchedStyleResult's lifetime.
291
291
  if (typeof node.id === 'number') {
292
- const map = this.matchingSelectors.get(node.id);
292
+ const map = this.#matchingSelectors.get(node.id);
293
293
  if (map && map.has(selectorText)) {
294
294
  return;
295
295
  }
@@ -298,7 +298,7 @@ export class CSSMatchedStyles {
298
298
  if (typeof ownerDocument.id !== 'number') {
299
299
  return;
300
300
  }
301
- const matchingNodeIds = await this.nodeInternal.domModel().querySelectorAll(ownerDocument.id, selectorText);
301
+ const matchingNodeIds = await this.#nodeInternal.domModel().querySelectorAll(ownerDocument.id, selectorText);
302
302
 
303
303
  if (matchingNodeIds) {
304
304
  if (typeof node.id === 'number') {
@@ -311,7 +311,7 @@ export class CSSMatchedStyles {
311
311
  }
312
312
 
313
313
  addNewRule(rule: CSSStyleRule, node: DOMNode): Promise<void> {
314
- this.addedStyles.set(rule.style, node);
314
+ this.#addedStyles.set(rule.style, node);
315
315
  return this.recomputeMatchingSelectors(rule);
316
316
  }
317
317
 
@@ -319,10 +319,10 @@ export class CSSMatchedStyles {
319
319
  if (typeof node.id !== 'number') {
320
320
  return;
321
321
  }
322
- let map = this.matchingSelectors.get(node.id);
322
+ let map = this.#matchingSelectors.get(node.id);
323
323
  if (!map) {
324
324
  map = new Map();
325
- this.matchingSelectors.set(node.id, map);
325
+ this.#matchingSelectors.set(node.id, map);
326
326
  }
327
327
  map.set(selectorText, value);
328
328
  }
@@ -341,20 +341,20 @@ export class CSSMatchedStyles {
341
341
  }
342
342
 
343
343
  nodeStyles(): CSSStyleDeclaration[] {
344
- return this.mainDOMCascade.styles();
344
+ return this.#mainDOMCascade.styles();
345
345
  }
346
346
 
347
347
  keyframes(): CSSKeyframesRule[] {
348
- return this.keyframesInternal;
348
+ return this.#keyframesInternal;
349
349
  }
350
350
 
351
351
  pseudoStyles(pseudoType: Protocol.DOM.PseudoType): CSSStyleDeclaration[] {
352
- const domCascade = this.pseudoDOMCascades.get(pseudoType);
352
+ const domCascade = this.#pseudoDOMCascades.get(pseudoType);
353
353
  return domCascade ? domCascade.styles() : [];
354
354
  }
355
355
 
356
356
  pseudoTypes(): Set<Protocol.DOM.PseudoType> {
357
- return new Set(this.pseudoDOMCascades.keys());
357
+ return new Set(this.#pseudoDOMCascades.keys());
358
358
  }
359
359
 
360
360
  private containsInherited(style: CSSStyleDeclaration): boolean {
@@ -370,63 +370,63 @@ export class CSSMatchedStyles {
370
370
  }
371
371
 
372
372
  nodeForStyle(style: CSSStyleDeclaration): DOMNode|null {
373
- return this.addedStyles.get(style) || this.nodeForStyleInternal.get(style) || null;
373
+ return this.#addedStyles.get(style) || this.#nodeForStyleInternal.get(style) || null;
374
374
  }
375
375
 
376
376
  availableCSSVariables(style: CSSStyleDeclaration): string[] {
377
- const domCascade = this.styleToDOMCascade.get(style) || null;
377
+ const domCascade = this.#styleToDOMCascade.get(style) || null;
378
378
  return domCascade ? domCascade.findAvailableCSSVariables(style) : [];
379
379
  }
380
380
 
381
381
  computeCSSVariable(style: CSSStyleDeclaration, variableName: string): string|null {
382
- const domCascade = this.styleToDOMCascade.get(style) || null;
382
+ const domCascade = this.#styleToDOMCascade.get(style) || null;
383
383
  return domCascade ? domCascade.computeCSSVariable(style, variableName) : null;
384
384
  }
385
385
 
386
386
  computeValue(style: CSSStyleDeclaration, value: string): string|null {
387
- const domCascade = this.styleToDOMCascade.get(style) || null;
387
+ const domCascade = this.#styleToDOMCascade.get(style) || null;
388
388
  return domCascade ? domCascade.computeValue(style, value) : null;
389
389
  }
390
390
 
391
391
  /**
392
- * Same as computeValue, but to be used for `var(--name [,...])` values only
392
+ * Same as computeValue, but to be used for `var(--#name [,...])` values only
393
393
  */
394
394
  computeSingleVariableValue(style: CSSStyleDeclaration, cssVariableValue: string): {
395
395
  computedValue: string|null,
396
396
  fromFallback: boolean,
397
397
  }|null {
398
- const domCascade = this.styleToDOMCascade.get(style) || null;
398
+ const domCascade = this.#styleToDOMCascade.get(style) || null;
399
399
  const cssVariableValueNoSpaces = cssVariableValue.replace(/\s/g, '');
400
400
  return domCascade ? domCascade.computeSingleVariableValue(style, cssVariableValueNoSpaces) : null;
401
401
  }
402
402
 
403
403
  isInherited(style: CSSStyleDeclaration): boolean {
404
- return this.inheritedStyles.has(style);
404
+ return this.#inheritedStyles.has(style);
405
405
  }
406
406
 
407
407
  propertyState(property: CSSProperty): PropertyState|null {
408
- const domCascade = this.styleToDOMCascade.get(property.ownerStyle);
408
+ const domCascade = this.#styleToDOMCascade.get(property.ownerStyle);
409
409
  return domCascade ? domCascade.propertyState(property) : null;
410
410
  }
411
411
 
412
412
  resetActiveProperties(): void {
413
- this.mainDOMCascade.reset();
414
- for (const domCascade of this.pseudoDOMCascades.values()) {
413
+ this.#mainDOMCascade.reset();
414
+ for (const domCascade of this.#pseudoDOMCascades.values()) {
415
415
  domCascade.reset();
416
416
  }
417
417
  }
418
418
  }
419
419
 
420
420
  class NodeCascade {
421
- private matchedStyles: CSSMatchedStyles;
421
+ #matchedStyles: CSSMatchedStyles;
422
422
  readonly styles: CSSStyleDeclaration[];
423
- private readonly isInherited: boolean;
423
+ readonly #isInherited: boolean;
424
424
  readonly propertiesState: Map<CSSProperty, PropertyState>;
425
425
  readonly activeProperties: Map<string, CSSProperty>;
426
426
  constructor(matchedStyles: CSSMatchedStyles, styles: CSSStyleDeclaration[], isInherited: boolean) {
427
- this.matchedStyles = matchedStyles;
427
+ this.#matchedStyles = matchedStyles;
428
428
  this.styles = styles;
429
- this.isInherited = isInherited;
429
+ this.#isInherited = isInherited;
430
430
  this.propertiesState = new Map();
431
431
  this.activeProperties = new Map();
432
432
  }
@@ -441,14 +441,14 @@ class NodeCascade {
441
441
  if (rule && !(rule instanceof CSSStyleRule)) {
442
442
  continue;
443
443
  }
444
- if (rule && !this.matchedStyles.hasMatchingSelectors(rule)) {
444
+ if (rule && !this.#matchedStyles.hasMatchingSelectors(rule)) {
445
445
  continue;
446
446
  }
447
447
 
448
448
  for (const property of style.allProperties()) {
449
449
  // Do not pick non-inherited properties from inherited styles.
450
450
  const metadata = cssMetadata();
451
- if (this.isInherited && !metadata.isPropertyInherited(property.name)) {
451
+ if (this.#isInherited && !metadata.isPropertyInherited(property.name)) {
452
452
  continue;
453
453
  }
454
454
 
@@ -493,34 +493,34 @@ class NodeCascade {
493
493
  }
494
494
 
495
495
  class DOMInheritanceCascade {
496
- private readonly nodeCascades: NodeCascade[];
497
- private readonly propertiesState: Map<CSSProperty, PropertyState>;
498
- private readonly availableCSSVariables: Map<NodeCascade, Map<string, string|null>>;
499
- private readonly computedCSSVariables: Map<NodeCascade, Map<string, string|null>>;
500
- private initialized: boolean;
501
- private readonly styleToNodeCascade: Map<CSSStyleDeclaration, NodeCascade>;
496
+ readonly #nodeCascades: NodeCascade[];
497
+ readonly #propertiesState: Map<CSSProperty, PropertyState>;
498
+ readonly #availableCSSVariables: Map<NodeCascade, Map<string, string|null>>;
499
+ readonly #computedCSSVariables: Map<NodeCascade, Map<string, string|null>>;
500
+ #initialized: boolean;
501
+ readonly #styleToNodeCascade: Map<CSSStyleDeclaration, NodeCascade>;
502
502
  constructor(nodeCascades: NodeCascade[]) {
503
- this.nodeCascades = nodeCascades;
504
- this.propertiesState = new Map();
505
- this.availableCSSVariables = new Map();
506
- this.computedCSSVariables = new Map();
507
- this.initialized = false;
503
+ this.#nodeCascades = nodeCascades;
504
+ this.#propertiesState = new Map();
505
+ this.#availableCSSVariables = new Map();
506
+ this.#computedCSSVariables = new Map();
507
+ this.#initialized = false;
508
508
 
509
- this.styleToNodeCascade = new Map();
509
+ this.#styleToNodeCascade = new Map();
510
510
  for (const nodeCascade of nodeCascades) {
511
511
  for (const style of nodeCascade.styles) {
512
- this.styleToNodeCascade.set(style, nodeCascade);
512
+ this.#styleToNodeCascade.set(style, nodeCascade);
513
513
  }
514
514
  }
515
515
  }
516
516
 
517
517
  findAvailableCSSVariables(style: CSSStyleDeclaration): string[] {
518
- const nodeCascade = this.styleToNodeCascade.get(style);
518
+ const nodeCascade = this.#styleToNodeCascade.get(style);
519
519
  if (!nodeCascade) {
520
520
  return [];
521
521
  }
522
522
  this.ensureInitialized();
523
- const availableCSSVariables = this.availableCSSVariables.get(nodeCascade);
523
+ const availableCSSVariables = this.#availableCSSVariables.get(nodeCascade);
524
524
  if (!availableCSSVariables) {
525
525
  return [];
526
526
  }
@@ -528,13 +528,13 @@ class DOMInheritanceCascade {
528
528
  }
529
529
 
530
530
  computeCSSVariable(style: CSSStyleDeclaration, variableName: string): string|null {
531
- const nodeCascade = this.styleToNodeCascade.get(style);
531
+ const nodeCascade = this.#styleToNodeCascade.get(style);
532
532
  if (!nodeCascade) {
533
533
  return null;
534
534
  }
535
535
  this.ensureInitialized();
536
- const availableCSSVariables = this.availableCSSVariables.get(nodeCascade);
537
- const computedCSSVariables = this.computedCSSVariables.get(nodeCascade);
536
+ const availableCSSVariables = this.#availableCSSVariables.get(nodeCascade);
537
+ const computedCSSVariables = this.#computedCSSVariables.get(nodeCascade);
538
538
  if (!availableCSSVariables || !computedCSSVariables) {
539
539
  return null;
540
540
  }
@@ -542,13 +542,13 @@ class DOMInheritanceCascade {
542
542
  }
543
543
 
544
544
  computeValue(style: CSSStyleDeclaration, value: string): string|null {
545
- const nodeCascade = this.styleToNodeCascade.get(style);
545
+ const nodeCascade = this.#styleToNodeCascade.get(style);
546
546
  if (!nodeCascade) {
547
547
  return null;
548
548
  }
549
549
  this.ensureInitialized();
550
- const availableCSSVariables = this.availableCSSVariables.get(nodeCascade);
551
- const computedCSSVariables = this.computedCSSVariables.get(nodeCascade);
550
+ const availableCSSVariables = this.#availableCSSVariables.get(nodeCascade);
551
+ const computedCSSVariables = this.#computedCSSVariables.get(nodeCascade);
552
552
  if (!availableCSSVariables || !computedCSSVariables) {
553
553
  return null;
554
554
  }
@@ -559,13 +559,13 @@ class DOMInheritanceCascade {
559
559
  computedValue: string|null,
560
560
  fromFallback: boolean,
561
561
  }|null {
562
- const nodeCascade = this.styleToNodeCascade.get(style);
562
+ const nodeCascade = this.#styleToNodeCascade.get(style);
563
563
  if (!nodeCascade) {
564
564
  return null;
565
565
  }
566
566
  this.ensureInitialized();
567
- const availableCSSVariables = this.availableCSSVariables.get(nodeCascade);
568
- const computedCSSVariables = this.computedCSSVariables.get(nodeCascade);
567
+ const availableCSSVariables = this.#availableCSSVariables.get(nodeCascade);
568
+ const computedCSSVariables = this.#computedCSSVariables.get(nodeCascade);
569
569
  if (!availableCSSVariables || !computedCSSVariables) {
570
570
  return null;
571
571
  }
@@ -632,44 +632,44 @@ class DOMInheritanceCascade {
632
632
  }
633
633
 
634
634
  styles(): CSSStyleDeclaration[] {
635
- return Array.from(this.styleToNodeCascade.keys());
635
+ return Array.from(this.#styleToNodeCascade.keys());
636
636
  }
637
637
 
638
638
  propertyState(property: CSSProperty): PropertyState|null {
639
639
  this.ensureInitialized();
640
- return this.propertiesState.get(property) || null;
640
+ return this.#propertiesState.get(property) || null;
641
641
  }
642
642
 
643
643
  reset(): void {
644
- this.initialized = false;
645
- this.propertiesState.clear();
646
- this.availableCSSVariables.clear();
647
- this.computedCSSVariables.clear();
644
+ this.#initialized = false;
645
+ this.#propertiesState.clear();
646
+ this.#availableCSSVariables.clear();
647
+ this.#computedCSSVariables.clear();
648
648
  }
649
649
 
650
650
  private ensureInitialized(): void {
651
- if (this.initialized) {
651
+ if (this.#initialized) {
652
652
  return;
653
653
  }
654
- this.initialized = true;
654
+ this.#initialized = true;
655
655
 
656
656
  const activeProperties = new Map<string, CSSProperty>();
657
- for (const nodeCascade of this.nodeCascades) {
657
+ for (const nodeCascade of this.#nodeCascades) {
658
658
  nodeCascade.computeActiveProperties();
659
659
  for (const entry of nodeCascade.propertiesState.entries()) {
660
660
  const property = (entry[0] as CSSProperty);
661
661
  const state = (entry[1] as PropertyState);
662
662
  if (state === PropertyState.Overloaded) {
663
- this.propertiesState.set(property, PropertyState.Overloaded);
663
+ this.#propertiesState.set(property, PropertyState.Overloaded);
664
664
  continue;
665
665
  }
666
666
  const canonicalName = cssMetadata().canonicalPropertyName(property.name);
667
667
  if (activeProperties.has(canonicalName)) {
668
- this.propertiesState.set(property, PropertyState.Overloaded);
668
+ this.#propertiesState.set(property, PropertyState.Overloaded);
669
669
  continue;
670
670
  }
671
671
  activeProperties.set(canonicalName, property);
672
- this.propertiesState.set(property, PropertyState.Active);
672
+ this.#propertiesState.set(property, PropertyState.Active);
673
673
  }
674
674
  }
675
675
  // If every longhand of the shorthand is not active, then the shorthand is not active too.
@@ -697,13 +697,13 @@ class DOMInheritanceCascade {
697
697
  continue;
698
698
  }
699
699
  activeProperties.delete(canonicalName);
700
- this.propertiesState.set(shorthandProperty, PropertyState.Overloaded);
700
+ this.#propertiesState.set(shorthandProperty, PropertyState.Overloaded);
701
701
  }
702
702
 
703
703
  // Work inheritance chain backwards to compute visible CSS Variables.
704
704
  const accumulatedCSSVariables = new Map<string, string|null>();
705
- for (let i = this.nodeCascades.length - 1; i >= 0; --i) {
706
- const nodeCascade = this.nodeCascades[i];
705
+ for (let i = this.#nodeCascades.length - 1; i >= 0; --i) {
706
+ const nodeCascade = this.#nodeCascades[i];
707
707
  const variableNames = [];
708
708
  for (const entry of nodeCascade.activeProperties.entries()) {
709
709
  const propertyName = (entry[0] as string);
@@ -715,8 +715,8 @@ class DOMInheritanceCascade {
715
715
  }
716
716
  const availableCSSVariablesMap = new Map(accumulatedCSSVariables);
717
717
  const computedVariablesMap = new Map();
718
- this.availableCSSVariables.set(nodeCascade, availableCSSVariablesMap);
719
- this.computedCSSVariables.set(nodeCascade, computedVariablesMap);
718
+ this.#availableCSSVariables.set(nodeCascade, availableCSSVariablesMap);
719
+ this.#computedCSSVariables.set(nodeCascade, computedVariablesMap);
720
720
  for (const variableName of variableNames) {
721
721
  accumulatedCSSVariables.delete(variableName);
722
722
  accumulatedCSSVariables.set(
@@ -9,13 +9,13 @@ import type {CSSModel} from './CSSModel.js';
9
9
  import {CSSQuery} from './CSSQuery.js';
10
10
 
11
11
  export class CSSMediaQuery {
12
- private readonly activeInternal: boolean;
13
- private readonly expressionsInternal: CSSMediaQueryExpression[]|null;
12
+ readonly #activeInternal: boolean;
13
+ readonly #expressionsInternal: CSSMediaQueryExpression[]|null;
14
14
  constructor(payload: Protocol.CSS.MediaQuery) {
15
- this.activeInternal = payload.active;
16
- this.expressionsInternal = [];
15
+ this.#activeInternal = payload.active;
16
+ this.#expressionsInternal = [];
17
17
  for (let j = 0; j < payload.expressions.length; ++j) {
18
- this.expressionsInternal.push(CSSMediaQueryExpression.parsePayload(payload.expressions[j]));
18
+ this.#expressionsInternal.push(CSSMediaQueryExpression.parsePayload(payload.expressions[j]));
19
19
  }
20
20
  }
21
21
 
@@ -24,26 +24,26 @@ export class CSSMediaQuery {
24
24
  }
25
25
 
26
26
  active(): boolean {
27
- return this.activeInternal;
27
+ return this.#activeInternal;
28
28
  }
29
29
 
30
30
  expressions(): CSSMediaQueryExpression[]|null {
31
- return this.expressionsInternal;
31
+ return this.#expressionsInternal;
32
32
  }
33
33
  }
34
34
 
35
35
  export class CSSMediaQueryExpression {
36
- private readonly valueInternal: number;
37
- private readonly unitInternal: string;
38
- private readonly featureInternal: string;
39
- private readonly valueRangeInternal: TextUtils.TextRange.TextRange|null;
40
- private readonly computedLengthInternal: number|null;
36
+ readonly #valueInternal: number;
37
+ readonly #unitInternal: string;
38
+ readonly #featureInternal: string;
39
+ readonly #valueRangeInternal: TextUtils.TextRange.TextRange|null;
40
+ readonly #computedLengthInternal: number|null;
41
41
  constructor(payload: Protocol.CSS.MediaQueryExpression) {
42
- this.valueInternal = payload.value;
43
- this.unitInternal = payload.unit;
44
- this.featureInternal = payload.feature;
45
- this.valueRangeInternal = payload.valueRange ? TextUtils.TextRange.TextRange.fromObject(payload.valueRange) : null;
46
- this.computedLengthInternal = payload.computedLength || null;
42
+ this.#valueInternal = payload.value;
43
+ this.#unitInternal = payload.unit;
44
+ this.#featureInternal = payload.feature;
45
+ this.#valueRangeInternal = payload.valueRange ? TextUtils.TextRange.TextRange.fromObject(payload.valueRange) : null;
46
+ this.#computedLengthInternal = payload.computedLength || null;
47
47
  }
48
48
 
49
49
  static parsePayload(payload: Protocol.CSS.MediaQueryExpression): CSSMediaQueryExpression {
@@ -51,23 +51,23 @@ export class CSSMediaQueryExpression {
51
51
  }
52
52
 
53
53
  value(): number {
54
- return this.valueInternal;
54
+ return this.#valueInternal;
55
55
  }
56
56
 
57
57
  unit(): string {
58
- return this.unitInternal;
58
+ return this.#unitInternal;
59
59
  }
60
60
 
61
61
  feature(): string {
62
- return this.featureInternal;
62
+ return this.#featureInternal;
63
63
  }
64
64
 
65
65
  valueRange(): TextUtils.TextRange.TextRange|null {
66
- return this.valueRangeInternal;
66
+ return this.#valueRangeInternal;
67
67
  }
68
68
 
69
69
  computedLength(): number|null {
70
- return this.computedLengthInternal;
70
+ return this.#computedLengthInternal;
71
71
  }
72
72
  }
73
73