chrome-devtools-frontend 1.0.957983 → 1.0.959844

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 (111) hide show
  1. package/.eslintignore +0 -1
  2. package/AUTHORS +1 -0
  3. package/config/owner/COMMON_OWNERS +0 -1
  4. package/config/owner/INFRA_OWNERS +0 -1
  5. package/front_end/Images/generate-css-vars.js +12 -13
  6. package/front_end/core/i18n/locales/af.json +399 -354
  7. package/front_end/core/i18n/locales/am.json +399 -354
  8. package/front_end/core/i18n/locales/ar.json +399 -354
  9. package/front_end/core/i18n/locales/as.json +399 -354
  10. package/front_end/core/i18n/locales/az.json +399 -354
  11. package/front_end/core/i18n/locales/be.json +399 -354
  12. package/front_end/core/i18n/locales/bg.json +399 -354
  13. package/front_end/core/i18n/locales/bn.json +399 -354
  14. package/front_end/core/i18n/locales/bs.json +400 -355
  15. package/front_end/core/i18n/locales/ca.json +399 -354
  16. package/front_end/core/i18n/locales/cs.json +399 -354
  17. package/front_end/core/i18n/locales/cy.json +399 -354
  18. package/front_end/core/i18n/locales/da.json +399 -354
  19. package/front_end/core/i18n/locales/de.json +399 -354
  20. package/front_end/core/i18n/locales/el.json +399 -354
  21. package/front_end/core/i18n/locales/en-GB.json +420 -375
  22. package/front_end/core/i18n/locales/es-419.json +399 -354
  23. package/front_end/core/i18n/locales/es.json +399 -354
  24. package/front_end/core/i18n/locales/et.json +399 -354
  25. package/front_end/core/i18n/locales/eu.json +403 -358
  26. package/front_end/core/i18n/locales/fa.json +399 -354
  27. package/front_end/core/i18n/locales/fi.json +399 -354
  28. package/front_end/core/i18n/locales/fil.json +399 -354
  29. package/front_end/core/i18n/locales/fr-CA.json +399 -354
  30. package/front_end/core/i18n/locales/fr.json +399 -354
  31. package/front_end/core/i18n/locales/gl.json +399 -354
  32. package/front_end/core/i18n/locales/gu.json +399 -354
  33. package/front_end/core/i18n/locales/he.json +399 -354
  34. package/front_end/core/i18n/locales/hi.json +399 -354
  35. package/front_end/core/i18n/locales/hr.json +399 -354
  36. package/front_end/core/i18n/locales/hu.json +399 -354
  37. package/front_end/core/i18n/locales/hy.json +399 -354
  38. package/front_end/core/i18n/locales/id.json +399 -354
  39. package/front_end/core/i18n/locales/is.json +399 -354
  40. package/front_end/core/i18n/locales/it.json +399 -354
  41. package/front_end/core/i18n/locales/ja.json +399 -354
  42. package/front_end/core/i18n/locales/ka.json +399 -354
  43. package/front_end/core/i18n/locales/kk.json +400 -355
  44. package/front_end/core/i18n/locales/km.json +399 -354
  45. package/front_end/core/i18n/locales/kn.json +399 -354
  46. package/front_end/core/i18n/locales/ko.json +399 -354
  47. package/front_end/core/i18n/locales/ky.json +399 -354
  48. package/front_end/core/i18n/locales/lo.json +399 -354
  49. package/front_end/core/i18n/locales/lt.json +399 -354
  50. package/front_end/core/i18n/locales/lv.json +399 -354
  51. package/front_end/core/i18n/locales/mk.json +399 -354
  52. package/front_end/core/i18n/locales/ml.json +399 -354
  53. package/front_end/core/i18n/locales/mn.json +399 -354
  54. package/front_end/core/i18n/locales/mr.json +399 -354
  55. package/front_end/core/i18n/locales/ms.json +399 -354
  56. package/front_end/core/i18n/locales/my.json +399 -354
  57. package/front_end/core/i18n/locales/ne.json +399 -354
  58. package/front_end/core/i18n/locales/nl.json +399 -354
  59. package/front_end/core/i18n/locales/no.json +399 -354
  60. package/front_end/core/i18n/locales/or.json +399 -354
  61. package/front_end/core/i18n/locales/pa.json +410 -365
  62. package/front_end/core/i18n/locales/pl.json +399 -354
  63. package/front_end/core/i18n/locales/pt-PT.json +399 -354
  64. package/front_end/core/i18n/locales/pt.json +399 -354
  65. package/front_end/core/i18n/locales/ro.json +399 -354
  66. package/front_end/core/i18n/locales/ru.json +399 -354
  67. package/front_end/core/i18n/locales/si.json +399 -354
  68. package/front_end/core/i18n/locales/sk.json +399 -354
  69. package/front_end/core/i18n/locales/sl.json +399 -354
  70. package/front_end/core/i18n/locales/sq.json +399 -354
  71. package/front_end/core/i18n/locales/sr-Latn.json +399 -354
  72. package/front_end/core/i18n/locales/sr.json +399 -354
  73. package/front_end/core/i18n/locales/sv.json +399 -354
  74. package/front_end/core/i18n/locales/sw.json +399 -354
  75. package/front_end/core/i18n/locales/ta.json +405 -360
  76. package/front_end/core/i18n/locales/te.json +399 -354
  77. package/front_end/core/i18n/locales/th.json +399 -354
  78. package/front_end/core/i18n/locales/tr.json +399 -354
  79. package/front_end/core/i18n/locales/uk.json +399 -354
  80. package/front_end/core/i18n/locales/ur.json +399 -354
  81. package/front_end/core/i18n/locales/uz.json +399 -354
  82. package/front_end/core/i18n/locales/vi.json +399 -354
  83. package/front_end/core/i18n/locales/zh-HK.json +399 -354
  84. package/front_end/core/i18n/locales/zh-TW.json +399 -354
  85. package/front_end/core/i18n/locales/zh.json +399 -354
  86. package/front_end/core/i18n/locales/zu.json +399 -354
  87. package/front_end/core/platform/generate-dcheck.js +2 -2
  88. package/front_end/core/sdk/ProfileTreeModel.ts +1 -1
  89. package/front_end/entrypoints/main/main-meta.ts +24 -24
  90. package/front_end/generated/SupportedCSSProperties.js +2 -2
  91. package/front_end/models/persistence/Automapping.ts +32 -4
  92. package/front_end/models/persistence/PersistenceImpl.ts +33 -13
  93. package/front_end/models/persistence/WorkspaceSettingsTab.ts +0 -1
  94. package/front_end/models/persistence/workspaceSettingsTab.css +3 -7
  95. package/front_end/panels/elements/AccessibilityTreeView.ts +2 -2
  96. package/front_end/panels/elements/ElementsPanel.ts +34 -29
  97. package/front_end/panels/elements/elementsPanel.css +10 -4
  98. package/front_end/panels/settings/settingsScreen.css +4 -3
  99. package/front_end/panels/sources/sources-meta.ts +14 -11
  100. package/front_end/ui/components/buttons/Button.ts +5 -1
  101. package/front_end/ui/components/buttons/button.css +10 -1
  102. package/front_end/ui/legacy/filter.css +1 -0
  103. package/front_end/ui/legacy/toolbar.css +2 -0
  104. package/package.json +1 -1
  105. package/scripts/build/generate_css_js_files.js +8 -6
  106. package/scripts/build/generate_html_entrypoint.js +2 -1
  107. package/scripts/build/ninja/copy-file.js +2 -1
  108. package/scripts/build/ninja/copy-files.js +2 -1
  109. package/scripts/build/ninja/generate-declaration.js +2 -1
  110. package/scripts/build/ninja/node.gni +4 -1
  111. package/scripts/build/ninja/write-if-changed.js +27 -0
