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.
- package/front_end/core/common/Console.ts +5 -1
- package/front_end/core/host/InspectorFrontendHost.ts +6 -5
- package/front_end/core/host/InspectorFrontendHostAPI.ts +102 -0
- package/front_end/core/sdk/CSSModel.ts +8 -4
- package/front_end/core/sdk/Connections.ts +5 -5
- package/front_end/core/sdk/DebuggerModel.ts +8 -5
- package/front_end/entrypoints/inspector_main/InspectorMain.ts +2 -3
- package/front_end/entrypoints/js_app/JsMain.ts +1 -1
- package/front_end/entrypoints/main/MainImpl.ts +4 -7
- package/front_end/entrypoints/node_main/NodeConnectionsPanel.ts +2 -2
- package/front_end/entrypoints/node_main/NodeMain.ts +2 -3
- package/front_end/entrypoints/worker_app/WorkerMain.ts +1 -1
- package/front_end/models/bindings/BreakpointManager.ts +3 -2
- package/front_end/models/extensions/ExtensionServer.ts +2 -2
- package/front_end/models/issues_manager/DeprecationIssue.ts +1 -1
- package/front_end/models/issues_manager/descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +15 -5
- package/front_end/models/issues_manager/descriptions/CoepFrameResourceNeedsCoepHeader.md +7 -3
- package/front_end/models/issues_manager/descriptions/deprecationNavigatorUserAgent.md +1 -1
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +26 -31
- package/front_end/models/persistence/NetworkPersistenceManager.ts +11 -1
- package/front_end/models/workspace/FileManager.ts +5 -7
- package/front_end/panels/console/ConsoleView.ts +3 -5
- package/front_end/panels/coverage/CoverageView.ts +5 -4
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +47 -44
- package/front_end/panels/css_overview/CSSOverviewController.ts +48 -8
- package/front_end/panels/css_overview/CSSOverviewModel.ts +5 -5
- package/front_end/panels/css_overview/CSSOverviewPanel.ts +22 -21
- package/front_end/panels/css_overview/CSSOverviewUnusedDeclarations.ts +12 -9
- package/front_end/panels/elements/ElementsPanel.ts +2 -3
- package/front_end/panels/layer_viewer/Layers3DView.ts +1 -1
- package/front_end/panels/lighthouse/LighthouseProtocolService.ts +1 -2
- package/front_end/panels/mobile_throttling/throttlingSettingsTab.css +4 -0
- package/front_end/panels/profiler/CPUProfileFlameChart.ts +26 -9
- package/front_end/panels/sources/DebuggerPlugin.ts +4 -5
- package/front_end/panels/sources/EditingLocationHistoryManager.ts +7 -5
- package/front_end/panels/sources/TabbedEditorContainer.ts +2 -4
- package/front_end/ui/components/docs/toggle_fonts.ts +21 -0
- package/front_end/ui/legacy/ContextMenu.ts +4 -4
- package/front_end/ui/legacy/ForwardedInputEventHandler.ts +3 -7
- package/front_end/ui/legacy/InspectorView.ts +1 -2
- package/front_end/ui/legacy/Widget.ts +1 -3
- package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +5 -8
- package/front_end/ui/legacy/components/color_picker/Spectrum.ts +5 -8
- package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +13 -3
- package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +3 -2
- package/front_end/ui/legacy/components/source_frame/SourcesTextEditor.ts +18 -2
- 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):
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
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:
|
|
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<
|
|
193
|
-
textColors: Map<string, Set<
|
|
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<
|
|
196
|
-
borderColors: Map<string, Set<
|
|
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,
|
|
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 =
|
|
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 {
|
|
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} =
|
|
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} =
|
|
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} =
|
|
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} =
|
|
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} =
|
|
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:
|
|
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
|
-
|
|
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(
|
|
1022
|
-
return prev.add(
|
|
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
|
-
|
|
1028
|
+
let frontendNode;
|
|
1029
|
+
if ('nodeId' in item && visibility.has('nodeId')) {
|
|
1029
1030
|
if (!relatedNodesMap) {
|
|
1030
1031
|
continue;
|
|
1031
1032
|
}
|
|
1032
|
-
|
|
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
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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<
|
|
19
|
-
textColors: Map<string, Set<
|
|
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<
|
|
22
|
-
borderColors: Map<string, Set<
|
|
23
|
-
fontInfo: Map<string, Map<string, Map<string,
|
|
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
|
|
31
|
-
private textColors
|
|
32
|
-
private fillColors
|
|
33
|
-
private borderColors
|
|
34
|
-
private fontInfo
|
|
35
|
-
private mediaQueries
|
|
36
|
-
private unusedDeclarations
|
|
37
|
-
private elementCount
|
|
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
|
|
40
|
-
private textColorContrastIssues
|
|
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:
|
|
128
|
-
textColors:
|
|
129
|
-
textColorContrastIssues:
|
|
130
|
-
fillColors:
|
|
131
|
-
borderColors:
|
|
132
|
-
globalStyleStats: this.globalStyleStats
|
|
133
|
-
fontInfo:
|
|
134
|
-
elementCount:
|
|
135
|
-
mediaQueries:
|
|
136
|
-
unusedDeclarations:
|
|
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:
|
|
42
|
+
nodeId: Protocol.DOM.BackendNodeId;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
export class CSSOverviewUnusedDeclarations {
|
|
45
|
-
private static add(
|
|
46
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
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(
|
|
1103
|
-
|
|
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;
|
|
@@ -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
|
|
14
|
+
export class ProtocolService {
|
|
16
15
|
private rawConnection?: ProtocolClient.InspectorBackend.Connection;
|
|
17
16
|
private lighthouseWorkerPromise?: Promise<Worker>;
|
|
18
17
|
private lighthouseMessageUpdateCallback?: ((arg0: string) => void);
|
|
@@ -145,7 +145,9 @@ export class ProfileFlameChartDataProvider implements PerfUI.FlameChart.FlameCha
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
export class CPUProfileFlameChart extends
|
|
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(
|
|
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
|
|
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
|
|
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(
|
|
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):
|
|
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(
|
|
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(
|
|
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
|
|
1821
|
-
if (
|
|
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):
|
|
55
|
-
|
|
56
|
-
|
|
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 (
|
|
59
|
-
this.pushActiveState(
|
|
60
|
+
if (to) {
|
|
61
|
+
this.pushActiveState(to);
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
64
|
|