chrome-devtools-frontend 1.0.922470 → 1.0.922924

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 (47) hide show
  1. package/front_end/core/common/Console.ts +5 -1
  2. package/front_end/core/host/InspectorFrontendHost.ts +6 -5
  3. package/front_end/core/host/InspectorFrontendHostAPI.ts +102 -0
  4. package/front_end/core/sdk/CSSModel.ts +8 -4
  5. package/front_end/core/sdk/Connections.ts +5 -5
  6. package/front_end/core/sdk/DebuggerModel.ts +8 -5
  7. package/front_end/entrypoints/inspector_main/InspectorMain.ts +2 -3
  8. package/front_end/entrypoints/js_app/JsMain.ts +1 -1
  9. package/front_end/entrypoints/main/MainImpl.ts +4 -7
  10. package/front_end/entrypoints/node_main/NodeConnectionsPanel.ts +2 -2
  11. package/front_end/entrypoints/node_main/NodeMain.ts +2 -3
  12. package/front_end/entrypoints/worker_app/WorkerMain.ts +1 -1
  13. package/front_end/models/bindings/BreakpointManager.ts +3 -2
  14. package/front_end/models/extensions/ExtensionServer.ts +2 -2
  15. package/front_end/models/issues_manager/DeprecationIssue.ts +1 -1
  16. package/front_end/models/issues_manager/descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +15 -5
  17. package/front_end/models/issues_manager/descriptions/CoepFrameResourceNeedsCoepHeader.md +7 -3
  18. package/front_end/models/issues_manager/descriptions/deprecationNavigatorUserAgent.md +1 -1
  19. package/front_end/models/persistence/IsolatedFileSystemManager.ts +26 -31
  20. package/front_end/models/persistence/NetworkPersistenceManager.ts +11 -1
  21. package/front_end/models/workspace/FileManager.ts +5 -7
  22. package/front_end/panels/console/ConsoleView.ts +3 -5
  23. package/front_end/panels/coverage/CoverageView.ts +5 -4
  24. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +47 -44
  25. package/front_end/panels/css_overview/CSSOverviewController.ts +48 -8
  26. package/front_end/panels/css_overview/CSSOverviewModel.ts +5 -5
  27. package/front_end/panels/css_overview/CSSOverviewPanel.ts +22 -21
  28. package/front_end/panels/css_overview/CSSOverviewUnusedDeclarations.ts +12 -9
  29. package/front_end/panels/elements/ElementsPanel.ts +2 -3
  30. package/front_end/panels/layer_viewer/Layers3DView.ts +1 -1
  31. package/front_end/panels/lighthouse/LighthouseProtocolService.ts +1 -2
  32. package/front_end/panels/mobile_throttling/throttlingSettingsTab.css +4 -0
  33. package/front_end/panels/profiler/CPUProfileFlameChart.ts +26 -9
  34. package/front_end/panels/sources/DebuggerPlugin.ts +4 -5
  35. package/front_end/panels/sources/EditingLocationHistoryManager.ts +7 -5
  36. package/front_end/panels/sources/TabbedEditorContainer.ts +2 -4
  37. package/front_end/ui/components/docs/toggle_fonts.ts +21 -0
  38. package/front_end/ui/legacy/ContextMenu.ts +4 -4
  39. package/front_end/ui/legacy/ForwardedInputEventHandler.ts +3 -7
  40. package/front_end/ui/legacy/InspectorView.ts +1 -2
  41. package/front_end/ui/legacy/Widget.ts +1 -3
  42. package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +5 -8
  43. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +5 -8
  44. package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +13 -3
  45. package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +3 -2
  46. package/front_end/ui/legacy/components/source_frame/SourcesTextEditor.ts +18 -2
  47. package/package.json +1 -1
@@ -614,10 +614,11 @@ export class LineDecorator implements SourceFrame.SourceFrame.LineDecorator {
614
614
  }
615
615
  }
616
616
 
