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
@@ -65,6 +65,7 @@ import stylesSidebarPaneStyles from './stylesSidebarPane.css.js';
65
65
 
66
66
  import type {Context} from './StylePropertyTreeElement.js';
67
67
  import {StylePropertyTreeElement} from './StylePropertyTreeElement.js';
68
+ import * as LayersWidget from './LayersWidget.js';
68
69
 
69
70
  const UIStrings = {
70
71
  /**
@@ -187,6 +188,14 @@ const UIStrings = {
187
188
  *@description Tooltip text that appears after clicking on the copy CSS changes button
188
189
  */
189
190
  copiedToClipboard: 'Copied to clipboard',
191
+ /**
192
+ *@description Text displayed on layer separators in the styles sidebar pane.
193
+ */
194
+ layer: 'Layer',
195
+ /**
196
+ *@description Tooltip text for the link in the sidebar pane layer separators that reveals the layer in the layer tree view.
197
+ */
198
+ clickToRevealLayer: 'Click to reveal layer in layer tree',
190
199
  };
191
200
 
192
201
  const str_ = i18n.i18n.registerUIStrings('panels/elements/StylesSidebarPane.ts', UIStrings);
@@ -853,6 +862,31 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
853
862
  const blocks = [new SectionBlock(null)];
854
863
  let sectionIdx = 0;
855
864
  let lastParentNode: SDK.DOMModel.DOMNode|null = null;
865
+
866
+ let lastLayers: SDK.CSSLayer.CSSLayer[]|null = null;
867
+ let sawLayers: boolean = false;
868
+
869
+ const layersExperimentEnabled = Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.CSS_LAYERS);
870
+ const addLayerSeparator = (style: SDK.CSSStyleDeclaration.CSSStyleDeclaration): void => {
871
+ if (!layersExperimentEnabled) {
872
+ return;
873
+ }
874
+ const parentRule = style.parentRule;
875
+ if (parentRule instanceof SDK.CSSRule.CSSStyleRule) {
876
+ const layers = parentRule.layers;
877
+ if ((layers.length || lastLayers) && lastLayers !== layers) {
878
+ const block = SectionBlock.createLayerBlock(layers);
879
+ blocks.push(block);
880
+ sawLayers = true;
881
+ lastLayers = layers;
882
+ }
883
+ }
884
+ };
885
+
886
+ // We disable the layer widget initially. If we see a layer in
887
+ // the matched styles we reenable the button.
888
+ LayersWidget.ButtonProvider.instance().item().setVisible(false);
889
+
856
890
  const refreshedURLs = new Set<string>();
857
891
  for (const style of matchedStyles.nodeStyles()) {
858
892
  if (Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.STYLES_PANE_CSS_CHANGES) && style.parentRule) {
@@ -870,6 +904,8 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
870
904
  blocks.push(block);
871
905
  }
872
906
 
907
+ addLayerSeparator(style);
908
+
873
909
  const lastBlock = blocks[blocks.length - 1];
