chrome-devtools-frontend 1.0.955630 → 1.0.956881

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 (72) hide show
  1. package/AUTHORS +1 -0
  2. package/config/gni/devtools_grd_files.gni +0 -2
  3. package/front_end/.eslintrc.js +1 -11
  4. package/front_end/Images/generate-css-vars.js +2 -2
  5. package/front_end/core/common/ParsedURL.ts +35 -2
  6. package/front_end/core/common/Settings.ts +1 -1
  7. package/front_end/core/host/InspectorFrontendHost.ts +2 -1
  8. package/front_end/core/i18n/i18nImpl.ts +2 -3
  9. package/front_end/core/i18n/locales/en-US.json +0 -3
  10. package/front_end/core/i18n/locales/en-XL.json +0 -3
  11. package/front_end/core/root/Runtime.ts +0 -72
  12. package/front_end/core/root/root-legacy.ts +0 -2
  13. package/front_end/entrypoints/formatter_worker/FormatterActions.ts +10 -0
  14. package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +3 -4
  15. package/front_end/entrypoints/lighthouse_worker/LighthouseService.ts +4 -7
  16. package/front_end/entrypoints/main/MainImpl.ts +21 -13
  17. package/front_end/entrypoints/main/main-meta.ts +1 -1
  18. package/front_end/generated/protocol.d.ts +1 -0
  19. package/front_end/global_typings/global_defs.d.ts +0 -1
  20. package/front_end/models/extensions/ExtensionServer.ts +1 -22
  21. package/front_end/models/formatter/FormatterWorkerPool.ts +2 -12
  22. package/front_end/models/formatter/ScriptFormatter.ts +3 -3
  23. package/front_end/models/issues_manager/DeprecationIssue.ts +7 -7
  24. package/front_end/panels/console/ConsoleSidebar.ts +9 -9
  25. package/front_end/panels/elements/ElementsPanel.ts +1 -1
  26. package/front_end/panels/elements/ElementsTreeElement.ts +5 -4
  27. package/front_end/panels/elements/components/LayoutPane.ts +1 -1
  28. package/front_end/panels/emulation/AdvancedApp.ts +2 -2
  29. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -1
  30. package/front_end/panels/sources/SourcesPanel.ts +1 -1
  31. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +19 -0
  32. package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +7 -1
  33. package/front_end/third_party/acorn/acorn.ts +1 -1
  34. package/front_end/ui/legacy/GlassPane.ts +0 -1
  35. package/front_end/ui/legacy/ResizerWidget.ts +4 -2
  36. package/front_end/ui/legacy/SoftDropDown.ts +2 -1
  37. package/front_end/ui/legacy/TextPrompt.ts +2 -2
  38. package/front_end/ui/legacy/Treeoutline.ts +9 -15
  39. package/front_end/ui/legacy/UIUtils.ts +17 -24
  40. package/front_end/ui/legacy/ViewManager.ts +1 -1
  41. package/front_end/ui/legacy/Widget.ts +3 -2
  42. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +5 -5
  43. package/front_end/ui/legacy/components/color_picker/spectrum.css +5 -2
  44. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +1 -0
  45. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +13 -18
  46. package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +2 -1
  47. package/front_end/ui/legacy/components/perf_ui/TimelineGrid.ts +1 -2
  48. package/front_end/ui/legacy/components/perf_ui/flameChart.css +8 -0
  49. package/front_end/ui/legacy/components/source_frame/FontView.ts +0 -1
  50. package/front_end/ui/legacy/components/source_frame/ImageView.ts +0 -1
  51. package/front_end/ui/legacy/components/source_frame/JSONView.ts +0 -1
  52. package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +0 -1
  53. package/front_end/ui/legacy/components/source_frame/XMLView.ts +0 -2
  54. package/front_end/ui/legacy/inspectorSyntaxHighlight.css +8 -11
  55. package/front_end/ui/legacy/softContextMenu.css +4 -1
  56. package/front_end/ui/legacy/tabbedPane.css +1 -0
  57. package/front_end/ui/legacy/themeColors.css +3 -1
  58. package/front_end/ui/legacy/theme_support/theme_support_impl.ts +24 -234
  59. package/front_end/ui/legacy/treeoutline.css +0 -4
  60. package/front_end/ui/legacy/utils/create-shadow-root-with-core-styles.ts +3 -2
  61. package/front_end/ui/legacy/utils/inject-core-styles.ts +3 -31
  62. package/front_end/ui/legacy/utils/utils.ts +1 -5
  63. package/front_end/ui/lit-html/lit-html.ts +1 -1
  64. package/package.json +1 -1
  65. package/scripts/build/generate_css_js_files.js +2 -2
  66. package/scripts/build/ninja/generate_css.gni +3 -0
  67. package/scripts/component_server/server.js +2 -2
  68. package/scripts/eslint_rules/lib/no_bound_component_methods.js +116 -0
  69. package/scripts/eslint_rules/tests/no_bound_component_methods_test.js +85 -0
  70. package/front_end/global_typings/intl_display_names.d.ts +0 -111
  71. package/front_end/ui/legacy/inspectorSyntaxHighlightDark.css +0 -270
  72. package/front_end/ui/legacy/utils/append-style.ts +0 -9