617
- makeGutterClickHandler(url: string): (arg0: Common.EventTarget.EventTargetEvent) => void {
618
- function handleGutterClick(event: Common.EventTarget.EventTargetEvent): void {
619
- const eventData = event.data as SourceFrame.SourcesTextEditor.GutterClickEventData;
620
- if (eventData.gutterType !== LineDecorator.GUTTER_TYPE) {
617
+ makeGutterClickHandler(url: string):
618
+ (arg0: Common.EventTarget.EventTargetEvent<SourceFrame.SourcesTextEditor.GutterClickEventData>) => void {
619
+ function handleGutterClick(
620
+ event: Common.EventTarget.EventTargetEvent<SourceFrame.SourcesTextEditor.GutterClickEventData>): void {
621
+ if (event.data.gutterType !== LineDecorator.GUTTER_TYPE) {
621
622
  return;
622
623
  }
623
624
  const coverageViewId = 'coverage';
@@ -17,7 +17,7 @@ import cssOverviewCompletedViewStyles from './cssOverviewCompletedView.css.js';
17
17
  import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
18
18
  import type * as Protocol from '../../generated/protocol.js';
19
19
 
20
- import type {OverviewController} from './CSSOverviewController.js';
20
+ import type {OverviewController, PopulateNodesEvent, PopulateNodesEventNodes, PopulateNodesEventNodeTypes} from './CSSOverviewController.js';
21
21
  import {Events as CSSOverViewControllerEvents} from './CSSOverviewController.js';
22
22
  import {CSSOverviewSidebarPanel, SidebarEvents} from './CSSOverviewSidebarPanel.js';
23
23
  import type {UnusedDeclaration} from './CSSOverviewUnusedDeclarations.js';
@@ -178,7 +178,7 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
178
178
  export type NodeStyleStats = Map<string, Set<number>>;
179
179
 
180
180
  export interface ContrastIssue {
181
- nodeId: number;
181
+ nodeId: Protocol.DOM.BackendNodeId;
182
182
  contrastRatio: number;
183
183
  textColor: Common.Color.Color;
184
184
  backgroundColor: Common.Color.Color;
@@ -189,18 +189,18 @@ export interface ContrastIssue {
189
189
  };
190
190
  }
191
191
  export interface OverviewData {
192
- backgroundColors: Map<string, Set<number>>;
193
- textColors: Map<string, Set<number>>;
192
+ backgroundColors: Map<string, Set<Protocol.DOM.BackendNodeId>>;
193
+ textColors: Map<string, Set<Protocol.DOM.BackendNodeId>>;
194
194
  textColorContrastIssues: Map<string, ContrastIssue[]>;
195
- fillColors: Map<string, Set<number>>;
196
- borderColors: Map<string, Set<number>>;
195
+ fillColors: Map<string, Set<Protocol.DOM.BackendNodeId>>;
196
+ borderColors: Map<string, Set<Protocol.DOM.BackendNodeId>>;
197
197
  globalStyleStats: {
198
198
  styleRules: number,
199
199
  inlineStyles: number,
200
200
  externalSheets: number,
201
201
  stats: {type: number, class: number, id: number, universal: number, attribute: number, nonSimple: number},
202
202
  };
203
- fontInfo: Map<string, Map<string, Map<string, number[]>>>;
203
+ fontInfo: Map<string, Map<string, Map<string, Protocol.DOM.BackendNodeId[]>>>;
204
204
  elementCount: number;
205
205
  mediaQueries: Map<string, Protocol.CSS.CSSMedia[]>;
206
206
  unusedDeclarations: Map<string, UnusedDeclaration[]>;
@@ -335,7 +335,7 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
335
335
  return;
336
336
  }
337
337
 
338
- let payload;
338
+ let payload: PopulateNodesEvent;
339
339
  switch (type) {
340
340
  case 'contrast': {
341
341
  const section = dataset.section;
@@ -435,7 +435,7 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
435
435
  return;
436
436
  }
437
437
 
438
- const nodesIds = (fontMetricInfo.get(value) as number[]);
438
+ const nodesIds = fontMetricInfo.get(value);
439
439
  if (!nodesIds) {
440
440
  return;
441
441
  }
@@ -451,7 +451,7 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
451
451
  }
452
452
 
453
453
  evt.consume();
454
- this.controller.dispatchEventToListeners(CSSOverViewControllerEvents.PopulateNodes, payload);
454
+ this.controller.dispatchEventToListeners(CSSOverViewControllerEvents.PopulateNodes, {payload});
455
455
  this.mainContainer.setSidebarMinimized(false);
456
456
  }
457
457
 
@@ -605,43 +605,43 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
605
605
  this.resultsContainer.element.appendChild(this.fragment.element());
606
606
  }
607
607
 
608
- private createElementsView(evt: Common.EventTarget.EventTargetEvent): void {
609
- const {type, nodes} = evt.data;
608
+ private createElementsView(evt: Common.EventTarget.EventTargetEvent<{payload: PopulateNodesEvent}>): void {
609
+ const {payload} = evt.data;
610
610
 
611
611
  let id = '';
612
612
  let tabTitle = '';
613
613
 
614
- switch (type) {
614
+ switch (payload.type) {
615
615
  case 'contrast': {
616
- const {section, key} = evt.data;
616
+ const {section, key} = payload;
617
617
  id = `${section}-${key}`;
618
618
  tabTitle = i18nString(UIStrings.contrastIssues);
619
619
  break;
620
620
  }
621
621
 
622
622
  case 'color': {
623
- const {section, color} = evt.data;
623
+ const {section, color} = payload;
624
624
  id = `${section}-${color}`;
625
625
  tabTitle = `${color.toUpperCase()} (${section})`;
626
626
  break;
627
627
  }
628
628
 
629
629
  case 'unused-declarations': {
630
- const {declaration} = evt.data;
630
+ const {declaration} = payload;
631
631
  id = `${declaration}`;
632
632
  tabTitle = `${declaration}`;
633
633
  break;
634
634
  }
635
635
 
636
636
  case 'media-queries': {
637
- const {text} = evt.data;
637
+ const {text} = payload;
638
638
  id = `${text}`;
639
639
  tabTitle = `${text}`;
640
640
  break;
641
641
  }
642
642
 
643
643
  case 'font-info': {
644
- const {name} = evt.data;
644
+ const {name} = payload;
645
645
  id = `${name}`;
646
646
  tabTitle = `${name}`;
647
647
  break;
@@ -651,7 +651,7 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
651
651
  let view = this.viewMap.get(id);
652
652
  if (!view) {
653
653
  view = new ElementDetailsView(this.controller, this.domModel, this.cssModel, this.linkifier);
654
- view.populateNodes(nodes);
654
+ view.populateNodes(payload.nodes);
655
655
  this.viewMap.set(id, view);
656
656
  }
657
657
 
@@ -995,8 +995,7 @@ export class ElementDetailsView extends UI.Widget.Widget {
995
995
  this.controller.dispatchEventToListeners(CSSOverViewControllerEvents.RequestNodeHighlight, backendNodeId);
996
996
  }
997
997
 
998
- async populateNodes(data: {nodeId: Protocol.DOM.BackendNodeId, hasChildren: boolean, [x: string]: unknown}[]):
999
- Promise<void> {
998
+ async populateNodes(data: PopulateNodesEventNodes): Promise<void> {
1000
999
  this.elementGrid.rootNode().removeChildren();
1001
1000
 
1002
1001
  if (!data.length) {
@@ -1005,39 +1004,39 @@ export class ElementDetailsView extends UI.Widget.Widget {
1005
1004
 
1006
1005
  const [firstItem] = data;
1007
1006
  const visibility = new Set<string>();
1008
- firstItem.nodeId && visibility.add('nodeId');
1009
- firstItem.declaration && visibility.add('declaration');
1010
- firstItem.sourceURL && visibility.add('sourceURL');
1011
- firstItem.contrastRatio && visibility.add('contrastRatio');
1007
+ 'nodeId' in firstItem && firstItem.nodeId && visibility.add('nodeId');
1008
+ 'declaration' in firstItem && firstItem.declaration && visibility.add('declaration');
1009
+ 'sourceURL' in firstItem && firstItem.sourceURL && visibility.add('sourceURL');
1010
+ 'contrastRatio' in firstItem && firstItem.contrastRatio && visibility.add('contrastRatio');
1012
1011
 
1013
- let relatedNodesMap;
1014
- if (visibility.has('nodeId')) {
1012
+ let relatedNodesMap: Map<Protocol.DOM.BackendNodeId, SDK.DOMModel.DOMNode|null>|null|undefined;
1013
+ if ('nodeId' in firstItem && visibility.has('nodeId')) {
1015
1014
  // Grab the nodes from the frontend, but only those that have not been
1016
1015
  // retrieved already.
1017
- const nodeIds = (data.reduce((prev, curr) => {
1018
- if (CSSOverviewCompletedView.pushedNodes.has(curr.nodeId)) {
1016
+ const nodeIds = (data as {nodeId: Protocol.DOM.BackendNodeId}[]).reduce((prev, curr) => {
1017
+ const nodeId = curr.nodeId;
1018
+ if (CSSOverviewCompletedView.pushedNodes.has(nodeId)) {
1019
1019
  return prev;
1020
1020
  }
1021
- CSSOverviewCompletedView.pushedNodes.add(curr.nodeId);
1022
- return prev.add(curr.nodeId);
1023
- }, new Set<Protocol.DOM.BackendNodeId>()));
1021
+ CSSOverviewCompletedView.pushedNodes.add(nodeId);
1022
+ return prev.add(nodeId);
1023
+ }, new Set<Protocol.DOM.BackendNodeId>());
1024
1024
  relatedNodesMap = await this.domModel.pushNodesByBackendIdsToFrontend(nodeIds);
1025
1025
  }
1026
1026
 
1027
1027
  for (const item of data) {
1028
- if (visibility.has('nodeId')) {
1028
+ let frontendNode;
1029
+ if ('nodeId' in item && visibility.has('nodeId')) {
1029
1030
  if (!relatedNodesMap) {
1030
1031
  continue;
1031
1032
  }
1032
- const frontendNode = relatedNodesMap.get(item.nodeId);
1033
+ frontendNode = relatedNodesMap.get(item.nodeId);
1033
1034
  if (!frontendNode) {
1034
1035
  continue;
1035
1036
  }
1036
-
1037
- item.node = frontendNode;
1038
1037
  }
1039
1038
 
1040
- const node = new ElementNode(item, this.linkifier, this.cssModel);
1039
+ const node = new ElementNode(item, frontendNode, this.linkifier, this.cssModel);
1041
1040
  node.selectable = false;
1042
1041
  this.elementGrid.insertChild(node);
1043
1042
  }
@@ -1051,28 +1050,32 @@ export class ElementDetailsView extends UI.Widget.Widget {
1051
1050
  export class ElementNode extends DataGrid.SortableDataGrid.SortableDataGridNode<ElementNode> {
1052
1051
  private readonly linkifier: Components.Linkifier.Linkifier;
1053
1052
  private readonly cssModel: SDK.CSSModel.CSSModel;
1053
+ private readonly frontendNode: SDK.DOMModel.DOMNode|null|undefined;
1054
1054
 
1055
1055
  constructor(
1056
- data: {
1057
- hasChildren: boolean,
1058
- [x: string]: unknown,
1059
- },
1056
+ data: PopulateNodesEventNodeTypes, frontendNode: SDK.DOMModel.DOMNode|null|undefined,
1060
1057
  linkifier: Components.Linkifier.Linkifier, cssModel: SDK.CSSModel.CSSModel) {
1061
- super(data, data.hasChildren);
1058
+ super(data);
1062
1059
 
1060
+ this.frontendNode = frontendNode;
1063
1061
  this.linkifier = linkifier;
1064
1062
  this.cssModel = cssModel;
1065
1063
  }
1066
1064
 
1067
1065
  createCell(columnId: string): HTMLElement {
1068
1066
  // Nodes.
1067
+ const {frontendNode} = this;
1069
1068
  if (columnId === 'nodeId') {
1070
1069
  const cell = this.createTD(columnId);
1071
1070
  cell.textContent = '...';
1072
1071
 
1073
- Common.Linkifier.Linkifier.linkify(this.data.node).then(link => {
1072
+ if (!frontendNode) {
1073
+ throw new Error('Node entry is missing a related frontend node.');
1074
+ }
1075
+
1076
+ Common.Linkifier.Linkifier.linkify(frontendNode).then(link => {
1074
1077
  cell.textContent = '';
1075
- (link as HTMLElement).dataset.backendNodeId = this.data.node.backendNodeId();
1078
+ (link as HTMLElement).dataset.backendNodeId = frontendNode.backendNodeId().toString();
1076
1079
  cell.appendChild(link);
1077
1080
  const button = document.createElement('button');
1078
1081
  button.classList.add('show-element');
@@ -4,8 +4,12 @@
4
4
 
5
5
  import * as Common from '../../core/common/common.js';
6
6
  import * as SDK from '../../core/sdk/sdk.js';
7
+ import type * as Protocol from '../../generated/protocol.js';
7
8
 
8
- export class OverviewController extends Common.ObjectWrapper.ObjectWrapper {
9
+ import type {ContrastIssue} from './CSSOverviewCompletedView.js';
10
+ import type {UnusedDeclaration} from './CSSOverviewUnusedDeclarations.js';
11
+
12
+ export class OverviewController extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
9
13
  currentUrl: string;
10
14
  constructor() {
11
15
  super();
@@ -25,11 +29,47 @@ export class OverviewController extends Common.ObjectWrapper.ObjectWrapper {
25
29
  }
26
30
  }
27
31
 
28
- export const Events = {
29
- RequestOverviewStart: Symbol('RequestOverviewStart'),
30
- RequestNodeHighlight: Symbol('RequestNodeHighlight'),
31
- PopulateNodes: Symbol('PopulateNodes'),
32
- RequestOverviewCancel: Symbol('RequestOverviewCancel'),
33
- OverviewCompleted: Symbol('OverviewCompleted'),
34
- Reset: Symbol('Reset'),
32
+ export type PopulateNodesEvent = {
33
+ type: 'contrast',
34
+ key: string,
35
+ section: string|undefined,
36
+ nodes: ContrastIssue[],
37
+ }|{
38
+ type: 'color',
39
+ color: string,
40
+ section: string | undefined,
41
+ nodes: {nodeId: Protocol.DOM.BackendNodeId}[],
42
+ }|{
43
+ type: 'unused-declarations',
44
+ declaration: string,
45
+ nodes: UnusedDeclaration[],
46
+ }|{
47
+ type: 'media-queries',
48
+ text: string,
49
+ nodes: Protocol.CSS.CSSMedia[],
50
+ }|{
51
+ type: 'font-info',
52
+ name: string,
53
+ nodes: {nodeId: Protocol.DOM.BackendNodeId}[],
54
+ };
55
+
56
+ export type PopulateNodesEventNodes = PopulateNodesEvent['nodes'];
57
+ export type PopulateNodesEventNodeTypes = PopulateNodesEventNodes[0];
58
+
59
+ export const enum Events {
60
+ RequestOverviewStart = 'RequestOverviewStart',
61
+ RequestNodeHighlight = 'RequestNodeHighlight',
62
+ PopulateNodes = 'PopulateNodes',
63
+ RequestOverviewCancel = 'RequestOverviewCancel',
64
+ OverviewCompleted = 'OverviewCompleted',
65
+ Reset = 'Reset',
66
+ }
67
+
68
+ export type EventTypes = {
69
+ [Events.RequestOverviewStart]: void,
70
+ [Events.RequestNodeHighlight]: number,
71
+ [Events.PopulateNodes]: {payload: PopulateNodesEvent},
72
+ [Events.RequestOverviewCancel]: void,
73
+ [Events.OverviewCompleted]: void,
74
+ [Events.Reset]: void,
35
75
  };
@@ -15,12 +15,12 @@ import {CSSOverviewUnusedDeclarations} from './CSSOverviewUnusedDeclarations.js'
15
15
 
16
16
  interface NodeStyleStats {
17
17
  elementCount: number;
18
- backgroundColors: Map<string, Set<number>>;
19
- textColors: Map<string, Set<number>>;
18
+ backgroundColors: Map<string, Set<Protocol.DOM.BackendNodeId>>;
19
+ textColors: Map<string, Set<Protocol.DOM.BackendNodeId>>;
20
20
  textColorContrastIssues: Map<string, ContrastIssue[]>;
21
- fillColors: Map<string, Set<number>>;
22
- borderColors: Map<string, Set<number>>;
23
- fontInfo: Map<string, Map<string, Map<string, number[]>>>;
21
+ fillColors: Map<string, Set<Protocol.DOM.BackendNodeId>>;
22
+ borderColors: Map<string, Set<Protocol.DOM.BackendNodeId>>;
23
+ fontInfo: Map<string, Map<string, Map<string, Protocol.DOM.BackendNodeId[]>>>;
24
24
  unusedDeclarations: Map<string, UnusedDeclaration[]>;
25
25
  }
26
26
 
@@ -27,17 +27,17 @@ export class CSSOverviewPanel extends UI.Panel.Panel {
27
27
  private readonly startView: CSSOverviewStartView;
28
28
  private readonly processingView: CSSOverviewProcessingView;
29
29
  private readonly completedView: CSSOverviewCompletedView;
30
- private backgroundColors?: Map<string, Set<number>>;
31
- private textColors?: Map<string, Set<number>>;
32
- private fillColors?: Map<string, Set<number>>;
33
- private borderColors?: Map<string, Set<number>>;
34
- private fontInfo?: Map<string, Map<string, Map<string, number[]>>>;
35
- private mediaQueries?: Map<string, Protocol.CSS.CSSMedia[]>;
36
- private unusedDeclarations?: Map<string, UnusedDeclaration[]>;
37
- private elementCount?: number;
30
+ private backgroundColors!: Map<string, Set<Protocol.DOM.BackendNodeId>>;
31
+ private textColors!: Map<string, Set<Protocol.DOM.BackendNodeId>>;
32
+ private fillColors!: Map<string, Set<Protocol.DOM.BackendNodeId>>;
33
+ private borderColors!: Map<string, Set<Protocol.DOM.BackendNodeId>>;
34
+ private fontInfo!: Map<string, Map<string, Map<string, Protocol.DOM.BackendNodeId[]>>>;
35
+ private mediaQueries!: Map<string, Protocol.CSS.CSSMedia[]>;
36
+ private unusedDeclarations!: Map<string, UnusedDeclaration[]>;
37
+ private elementCount!: number;
38
38
  private cancelled?: boolean;
39
- private globalStyleStats?: GlobalStyleStats;
40
- private textColorContrastIssues?: Map<string, ContrastIssue[]>;
39
+ private globalStyleStats!: GlobalStyleStats;
40
+ private textColorContrastIssues!: Map<string, ContrastIssue[]>;
41
41
 
42
42
  private constructor() {
43
43
  super('css_overview');
@@ -97,10 +97,11 @@ export class CSSOverviewPanel extends UI.Panel.Panel {
97
97
  nonSimple: 0,
98
98
  },
99
99
  };
100
+ this.textColorContrastIssues = new Map();
100
101
  this.renderInitialView();
101
102
  }
102
103
 
103
- private requestNodeHighlight(evt: Common.EventTarget.EventTargetEvent): void {
104
+ private requestNodeHighlight(evt: Common.EventTarget.EventTargetEvent<number>): void {
104
105
  this.model.highlightNode((evt.data as Protocol.DOM.BackendNodeId));
105
106
  }
106
107
 
@@ -124,16 +125,16 @@ export class CSSOverviewPanel extends UI.Panel.Panel {
124
125
 
125
126
  this.completedView.show(this.contentElement);
126
127
  this.completedView.setOverviewData({
127
- backgroundColors: (this.backgroundColors as Map<string, Set<number>>),
128
- textColors: (this.textColors as Map<string, Set<number>>),
129
- textColorContrastIssues: (this.textColorContrastIssues as Map<string, ContrastIssue[]>),
130
- fillColors: (this.fillColors as Map<string, Set<number>>),
131
- borderColors: (this.borderColors as Map<string, Set<number>>),
132
- globalStyleStats: this.globalStyleStats as GlobalStyleStats,
133
- fontInfo: (this.fontInfo as Map<string, Map<string, Map<string, number[]>>>),
134
- elementCount: (this.elementCount as number),
135
- mediaQueries: (this.mediaQueries as Map<string, Protocol.CSS.CSSMedia[]>),
136
- unusedDeclarations: (this.unusedDeclarations as Map<string, UnusedDeclaration[]>),
128
+ backgroundColors: this.backgroundColors,
129
+ textColors: this.textColors,
130
+ textColorContrastIssues: this.textColorContrastIssues,
131
+ fillColors: this.fillColors,
132
+ borderColors: this.borderColors,
133
+ globalStyleStats: this.globalStyleStats,
134
+ fontInfo: this.fontInfo,
135
+ elementCount: this.elementCount,
136
+ mediaQueries: this.mediaQueries,
137
+ unusedDeclarations: this.unusedDeclarations,
137
138
  });
138
139
  }
139
140
 
@@ -3,6 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as i18n from '../../core/i18n/i18n.js';
6
+ import type * as Protocol from '../../generated/protocol.js';
6
7
 
7
8
  const UIStrings = {
8
9
  /**
@@ -38,20 +39,22 @@ const str_ = i18n.i18n.registerUIStrings('panels/css_overview/CSSOverviewUnusedD
38
39
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
39
40
  export interface UnusedDeclaration {
40
41
  declaration: string;
41
- nodeId: number;
42
+ nodeId: Protocol.DOM.BackendNodeId;
42
43
  }
43
44
 
44
45
  export class CSSOverviewUnusedDeclarations {
45
- private static add(
46
- target: Map<string, UnusedDeclaration[]>, key: string, item: {declaration: string, nodeId: number}): void {
46
+ private static add(target: Map<string, UnusedDeclaration[]>, key: string, item: {
47
+ declaration: string,
48
+ nodeId: Protocol.DOM.BackendNodeId,
49
+ }): void {
47
50
  const values = target.get(key) || [];
48
51
  values.push(item);
49
52
  target.set(key, values);
50
53
  }
51
54
 
52
55
  static checkForUnusedPositionValues(
53
- unusedDeclarations: Map<string, UnusedDeclaration[]>, nodeId: number, strings: string[], positionIdx: number,
54
- topIdx: number, leftIdx: number, rightIdx: number, bottomIdx: number): void {
56
+ unusedDeclarations: Map<string, UnusedDeclaration[]>, nodeId: Protocol.DOM.BackendNodeId, strings: string[],
57
+ positionIdx: number, topIdx: number, leftIdx: number, rightIdx: number, bottomIdx: number): void {
55
58
  if (strings[positionIdx] !== 'static') {
56
59
  return;
57
60
  }
@@ -90,8 +93,8 @@ export class CSSOverviewUnusedDeclarations {
90
93
  }
91
94
 
92
95
  static checkForUnusedWidthAndHeightValues(
93
- unusedDeclarations: Map<string, UnusedDeclaration[]>, nodeId: number, strings: string[], displayIdx: number,
94
- widthIdx: number, heightIdx: number): void {
96
+ unusedDeclarations: Map<string, UnusedDeclaration[]>, nodeId: Protocol.DOM.BackendNodeId, strings: string[],
97
+ displayIdx: number, widthIdx: number, heightIdx: number): void {
95
98
  if (strings[displayIdx] !== 'inline') {
96
99
  return;
97
100
  }
@@ -114,8 +117,8 @@ export class CSSOverviewUnusedDeclarations {
114
117
  }
115
118
 
116
119
  static checkForInvalidVerticalAlignment(
117
- unusedDeclarations: Map<string, UnusedDeclaration[]>, nodeId: number, strings: string[], displayIdx: number,
118
- verticalAlignIdx: number): void {
120
+ unusedDeclarations: Map<string, UnusedDeclaration[]>, nodeId: Protocol.DOM.BackendNodeId, strings: string[],
121
+ displayIdx: number, verticalAlignIdx: number): void {
119
122
  if (!strings[displayIdx] || strings[displayIdx] === 'inline' || strings[displayIdx].startsWith('table')) {
120
123
  return;
121
124
  }
@@ -1099,9 +1099,8 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
1099
1099
  SDK.CSSModel.CSSPropertyTrackerEvents.TrackedCSSPropertiesUpdated, this.trackedCSSPropertiesUpdated, this);
1100
1100
  }
1101
1101
 
1102
- private trackedCSSPropertiesUpdated(event: Common.EventTarget.EventTargetEvent): void {
1103
- const domNodes = (event.data.domNodes as (SDK.DOMModel.DOMNode | null)[]);
1104
-
1102
+ private trackedCSSPropertiesUpdated({data: domNodes}:
1103
+ Common.EventTarget.EventTargetEvent<(SDK.DOMModel.DOMNode | null)[]>): void {
1105
1104
  for (const domNode of domNodes) {
1106
1105
  if (!domNode) {
1107
1106
  continue;
@@ -895,7 +895,7 @@ export enum Events {
895
895
 
896
896
  export type EventTypes = {
897
897
  [Events.PaintProfilerRequested]: Selection,
898
- [Events.ScaleChanged]: void,
898
+ [Events.ScaleChanged]: number,
899
899
  };
900
900
 
901
901
  export const enum ChromeTexture {
@@ -2,7 +2,6 @@
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
- import * as Common from '../../core/common/common.js';
6
5
  import * as i18n from '../../core/i18n/i18n.js';
7
6
  import type * as ProtocolClient from '../../core/protocol_client/protocol_client.js';
8
7
  import * as SDK from '../../core/sdk/sdk.js';
@@ -12,7 +11,7 @@ import type * as ReportRenderer from './LighthouseReporterTypes.js';
12
11
 
13
12
  let lastId = 1;
14
13
 
15
- export class ProtocolService extends Common.ObjectWrapper.ObjectWrapper {
14
+ export class ProtocolService {
16
15
  private rawConnection?: ProtocolClient.InspectorBackend.Connection;
17
16
  private lighthouseWorkerPromise?: Promise<Worker>;
18
17
  private lighthouseMessageUpdateCallback?: ((arg0: string) => void);
@@ -53,6 +53,10 @@
53
53
  text-align: left;
54
54
  }
55
55
 
56
+ .conditions-edit-row .conditions-list-text:last-child {
57
+ text-align: right;
58
+ }
59
+
56
60
  .conditions-list-title {
57
61
  text-align: start;
58
62
  display: flex;
@@ -145,7 +145,9 @@ export class ProfileFlameChartDataProvider implements PerfUI.FlameChart.FlameCha
145
145
  }
146
146
  }
147
147
 
148
- export class CPUProfileFlameChart extends UI.Widget.VBox implements UI.SearchableView.Searchable {
148
+ export class CPUProfileFlameChart extends
149
+ Common.ObjectWrapper.eventMixin<PerfUI.FlameChart.EventTypes, typeof UI.Widget.VBox>(UI.Widget.VBox)
150
+ implements UI.SearchableView.Searchable {
149
151
  readonly searchableView: UI.SearchableView.SearchableView;
150
152
  readonly overviewPane: OverviewPane;
151
153
  readonly mainPane: PerfUI.FlameChart.FlameChart;
@@ -171,7 +173,7 @@ export class CPUProfileFlameChart extends UI.Widget.VBox implements UI.Searchabl
171
173
  this.mainPane.addEventListener(PerfUI.FlameChart.Events.EntryInvoked, this.onEntryInvoked, this);
172
174
  this.entrySelected = false;
173
175
  this.mainPane.addEventListener(PerfUI.FlameChart.Events.CanvasFocused, this.onEntrySelected, this);
174
- this.overviewPane.addEventListener(PerfUI.OverviewGrid.Events.WindowChanged, this.onWindowChanged, this);
176
+ this.overviewPane.addEventListener(OverviewPaneEvents.WindowChanged, this.onWindowChanged, this);
175
177
  this.dataProvider = dataProvider;
176
178
  this.searchResults = [];
177
179
  }
@@ -180,9 +182,8 @@ export class CPUProfileFlameChart extends UI.Widget.VBox implements UI.Searchabl
180
182
  this.mainPane.focus();
181
183
  }
182
184
 
183
- onWindowChanged(event: Common.EventTarget.EventTargetEvent): void {
184
- const windowLeft = event.data.windowTimeLeft;
185
- const windowRight = event.data.windowTimeRight;
185
+ onWindowChanged(event: Common.EventTarget.EventTargetEvent<OverviewPaneWindowChangedEvent>): void {
186
+ const {windowTimeLeft: windowLeft, windowTimeRight: windowRight} = event.data;
186
187
  this.mainPane.setWindowTimes(windowLeft, windowRight, /* animate */ true);
187
188
  }
188
189
 
@@ -308,7 +309,8 @@ export class OverviewCalculator implements PerfUI.TimelineGrid.Calculator {
308
309
  }
309
310
  }
310
311
 
311
- export class OverviewPane extends UI.Widget.VBox implements PerfUI.FlameChart.FlameChartDelegate {
312
+ export class OverviewPane extends Common.ObjectWrapper.eventMixin<OverviewPaneEventTypes, typeof UI.Widget.VBox>(
313
+ UI.Widget.VBox) implements PerfUI.FlameChart.FlameChartDelegate {
312
314
  overviewContainer: HTMLElement;
313
315
  readonly overviewCalculator: OverviewCalculator;
314
316
  readonly overviewGrid: PerfUI.OverviewGrid.OverviewGrid;
@@ -329,7 +331,8 @@ export class OverviewPane extends UI.Widget.VBox implements PerfUI.FlameChart.Fl
329
331
  (this.overviewContainer.createChild('canvas', 'cpu-profile-flame-chart-overview-canvas') as HTMLCanvasElement);
330
332
  this.overviewContainer.appendChild(this.overviewGrid.element);
331
333
  this.dataProvider = dataProvider;
332
- this.overviewGrid.addEventListener(PerfUI.OverviewGrid.Events.WindowChanged, this.onWindowChanged, this);
334
+ this.overviewGrid.addEventListener(
335
+ PerfUI.OverviewGrid.Events.WindowChangedWithPosition, this.onWindowChanged, this);
333
336
  }
334
337
 
335
338
  windowChanged(windowStartTime: number, windowEndTime: number): void {
@@ -348,12 +351,13 @@ export class OverviewPane extends UI.Widget.VBox implements PerfUI.FlameChart.Fl
348
351
  this.overviewGrid.setWindow((timeLeft - startTime) / totalTime, (timeRight - startTime) / totalTime);
349
352
  }
350
353
 
351
- onWindowChanged(event: Common.EventTarget.EventTargetEvent): void {
354
+ onWindowChanged(event: Common.EventTarget.EventTargetEvent<PerfUI.OverviewGrid.WindowChangedWithPositionEvent>):
355
+ void {
352
356
  const windowPosition = {windowTimeLeft: event.data.rawStartValue, windowTimeRight: event.data.rawEndValue};
353
357
  this.windowTimeLeft = windowPosition.windowTimeLeft;
354
358
  this.windowTimeRight = windowPosition.windowTimeRight;
355
359
 
356
- this.dispatchEventToListeners(PerfUI.OverviewGrid.Events.WindowChanged, windowPosition);
360
+ this.dispatchEventToListeners(OverviewPaneEvents.WindowChanged, windowPosition);
357
361
  }
358
362
 
359
363
  timelineData(): PerfUI.FlameChart.TimelineData|null {
@@ -445,3 +449,16 @@ export class OverviewPane extends UI.Widget.VBox implements PerfUI.FlameChart.Fl
445
449
  this.overviewCanvas.style.height = height + 'px';
446
450
  }
447
451
  }
452
+
453
+ export const enum OverviewPaneEvents {
454
+ WindowChanged = 'WindowChanged',
455
+ }
456
+
457
+ export interface OverviewPaneWindowChangedEvent {
458
+ windowTimeLeft: number;
459
+ windowTimeRight: number;
460
+ }
461
+
462
+ export type OverviewPaneEventTypes = {
463
+ [OverviewPaneEvents.WindowChanged]: OverviewPaneWindowChangedEvent,
464
+ };
@@ -1812,17 +1812,16 @@ export class DebuggerPlugin extends Plugin {
1812
1812
  this.textEditor.attachInfobar(this.prettyPrintInfobar);
1813
1813
  }
1814
1814
 
1815
- private async handleGutterClick(event: Common.EventTarget.EventTargetEvent): Promise<void> {
1815
+ private async handleGutterClick(
1816
+ event: Common.EventTarget.EventTargetEvent<SourceFrame.SourcesTextEditor.GutterClickEventData>): Promise<void> {
1816
1817
  if (this.muted) {
1817
1818
  return;
1818
1819
  }
1819
1820
 
1820
- const eventData = (event.data as SourceFrame.SourcesTextEditor.GutterClickEventData);
1821
- if (eventData.gutterType !== SourceFrame.SourcesTextEditor.lineNumbersGutterType) {
1821
+ const {gutterType, lineNumber: editorLineNumber, event: eventObject} = event.data;
1822
+ if (gutterType !== SourceFrame.SourcesTextEditor.lineNumbersGutterType) {
1822
1823
  return;
1823
1824
  }
1824
- const editorLineNumber = eventData.lineNumber;
1825
- const eventObject = eventData.event;
1826
1825
 
1827
1826
  if (eventObject.button !== 0 || eventObject.altKey || eventObject.ctrlKey || eventObject.metaKey) {
1828
1827
  return;
@@ -51,12 +51,14 @@ export class EditingLocationHistoryManager {
51
51
  SourceFrame.SourcesTextEditor.Events.JumpHappened, this.onJumpHappened.bind(this));
52
52
  }
53
53
 
54
- private onJumpHappened(event: Common.EventTarget.EventTargetEvent): void {
55
- if (event.data.from) {
56
- this.updateActiveState(event.data.from);
54
+ private onJumpHappened(event: Common.EventTarget.EventTargetEvent<SourceFrame.SourcesTextEditor.JumpHappenedEvent>):
55
+ void {
56
+ const {from, to} = event.data;
57
+ if (from) {
58
+ this.updateActiveState(from);
57
59
  }
58
- if (event.data.to) {
59
- this.pushActiveState(event.data.to);
60
+ if (to) {
61
+ this.pushActiveState(to);
60
62
  }
61
63
  }
62
64