874
910
  if (lastBlock) {
875
911
  this.idleCallbackManager.schedule(() => {
@@ -887,15 +923,18 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
887
923
  }
888
924
  pseudoTypes = pseudoTypes.concat([...keys].sort());
889
925
  for (const pseudoType of pseudoTypes) {
890
- const block = SectionBlock.createPseudoTypeBlock(pseudoType);
926
+ blocks.push(SectionBlock.createPseudoTypeBlock(pseudoType));
927
+ lastLayers = null;
928
+
891
929
  for (const style of matchedStyles.pseudoStyles(pseudoType)) {
930
+ addLayerSeparator(style);
931
+ const lastBlock = blocks[blocks.length - 1];
892
932
  this.idleCallbackManager.schedule(() => {
893
933
  const section = new StylePropertiesSection(this, matchedStyles, style, sectionIdx);
894
934
  sectionIdx++;
895
- block.sections.push(section);
935
+ lastBlock.sections.push(section);
896
936
  });
897
937
  }
898
- blocks.push(block);
899
938
  }
900
939
 
901
940
  for (const keyframesRule of matchedStyles.keyframes()) {
@@ -909,6 +948,18 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
909
948
  blocks.push(block);
910
949
  }
911
950
 
951
+ if (layersExperimentEnabled) {
952
+ // If we have seen a layer in matched styles we enable
953
+ // the layer widget button.
954
+ if (sawLayers) {
955
+ LayersWidget.ButtonProvider.instance().item().setVisible(true);
956
+ } else if (LayersWidget.LayersWidget.instance().isShowing()) {
957
+ // Since the button for toggling the layers view is now hidden
958
+ // we ensure that the layers view is not currently toggled.
959
+ ElementsPanel.instance().showToolbarPane(null, LayersWidget.ButtonProvider.instance().item());
960
+ }
961
+ }
962
+
912
963
  await this.idleCallbackManager.awaitDone();
913
964
 
914
965
  return blocks;
@@ -1379,6 +1430,23 @@ export class SectionBlock {
1379
1430
  return new SectionBlock(separatorElement);
1380
1431
  }
1381
1432
 
1433
+ static createLayerBlock(layers: SDK.CSSLayer.CSSLayer[]): SectionBlock {
1434
+ const separatorElement = document.createElement('div');
1435
+ separatorElement.className = 'sidebar-separator layer-separator';
1436
+ UI.UIUtils.createTextChild(separatorElement.createChild('div'), i18nString(UIStrings.layer));
1437
+ if (!layers.length) {
1438
+ UI.UIUtils.createTextChild(separatorElement.createChild('div'), '\xa0user\xa0agent\xa0stylesheet');
1439
+ return new SectionBlock(separatorElement);
1440
+ }
1441
+ const layerLink = separatorElement.createChild('button') as HTMLButtonElement;
1442
+ layerLink.className = 'link';
1443
+ layerLink.title = i18nString(UIStrings.clickToRevealLayer);
1444
+ const name = layers.map(layer => layer.text || '<anonymous>').join('.');
1445
+ layerLink.textContent = name;
1446
+ layerLink.onclick = (): Promise<void> => LayersWidget.LayersWidget.instance().revealLayer(name);
1447
+ return new SectionBlock(separatorElement);
1448
+ }
1449
+
1382
1450
  updateFilter(): boolean {
1383
1451
  let hasAnyVisibleSection = false;
1384
1452
  for (const section of this.sections) {
@@ -513,7 +513,7 @@ Common.Revealer.registerRevealer({
513
513
  UI.Toolbar.registerToolbarItem({
514
514
  async loadItem() {
515
515
  const Elements = await loadElementsModule();
516
- return Elements.ElementStatePaneWidget.ButtonProvider.instance();
516
+ return Elements.LayersWidget.ButtonProvider.instance();
517
517
  },
518
518
  order: 1,
519
519
  location: UI.Toolbar.ToolbarItemLocation.STYLES_SIDEBARPANE_TOOLBAR,
@@ -526,7 +526,7 @@ UI.Toolbar.registerToolbarItem({
526
526
  UI.Toolbar.registerToolbarItem({
527
527
  async loadItem() {
528
528
  const Elements = await loadElementsModule();
529
- return Elements.ClassesPaneWidget.ButtonProvider.instance();
529
+ return Elements.ElementStatePaneWidget.ButtonProvider.instance();
530
530
  },
531
531
  order: 2,
532
532
  location: UI.Toolbar.ToolbarItemLocation.STYLES_SIDEBARPANE_TOOLBAR,
@@ -536,6 +536,19 @@ UI.Toolbar.registerToolbarItem({
536
536
  actionId: undefined,
537
537
  });
538
538
 
539
+ UI.Toolbar.registerToolbarItem({
540
+ async loadItem() {
541
+ const Elements = await loadElementsModule();
542
+ return Elements.ClassesPaneWidget.ButtonProvider.instance();
543
+ },
544
+ order: 3,
545
+ location: UI.Toolbar.ToolbarItemLocation.STYLES_SIDEBARPANE_TOOLBAR,
546
+ showLabel: undefined,
547
+ condition: undefined,
548
+ separator: undefined,
549
+ actionId: undefined,
550
+ });
551
+
539
552
  UI.Toolbar.registerToolbarItem({
540
553
  async loadItem() {
541
554
  const Elements = await loadElementsModule();
@@ -39,6 +39,7 @@ import * as ElementsTreeElementHighlighter from './ElementsTreeElementHighlighte
39
39
  import * as ElementsTreeOutline from './ElementsTreeOutline.js';
40
40
  import * as EventListenersWidget from './EventListenersWidget.js';
41
41
  import * as InspectElementModeController from './InspectElementModeController.js';
42
+ import * as LayersWidget from './LayersWidget.js';
42
43
  import * as LayoutSidebarPane from './LayoutSidebarPane.js';
43
44
  import * as MarkerDecorator from './MarkerDecorator.js';
44
45
  import * as MetricsSidebarPane from './MetricsSidebarPane.js';
@@ -66,6 +67,7 @@ export {
66
67
  ElementsTreeOutline,
67
68
  EventListenersWidget,
68
69
  InspectElementModeController,
70
+ LayersWidget,
69
71
  LayoutSidebarPane,
70
72
  MarkerDecorator,
71
73
  MetricsSidebarPane,
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright 2022 The Chromium Authors. All rights reserved.
3
+ * Use of this source code is governed by a BSD-style license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ .styles-layers-pane {
8
+ overflow: hidden;
9
+ padding-left: 2px;
10
+ background-color: var(--color-background-elevation-1);
11
+ border-bottom: 1px solid var(--color-details-hairline);
12
+ margin-top: 0;
13
+ padding-bottom: 2px;
14
+ }
15
+
16
+ .styles-layers-pane > div {
17
+ font-weight: bold;
18
+ margin: 8px 4px 6px;
19
+ }
20
+
21
+ .styles-layers-pane > table {
22
+ width: 100%;
23
+ border-spacing: 0;
24
+ }
25
+
26
+ .styles-layers-pane td {
27
+ padding: 0;
28
+ }
@@ -217,6 +217,10 @@
217
217
  margin-left: 2px;
218
218
  }
219
219
 
220
+ .sidebar-separator.layer-separator {
221
+ display: flex;
222
+ }
223
+
220
224
  .sidebar-pane-section-toolbar {
221
225
  position: absolute;
222
226
  right: 0;
@@ -109,7 +109,7 @@ const UIStrings = {
109
109
  */
110
110
  lighthouseMode: 'Lighthouse mode',
111
111
  /**
112
- * @description Tooltip text of a radio button to select the Lighthouse mode.
112
+ * @description Tooltip text of a radio button to select the Lighthouse mode. "Navigation" is a Lighthouse mode that audits a page navigation. "Timespan" is a Lighthouse mode that audits user interactions over a period of time. "Snapshot" is a Lighthouse mode that audits the current page state.
113
113
  */
114
114
  runLighthouseInMode: 'Run Lighthouse in navigation, timespan, or snapshot mode',
115
115
  /**
@@ -150,9 +150,9 @@ const UIStrings = {
150
150
  */
151
151
  legacyNavigation: 'Legacy navigation',
152
152
  /**
153
- * @description Tooltip text that appears when hovering over the 'Legacy navigation' checkbox in the settings pane opened by clicking the setting cog in the start view of the audits panel
153
+ * @description Tooltip text that appears when hovering over the 'Legacy navigation' checkbox in the settings pane opened by clicking the setting cog in the start view of the audits panel. "Navigation mode" is a Lighthouse mode that analyzes a page navigation.
154
154
  */
155
- useLegacyNavigation: 'Audit the page using classic Lighthouse when in navigation mode.',
155
+ useLegacyNavigation: 'Analyze the page using classic Lighthouse when in navigation mode.',
156
156
  /**
157
157
  * @description Tooltip text of checkbox to reset storage features prior to running audits in
158
158
  * Lighthouse. Resetting the storage clears/empties it to a neutral state.
@@ -16,6 +16,7 @@
16
16
  .status-dialog-line {
17
17
  margin: 2px;
18
18
  height: 14px;
19
+ min-height: auto;
19
20
  display: flex;
20
21
  align-items: baseline;
21
22
  }
@@ -15,6 +15,7 @@ declare module 'estree' {
15
15
  // The @types/estree do not export the types to a namespace. Since we reference
16
16
  // these types as "ESTree.Node", we need to explicitly re-export them here.
17
17
  export type ArrayPattern = estree.ArrayPattern;
18
+ export type AssignmentProperty = estree.AssignmentProperty;
18
19
  export type CatchClause = estree.CatchClause;
19
20
  export type Class = estree.Class;
20
21
  export type Expression = estree.Expression;
@@ -4,11 +4,12 @@
4
4
 
5
5
  import * as CodeMirror from '../../../third_party/codemirror.next/codemirror.next.js';
6
6
 
7
+ export type ArgumentHintsTooltip = [CodeMirror.StateField<CodeMirror.Tooltip|null>, CodeMirror.ViewPlugin<{}>];
7
8
  export const closeTooltip = CodeMirror.StateEffect.define<null>();
8
9
 
9
10
  export function cursorTooltip(
10
11
  source: (state: CodeMirror.EditorState, pos: number) => Promise<(() => CodeMirror.TooltipView)|null>,
11
- ): CodeMirror.Extension {
12
+ ): ArgumentHintsTooltip {
12
13
  const openTooltip = CodeMirror.StateEffect.define<() => CodeMirror.TooltipView>();
13
14
 
14
15
  const state = CodeMirror.StateField.define<null|CodeMirror.Tooltip>({
@@ -8,7 +8,7 @@ import * as JavaScriptMetaData from '../../../models/javascript_metadata/javascr
8
8
  import * as CodeMirror from '../../../third_party/codemirror.next/codemirror.next.js';
9
9
  import * as UI from '../../legacy/legacy.js';
10
10
 
11
- import {closeTooltip, cursorTooltip} from './cursor_tooltip.js';
11
+ import {type ArgumentHintsTooltip, closeTooltip, cursorTooltip} from './cursor_tooltip.js';
12
12
 
13
13
  export function completion(): CodeMirror.Extension {
14
14
  return CodeMirror.javascript.javascriptLanguage.data.of({
@@ -421,12 +421,19 @@ export async function isExpressionComplete(expression: string): Promise<boolean>
421
421
  return false;
422
422
  }
423
423
 
424
- export function argumentHints(): CodeMirror.Extension {
424
+ export function argumentHints(): ArgumentHintsTooltip {
425
425
  return cursorTooltip(getArgumentHints);
426
426
  }
427
427
 
428
- export function closeArgumentsHintsTooltip(view: CodeMirror.EditorView): void {
428
+ export function closeArgumentsHintsTooltip(
429
+ view: CodeMirror.EditorView, tooltip: CodeMirror.StateField<CodeMirror.Tooltip|null>): boolean {
430
+ // If the tooltip is currently showing, the state will reflect its properties.
431
+ // If it isn't showing, the state is explicitly set to `null`.
432
+ if (view.state.field(tooltip) === null) {
433
+ return false;
434
+ }
429
435
  view.dispatch({effects: closeTooltip.of(null)});
436
+ return true;
430
437
  }
431
438
 
432
439
  async function getArgumentHints(
@@ -542,6 +542,7 @@ export class ToolbarButton extends ToolbarItem<ToolbarButton.EventTypes> {
542
542
  private textElement: HTMLElement;
543
543
  private text?: string;
544
544
  private glyph?: string;
545
+ private icon?: HTMLElement;
545
546
  /**
546
547
  * TODO(crbug.com/1126026): remove glyph parameter in favor of icon.
547
548
  */
@@ -557,11 +558,8 @@ export class ToolbarButton extends ToolbarItem<ToolbarButton.EventTypes> {
557
558
  this.textElement = this.element.createChild('div', 'toolbar-text hidden');
558
559
 
559
560
  this.setTitle(title);
560
- if (glyphOrIcon instanceof HTMLElement) {
561
- glyphOrIcon.classList.add('toolbar-icon');
562
- this.element.append(glyphOrIcon);
563
- } else if (glyphOrIcon) {
564
- this.setGlyph(glyphOrIcon);
561
+ if (glyphOrIcon) {
562
+ this.setGlyphOrIcon(glyphOrIcon);
565
563
  }
566
564
  this.setText(text || '');
567
565
  this.title = '';
@@ -580,6 +578,20 @@ export class ToolbarButton extends ToolbarItem<ToolbarButton.EventTypes> {
580
578
  this.text = text;
581
579
  }
582
580
 
581
+ setGlyphOrIcon(glyphOrIcon: string|HTMLElement): void {
582
+ if (glyphOrIcon instanceof HTMLElement) {
583
+ glyphOrIcon.classList.add('toolbar-icon');
584
+ if (this.icon) {
585
+ this.icon.replaceWith(glyphOrIcon);
586
+ } else {
587
+ this.element.appendChild(glyphOrIcon);
588
+ }
589
+ this.icon = glyphOrIcon;
590
+ } else if (glyphOrIcon) {
591
+ this.setGlyph(glyphOrIcon);
592
+ }
593
+ }
594
+
583
595
  setGlyph(glyph: string): void {
584
596
  if (this.glyph === glyph) {
585
597
  return;
@@ -739,14 +751,14 @@ export namespace ToolbarInput {
739
751
 
740
752
  export class ToolbarToggle extends ToolbarButton {
741
753
  private toggledInternal: boolean;
742
- private readonly untoggledGlyph: string|undefined;
743
- private readonly toggledGlyph: string|undefined;
754
+ private readonly untoggledGlyphOrIcon: string|HTMLElement|undefined;
755
+ private readonly toggledGlyphOrIcon: string|HTMLElement|undefined;
744
756
 
745
- constructor(title: string, glyph?: string, toggledGlyph?: string) {
746
- super(title, glyph, '');
757
+ constructor(title: string, glyphOrIcon?: string|HTMLElement, toggledGlyphOrIcon?: string|HTMLElement) {
758
+ super(title, glyphOrIcon, '');
747
759
  this.toggledInternal = false;
748
- this.untoggledGlyph = glyph;
749
- this.toggledGlyph = toggledGlyph;
760
+ this.untoggledGlyphOrIcon = glyphOrIcon;
761
+ this.toggledGlyphOrIcon = toggledGlyphOrIcon;
750
762
  this.element.classList.add('toolbar-state-off');
751
763
  ARIAUtils.setPressed(this.element, false);
752
764
  }
@@ -763,8 +775,8 @@ export class ToolbarToggle extends ToolbarButton {
763
775
  this.element.classList.toggle('toolbar-state-on', toggled);
764
776
  this.element.classList.toggle('toolbar-state-off', !toggled);
765
777
  ARIAUtils.setPressed(this.element, toggled);
766
- if (this.toggledGlyph && this.untoggledGlyph) {
767
- this.setGlyph(toggled ? this.toggledGlyph : this.untoggledGlyph);
778
+ if (this.toggledGlyphOrIcon && this.untoggledGlyphOrIcon) {
779
+ this.setGlyphOrIcon(toggled ? this.toggledGlyphOrIcon : this.untoggledGlyphOrIcon);
768
780
  }
769
781
  }
770
782
 
package/package.json CHANGED
@@ -54,5 +54,5 @@
54
54
  "unittest": "scripts/test/run_unittests.py --no-text-coverage",
55
55
  "watch": "third_party/node/node.py --output scripts/watch_build.js"
56
56
  },
57
- "version": "1.0.974080"
57
+ "version": "1.0.975442"
58
58
  }
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env vpython
1
+ #!/usr/bin/env vpython3
2
2
  # -*- coding: UTF-8 -*-
3
3
  #
4
4
  # Copyright 2021 The Chromium Authors. All rights reserved.
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env vpython
1
+ #!/usr/bin/env vpython3
2
2
  # -*- coding: UTF-8 -*-
3
3
  #
4
4
  # Copyright 2022 The Chromium Authors. All rights reserved.
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env vpython
1
+ #!/usr/bin/env vpython3
2
2
  # -*- coding: utf-8 -*-
3
3
  #
4
4
  # Copyright 2020 The Chromium Authors. All rights reserved.
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env vpython
1
+ #!/usr/bin/env vpython3
2
2
  # Copyright (c) 2011 Google Inc. All rights reserved.
3
3
  # Copyright (c) 2012 Intel Corporation. All rights reserved.
4
4
  #
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env vpython
1
+ #!/usr/bin/env vpython3
2
2
  #
3
3
  # Copyright 2019 The Chromium Authors. All rights reserved.
4
4
  # Use of this source code is governed by a BSD-style license that can be
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env vpython3
2
+ #
1
3
  # Copyright 2018 The Chromium Authors. All rights reserved.
2
4
  # Use of this source code is governed by a BSD-style license that can be
3
5
  # found in the LICENSE file.
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env vpython
1
+ #!/usr/bin/env vpython3
2
2
  #
3
3
  # Copyright (C) 2011 Google Inc. All rights reserved.
4
4
  #
@@ -29,13 +29,9 @@
29
29
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
30
  """Creates a grd file for packaging the inspector files."""
31
31
 
32
- from __future__ import with_statement
33
- from os import path
34
32
 
35
- import errno
36
33
  import os
37
34
  import shlex
38
- import shutil
39
35
  import sys
40
36
  from xml.dom import minidom
41
37
 
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env vpython
1
+ #!/usr/bin/env vpython3
2
2
  # Copyright (c) 2014 Google Inc. All rights reserved.
3
3
  #
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -44,7 +44,7 @@ READ_LOCATION = path.join(ROOT_DIRECTORY, 'third_party', 'blink', 'renderer', 'c
44
44
 
45
45
 
46
46
  def _keep_only_required_keys(entry):
47
- for key in entry.keys():
47
+ for key in list(entry.keys()):
48
48
  if key not in ("name", "longhands", "svg", "inherited", "keywords"):
49
49
  del entry[key]
50
50
  return entry
@@ -70,9 +70,10 @@ def properties_from_file(file_name):
70
70
  properties.append(_keep_only_required_keys(entry))
71
71
  property_names[entry["name"]] = entry
72
72
  if "keywords" in entry:
73
- keywords = list(
74
- filter(lambda keyword: not keyword.startswith("-internal-"),
75
- entry["keywords"]))
73
+ keywords = [
74
+ keyword for keyword in entry["keywords"]
75
+ if not keyword.startswith("-internal-")
76
+ ]
76
77
  property_values[entry["name"]] = {"values": keywords}
77
78
 
78
79
  properties.sort(key=lambda entry: entry["name"])