@@ -257,7 +257,8 @@ export class PerformanceMonitorImpl extends UI.Widget.HBox implements
257
257
  color: metricInfo.color,
258
258
  });
259
259
  }
260
- const backgroundColor = Common.Color.Color.parse(UI.Utils.getThemeColorValue('--color-background'));
260
+ const backgroundColor =
261
+ Common.Color.Color.parse(ThemeSupport.ThemeSupport.instance().getComputedValue('--color-background'));
261
262
 
262
263
  if (backgroundColor) {
263
264
  for (const path of paths.reverse()) {
@@ -566,7 +566,7 @@ export class SourcesPanel extends UI.Panel.Panel implements UI.ContextMenu.Provi
566
566
  const enabled = Common.Settings.Settings.instance().moduleSetting('pauseOnExceptionEnabled').get();
567
567
  const button = (this.pauseOnExceptionButton as UI.Toolbar.ToolbarToggle);
568
568
  button.setToggled(enabled);
569
- button.setTitle(enabled ? i18nString(UIStrings.pauseOnExceptions) : i18nString(UIStrings.dontPauseOnExceptions));
569
+ button.setTitle(enabled ? i18nString(UIStrings.dontPauseOnExceptions) : i18nString(UIStrings.pauseOnExceptions));
570
570
  this.debugToolbarDrawer.classList.toggle('expanded', enabled);
571
571
  }
572
572
 
@@ -243,6 +243,25 @@ export class TimelineFlameChartDataProvider extends Common.ObjectWrapper.ObjectW
243
243
  this.interactionsHeaderLevel2 = this.buildGroupStyle({padding: 2, nestingLevel: 1});
244
244
  this.experienceHeader = this.buildGroupStyle({collapsible: false});
245
245
 
246
+ ThemeSupport.ThemeSupport.instance().addEventListener(ThemeSupport.ThemeChangeEvent.eventName, () => {
247
+ const headers = [
248
+ this.headerLevel1,
249
+ this.headerLevel2,
250
+ this.staticHeader,
251
+ this.framesHeader,
252
+ this.collapsibleTimingsHeader,
253
+ this.timingsHeader,
254
+ this.screenshotsHeader,
255
+ this.interactionsHeaderLevel1,
256
+ this.interactionsHeaderLevel2,
257
+ this.experienceHeader,
258
+ ];
259
+ for (const header of headers) {
260
+ header.color = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-text-primary');
261
+ header.backgroundColor = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-background');
262
+ }
263
+ });
264
+
246
265
  this.flowEventIndexById = new Map();
247
266
  }
248
267
 
@@ -79,6 +79,12 @@ export class TimelineFlameChartNetworkDataProvider implements PerfUI.FlameChart.
79
79
  this.timeSpan = 0;
80
80
  this.requests = [];
81
81
  this.maxLevel = 0;
82
+
83
+ // In the event of a theme change, these colors must be recalculated.
84
+ ThemeSupport.ThemeSupport.instance().addEventListener(ThemeSupport.ThemeChangeEvent.eventName, () => {
85
+ this.style.color = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-text-primary');
86
+ this.style.backgroundColor = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-background');
87
+ });
82
88
  }
83
89
 
