chrome-devtools-frontend 1.0.922470 → 1.0.922671
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/entrypoints/inspector_main/InspectorMain.ts +1 -1
- package/front_end/entrypoints/js_app/JsMain.ts +1 -1
- package/front_end/entrypoints/node_main/NodeMain.ts +1 -1
- package/front_end/entrypoints/worker_app/WorkerMain.ts +1 -1
- package/front_end/panels/coverage/CoverageView.ts +5 -4
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +40 -37
- package/front_end/panels/css_overview/CSSOverviewController.ts +48 -8
- package/front_end/panels/css_overview/CSSOverviewPanel.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 +23 -8
- 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/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
|
@@ -37,7 +37,7 @@ const str_ = i18n.i18n.registerUIStrings('entrypoints/inspector_main/InspectorMa
|
|
|
37
37
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
38
38
|
let inspectorMainImplInstance: InspectorMainImpl;
|
|
39
39
|
|
|
40
|
-
export class InspectorMainImpl
|
|
40
|
+
export class InspectorMainImpl implements Common.Runnable.Runnable {
|
|
41
41
|
static instance(opts: {
|
|
42
42
|
forceNew: boolean|null,
|
|
43
43
|
} = {forceNew: null}): InspectorMainImpl {
|
|
@@ -20,7 +20,7 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
|
20
20
|
|
|
21
21
|
let jsMainImplInstance: JsMainImpl;
|
|
22
22
|
|
|
23
|
-
export class JsMainImpl
|
|
23
|
+
export class JsMainImpl implements Common.Runnable.Runnable {
|
|
24
24
|
static instance(opts: {forceNew: boolean|null} = {forceNew: null}): JsMainImpl {
|
|
25
25
|
const {forceNew} = opts;
|
|
26
26
|
if (!jsMainImplInstance || forceNew) {
|
|
@@ -27,7 +27,7 @@ const str_ = i18n.i18n.registerUIStrings('entrypoints/node_main/NodeMain.ts', UI
|
|
|
27
27
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
28
28
|
let nodeMainImplInstance: NodeMainImpl;
|
|
29
29
|
|
|
30
|
-
export class NodeMainImpl
|
|
30
|
+
export class NodeMainImpl implements Common.Runnable.Runnable {
|
|
31
31
|
static instance(opts: {forceNew: boolean|null} = {forceNew: null}): NodeMainImpl {
|
|
32
32
|
const {forceNew} = opts;
|
|
33
33
|
if (!nodeMainImplInstance || forceNew) {
|
|
@@ -20,7 +20,7 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
|
20
20
|
|
|
21
21
|
let workerMainImplInstance: WorkerMainImpl;
|
|
22
22
|
|
|
23
|
-
export class WorkerMainImpl
|
|
23
|
+
export class WorkerMainImpl implements Common.Runnable.Runnable {
|
|
24
24
|
static instance(opts: {
|
|
25
25
|
forceNew: boolean|null,
|
|
26
26
|
} = {forceNew: null}): WorkerMainImpl {
|
|
@@ -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';
|
|
@@ -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;
|
|
@@ -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: number}[]).reduce((prev, curr) => {
|
|
1017
|
+
const nodeId = curr.nodeId as Protocol.DOM.BackendNodeId;
|
|
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 as Protocol.DOM.BackendNodeId);
|
|
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: number}[],
|
|
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: number}[],
|
|
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
|
};
|
|
@@ -100,7 +100,7 @@ export class CSSOverviewPanel extends UI.Panel.Panel {
|
|
|
100
100
|
this.renderInitialView();
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
private requestNodeHighlight(evt: Common.EventTarget.EventTargetEvent): void {
|
|
103
|
+
private requestNodeHighlight(evt: Common.EventTarget.EventTargetEvent<number>): void {
|
|
104
104
|
this.model.highlightNode((evt.data as Protocol.DOM.BackendNodeId));
|
|
105
105
|
}
|
|
106
106
|
|
|
@@ -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);
|
|
@@ -171,7 +171,7 @@ export class CPUProfileFlameChart extends UI.Widget.VBox implements UI.Searchabl
|
|
|
171
171
|
this.mainPane.addEventListener(PerfUI.FlameChart.Events.EntryInvoked, this.onEntryInvoked, this);
|
|
172
172
|
this.entrySelected = false;
|
|
173
173
|
this.mainPane.addEventListener(PerfUI.FlameChart.Events.CanvasFocused, this.onEntrySelected, this);
|
|
174
|
-
this.overviewPane.addEventListener(
|
|
174
|
+
this.overviewPane.addEventListener(OverviewPaneEvents.WindowChanged, this.onWindowChanged, this);
|
|
175
175
|
this.dataProvider = dataProvider;
|
|
176
176
|
this.searchResults = [];
|
|
177
177
|
}
|
|
@@ -180,9 +180,8 @@ export class CPUProfileFlameChart extends UI.Widget.VBox implements UI.Searchabl
|
|
|
180
180
|
this.mainPane.focus();
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
onWindowChanged(event: Common.EventTarget.EventTargetEvent): void {
|
|
184
|
-
const windowLeft = event.data
|
|
185
|
-
const windowRight = event.data.windowTimeRight;
|
|
183
|
+
onWindowChanged(event: Common.EventTarget.EventTargetEvent<OverviewPaneWindowChangedEvent>): void {
|
|
184
|
+
const {windowTimeLeft: windowLeft, windowTimeRight: windowRight} = event.data;
|
|
186
185
|
this.mainPane.setWindowTimes(windowLeft, windowRight, /* animate */ true);
|
|
187
186
|
}
|
|
188
187
|
|
|
@@ -308,7 +307,8 @@ export class OverviewCalculator implements PerfUI.TimelineGrid.Calculator {
|
|
|
308
307
|
}
|
|
309
308
|
}
|
|
310
309
|
|
|
311
|
-
export class OverviewPane extends
|
|
310
|
+
export class OverviewPane extends Common.ObjectWrapper.eventMixin<OverviewPaneEvents, typeof UI.Widget.VBox>(
|
|
311
|
+
UI.Widget.VBox) implements PerfUI.FlameChart.FlameChartDelegate {
|
|
312
312
|
overviewContainer: HTMLElement;
|
|
313
313
|
readonly overviewCalculator: OverviewCalculator;
|
|
314
314
|
readonly overviewGrid: PerfUI.OverviewGrid.OverviewGrid;
|
|
@@ -329,7 +329,8 @@ export class OverviewPane extends UI.Widget.VBox implements PerfUI.FlameChart.Fl
|
|
|
329
329
|
(this.overviewContainer.createChild('canvas', 'cpu-profile-flame-chart-overview-canvas') as HTMLCanvasElement);
|
|
330
330
|
this.overviewContainer.appendChild(this.overviewGrid.element);
|
|
331
331
|
this.dataProvider = dataProvider;
|
|
332
|
-
this.overviewGrid.addEventListener(
|
|
332
|
+
this.overviewGrid.addEventListener(
|
|
333
|
+
PerfUI.OverviewGrid.Events.WindowChangedWithPosition, this.onWindowChanged, this);
|
|
333
334
|
}
|
|
334
335
|
|
|
335
336
|
windowChanged(windowStartTime: number, windowEndTime: number): void {
|
|
@@ -348,12 +349,13 @@ export class OverviewPane extends UI.Widget.VBox implements PerfUI.FlameChart.Fl
|
|
|
348
349
|
this.overviewGrid.setWindow((timeLeft - startTime) / totalTime, (timeRight - startTime) / totalTime);
|
|
349
350
|
}
|
|
350
351
|
|
|
351
|
-
onWindowChanged(event: Common.EventTarget.EventTargetEvent):
|
|
352
|
+
onWindowChanged(event: Common.EventTarget.EventTargetEvent<PerfUI.OverviewGrid.WindowChangedWithPositionEvent>):
|
|
353
|
+
void {
|
|
352
354
|
const windowPosition = {windowTimeLeft: event.data.rawStartValue, windowTimeRight: event.data.rawEndValue};
|
|
353
355
|
this.windowTimeLeft = windowPosition.windowTimeLeft;
|
|
354
356
|
this.windowTimeRight = windowPosition.windowTimeRight;
|
|
355
357
|
|
|
356
|
-
this.dispatchEventToListeners(
|
|
358
|
+
this.dispatchEventToListeners(OverviewPaneEvents.WindowChanged, windowPosition);
|
|
357
359
|
}
|
|
358
360
|
|
|
359
361
|
timelineData(): PerfUI.FlameChart.TimelineData|null {
|
|
@@ -445,3 +447,16 @@ export class OverviewPane extends UI.Widget.VBox implements PerfUI.FlameChart.Fl
|
|
|
445
447
|
this.overviewCanvas.style.height = height + 'px';
|
|
446
448
|
}
|
|
447
449
|
}
|
|
450
|
+
|
|
451
|
+
export const enum OverviewPaneEvents {
|
|
452
|
+
WindowChanged = 'WindowChanged',
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
export interface OverviewPaneWindowChangedEvent {
|
|
456
|
+
windowTimeLeft: number;
|
|
457
|
+
windowTimeRight: number;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
export type OVerviewPaneEventTypes = {
|
|
461
|
+
[OverviewPaneEvents.WindowChanged]: OverviewPaneWindowChangedEvent,
|
|
462
|
+
};
|
|
@@ -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
|
|
|
@@ -236,11 +236,10 @@ export class TabbedEditorContainer extends Common.ObjectWrapper.ObjectWrapper<Ev
|
|
|
236
236
|
SourceFrame.SourcesTextEditor.Events.SelectionChanged, this.selectionChanged, this);
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
private scrollChanged(
|
|
239
|
+
private scrollChanged({data: lineNumber}: Common.EventTarget.EventTargetEvent<number>): void {
|
|
240
240
|
if (this.scrollTimer) {
|
|
241
241
|
clearTimeout(this.scrollTimer);
|
|
242
242
|
}
|
|
243
|
-
const lineNumber = (event.data as number);
|
|
244
243
|
this.scrollTimer = window.setTimeout(saveHistory.bind(this), 100);
|
|
245
244
|
if (this.currentFileInternal) {
|
|
246
245
|
this.history.updateScrollLineNumber(this.currentFileInternal.url(), lineNumber);
|
|
@@ -251,8 +250,7 @@ export class TabbedEditorContainer extends Common.ObjectWrapper.ObjectWrapper<Ev
|
|
|
251
250
|
}
|
|
252
251
|
}
|
|
253
252
|
|
|
254
|
-
private selectionChanged(
|
|
255
|
-
const range = (event.data as TextUtils.TextRange.TextRange);
|
|
253
|
+
private selectionChanged({data: range}: Common.EventTarget.EventTargetEvent<TextUtils.TextRange.TextRange>): void {
|
|
256
254
|
if (this.currentFileInternal) {
|
|
257
255
|
this.history.updateSelectionRange(this.currentFileInternal.url(), range);
|
|
258
256
|
}
|
|
@@ -6,7 +6,28 @@ const PLATFORM_MAC_CLASS = 'platform-mac';
|
|
|
6
6
|
const PLATFORM_LINUX_CLASS = 'platform-linux';
|
|
7
7
|
const PLATFORM_WINDOWS_CLASS = 'platform-windows';
|
|
8
8
|
|
|
9
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
10
|
+
|
|
9
11
|
export function init(): void {
|
|
12
|
+
// fontFamily is provided by the interaction tests.
|
|
13
|
+
// While platform-specific class names define multiple font-families,
|
|
14
|
+
// we want a single font-family to be used by the tests.
|
|
15
|
+
if (urlParams.has('fontFamily')) {
|
|
16
|
+
const div = document.createElement('div');
|
|
17
|
+
div.style.position = 'fixed';
|
|
18
|
+
div.style.bottom = '10px';
|
|
19
|
+
div.style.right = '230px';
|
|
20
|
+
div.style.width = '250px';
|
|
21
|
+
div.style.fontSize = '16px';
|
|
22
|
+
div.style.padding = '5px';
|
|
23
|
+
div.innerText = `font-family: ${urlParams.get('fontFamily')}`;
|
|
24
|
+
window.addEventListener('load', () => {
|
|
25
|
+
document.body.appendChild(div);
|
|
26
|
+
});
|
|
27
|
+
document.body.style.fontFamily = `${urlParams.get('fontFamily')}`;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
10
31
|
document.body.classList.add(PLATFORM_LINUX_CLASS);
|
|
11
32
|
const button = document.createElement('button');
|
|
12
33
|
|
|
@@ -417,11 +417,10 @@ export class Window extends Common.ObjectWrapper.ObjectWrapper {
|
|
|
417
417
|
this.windowLeft = windowLeft;
|
|
418
418
|
this.windowRight = windowRight;
|
|
419
419
|
this.updateCurtains();
|
|
420
|
-
let windowPosition;
|
|
421
420
|
if (this.calculator) {
|
|
422
|
-
|
|
421
|
+
this.dispatchEventToListeners(Events.WindowChangedWithPosition, this.calculateWindowPosition());
|
|
423
422
|
}
|
|
424
|
-
this.dispatchEventToListeners(Events.WindowChanged
|
|
423
|
+
this.dispatchEventToListeners(Events.WindowChanged);
|
|
425
424
|
}
|
|
426
425
|
|
|
427
426
|
private updateCurtains(): void {
|
|
@@ -523,8 +522,19 @@ export class Window extends Common.ObjectWrapper.ObjectWrapper {
|
|
|
523
522
|
// eslint-disable-next-line rulesdir/const_enum
|
|
524
523
|
export enum Events {
|
|
525
524
|
WindowChanged = 'WindowChanged',
|
|
525
|
+
WindowChangedWithPosition = 'WindowChangedWithPosition',
|
|
526
526
|
}
|
|
527
527
|
|
|
528
|
+
export interface WindowChangedWithPositionEvent {
|
|
529
|
+
rawStartValue: number;
|
|
530
|
+
rawEndValue: number;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
export type EventTypes = {
|
|
534
|
+
[Events.WindowChanged]: void,
|
|
535
|
+
[Events.WindowChangedWithPosition]: WindowChangedWithPositionEvent,
|
|
536
|
+
};
|
|
537
|
+
|
|
528
538
|
export class WindowSelector {
|
|
529
539
|
private startPosition: number;
|
|
530
540
|
private width: number;
|
|
@@ -33,6 +33,7 @@ import type * as SDK from '../../../../core/sdk/sdk.js';
|
|
|
33
33
|
import * as UI from '../../legacy.js';
|
|
34
34
|
import * as i18n from '../../../../core/i18n/i18n.js';
|
|
35
35
|
|
|
36
|
+
import type {WindowChangedWithPositionEvent} from './OverviewGrid.js';
|
|
36
37
|
import {Events as OverviewGridEvents, OverviewGrid} from './OverviewGrid.js';
|
|
37
38
|
import type {Calculator} from './TimelineGrid.js';
|
|
38
39
|
|
|
@@ -66,7 +67,7 @@ export class TimelineOverviewPane extends Common.ObjectWrapper.eventMixin<EventT
|
|
|
66
67
|
this.cursorArea.addEventListener('mouseleave', this.hideCursor.bind(this), true);
|
|
67
68
|
|
|
68
69
|
this.overviewGrid.setResizeEnabled(false);
|
|
69
|
-
this.overviewGrid.addEventListener(OverviewGridEvents.
|
|
70
|
+
this.overviewGrid.addEventListener(OverviewGridEvents.WindowChangedWithPosition, this.onWindowChanged, this);
|
|
70
71
|
this.overviewGrid.setClickHandler(this.onClick.bind(this));
|
|
71
72
|
this.overviewControls = [];
|
|
72
73
|
this.markers = new Map();
|
|
@@ -209,7 +210,7 @@ export class TimelineOverviewPane extends Common.ObjectWrapper.eventMixin<EventT
|
|
|
209
210
|
return this.overviewControls.some(control => control.onClick(event));
|
|
210
211
|
}
|
|
211
212
|
|
|
212
|
-
private onWindowChanged(event: Common.EventTarget.EventTargetEvent): void {
|
|
213
|
+
private onWindowChanged(event: Common.EventTarget.EventTargetEvent<WindowChangedWithPositionEvent>): void {
|
|
213
214
|
if (this.muteOnWindowChanged) {
|
|
214
215
|
return;
|
|
215
216
|
}
|
|
@@ -9,7 +9,9 @@ import * as TextEditor from '../text_editor/text_editor.js';
|
|
|
9
9
|
|
|
10
10
|
const whitespaceStyleInjectedSet = new WeakSet<Document>();
|
|
11
11
|
|
|
12
|
-
export class SourcesTextEditor extends
|
|
12
|
+
export class SourcesTextEditor extends
|
|
13
|
+
Common.ObjectWrapper.eventMixin<EventTypes, typeof TextEditor.CodeMirrorTextEditor.CodeMirrorTextEditor>(
|
|
14
|
+
TextEditor.CodeMirrorTextEditor.CodeMirrorTextEditor) {
|
|
13
15
|
private readonly delegate: SourcesTextEditorDelegate;
|
|
14
16
|
private readonly gutterMouseMove: (event: Event) => void;
|
|
15
17
|
private readonly gutterMouseOut: () => void;
|
|
@@ -486,7 +488,7 @@ export class SourcesTextEditor extends TextEditor.CodeMirrorTextEditor.CodeMirro
|
|
|
486
488
|
if (from && to && from.equal(to)) {
|
|
487
489
|
return;
|
|
488
490
|
}
|
|
489
|
-
this.dispatchEventToListeners(Events.JumpHappened, {from
|
|
491
|
+
this.dispatchEventToListeners(Events.JumpHappened, {from, to});
|
|
490
492
|
}
|
|
491
493
|
|
|
492
494
|
private scroll(): void {
|
|
@@ -696,6 +698,20 @@ export enum Events {
|
|
|
696
698
|
JumpHappened = 'JumpHappened',
|
|
697
699
|
}
|
|
698
700
|
|
|
701
|
+
export interface JumpHappenedEvent {
|
|
702
|
+
from: TextUtils.TextRange.TextRange|null;
|
|
703
|
+
to: TextUtils.TextRange.TextRange|null;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
export type EventTypes = {
|
|
707
|
+
[Events.GutterClick]: GutterClickEventData,
|
|
708
|
+
[Events.SelectionChanged]: TextUtils.TextRange.TextRange,
|
|
709
|
+
[Events.ScrollChanged]: number,
|
|
710
|
+
[Events.EditorFocused]: void,
|
|
711
|
+
[Events.EditorBlurred]: void,
|
|
712
|
+
[Events.JumpHappened]: JumpHappenedEvent,
|
|
713
|
+
};
|
|
714
|
+
|
|
699
715
|
export class SourcesTextEditorDelegate {
|
|
700
716
|
populateLineGutterContextMenu(_contextMenu: UI.ContextMenu.ContextMenu, _lineNumber: number): Promise<void> {
|
|
701
717
|
throw new Error('Not implemented');
|
package/package.json
CHANGED