@@ -2,8 +2,8 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- const fs = require('fs');
6
5
  const path = require('path');
6
+ const {writeIfChanged} = require('../../../scripts/build/ninja/write-if-changed.js');
7
7
  const [, , targetGenDir] = process.argv;
8
8
 
9
9
  let functionImplementation = '';
@@ -16,6 +16,6 @@ if (process.argv.includes('--should-dcheck')) {
16
16
  `;
17
17
  }
18
18
 
19
- fs.writeFileSync(
19
+ writeIfChanged(
20
20
  path.join(targetGenDir, 'dcheck.js'),
21
21
  `export function DCHECK(condition, message = 'DCHECK') {${functionImplementation}}`);
@@ -32,7 +32,7 @@ export class ProfileNode {
32
32
  }
33
33
 
34
34
  get scriptId(): Protocol.Runtime.ScriptId {
35
- return this.callFrame.scriptId;
35
+ return String(this.callFrame.scriptId) as Protocol.Runtime.ScriptId;
36
36
  }
37
37
 
38
38
  get url(): string {
@@ -672,6 +672,30 @@ Common.Settings.registerSettingExtension({
672
672
  ],
673
673
  });
674
674
 
675
+ // Not all locales that are supported should also be made available in the
676
+ // settings. Filter out pseudo locales e.g.
677
+ function filterLocalesForSettings(): string[] {
678
+ return i18n.i18n.getAllSupportedDevToolsLocales().filter(locale => locale !== 'en-XL');
679
+ }
680
+
681
+ Common.Settings.registerSettingExtension({
682
+ category: Common.Settings.SettingCategory.APPEARANCE,
683
+ storageType: Common.Settings.SettingStorageType.Synced,
684
+ settingName: 'language',
685
+ settingType: Common.Settings.SettingType.ENUM,
686
+ title: i18nLazyString(UIStrings.language),
687
+ defaultValue: 'en-US',
688
+ options: [
689
+ {
690
+ value: 'browserLanguage',
691
+ title: i18nLazyString(UIStrings.browserLanguage),
692
+ text: i18nLazyString(UIStrings.browserLanguage),
693
+ },
694
+ ...filterLocalesForSettings().map(locale => createOptionForLocale(locale)),
695
+ ],
696
+ reloadRequired: true,
697
+ });
698
+
675
699
  Common.Settings.registerSettingExtension({
676
700
  category: Common.Settings.SettingCategory.APPEARANCE,
677
701
  storageType: Common.Settings.SettingStorageType.Synced,
@@ -743,30 +767,6 @@ function createOptionForLocale(localeString: string): Common.Settings.SettingExt
743
767
  };
744
768
  }
745
769
 
746
- // Not all locales that are supported should also be made available in the
747
- // settings. Filter out pseudo locales e.g.
748
- function filterLocalesForSettings(): string[] {
749
- return i18n.i18n.getAllSupportedDevToolsLocales().filter(locale => locale !== 'en-XL');
750
- }
751
-
752
- Common.Settings.registerSettingExtension({
753
- category: Common.Settings.SettingCategory.APPEARANCE,
754
- storageType: Common.Settings.SettingStorageType.Synced,
755
- settingName: 'language',
756
- settingType: Common.Settings.SettingType.ENUM,
757
- title: i18nLazyString(UIStrings.language),
758
- defaultValue: 'en-US',
759
- options: [
760
- {
761
- value: 'browserLanguage',
762
- title: i18nLazyString(UIStrings.browserLanguage),
763
- text: i18nLazyString(UIStrings.browserLanguage),
764
- },
765
- ...filterLocalesForSettings().map(locale => createOptionForLocale(locale)),
766
- ],
767
- reloadRequired: true,
768
- });
769
-
770
770
  Common.Settings.registerSettingExtension({
771
771
  category: Common.Settings.SettingCategory.SYNC,
772
772
  // This name must be kept in sync with DevToolsSettings::kSyncDevToolsPreferencesFrontendName.
@@ -582,7 +582,7 @@ export const generatedProperties = [
582
582
  'name': 'mix-blend-mode',
583
583
  'keywords': [
584
584
  'normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light',
585
- 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity'
585
+ 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity', 'plus-lighter'
586
586
  ]
587
587
  },
588
588
  {'name': 'negative'},
@@ -1086,7 +1086,7 @@ export const generatedPropertyValues = {
1086
1086
  'mix-blend-mode': {
1087
1087
  'values': [
1088
1088
  'normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light',
1089
- 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity'
1089
+ 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity', 'plus-lighter'
1090
1090
  ]
1091
1091
  },
1092
1092
  'object-fit': {'values': ['fill', 'contain', 'cover', 'none', 'scale-down']},
@@ -3,6 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as Common from '../../core/common/common.js';
6
+ import * as Host from '../../core/host/host.js';
6
7
  import * as i18n from '../../core/i18n/i18n.js';
7
8
  import * as Platform from '../../core/platform/platform.js';
8
9
  import * as SDK from '../../core/sdk/sdk.js';
@@ -28,7 +29,7 @@ export class Automapping {
28
29
  private readonly onStatusAdded: (arg0: AutomappingStatus) => Promise<void>;
29
30
  private readonly onStatusRemoved: (arg0: AutomappingStatus) => Promise<void>;
30
31
  private readonly statuses: Set<AutomappingStatus>;
31
- private readonly fileSystemUISourceCodes: Map<string, Workspace.UISourceCode.UISourceCode>;
32
+ private readonly fileSystemUISourceCodes: FileSystemUISourceCodes;
32
33
  private readonly sweepThrottler: Common.Throttler.Throttler;
33
34
  private readonly sourceCodeToProcessingPromiseMap: WeakMap<Workspace.UISourceCode.UISourceCode, Promise<void>>;
34
35
  private readonly sourceCodeToAutoMappingStatusMap: WeakMap<Workspace.UISourceCode.UISourceCode, AutomappingStatus>;
@@ -47,7 +48,7 @@ export class Automapping {
47
48
  this.onStatusRemoved = onStatusRemoved;
48
49
  this.statuses = new Set();
49
50
 
50
- this.fileSystemUISourceCodes = new Map();
51
+ this.fileSystemUISourceCodes = new FileSystemUISourceCodes();
51
52
  this.sweepThrottler = new Common.Throttler.Throttler(100);
52
53
 
53
54
  this.sourceCodeToProcessingPromiseMap = new WeakMap();
@@ -144,7 +145,7 @@ export class Automapping {
144
145
  return;
145
146
  }
146
147
  this.filesIndex.addPath(uiSourceCode.url());
147
- this.fileSystemUISourceCodes.set(uiSourceCode.url(), uiSourceCode);
148
+ this.fileSystemUISourceCodes.add(uiSourceCode);
148
149
  this.scheduleSweep();
149
150
  } else if (project.type() === Workspace.Workspace.projectTypes.Network) {
150
151
  this.computeNetworkStatus(uiSourceCode);
@@ -179,7 +180,7 @@ export class Automapping {
179
180
  }
180
181
 
181
182
  this.filesIndex.addPath(uiSourceCode.url());
182
- this.fileSystemUISourceCodes.set(uiSourceCode.url(), uiSourceCode);
183
+ this.fileSystemUISourceCodes.add(uiSourceCode);
183
184
  this.scheduleSweep();
184
185
  }
185
186
 
@@ -489,6 +490,33 @@ class FolderIndex {
489
490
  }
490
491
  }
491
492
 
493
+ class FileSystemUISourceCodes {
494
+ private readonly sourceCodes: Map<string, Workspace.UISourceCode.UISourceCode>;
495
+
496
+ constructor() {
497
+ this.sourceCodes = new Map();
498
+ }
499
+
500
+ private getPlatformCanonicalFileUrl(path: string): string {
501
+ return Host.Platform.isWin() ? path.toLowerCase() : path;
502
+ }
503
+
504
+ add(sourceCode: Workspace.UISourceCode.UISourceCode): void {
505
+ const fileUrl = this.getPlatformCanonicalFileUrl(sourceCode.url());
506
+ this.sourceCodes.set(fileUrl, sourceCode);
507
+ }
508
+
509
+ get(fileUrl: string): Workspace.UISourceCode.UISourceCode|undefined {
510
+ fileUrl = this.getPlatformCanonicalFileUrl(fileUrl);
511
+ return this.sourceCodes.get(fileUrl);
512
+ }
513
+
514
+ delete(fileUrl: string): void {
515
+ fileUrl = this.getPlatformCanonicalFileUrl(fileUrl);
516
+ this.sourceCodes.delete(fileUrl);
517
+ }
518
+ }
519
+
492
520
  export class AutomappingStatus {
493
521
  network: Workspace.UISourceCode.UISourceCode;
494
522
  fileSystem: Workspace.UISourceCode.UISourceCode;
@@ -3,6 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as Common from '../../core/common/common.js';
6
+ import * as Host from '../../core/host/host.js';
6
7
  import * as Platform from '../../core/platform/platform.js';
7
8
  import * as SDK from '../../core/sdk/sdk.js';
8
9
  import * as Components from '../../ui/legacy/components/utils/utils.js';
@@ -18,7 +19,7 @@ let persistenceInstance: PersistenceImpl;
18
19
  export class PersistenceImpl extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
19
20
  private readonly workspace: Workspace.Workspace.WorkspaceImpl;
20
21
  private readonly breakpointManager: Bindings.BreakpointManager.BreakpointManager;
21
- private readonly filePathPrefixesToBindingCount: Map<string, number>;
22
+ private readonly filePathPrefixesToBindingCount: FilePathPrefixesBindingCounts;
22
23
  private subscribedBindingEventListeners:
23
24
  Platform.MapUtilities.Multimap<Workspace.UISourceCode.UISourceCode, () => void>;
24
25
  private readonly mapping: Automapping;
@@ -28,7 +29,7 @@ export class PersistenceImpl extends Common.ObjectWrapper.ObjectWrapper<EventTyp
28
29
  super();
29
30
  this.workspace = workspace;
30
31
  this.breakpointManager = breakpointManager;
31
- this.filePathPrefixesToBindingCount = new Map();
32
+ this.filePathPrefixesToBindingCount = new FilePathPrefixesBindingCounts();
32
33
 
33
34
  this.subscribedBindingEventListeners = new Platform.MapUtilities.Multimap();
34
35
 
@@ -92,7 +93,7 @@ export class PersistenceImpl extends Common.ObjectWrapper.ObjectWrapper<EventTyp
92
93
  binding.fileSystem.addEventListener(
93
94
  Workspace.UISourceCode.Events.WorkingCopyChanged, this.onWorkingCopyChanged, this);
94
95
 
95
- this.addFilePathBindingPrefixes(binding.fileSystem.url());
96
+ this.filePathPrefixesToBindingCount.add(binding.fileSystem.url());
96
97
 
97
98
  await this.moveBreakpoints(binding.fileSystem, binding.network);
98
99
 
@@ -131,7 +132,7 @@ export class PersistenceImpl extends Common.ObjectWrapper.ObjectWrapper<EventTyp
131
132
  binding.fileSystem.removeEventListener(
132
133
  Workspace.UISourceCode.Events.WorkingCopyChanged, this.onWorkingCopyChanged, this);
133
134
 
134
- this.removeFilePathBindingPrefixes(binding.fileSystem.url());
135
+ this.filePathPrefixesToBindingCount.remove(binding.fileSystem.url());
135
136
  await this.breakpointManager.copyBreakpoints(binding.network.url(), binding.fileSystem);
136
137
 
137
138
  this.notifyBindingEvent(binding.network);
@@ -307,33 +308,52 @@ export class PersistenceImpl extends Common.ObjectWrapper.ObjectWrapper<EventTyp
307
308
  return binding ? binding.network : null;
308
309
  }
309
310
 
310
- private addFilePathBindingPrefixes(filePath: string): void {
311
+ filePathHasBindings(filePath: string): boolean {
312
+ return this.filePathPrefixesToBindingCount.hasBindingPrefix(filePath);
313
+ }
314
+ }
315
+
316
+ class FilePathPrefixesBindingCounts {
317
+ private prefixCounts: Map<string, number>;
318
+
319
+ constructor() {
320
+ this.prefixCounts = new Map();
321
+ }
322
+
323
+ private getPlatformCanonicalFilePath(path: string): string {
324
+ return Host.Platform.isWin() ? path.toLowerCase() : path;
325
+ }
326
+
327
+ add(filePath: string): void {
328
+ filePath = this.getPlatformCanonicalFilePath(filePath);
311
329
  let relative = '';
312
330
  for (const token of filePath.split('/')) {
313
331
  relative += token + '/';
314
- const count = this.filePathPrefixesToBindingCount.get(relative) || 0;
315
- this.filePathPrefixesToBindingCount.set(relative, count + 1);
332
+ const count = this.prefixCounts.get(relative) || 0;
333
+ this.prefixCounts.set(relative, count + 1);
316
334
  }
317
335
  }
318
336
 
319
- private removeFilePathBindingPrefixes(filePath: string): void {
337
+ remove(filePath: string): void {
338
+ filePath = this.getPlatformCanonicalFilePath(filePath);
320
339
  let relative = '';
321
340
  for (const token of filePath.split('/')) {
322
341
  relative += token + '/';
323
- const count = this.filePathPrefixesToBindingCount.get(relative);
342
+ const count = this.prefixCounts.get(relative);
324
343
  if (count === 1) {
325
- this.filePathPrefixesToBindingCount.delete(relative);
344
+ this.prefixCounts.delete(relative);
326
345
  } else if (count !== undefined) {
327
- this.filePathPrefixesToBindingCount.set(relative, count - 1);
346
+ this.prefixCounts.set(relative, count - 1);
328
347
  }
329
348
  }
330
349
  }
331
350
 
332
- filePathHasBindings(filePath: string): boolean {
351
+ hasBindingPrefix(filePath: string): boolean {
352
+ filePath = this.getPlatformCanonicalFilePath(filePath);
333
353
  if (!filePath.endsWith('/')) {
334
354
  filePath += '/';
335
355
  }
336
- return this.filePathPrefixesToBindingCount.has(filePath);
356
+ return this.prefixCounts.has(filePath);
337
357
  }
338
358
  }
339
359
 
@@ -106,7 +106,6 @@ export class WorkspaceSettingsTab extends UI.Widget.VBox {
106
106
  const inputElement = UI.UIUtils.createInput('', 'text');
107
107
  UI.ARIAUtils.bindLabelToControl(labelElement, inputElement);
108
108
  p.appendChild(inputElement);
109
- inputElement.style.width = '270px';
110
109
  const folderExcludeSetting = IsolatedFileSystemManager.instance().workspaceFolderExcludePatternSetting();
111
110
  const setValue =
112
111
  UI.UIUtils.bindInput(inputElement, folderExcludeSetting.set.bind(folderExcludeSetting), regexValidator, false);
@@ -32,11 +32,6 @@
32
32
  column-width: 308px;
33
33
  }
34
34
 
35
- .workspace-settings-tab .settings-tab label {
36
- padding-right: 4px;
37
- display: inline-flex;
38
- }
39
-
40
35
  .workspace-settings-tab .settings-container-wrapper {
41
36
  position: absolute;
42
37
  top: 31px;
@@ -57,12 +52,13 @@
57
52
  }
58
53
 
59
54
  .workspace-settings-tab p.folder-exclude-pattern {
60
- display: flex;
55
+ display: grid;
61
56
  align-items: center;
62
57
  }
63
58
 
64
59
  .workspace-settings-tab p.folder-exclude-pattern > input {
65
- flex: auto;
60
+ width: 80%;
61
+ margin-left: 10px;
66
62
  }
67
63
 
68
64
  .workspace-settings-tab .settings-tab .file-system-container {
@@ -12,11 +12,11 @@ import {ElementsPanel} from './ElementsPanel.js';
12
12
  export class AccessibilityTreeView extends UI.Widget.VBox implements
13
13
  SDK.TargetManager.SDKModelObserver<SDK.AccessibilityModel.AccessibilityModel> {
14
14
  private accessibilityTreeComponent = new TreeOutline.TreeOutline.TreeOutline<AccessibilityTreeUtils.AXTreeNodeData>();
15
- private readonly toggleButton: HTMLButtonElement;
15
+ private readonly toggleButton: HTMLElement;
16
16
  private inspectedDOMNode: SDK.DOMModel.DOMNode|null = null;
17
17
  private root: SDK.AccessibilityModel.AccessibilityNode|null = null;
18
18
 
19
- constructor(toggleButton: HTMLButtonElement) {
19
+ constructor(toggleButton: HTMLElement) {
20
20
  super();
21
21
  // toggleButton is bound to a click handler on ElementsPanel to switch between the DOM tree
22
22
  // and accessibility tree views.
@@ -42,7 +42,7 @@ import * as Extensions from '../../models/extensions/extensions.js';
42
42
  import elementsPanelStyles from './elementsPanel.css.js';
43
43
 
44
44
  import type * as Adorners from '../../ui/components/adorners/adorners.js';
45
- import * as IconButton from '../../ui/components/icon_button/icon_button.js';
45
+ import * as Buttons from '../../ui/components/buttons/buttons.js';
46
46
  import * as Components from '../../ui/legacy/components/utils/utils.js';
47
47
  import * as UI from '../../ui/legacy/legacy.js';
48
48
 
@@ -142,20 +142,21 @@ const UIStrings = {
142
142
  const str_ = i18n.i18n.registerUIStrings('panels/elements/ElementsPanel.ts', UIStrings);
143
143
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
144
144
 
145
- const createAccessibilityTreeToggleButton = (isActive: boolean): HTMLButtonElement => {
146
- const button = document.createElement('button');
145
+ const createAccessibilityTreeToggleButton = (isActive: boolean): HTMLElement => {
146
+ const button = new Buttons.Button.Button();
147
+ const title =
148
+ isActive ? i18nString(UIStrings.switchToDomTreeView) : i18nString(UIStrings.switchToAccessibilityTreeView);
149
+ button.data = {
150
+ active: isActive,
151
+ variant: Buttons.Button.Variant.TOOLBAR,
152
+ iconUrl: new URL('../../Images/accessibility-icon.svg', import.meta.url).toString(),
153
+ title,
154
+ };
155
+ button.tabIndex = 0;
156
+ button.classList.add('axtree-button');
147
157
  if (isActive) {
148
- button.classList.add('axtree-button', 'axtree-button-active');
149
- } else {
150
- button.classList.add('axtree-button');
158
+ button.classList.add('active');
151
159
  }
152
- button.tabIndex = 0;
153
- button.title =
154
- isActive ? i18nString(UIStrings.switchToDomTreeView) : i18nString(UIStrings.switchToAccessibilityTreeView);
155
- const icon = new IconButton.Icon.Icon();
156
- const bgColor = isActive ? 'var(--color-primary)' : 'var(--color-text-secondary)';
157
- icon.data = {iconName: 'accessibility-icon', color: bgColor, width: '16px', height: '16px'};
158
- button.appendChild(icon);
159
160
  return button;
160
161
  };
161
162
 
@@ -166,7 +167,8 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
166
167
  UI.View.ViewLocationResolver {
167
168
  private splitWidget: UI.SplitWidget.SplitWidget;
168
169
  private readonly searchableViewInternal: UI.SearchableView.SearchableView;
169
- private contentElementInternal: HTMLDivElement;
170
+ private mainContainer: HTMLDivElement;
171
+ private domTreeContainer: HTMLDivElement;
170
172
  private splitMode: _splitMode|null;
171
173
  private readonly accessibilityTreeView: AccessibilityTreeView|undefined;
172
174
  private breadcrumbs: ElementsComponents.ElementsBreadcrumbs.ElementsBreadcrumbs;
@@ -185,8 +187,8 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
185
187
  private readonly adornerManager: ElementsComponents.AdornerManager.AdornerManager;
186
188
  private adornerSettingsPane: ElementsComponents.AdornerSettingsPane.AdornerSettingsPane|null;
187
189
  private readonly adornersByName: Map<string, Set<Adorners.Adorner.Adorner>>;
188
- accessibilityTreeButton?: HTMLButtonElement;
189
- domTreeButton?: HTMLButtonElement;
190
+ accessibilityTreeButton?: HTMLElement;
191
+ domTreeButton?: HTMLElement;
190
192
  private selectedNodeOnReset?: SDK.DOMModel.DOMNode;
191
193
  private hasNonDefaultSelectedNode?: boolean;
192
194
  private searchConfig?: UI.SearchableView.SearchConfig;
@@ -210,24 +212,27 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
210
212
  this.searchableViewInternal.setPlaceholder(i18nString(UIStrings.findByStringSelectorOrXpath));
211
213
  const stackElement = this.searchableViewInternal.element;
212
214
 
213
- this.contentElementInternal = document.createElement('div');
215
+ this.mainContainer = document.createElement('div');
216
+ this.domTreeContainer = document.createElement('div');
214
217
  const crumbsContainer = document.createElement('div');
215
218
  if (Root.Runtime.experiments.isEnabled('fullAccessibilityTree')) {
216
219
  this.initializeFullAccessibilityTreeView();
217
220
  }
218
- stackElement.appendChild(this.contentElementInternal);
221
+ this.mainContainer.appendChild(this.domTreeContainer);
222
+ stackElement.appendChild(this.mainContainer);
219
223
  stackElement.appendChild(crumbsContainer);
220
224
 
221
- UI.ARIAUtils.markAsMain(this.contentElementInternal);
222
- UI.ARIAUtils.setAccessibleName(this.contentElementInternal, i18nString(UIStrings.domTreeExplorer));
225
+ UI.ARIAUtils.markAsMain(this.domTreeContainer);
226
+ UI.ARIAUtils.setAccessibleName(this.domTreeContainer, i18nString(UIStrings.domTreeExplorer));
223
227
 
224
228
  this.splitWidget.setMainWidget(this.searchableViewInternal);
225
229
  this.splitMode = null;
226
230
 
227
- this.contentElementInternal.id = 'elements-content';
231
+ this.mainContainer.id = 'main-content';
232
+ this.domTreeContainer.id = 'elements-content';
228
233
  // FIXME: crbug.com/425984
229
234
  if (Common.Settings.Settings.instance().moduleSetting('domWordWrap').get()) {
230
- this.contentElementInternal.classList.add('elements-wrap');
235
+ this.domTreeContainer.classList.add('elements-wrap');
231
236
  }
232
237
  Common.Settings.Settings.instance()
233
238
  .moduleSetting('domWordWrap')
@@ -281,7 +286,7 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
281
286
  this.domTreeButton = createAccessibilityTreeToggleButton(true);
282
287
  this.domTreeButton.addEventListener('click', this.showDOMTree.bind(this));
283
288
 
284
- this.contentElementInternal.appendChild(this.accessibilityTreeButton);
289
+ this.mainContainer.appendChild(this.accessibilityTreeButton);
285
290
  }
286
291
 
287
292
  private showAccessibilityTree(): void {
@@ -432,12 +437,12 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
432
437
 
433
438
  for (const treeOutline of this.treeOutlines) {
434
439
  // Attach heavy component lazily
435
- if (treeOutline.element.parentElement !== this.contentElementInternal) {
440
+ if (treeOutline.element.parentElement !== this.domTreeContainer) {
436
441
  const header = this.treeOutlineHeaders.get(treeOutline);
437
442
  if (header) {
438
- this.contentElementInternal.appendChild(header);
443
+ this.domTreeContainer.appendChild(header);
439
444
  }
440
- this.contentElementInternal.appendChild(treeOutline.element);
445
+ this.domTreeContainer.appendChild(treeOutline.element);
441
446
  }
442
447
  }
443
448
 
@@ -468,10 +473,10 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
468
473
  for (const treeOutline of this.treeOutlines) {
469
474
  treeOutline.setVisible(false);
470
475
  // Detach heavy component on hide
471
- this.contentElementInternal.removeChild(treeOutline.element);
476
+ this.domTreeContainer.removeChild(treeOutline.element);
472
477
  const header = this.treeOutlineHeaders.get(treeOutline);
473
478
  if (header) {
474
- this.contentElementInternal.removeChild(header);
479
+ this.domTreeContainer.removeChild(header);
475
480
  }
476
481
  }
477
482
  super.willHide();
@@ -667,7 +672,7 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
667
672
  }
668
673
 
669
674
  private domWordWrapSettingChanged(event: Common.EventTarget.EventTargetEvent<boolean>): void {
670
- this.contentElementInternal.classList.toggle('elements-wrap', event.data);
675
+ this.domTreeContainer.classList.toggle('elements-wrap', event.data);
671
676
  for (const treeOutline of this.treeOutlines) {
672
677
  treeOutline.setWordWrap(event.data);
673
678
  }
@@ -27,11 +27,15 @@
27
27
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
28
  */
29
29
 
30
- #elements-content {
30
+ #main-content {
31
+ position: relative;
31
32
  flex: 1 1;
33
+ }
34
+
35
+ #elements-content {
32
36
  overflow: auto;
33
37
  padding: 2px 0 0;
34
- position: relative;
38
+ height: 100%;
35
39
  }
36
40
 
37
41
  .style-panes-wrapper {
@@ -82,11 +86,13 @@ devtools-tree-outline {
82
86
 
83
87
  .axtree-button {
84
88
  position: absolute;
85
- padding: 4px;
86
89
  top: 16px;
87
- right: 16px;
90
+ right: 20px;
91
+ background-color: var(--color-background-elevation-1);
88
92
  display: flex;
89
93
  justify-content: center;
90
94
  align-items: center;
91
95
  z-index: 1;
96
+ border: 1px solid var(--color-details-hairline);
97
+ border-radius: 3px;
92
98
  }
@@ -80,9 +80,9 @@ fieldset {
80
80
  align-items: center;
81
81
  }
82
82
 
83
- .experiments-filter label {
83
+ label {
84
84
  padding-right: 8px;
85
- flex-shrink: 0;
85
+ padding-bottom: 8px;
86
86
  }
87
87
 
88
88
  .settings-tab p {
@@ -95,7 +95,7 @@ fieldset {
95
95
 
96
96
  .settings-select {
97
97
  align-items: center;
98
- display: flex;
98
+ display: grid;
99
99
  }
100
100
 
101
101
  .settings-experiments-warning-subsection-warning {
@@ -174,6 +174,7 @@ fieldset {
174
174
 
175
175
  .settings-tab select {
176
176
  margin-left: 10px;
177
+ width: 80%;
177
178
  }
178
179
 
179
180
  .settings-experiment {
@@ -3,6 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as Common from '../../core/common/common.js';
6
+ import * as Host from '../../core/host/host.js';
6
7
  import * as i18n from '../../core/i18n/i18n.js';
7
8
  import * as Root from '../../core/root/root.js';
8
9
  import * as SDK from '../../core/sdk/sdk.js';
@@ -1097,17 +1098,19 @@ UI.ActionRegistration.registerActionExtension({
1097
1098
  title: i18nLazyString(UIStrings.createNewSnippet),
1098
1099
  });
1099
1100
 
1100
- UI.ActionRegistration.registerActionExtension({
1101
- category: UI.ActionRegistration.ActionCategory.SOURCES,
1102
- actionId: 'sources.add-folder-to-workspace',
1103
- async loadActionDelegate() {
1104
- const Sources = await loadSourcesModule();
1105
- return Sources.SourcesNavigator.ActionDelegate.instance();
1106
- },
1107
- iconClass: UI.ActionRegistration.IconClass.LARGE_ICON_ADD,
1108
- title: i18nLazyString(UIStrings.addFolderToWorkspace),
1109
- condition: Root.Runtime.ConditionName.NOT_SOURCES_HIDE_ADD_FOLDER,
1110
- });
1101
+ if (!Host.InspectorFrontendHost.InspectorFrontendHostInstance.isHostedMode()) {
1102
+ UI.ActionRegistration.registerActionExtension({
1103
+ category: UI.ActionRegistration.ActionCategory.SOURCES,
1104
+ actionId: 'sources.add-folder-to-workspace',
1105
+ async loadActionDelegate() {
1106
+ const Sources = await loadSourcesModule();
1107
+ return Sources.SourcesNavigator.ActionDelegate.instance();
1108
+ },
1109
+ iconClass: UI.ActionRegistration.IconClass.LARGE_ICON_ADD,
1110
+ title: i18nLazyString(UIStrings.addFolderToWorkspace),
1111
+ condition: Root.Runtime.ConditionName.NOT_SOURCES_HIDE_ADD_FOLDER,
1112
+ });
1113
+ }
1111
1114
 
1112
1115
  UI.ActionRegistration.registerActionExtension({
1113
1116
  category: UI.ActionRegistration.ActionCategory.DEBUGGER,
@@ -36,6 +36,7 @@ interface ButtonState {
36
36
  spinner?: boolean;
37
37
  type: ButtonType;
38
38
  value?: string;
39
+ title?: string;
39
40
  }
40
41
 
41
42
  export type ButtonData = {
@@ -47,6 +48,7 @@ export type ButtonData = {
47
48
  spinner?: boolean,
48
49
  type?: ButtonType,
49
50
  value?: string,
51
+ title?: string,
50
52
  }|{
51
53
  variant: Variant.PRIMARY | Variant.SECONDARY,
52
54
  iconUrl?: string,
@@ -56,6 +58,7 @@ export type ButtonData = {
56
58
  spinner?: boolean,
57
59
  type?: ButtonType,
58
60
  value?: string,
61
+ title?: string,
59
62
  };
60
63
 
61
64
  interface ButtonElementInternals extends ElementInternals {
@@ -101,6 +104,7 @@ export class Button extends HTMLElement {
101
104
  this.#props.spinner = Boolean(data.spinner);
102
105
  this.#props.type = data.type || 'button';
103
106
  this.#setDisabledProperty(data.disabled || false);
107
+ this.#props.title = data.title;
104
108
  void ComponentHelpers.ScheduledRender.scheduleRender(this, this.#boundRender);
105
109
  }
106
110
 
@@ -208,7 +212,7 @@ export class Button extends HTMLElement {
208
212
  // clang-format off
209
213
  LitHtml.render(
210
214
  LitHtml.html`
211
- <button .disabled=${this.#props.disabled} class=${LitHtml.Directives.classMap(classes)}>
215
+ <button .title=${this.#props.title} .disabled=${this.#props.disabled} class=${LitHtml.Directives.classMap(classes)}>
212
216
  ${this.#props.iconUrl ? LitHtml.html`<${IconButton.Icon.Icon.litTagName}
213
217
  .data=${{
214
218
  iconPath: this.#props.iconUrl,
@@ -169,7 +169,7 @@ button.toolbar devtools-icon {
169
169
  width: 24px;
170
170
  height: 24px;
171
171
 
172
- --icon-color: var(--color-text-primary);
172
+ --icon-color: var(--color-text-secondary);
173
173
  }
174
174
 
175
175
  button.primary devtools-icon {
@@ -190,6 +190,15 @@ button.toolbar.small devtools-icon {
190
190
  height: 18px;
191
191
  }
192
192
 
193
+ button.toolbar.active devtools-icon,
194
+ button.toolbar:active devtools-icon {
195
+ --icon-color: var(--color-primary);
196
+ }
197
+
198
+ button.toolbar:hover devtools-icon {
199
+ --icon-color: var(--color-text-primary);
200
+ }
201
+
193
202
  button.toolbar:disabled devtools-icon {
194
203
  --icon-color: var(--color-text-disabled);
195
204
  }
@@ -65,6 +65,7 @@
65
65
  border-radius: 6px;
66
66
  overflow: hidden;
67
67
  cursor: pointer;
68
+ line-height: 1.2;
68
69
  }
69
70
 
70
71
  .filter-bitset-filter span:focus-visible {