84
90
  setModel(performanceModel: PerformanceModel|null): void {
@@ -194,7 +200,7 @@ export class TimelineFlameChartNetworkDataProvider implements PerfUI.FlameChart.
194
200
  const end = Math.max(timeToPixel(endTime), finish);
195
201
 
196
202
  // Draw waiting time.
197
- context.fillStyle = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-background-opacity-80');
203
+ context.fillStyle = 'hsla(0, 100%, 100%, 0.8)';
198
204
  context.fillRect(sendStart + 0.5, barY + 0.5, headersEnd - sendStart - 0.5, barHeight - 2);
199
205
  // Clear portions of initial rect to prepare for the ticks.
200
206
  context.fillStyle = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-background');
@@ -7,7 +7,7 @@ import * as acorn from './package/dist/acorn.mjs';
7
7
  import type * as ESTree from './estree-legacy';
8
8
  export {ESTree};
9
9
 
10
- export { Comment, defaultOptions, getLineInfo, isNewLine, lineBreak, lineBreakG, Node, SourceLocation, Token, tokTypes, tokContexts} from './package/dist/acorn.mjs';
10
+ export { type Comment, defaultOptions, getLineInfo, isNewLine, lineBreak, lineBreakG, Node, SourceLocation, Token, tokTypes, tokContexts} from './package/dist/acorn.mjs';
11
11
 
12
12
  export const Parser = acorn.Parser;
13
13
  export const tokenizer = acorn.Parser.tokenizer.bind(acorn.Parser);
@@ -56,7 +56,6 @@ export class GlassPane {
56
56
  }
57
57
 
58
58
  registerRequiredCSS(cssFile: {cssContent: string}): void {
59
- // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
60
59
  this.widgetInternal.registerRequiredCSS(cssFile);
61
60
  }
62
61
 
@@ -38,7 +38,7 @@ export class ResizerWidget extends Common.ObjectWrapper.ObjectWrapper<EventTypes
38
38
  addElement(element: HTMLElement): void {
39
39
  if (!this.elementsInternal.has(element)) {
40
40
  this.elementsInternal.add(element);
41
- element.addEventListener('mousedown', this.installDragOnMouseDownBound, false);
41
+ element.addEventListener('pointerdown', this.installDragOnMouseDownBound, false);
42
42
  this.updateElementCursor(element);
43
43
  }
44
44
  }
@@ -46,7 +46,7 @@ export class ResizerWidget extends Common.ObjectWrapper.ObjectWrapper<EventTypes
46
46
  removeElement(element: HTMLElement): void {
47
47
  if (this.elementsInternal.has(element)) {
48
48
  this.elementsInternal.delete(element);
49
- element.removeEventListener('mousedown', this.installDragOnMouseDownBound, false);
49
+ element.removeEventListener('pointerdown', this.installDragOnMouseDownBound, false);
50
50
  element.style.removeProperty('cursor');
51
51
  }
52
52
  }
@@ -58,8 +58,10 @@ export class ResizerWidget extends Common.ObjectWrapper.ObjectWrapper<EventTypes
58
58
  private updateElementCursor(element: HTMLElement): void {
59
59
  if (this.isEnabledInternal) {
60
60
  element.style.setProperty('cursor', this.cursor());
61
+ element.style.setProperty('touch-action', 'none');
61
62
  } else {
62
63
  element.style.removeProperty('cursor');
64
+ element.style.removeProperty('touch-action');
63
65
  }
64
66
  }
65
67
 
@@ -4,6 +4,7 @@
4
4
 
5
5
  import type * as Common from '../../core/common/common.js';
6
6
  import * as i18n from '../../core/i18n/i18n.js';
7
+ import * as ThemeSupport from './theme_support/theme_support.js';
7
8
  import * as Utils from './utils/utils.js';
8
9
 
9
10
  import * as ARIAUtils from './ARIAUtils.js';
@@ -48,7 +49,7 @@ export class SoftDropDown<T> implements ListDelegate<T> {
48
49
 
49
50
  this.element = document.createElement('button');
50
51
  this.element.classList.add('soft-dropdown');
51
- Utils.appendStyle(this.element, softDropDownButtonStyles);
52
+ ThemeSupport.ThemeSupport.instance().appendStyle(this.element, softDropDownButtonStyles);
52
53
  this.titleElement = this.element.createChild('span', 'title');
53
54
  const dropdownArrowIcon = Icon.create('smallicon-triangle-down');
54
55
  this.element.appendChild(dropdownArrowIcon);
@@ -37,7 +37,7 @@ import * as Platform from '../../core/platform/platform.js';
37
37
  import * as TextUtils from '../../models/text_utils/text_utils.js';
38
38
 
39
39
  import * as ARIAUtils from './ARIAUtils.js';
40
- import * as Utils from './utils/utils.js';
40
+ import * as ThemeSupport from './theme_support/theme_support.js';
41
41
 
42
42
  import type {SuggestBoxDelegate, Suggestion} from './SuggestBox.js';
43
43
  import {SuggestBox} from './SuggestBox.js';
@@ -136,7 +136,7 @@ export class TextPrompt extends Common.ObjectWrapper.ObjectWrapper<EventTypes> i
136
136
  this.boundOnMouseWheel = this.onMouseWheel.bind(this);
137
137
  this.boundClearAutocomplete = this.clearAutocomplete.bind(this);
138
138
  this.proxyElement = element.ownerDocument.createElement('span');
139
- Utils.appendStyle(this.proxyElement, textPromptStyles);
139
+ ThemeSupport.ThemeSupport.instance().appendStyle(this.proxyElement, textPromptStyles);
140
140
  this.contentElement = this.proxyElement.createChild('div', 'text-prompt-root');
141
141
  this.proxyElement.style.display = this.proxyElementDisplay;
142
142
  if (element.parentElement) {
@@ -37,6 +37,7 @@ import * as Common from '../../core/common/common.js';
37
37
  import * as Platform from '../../core/platform/platform.js';
38
38
 
39
39
  import * as ARIAUtils from './ARIAUtils.js';
40
+ import * as ThemeSupport from './theme_support/theme_support.js';
40
41
  import * as Utils from './utils/utils.js';
41
42
 
42
43
  import type {Icon} from './Icon.js';
@@ -400,7 +401,7 @@ export class TreeOutlineInShadow extends TreeOutline {
400
401
  }
401
402
 
402
403
  registerRequiredCSS(cssFile: {cssContent: string}): void {
403
- Utils.appendStyle(this.shadowRoot, cssFile);
404
+ ThemeSupport.ThemeSupport.instance().appendStyle(this.shadowRoot, cssFile);
404
405
  }
405
406
 
406
407
  registerCSSFiles(cssFiles: CSSStyleSheet[]): void {
@@ -432,7 +433,6 @@ export class TreeElement {
432
433
  private readonly boundOnFocus: () => void;
433
434
  private readonly boundOnBlur: () => void;
434
435
  readonly listItemNode: HTMLLIElement;
435
- readonly contentNode: HTMLElement;
436
436
  titleElement: Node;
437
437
  titleInternal: string|Node;
438
438
  private childrenInternal: TreeElement[]|null;
@@ -459,10 +459,8 @@ export class TreeElement {
459
459
  this.boundOnFocus = this.onFocus.bind(this);
460
460
  this.boundOnBlur = this.onBlur.bind(this);
461
461
  this.listItemNode = document.createElement('li');
462
- this.contentNode = this.listItemElement.createChild('div');
463
- this.contentNode.classList.add('tree-element-content');
464
462
 
465
- this.titleElement = this.contentNode.createChild('span', 'tree-element-title');
463
+ this.titleElement = this.listItemNode.createChild('span', 'tree-element-title');
466
464
  treeElementBylistItemNode.set(this.listItemNode, this);
467
465
  this.titleInternal = '';
468
466
  if (title) {
@@ -732,10 +730,6 @@ export class TreeElement {
732
730
  return this.listItemNode;
733
731
  }
734
732
 
735
- get contentElement(): HTMLElement {
736
- return this.contentNode;
737
- }
738
-
739
733
  get childrenListElement(): HTMLOListElement {
740
734
  return this.childrenListNode;
741
735
  }
@@ -758,13 +752,13 @@ export class TreeElement {
758
752
  this.tooltip = '';
759
753
  }
760
754
 
761
- this.contentNode.removeChildren();
755
+ this.listItemNode.removeChildren();
762
756
  if (this.leadingIconsElement) {
763
- this.contentNode.appendChild(this.leadingIconsElement);
757
+ this.listItemNode.appendChild(this.leadingIconsElement);
764
758
  }
765
- this.contentNode.appendChild(this.titleElement);
759
+ this.listItemNode.appendChild(this.titleElement);
766
760
  if (this.trailingIconsElement) {
767
- this.contentNode.appendChild(this.trailingIconsElement);
761
+ this.listItemNode.appendChild(this.trailingIconsElement);
768
762
  }
769
763
  this.ensureSelection();
770
764
  }
@@ -794,7 +788,7 @@ export class TreeElement {
794
788
  this.leadingIconsElement = document.createElement('div');
795
789
  this.leadingIconsElement.classList.add('leading-icons');
796
790
  this.leadingIconsElement.classList.add('icons-container');
797
- this.contentNode.insertBefore(this.leadingIconsElement, this.titleElement);
791
+ this.listItemNode.insertBefore(this.leadingIconsElement, this.titleElement);
798
792
  this.ensureSelection();
799
793
  }
800
794
  this.leadingIconsElement.removeChildren();
@@ -811,7 +805,7 @@ export class TreeElement {
811
805
  this.trailingIconsElement = document.createElement('div');
812
806
  this.trailingIconsElement.classList.add('trailing-icons');
813
807
  this.trailingIconsElement.classList.add('icons-container');
814
- this.contentNode.appendChild(this.trailingIconsElement);
808
+ this.listItemNode.appendChild(this.trailingIconsElement);
815
809
  this.ensureSelection();
816
810
  }
817
811
  this.trailingIconsElement.removeChildren();
@@ -33,7 +33,6 @@
33
33
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
34
  */
35
35
 
36
- import type * as Common from '../../core/common/common.js';
37
36
  import * as DOMExtension from '../../core/dom_extension/dom_extension.js';
38
37
  import * as Host from '../../core/host/host.js';
39
38
  import * as i18n from '../../core/i18n/i18n.js';
@@ -46,7 +45,6 @@ import {Size} from './Geometry.js';
46
45
  import {GlassPane, PointerEventsBehavior, SizeBehavior} from './GlassPane.js';
47
46
  import {Icon} from './Icon.js';
48
47
  import {KeyboardShortcut} from './KeyboardShortcut.js';
49
- import * as ThemeSupport from './theme_support/theme_support.js';
50
48
  import * as Utils from './utils/utils.js';
51
49
 
52
50
  import type {ToolbarButton} from './Toolbar.js';
@@ -141,9 +139,9 @@ export function installDragHandle(
141
139
  }
142
140
 
143
141
  let startTimer: number|null;
144
- element.addEventListener('mousedown', onMouseDown, false);
142
+ element.addEventListener('pointerdown', onMouseDown, false);
145
143
  if (startDelay) {
146
- element.addEventListener('mouseup', onMouseUp, false);
144
+ element.addEventListener('pointerup', onMouseUp, false);
147
145
  }
148
146
  if (hoverCursor !== null) {
149
147
  (element as HTMLElement).style.cursor = hoverCursor || cursor || '';
@@ -233,12 +231,12 @@ class DragHandler {
233
231
  this.dragEventsTargetDocumentTop = this.dragEventsTargetDocument;
234
232
  }
235
233
 
236
- targetDocument.addEventListener('mousemove', this.elementDragMove, true);
237
- targetDocument.addEventListener('mouseup', this.elementDragEnd, true);
234
+ targetDocument.addEventListener('pointermove', this.elementDragMove, true);
235
+ targetDocument.addEventListener('pointerup', this.elementDragEnd, true);
238
236
  DragHandler.rootForMouseOut &&
239
- DragHandler.rootForMouseOut.addEventListener('mouseout', this.mouseOutWhileDragging, {capture: true});
237
+ DragHandler.rootForMouseOut.addEventListener('pointerout', this.mouseOutWhileDragging, {capture: true});
240
238
  if (this.dragEventsTargetDocumentTop && targetDocument !== this.dragEventsTargetDocumentTop) {
241
- this.dragEventsTargetDocumentTop.addEventListener('mouseup', this.elementDragEnd, true);
239
+ this.dragEventsTargetDocumentTop.addEventListener('pointerup', this.elementDragEnd, true);
242
240
  }
243
241
 
244
242
  const targetHtmlElement = (targetElement as HTMLElement);
@@ -264,17 +262,17 @@ class DragHandler {
264
262
  if (!DragHandler.rootForMouseOut) {
265
263
  return;
266
264
  }
267
- DragHandler.rootForMouseOut.removeEventListener('mouseout', this.mouseOutWhileDragging, {capture: true});
265
+ DragHandler.rootForMouseOut.removeEventListener('pointerout', this.mouseOutWhileDragging, {capture: true});
268
266
  }
269
267
 
270
268
  private unregisterDragEvents(): void {
271
269
  if (!this.dragEventsTargetDocument) {
272
270
  return;
273
271
  }
274
- this.dragEventsTargetDocument.removeEventListener('mousemove', this.elementDragMove, true);
275
- this.dragEventsTargetDocument.removeEventListener('mouseup', this.elementDragEnd, true);
272
+ this.dragEventsTargetDocument.removeEventListener('pointermove', this.elementDragMove, true);
273
+ this.dragEventsTargetDocument.removeEventListener('pointerup', this.elementDragEnd, true);
276
274
  if (this.dragEventsTargetDocumentTop && this.dragEventsTargetDocument !== this.dragEventsTargetDocumentTop) {
277
- this.dragEventsTargetDocumentTop.removeEventListener('mouseup', this.elementDragEnd, true);
275
+ this.dragEventsTargetDocumentTop.removeEventListener('pointerup', this.elementDragEnd, true);
278
276
  }
279
277
  delete this.dragEventsTargetDocument;
280
278
  delete this.dragEventsTargetDocumentTop;
@@ -993,9 +991,9 @@ export class LongClickController {
993
991
 
994
992
  this.element.addEventListener('keydown', boundKeyDown, false);
995
993
  this.element.addEventListener('keyup', boundKeyUp, false);
996
- this.element.addEventListener('mousedown', boundMouseDown, false);
997
- this.element.addEventListener('mouseout', boundReset, false);
998
- this.element.addEventListener('mouseup', boundMouseUp, false);
994
+ this.element.addEventListener('pointerdown', boundMouseDown, false);
995
+ this.element.addEventListener('pointerout', boundReset, false);
996
+ this.element.addEventListener('pointerup', boundMouseUp, false);
999
997
  this.element.addEventListener('click', boundReset, true);
1000
998
 
1001
999
  this.longClickData = {mouseUp: boundMouseUp, mouseDown: boundMouseDown, reset: boundReset};
@@ -1033,9 +1031,9 @@ export class LongClickController {
1033
1031
  if (!this.longClickData) {
1034
1032
  return;
1035
1033
  }
1036
- this.element.removeEventListener('mousedown', this.longClickData.mouseDown, false);
1037
- this.element.removeEventListener('mouseout', this.longClickData.reset, false);
1038
- this.element.removeEventListener('mouseup', this.longClickData.mouseUp, false);
1034
+ this.element.removeEventListener('poinerdown', this.longClickData.mouseDown, false);
1035
+ this.element.removeEventListener('pointerout', this.longClickData.reset, false);
1036
+ this.element.removeEventListener('pointerup', this.longClickData.mouseUp, false);
1039
1037
  this.element.addEventListener('click', this.longClickData.reset, true);
1040
1038
  delete this.longClickData;
1041
1039
  }
@@ -1043,7 +1041,7 @@ export class LongClickController {
1043
1041
  static readonly TIME_MS = 200;
1044
1042
  }
1045
1043
 
1046
- export function initializeUIUtils(document: Document, themeSetting: Common.Settings.Setting<string>): void {
1044
+ export function initializeUIUtils(document: Document): void {
1047
1045
  document.body.classList.toggle('inactive', !document.hasFocus());
1048
1046
  if (document.defaultView) {
1049
1047
  document.defaultView.addEventListener('focus', windowFocused.bind(undefined, document), false);
@@ -1051,11 +1049,6 @@ export function initializeUIUtils(document: Document, themeSetting: Common.Setti
1051
1049
  }
1052
1050
  document.addEventListener('focus', Utils.focusChanged.bind(undefined), true);
1053
1051
 
1054
- if (!ThemeSupport.ThemeSupport.hasInstance()) {
1055
- ThemeSupport.ThemeSupport.instance({forceNew: true, setting: themeSetting});
1056
- }
1057
- ThemeSupport.ThemeSupport.instance().applyTheme(document);
1058
-
1059
1052
  const body = (document.body as Element);
1060
1053
  GlassPane.setContainer(body);
1061
1054
  }
@@ -15,7 +15,7 @@ import type {ToolbarItem} from './Toolbar.js';
15
15
  import {Toolbar, ToolbarMenuButton} from './Toolbar.js';
16
16
  import {createTextChild} from './UIUtils.js';
17
17
  import type {TabbedViewLocation, View, ViewLocation, ViewLocationResolver} from './View.js';
18
- import {getRegisteredLocationResolvers, getRegisteredViewExtensions, maybeRemoveViewExtension, registerLocationResolver, registerViewExtension, ViewLocationCategoryValues, ViewLocationValues, ViewPersistence, ViewRegistration} from './ViewRegistration.js';
18
+ import {getRegisteredLocationResolvers, getRegisteredViewExtensions, maybeRemoveViewExtension, registerLocationResolver, registerViewExtension, ViewLocationCategoryValues, ViewLocationValues, ViewPersistence, type ViewRegistration} from './ViewRegistration.js';
19
19
  import type {Widget, WidgetElement} from './Widget.js';
20
20
  import {VBox} from './Widget.js';
21
21
  import viewContainersStyles from './viewContainers.css.legacy.js';
@@ -32,6 +32,7 @@ import * as DOMExtension from '../../core/dom_extension/dom_extension.js';
32
32
  import * as Helpers from '../components/helpers/helpers.js';
33
33
 
34
34
  import {Constraints, Size} from './Geometry.js';
35
+ import * as ThemeSupport from './theme_support/theme_support.js';
35
36
  import * as Utils from './utils/utils.js';
36
37
  import {XWidget} from './XWidget.js';
37
38
 
@@ -460,9 +461,9 @@ export class Widget {
460
461
 
461
462
  registerRequiredCSS(cssFile: {cssContent: string}): void {
462
463
  if (this.isWebComponent) {
463
- Utils.appendStyle((this.shadowRoot as DocumentFragment), cssFile);
464
+ ThemeSupport.ThemeSupport.instance().appendStyle((this.shadowRoot as DocumentFragment), cssFile);
464
465
  } else {
465
- Utils.appendStyle(this.element, cssFile);
466
+ ThemeSupport.ThemeSupport.instance().appendStyle(this.element, cssFile);
466
467
  }
467
468
  }
468
469
 
@@ -267,14 +267,14 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
267
267
  UI.ARIAUtils.markAsButton(displaySwitcher);
268
268
 
269
269
  UI.UIUtils.installDragHandle(
270
- this.hueElement, this.dragStart.bind(this, positionHue.bind(this)), positionHue.bind(this), null, 'pointer',
271
- 'default');
270
+ this.hueElement, this.dragStart.bind(this, positionHue.bind(this)), positionHue.bind(this), null, 'ew-resize',
271
+ 'crosshair');
272
272
  UI.UIUtils.installDragHandle(
273
273
  this.alphaElement, this.dragStart.bind(this, positionAlpha.bind(this)), positionAlpha.bind(this), null,
274
- 'pointer', 'default');
274
+ 'ew-resize', 'crosshair');
275
275
  UI.UIUtils.installDragHandle(
276
- this.colorElement, this.dragStart.bind(this, positionColor.bind(this)), positionColor.bind(this), null,
277
- 'pointer', 'default');
276
+ this.colorElement, this.dragStart.bind(this, positionColor.bind(this)), positionColor.bind(this), null, 'move',
277
+ 'crosshair');
278
278
 
279
279
  // Color contrast business.
280
280
  if (contrastInfo) {
@@ -25,6 +25,7 @@
25
25
  border-radius: 2px 2px 0 0;
26
26
  overflow: hidden;
27
27
  flex: none;
28
+ touch-action: none;
28
29
  }
29
30
 
30
31
  .spectrum-dragger,
@@ -37,7 +38,8 @@
37
38
  height: 12px;
38
39
  width: 12px;
39
40
  border: 1px solid var(--color-background);
40
- cursor: pointer;
41
+ cursor: move;
42
+ z-index: 1;
41
43
  position: absolute;
42
44
  top: 0;
43
45
  left: 0;
@@ -48,7 +50,7 @@
48
50
  .spectrum-slider {
49
51
  position: absolute;
50
52
  top: -1px;
51
- cursor: pointer;
53
+ cursor: ew-resize;
52
54
  width: 13px;
53
55
  height: 13px;
54
56
  border-radius: 13px;
@@ -90,6 +92,7 @@
90
92
  width: 130px;
91
93
  height: 11px;
92
94
  border-radius: 2px;
95
+ touch-action: none;
93
96
  }
94
97
 
95
98
  .spectrum-hue:focus-visible .spectrum-slider,
@@ -1465,6 +1465,7 @@ export class DataGridImpl<T> extends Common.ObjectWrapper.ObjectWrapper<EventTyp
1465
1465
  }
1466
1466
 
1467
1467
  this.positionResizers();
1468
+ this.updateWidths();
1468
1469
  event.preventDefault();
1469
1470
  }
1470
1471
 
@@ -126,8 +126,6 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
126
126
  private lastMouseOffsetX: number;
127
127
  private selectedGroup: number;
128
128
  private keyboardFocusedGroup: number;
129
- private selectedGroupBackroundColor: string;
130
- private selectedGroupBorderColor: string;
131
129
  private offsetWidth!: number;
132
130
  private offsetHeight!: number;
133
131
  private dragStartX!: number;
@@ -230,10 +228,9 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
230
228
  // Keyboard focused group is used to navigate groups irrespective of whether they are selectable or not
231
229
  this.keyboardFocusedGroup = -1;
232
230
 
233
- this.selectedGroupBackroundColor = ThemeSupport.ThemeSupport.instance().patchColorText(
234
- Colors.SelectedGroupBackground, ThemeSupport.ThemeSupport.ColorUsage.Background);
235
- this.selectedGroupBorderColor = ThemeSupport.ThemeSupport.instance().patchColorText(
236
- Colors.SelectedGroupBorder, ThemeSupport.ThemeSupport.ColorUsage.Background);
231
+ ThemeSupport.ThemeSupport.instance().addEventListener(ThemeSupport.ThemeChangeEvent.eventName, () => {
232
+ this.scheduleUpdate();
233
+ });
237
234
  }
238
235
 
239
236
  willHide(): void {
@@ -1140,7 +1137,8 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
1140
1137
  context.save();
1141
1138
  this.forEachGroupInViewport((offset, index, group, isFirst, groupHeight) => {
1142
1139
  if (this.isGroupFocused(index)) {
1143
- context.fillStyle = this.selectedGroupBackroundColor;
1140
+ context.fillStyle =
1141
+ ThemeSupport.ThemeSupport.instance().getComputedValue('--selected-group-background', this.contentElement);
1144
1142
  context.fillRect(0, offset, width, groupHeight - group.style.padding);
1145
1143
  }
1146
1144
  });
@@ -1563,7 +1561,6 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
1563
1561
  return;
1564
1562
  }
1565
1563
  const lastGroupOffset = groupOffsets[groupOffsets.length - 1];
1566
- const colorUsage = ThemeSupport.ThemeSupport.ColorUsage;
1567
1564
 
1568
1565
  context.save();
1569
1566
  context.scale(ratio, ratio);
@@ -1571,7 +1568,7 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
1571
1568
  const defaultFont = '11px ' + Host.Platform.fontFamily();
1572
1569
  context.font = defaultFont;
1573
1570
 
1574
- context.fillStyle = ThemeSupport.ThemeSupport.instance().patchColorText('#fff', colorUsage.Background);
1571
+ context.fillStyle = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-background');
1575
1572
  this.forEachGroupInViewport((offset, index, group) => {
1576
1573
  const paddingHeight = group.style.padding;
1577
1574
  if (paddingHeight < 5) {
@@ -1583,7 +1580,7 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
1583
1580
  context.fillRect(0, lastGroupOffset + 2, width, top + height - lastGroupOffset);
1584
1581
  }
1585
1582
 
1586
- context.strokeStyle = ThemeSupport.ThemeSupport.instance().patchColorText('#eee', colorUsage.Background);
1583
+ context.strokeStyle = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-background-elevation-1');
1587
1584
  context.beginPath();
1588
1585
  this.forEachGroupInViewport((offset, index, group, isFirst) => {
1589
1586
  if (isFirst || group.style.padding < 4) {
@@ -1622,7 +1619,8 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
1622
1619
  if (this.isGroupCollapsible(index) && !group.expanded || group.style.shareHeaderLine) {
1623
1620
  const width = this.labelWidthForGroup(context, group) + 2;
1624
1621
  if (this.isGroupFocused(index)) {
1625
- context.fillStyle = this.selectedGroupBackroundColor;
1622
+ context.fillStyle =
1623
+ ThemeSupport.ThemeSupport.instance().getComputedValue('--selected-group-background', this.contentElement);
1626
1624
  } else {
1627
1625
  const parsedColor = Common.Color.Color.parse(group.style.backgroundColor);
1628
1626
  if (parsedColor) {
@@ -1641,7 +1639,7 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
1641
1639
  });
1642
1640
  context.restore();
1643
1641
 
1644
- context.fillStyle = ThemeSupport.ThemeSupport.instance().patchColorText('#6e6e6e', colorUsage.Foreground);
1642
+ context.fillStyle = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-text-secondary');
1645
1643
  context.beginPath();
1646
1644
  this.forEachGroupInViewport((offset, index, group) => {
1647
1645
  if (this.isGroupCollapsible(index)) {
@@ -1652,7 +1650,7 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
1652
1650
  });
1653
1651
  context.fill();
1654
1652
 
1655
- context.strokeStyle = ThemeSupport.ThemeSupport.instance().patchColorText('#ddd', colorUsage.Background);
1653
+ context.strokeStyle = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-details-hairline-light');
1656
1654
  context.beginPath();
1657
1655
  context.stroke();
1658
1656
 
@@ -1660,7 +1658,8 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
1660
1658
  if (this.isGroupFocused(index)) {
1661
1659
  const lineWidth = 2;
1662
1660
  const bracketLength = 10;
1663
- context.fillStyle = this.selectedGroupBorderColor;
1661
+ context.fillStyle =
1662
+ ThemeSupport.ThemeSupport.instance().getComputedValue('--selected-group-border', this.contentElement);
1664
1663
  context.fillRect(0, offset - lineWidth, lineWidth, groupHeight - group.style.padding + 2 * lineWidth);
1665
1664
  context.fillRect(0, offset - lineWidth, bracketLength, lineWidth);
1666
1665
  context.fillRect(0, offset + groupHeight - group.style.padding, bracketLength, lineWidth);
@@ -2326,10 +2325,6 @@ export type EventTypes = {
2326
2325
  [Events.EntryHighlighted]: number,
2327
2326
  };
2328
2327
 
2329
- export const Colors = {
2330
- SelectedGroupBackground: 'hsl(215, 85%, 98%)',
2331
- SelectedGroupBorder: 'hsl(216, 68%, 54%)',
2332
- };
2333
2328
  export interface Group {
2334
2329
  name: Common.UIString.LocalizedString;
2335
2330
  startLevel: number;
@@ -32,6 +32,7 @@ import * as Common from '../../../../core/common/common.js';
32
32
  import * as i18n from '../../../../core/i18n/i18n.js';
33
33
  import * as Platform from '../../../../core/platform/platform.js';
34
34
  import * as UI from '../../legacy.js';
35
+ import * as ThemeSupport from '../../theme_support/theme_support.js';
35
36
 
36
37
  import type {Calculator} from './TimelineGrid.js';
37
38
  import {TimelineGrid} from './TimelineGrid.js';
@@ -162,7 +163,7 @@ export class Window extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
162
163
 
163
164
  this.parentElement.addEventListener('wheel', this.onMouseWheel.bind(this), true);
164
165
  this.parentElement.addEventListener('dblclick', this.resizeWindowMaximum.bind(this), true);
165
- UI.Utils.appendStyle(this.parentElement, overviewGridStyles);
166
+ ThemeSupport.ThemeSupport.instance().appendStyle(this.parentElement, overviewGridStyles);
166
167
 
167
168
  this.leftResizeElement = parentElement.createChild('div', 'overview-grid-window-resizer') as HTMLElement;
168
169
  UI.UIUtils.installDragHandle(
@@ -33,7 +33,6 @@
33
33
  */
34
34
 
35
35
  import * as Host from '../../../../core/host/host.js';
36
- import * as UI from '../../legacy.js';
37
36
  import * as ThemeSupport from '../../theme_support/theme_support.js';
38
37
 
39
38
  import timelineGridStyles from './timelineGrid.css.legacy.js';
@@ -49,7 +48,7 @@ export class TimelineGrid {
49
48
 
50
49
  constructor() {
51
50
  this.element = document.createElement('div');
52
- UI.Utils.appendStyle(this.element, timelineGridStyles);
51
+ ThemeSupport.ThemeSupport.instance().appendStyle(this.element, timelineGridStyles);
53
52
 
54
53
  this.dividersElementInternal = this.element.createChild('div', 'resources-dividers');
55
54
 
@@ -6,6 +6,14 @@
6
6
 
7
7
  .flame-chart-main-pane {
8
8
  overflow: hidden;
9
+
10
+ --selected-group-background: hsl(215deg 85% 98%);
11
+ --selected-group-border: hsl(216deg 68% 54%);
12
+ }
13
+
14
+ :host-context(.-theme-with-dark-background) .flame-chart-main-pane {
15
+ --selected-group-background: hsl(215deg 85% 15%);
16
+ --selected-group-border: hsl(216deg 68% 46%);
9
17
  }
10
18
 
11
19
  .flame-chart-marker-highlight-element {
@@ -61,7 +61,6 @@ export class FontView extends UI.View.SimpleView {
61
61
  private inResize!: boolean|null;
62
62
  constructor(mimeType: string, contentProvider: TextUtils.ContentProvider.ContentProvider) {
63
63
  super(i18nString(UIStrings.font));
64
- // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
65
64
  this.registerRequiredCSS(fontViewStyles);
66
65
  this.element.classList.add('font-view');
67
66
  this.url = contentProvider.contentURL();
@@ -98,7 +98,6 @@ export class ImageView extends UI.View.SimpleView {
98
98
  private cachedContent?: string|null;
99
99
  constructor(mimeType: string, contentProvider: TextUtils.ContentProvider.ContentProvider) {
100
100
  super(i18nString(UIStrings.image));
101
- // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
102
101
  this.registerRequiredCSS(imageViewStyles);
103
102
  this.element.tabIndex = -1;
104
103
  this.element.classList.add('image-view');
@@ -56,7 +56,6 @@ export class JSONView extends UI.Widget.VBox implements UI.SearchableView.Search
56
56
  constructor(parsedJSON: ParsedJSON, startCollapsed?: boolean) {
57
57
  super();
58
58
  this.initialized = false;
59
- // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
60
59
  this.registerRequiredCSS(jsonViewStyles);
61
60
  this.parsedJSON = parsedJSON;
62
61
  this.startCollapsed = Boolean(startCollapsed);
@@ -84,7 +84,6 @@ export class SearchableContainer extends UI.Widget.VBox {
84
84
 
85
85
  constructor(resource: TextUtils.ContentProvider.ContentProvider, contentType: string, autoPrettyPrint?: boolean) {
86
86
  super(true);
87
- // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
88
87
  this.registerRequiredCSS(resourceSourceFrameStyles);
89
88
  const sourceFrame = new ResourceSourceFrame(resource, contentType);
90
89
  this.sourceFrame = sourceFrame;