chrome-devtools-frontend 1.0.929965 → 1.0.930993
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/config/gni/devtools_grd_files.gni +2 -1
- package/front_end/core/host/InspectorFrontendHost.ts +8 -1
- package/front_end/core/host/InspectorFrontendHostAPI.ts +12 -0
- package/front_end/core/i18n/locales/en-US.json +3 -0
- package/front_end/core/i18n/locales/en-XL.json +3 -0
- package/front_end/core/protocol_client/InspectorBackend.ts +71 -71
- package/front_end/core/sdk/NetworkManager.ts +6 -2
- package/front_end/devtools_compatibility.js +8 -0
- package/front_end/legacy_test_runner/sources_test_runner/DebuggerTestRunner.js +2 -2
- package/front_end/legacy_test_runner/test_runner/TestRunner.js +2 -3
- package/front_end/models/bindings/BreakpointManager.ts +158 -154
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +64 -56
- package/front_end/models/bindings/CompilerScriptMapping.ts +70 -70
- package/front_end/models/bindings/ContentProviderBasedProject.ts +20 -20
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +132 -132
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +73 -72
- package/front_end/models/bindings/DefaultScriptMapping.ts +22 -22
- package/front_end/models/bindings/FileUtils.ts +81 -81
- package/front_end/models/bindings/IgnoreListManager.ts +17 -17
- package/front_end/models/bindings/LiveLocation.ts +21 -21
- package/front_end/models/bindings/PresentationConsoleMessageHelper.ts +28 -28
- package/front_end/models/bindings/ResourceMapping.ts +50 -50
- package/front_end/models/bindings/ResourceScriptMapping.ts +71 -71
- package/front_end/models/bindings/SASSSourceMapping.ts +32 -32
- package/front_end/models/bindings/StylesSourceMapping.ts +57 -57
- package/front_end/models/bindings/TempFile.ts +34 -34
- package/front_end/models/emulation/DeviceModeModel.ts +208 -203
- package/front_end/models/emulation/EmulatedDevices.ts +34 -34
- package/front_end/panels/console/ConsoleView.ts +2 -1
- package/front_end/panels/console/ConsoleViewMessage.ts +3 -3
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +133 -133
- package/front_end/panels/css_overview/CSSOverviewModel.ts +16 -16
- package/front_end/panels/css_overview/CSSOverviewPanel.ts +77 -77
- package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +5 -5
- package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +4 -4
- package/front_end/panels/elements/ElementsTreeElement.ts +6 -10
- package/front_end/panels/elements/ElementsTreeOutline.ts +3 -1
- package/front_end/panels/elements/components/LayoutPane.ts +6 -0
- package/front_end/panels/elements/elementsPanel.css +0 -1
- package/front_end/panels/elements/elementsTreeOutline.css +0 -4
- package/front_end/panels/lighthouse/LighthouseController.ts +18 -9
- package/front_end/panels/lighthouse/LighthousePanel.ts +2 -2
- package/front_end/panels/lighthouse/LighthouseProtocolService.ts +7 -2
- package/front_end/panels/network/BlockedURLsPane.ts +8 -5
- package/front_end/panels/network/blockedURLsPane.css +0 -1
- package/front_end/panels/search/SearchView.ts +0 -2
- package/front_end/panels/sources/BreakpointEditDialog.ts +98 -81
- package/front_end/panels/sources/DebuggerPlugin.ts +15 -14
- package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +18 -2
- package/front_end/ui/components/text_editor/config.ts +6 -0
- package/front_end/ui/components/text_editor/cursor_tooltip.ts +70 -0
- package/front_end/ui/components/text_editor/javascript.ts +590 -0
- package/front_end/ui/components/text_editor/text_editor.ts +1 -0
- package/front_end/ui/components/text_editor/theme.ts +11 -0
- package/front_end/ui/components/tree_outline/TreeOutline.ts +3 -1
- package/front_end/ui/legacy/ARIAUtils.ts +24 -8
- package/front_end/ui/legacy/components/text_editor/cmdevtools.css +1 -0
- package/front_end/ui/legacy/components/text_editor/text_editor-legacy.ts +0 -3
- package/front_end/ui/legacy/components/text_editor/text_editor.ts +0 -2
- package/package.json +1 -1
- package/scripts/migration/class-fields/migrate.js +15 -2
- package/scripts/migration/class-fields/migrate.sh +10 -0
- package/front_end/ui/legacy/components/text_editor/SyntaxHighlighter.ts +0 -62
|
@@ -221,80 +221,80 @@ function getBorderString(color: Common.Color.Color): string {
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
224
|
+
#controller: OverviewController;
|
|
225
|
+
#formatter: Intl.NumberFormat;
|
|
226
|
+
readonly #mainContainer: UI.SplitWidget.SplitWidget;
|
|
227
|
+
readonly #resultsContainer: UI.Widget.VBox;
|
|
228
|
+
readonly #elementContainer: DetailsView;
|
|
229
|
+
readonly #sideBar: CSSOverviewSidebarPanel;
|
|
230
|
+
#cssModel: SDK.CSSModel.CSSModel;
|
|
231
|
+
#domModel: SDK.DOMModel.DOMModel;
|
|
232
|
+
readonly #domAgent: ProtocolProxyApi.DOMApi;
|
|
233
|
+
#linkifier: Components.Linkifier.Linkifier;
|
|
234
|
+
#viewMap: Map<string, ElementDetailsView>;
|
|
235
|
+
#data: OverviewData|null;
|
|
236
|
+
#fragment?: UI.Fragment.Fragment;
|
|
237
237
|
|
|
238
238
|
constructor(controller: OverviewController, target: SDK.Target.Target) {
|
|
239
239
|
super('css_overview_completed_view');
|
|
240
240
|
|
|
241
|
-
this
|
|
242
|
-
this
|
|
241
|
+
this.#controller = controller;
|
|
242
|
+
this.#formatter = new Intl.NumberFormat('en-US');
|
|
243
243
|
|
|
244
|
-
this
|
|
245
|
-
this
|
|
246
|
-
this
|
|
244
|
+
this.#mainContainer = new UI.SplitWidget.SplitWidget(true, true);
|
|
245
|
+
this.#resultsContainer = new UI.Widget.VBox();
|
|
246
|
+
this.#elementContainer = new DetailsView();
|
|
247
247
|
|
|
248
248
|
// If closing the last tab, collapse the sidebar.
|
|
249
|
-
this
|
|
249
|
+
this.#elementContainer.addEventListener(Events.TabClosed, evt => {
|
|
250
250
|
if (evt.data === 0) {
|
|
251
|
-
this
|
|
251
|
+
this.#mainContainer.setSidebarMinimized(true);
|
|
252
252
|
}
|
|
253
253
|
});
|
|
254
254
|
|
|
255
255
|
// Dupe the styles into the main container because of the shadow root will prevent outer styles.
|
|
256
256
|
|
|
257
|
-
this
|
|
258
|
-
this
|
|
259
|
-
this
|
|
260
|
-
this
|
|
261
|
-
this
|
|
257
|
+
this.#mainContainer.setMainWidget(this.#resultsContainer);
|
|
258
|
+
this.#mainContainer.setSidebarWidget(this.#elementContainer);
|
|
259
|
+
this.#mainContainer.setVertical(false);
|
|
260
|
+
this.#mainContainer.setSecondIsSidebar(true);
|
|
261
|
+
this.#mainContainer.setSidebarMinimized(true);
|
|
262
262
|
|
|
263
|
-
this
|
|
264
|
-
this.splitWidget().setSidebarWidget(this
|
|
265
|
-
this.splitWidget().setMainWidget(this
|
|
263
|
+
this.#sideBar = new CSSOverviewSidebarPanel();
|
|
264
|
+
this.splitWidget().setSidebarWidget(this.#sideBar);
|
|
265
|
+
this.splitWidget().setMainWidget(this.#mainContainer);
|
|
266
266
|
|
|
267
267
|
const cssModel = target.model(SDK.CSSModel.CSSModel);
|
|
268
268
|
const domModel = target.model(SDK.DOMModel.DOMModel);
|
|
269
269
|
if (!cssModel || !domModel) {
|
|
270
270
|
throw new Error('Target must provide CSS and DOM models');
|
|
271
271
|
}
|
|
272
|
-
this
|
|
273
|
-
this
|
|
274
|
-
this
|
|
275
|
-
this
|
|
276
|
-
|
|
277
|
-
this
|
|
278
|
-
|
|
279
|
-
this
|
|
280
|
-
this
|
|
281
|
-
this
|
|
282
|
-
this
|
|
283
|
-
this
|
|
284
|
-
this
|
|
285
|
-
|
|
286
|
-
this
|
|
287
|
-
this
|
|
288
|
-
this
|
|
289
|
-
this
|
|
290
|
-
this
|
|
291
|
-
|
|
292
|
-
this
|
|
272
|
+
this.#cssModel = cssModel;
|
|
273
|
+
this.#domModel = domModel;
|
|
274
|
+
this.#domAgent = target.domAgent();
|
|
275
|
+
this.#linkifier = new Components.Linkifier.Linkifier(/* maxLinkLength */ 20, /* useLinkDecorator */ true);
|
|
276
|
+
|
|
277
|
+
this.#viewMap = new Map();
|
|
278
|
+
|
|
279
|
+
this.#sideBar.addItem(i18nString(UIStrings.overviewSummary), 'summary');
|
|
280
|
+
this.#sideBar.addItem(i18nString(UIStrings.colors), 'colors');
|
|
281
|
+
this.#sideBar.addItem(i18nString(UIStrings.fontInfo), 'font-info');
|
|
282
|
+
this.#sideBar.addItem(i18nString(UIStrings.unusedDeclarations), 'unused-declarations');
|
|
283
|
+
this.#sideBar.addItem(i18nString(UIStrings.mediaQueries), 'media-queries');
|
|
284
|
+
this.#sideBar.select('summary');
|
|
285
|
+
|
|
286
|
+
this.#sideBar.addEventListener(SidebarEvents.ItemSelected, this.sideBarItemSelected, this);
|
|
287
|
+
this.#sideBar.addEventListener(SidebarEvents.Reset, this.sideBarReset, this);
|
|
288
|
+
this.#controller.addEventListener(CSSOverViewControllerEvents.Reset, this.reset, this);
|
|
289
|
+
this.#controller.addEventListener(CSSOverViewControllerEvents.PopulateNodes, this.createElementsView, this);
|
|
290
|
+
this.#resultsContainer.element.addEventListener('click', this.onClick.bind(this));
|
|
291
|
+
|
|
292
|
+
this.#data = null;
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
wasShown(): void {
|
|
296
296
|
super.wasShown();
|
|
297
|
-
this
|
|
297
|
+
this.#mainContainer.registerCSSFiles([cssOverviewCompletedViewStyles]);
|
|
298
298
|
this.registerCSSFiles([cssOverviewCompletedViewStyles]);
|
|
299
299
|
|
|
300
300
|
// TODO(paullewis): update the links in the panels in case source has been .
|
|
@@ -302,7 +302,7 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
|
|
|
302
302
|
|
|
303
303
|
private sideBarItemSelected(event: Common.EventTarget.EventTargetEvent<string>): void {
|
|
304
304
|
const {data} = event;
|
|
305
|
-
const section = (this
|
|
305
|
+
const section = (this.#fragment as UI.Fragment.Fragment).$(data);
|
|
306
306
|
if (!section) {
|
|
307
307
|
return;
|
|
308
308
|
}
|
|
@@ -311,16 +311,16 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
|
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
private sideBarReset(): void {
|
|
314
|
-
this
|
|
314
|
+
this.#controller.dispatchEventToListeners(CSSOverViewControllerEvents.Reset);
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
private reset(): void {
|
|
318
|
-
this
|
|
319
|
-
this
|
|
320
|
-
this
|
|
321
|
-
this
|
|
318
|
+
this.#resultsContainer.element.removeChildren();
|
|
319
|
+
this.#mainContainer.setSidebarMinimized(true);
|
|
320
|
+
this.#elementContainer.closeTabs();
|
|
321
|
+
this.#viewMap = new Map();
|
|
322
322
|
CSSOverviewCompletedView.pushedNodes.clear();
|
|
323
|
-
this
|
|
323
|
+
this.#sideBar.select('summary');
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
private onClick(evt: Event): void {
|
|
@@ -331,7 +331,7 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
|
|
|
331
331
|
const dataset = target.dataset;
|
|
332
332
|
|
|
333
333
|
const type = dataset.type;
|
|
334
|
-
if (!type || !this
|
|
334
|
+
if (!type || !this.#data) {
|
|
335
335
|
return;
|
|
336
336
|
}
|
|
337
337
|
|
|
@@ -346,7 +346,7 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
|
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
// Remap the Set to an object that is the same shape as the unused declarations.
|
|
349
|
-
const nodes = this
|
|
349
|
+
const nodes = this.#data.textColorContrastIssues.get(key) || [];
|
|
350
350
|
payload = {type, key, nodes, section};
|
|
351
351
|
break;
|
|
352
352
|
}
|
|
@@ -360,19 +360,19 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
|
|
|
360
360
|
let nodes;
|
|
361
361
|
switch (section) {
|
|
362
362
|
case 'text':
|
|
363
|
-
nodes = this
|
|
363
|
+
nodes = this.#data.textColors.get(color);
|
|
364
364
|
break;
|
|
365
365
|
|
|
366
366
|
case 'background':
|
|
367
|
-
nodes = this
|
|
367
|
+
nodes = this.#data.backgroundColors.get(color);
|
|
368
368
|
break;
|
|
369
369
|
|
|
370
370
|
case 'fill':
|
|
371
|
-
nodes = this
|
|
371
|
+
nodes = this.#data.fillColors.get(color);
|
|
372
372
|
break;
|
|
373
373
|
|
|
374
374
|
case 'border':
|
|
375
|
-
nodes = this
|
|
375
|
+
nodes = this.#data.borderColors.get(color);
|
|
376
376
|
break;
|
|
377
377
|
}
|
|
378
378
|
|
|
@@ -391,7 +391,7 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
|
|
|
391
391
|
if (!declaration) {
|
|
392
392
|
return;
|
|
393
393
|
}
|
|
394
|
-
const nodes = this
|
|
394
|
+
const nodes = this.#data.unusedDeclarations.get(declaration);
|
|
395
395
|
if (!nodes) {
|
|
396
396
|
return;
|
|
397
397
|
}
|
|
@@ -405,7 +405,7 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
|
|
|
405
405
|
if (!text) {
|
|
406
406
|
return;
|
|
407
407
|
}
|
|
408
|
-
const nodes = this
|
|
408
|
+
const nodes = this.#data.mediaQueries.get(text);
|
|
409
409
|
if (!nodes) {
|
|
410
410
|
return;
|
|
411
411
|
}
|
|
@@ -425,7 +425,7 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
|
|
|
425
425
|
return;
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
-
const fontFamilyInfo = this
|
|
428
|
+
const fontFamilyInfo = this.#data.fontInfo.get(fontFamily);
|
|
429
429
|
if (!fontFamilyInfo) {
|
|
430
430
|
return;
|
|
431
431
|
}
|
|
@@ -451,8 +451,8 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
|
|
|
451
451
|
}
|
|
452
452
|
|
|
453
453
|
evt.consume();
|
|
454
|
-
this
|
|
455
|
-
this
|
|
454
|
+
this.#controller.dispatchEventToListeners(CSSOverViewControllerEvents.PopulateNodes, {payload});
|
|
455
|
+
this.#mainContainer.setSidebarMinimized(false);
|
|
456
456
|
}
|
|
457
457
|
|
|
458
458
|
private onMouseOver(evt: Event): void {
|
|
@@ -464,7 +464,7 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
|
|
|
464
464
|
}
|
|
465
465
|
|
|
466
466
|
const backendNodeId = Number(node.dataset.backendNodeId);
|
|
467
|
-
this
|
|
467
|
+
this.#controller.dispatchEventToListeners(CSSOverViewControllerEvents.RequestNodeHighlight, backendNodeId);
|
|
468
468
|
}
|
|
469
469
|
|
|
470
470
|
private async render(data: OverviewData): Promise<void> {
|
|
@@ -472,7 +472,7 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
|
|
|
472
472
|
return;
|
|
473
473
|
}
|
|
474
474
|
|
|
475
|
-
this
|
|
475
|
+
this.#data = data;
|
|
476
476
|
const {
|
|
477
477
|
elementCount,
|
|
478
478
|
backgroundColors,
|
|
@@ -484,7 +484,7 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
|
|
|
484
484
|
mediaQueries,
|
|
485
485
|
unusedDeclarations,
|
|
486
486
|
fontInfo,
|
|
487
|
-
} = this
|
|
487
|
+
} = this.#data;
|
|
488
488
|
|
|
489
489
|
// Convert rgb values from the computed styles to either undefined or HEX(A) strings.
|
|
490
490
|
const sortedBackgroundColors = this.sortColorsByLuminance(backgroundColors);
|
|
@@ -492,7 +492,7 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
|
|
|
492
492
|
const sortedFillColors = this.sortColorsByLuminance(fillColors);
|
|
493
493
|
const sortedBorderColors = this.sortColorsByLuminance(borderColors);
|
|
494
494
|
|
|
495
|
-
this
|
|
495
|
+
this.#fragment = UI.Fragment.Fragment.build`
|
|
496
496
|
<div class="vbox overview-completed-view">
|
|
497
497
|
<div $="summary" class="results-section horizontally-padded summary">
|
|
498
498
|
<h1>${i18nString(UIStrings.overviewSummary)}</h1>
|
|
@@ -500,47 +500,47 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
|
|
|
500
500
|
<ul>
|
|
501
501
|
<li>
|
|
502
502
|
<div class="label">${i18nString(UIStrings.elements)}</div>
|
|
503
|
-
<div class="value">${this
|
|
503
|
+
<div class="value">${this.#formatter.format(elementCount)}</div>
|
|
504
504
|
</li>
|
|
505
505
|
<li>
|
|
506
506
|
<div class="label">${i18nString(UIStrings.externalStylesheets)}</div>
|
|
507
|
-
<div class="value">${this
|
|
507
|
+
<div class="value">${this.#formatter.format(globalStyleStats.externalSheets)}</div>
|
|
508
508
|
</li>
|
|
509
509
|
<li>
|
|
510
510
|
<div class="label">${i18nString(UIStrings.inlineStyleElements)}</div>
|
|
511
|
-
<div class="value">${this
|
|
511
|
+
<div class="value">${this.#formatter.format(globalStyleStats.inlineStyles)}</div>
|
|
512
512
|
</li>
|
|
513
513
|
<li>
|
|
514
514
|
<div class="label">${i18nString(UIStrings.styleRules)}</div>
|
|
515
|
-
<div class="value">${this
|
|
515
|
+
<div class="value">${this.#formatter.format(globalStyleStats.styleRules)}</div>
|
|
516
516
|
</li>
|
|
517
517
|
<li>
|
|
518
518
|
<div class="label">${i18nString(UIStrings.mediaQueries)}</div>
|
|
519
|
-
<div class="value">${this
|
|
519
|
+
<div class="value">${this.#formatter.format(mediaQueries.size)}</div>
|
|
520
520
|
</li>
|
|
521
521
|
<li>
|
|
522
522
|
<div class="label">${i18nString(UIStrings.typeSelectors)}</div>
|
|
523
|
-
<div class="value">${this
|
|
523
|
+
<div class="value">${this.#formatter.format(globalStyleStats.stats.type)}</div>
|
|
524
524
|
</li>
|
|
525
525
|
<li>
|
|
526
526
|
<div class="label">${i18nString(UIStrings.idSelectors)}</div>
|
|
527
|
-
<div class="value">${this
|
|
527
|
+
<div class="value">${this.#formatter.format(globalStyleStats.stats.id)}</div>
|
|
528
528
|
</li>
|
|
529
529
|
<li>
|
|
530
530
|
<div class="label">${i18nString(UIStrings.classSelectors)}</div>
|
|
531
|
-
<div class="value">${this
|
|
531
|
+
<div class="value">${this.#formatter.format(globalStyleStats.stats.class)}</div>
|
|
532
532
|
</li>
|
|
533
533
|
<li>
|
|
534
534
|
<div class="label">${i18nString(UIStrings.universalSelectors)}</div>
|
|
535
|
-
<div class="value">${this
|
|
535
|
+
<div class="value">${this.#formatter.format(globalStyleStats.stats.universal)}</div>
|
|
536
536
|
</li>
|
|
537
537
|
<li>
|
|
538
538
|
<div class="label">${i18nString(UIStrings.attributeSelectors)}</div>
|
|
539
|
-
<div class="value">${this
|
|
539
|
+
<div class="value">${this.#formatter.format(globalStyleStats.stats.attribute)}</div>
|
|
540
540
|
</li>
|
|
541
541
|
<li>
|
|
542
542
|
<div class="label">${i18nString(UIStrings.nonsimpleSelectors)}</div>
|
|
543
|
-
<div class="value">${this
|
|
543
|
+
<div class="value">${this.#formatter.format(globalStyleStats.stats.nonSimple)}</div>
|
|
544
544
|
</li>
|
|
545
545
|
</ul>
|
|
546
546
|
</div>
|
|
@@ -602,7 +602,7 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
|
|
|
602
602
|
</div>
|
|
603
603
|
</div>`;
|
|
604
604
|
|
|
605
|
-
this
|
|
605
|
+
this.#resultsContainer.element.appendChild(this.#fragment.element());
|
|
606
606
|
}
|
|
607
607
|
|
|
608
608
|
private createElementsView(evt: Common.EventTarget.EventTargetEvent<{payload: PopulateNodesEvent}>): void {
|
|
@@ -648,14 +648,14 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
|
|
|
648
648
|
}
|
|
649
649
|
}
|
|
650
650
|
|
|
651
|
-
let view = this
|
|
651
|
+
let view = this.#viewMap.get(id);
|
|
652
652
|
if (!view) {
|
|
653
|
-
view = new ElementDetailsView(this
|
|
653
|
+
view = new ElementDetailsView(this.#controller, this.#domModel, this.#cssModel, this.#linkifier);
|
|
654
654
|
view.populateNodes(payload.nodes);
|
|
655
|
-
this
|
|
655
|
+
this.#viewMap.set(id, view);
|
|
656
656
|
}
|
|
657
657
|
|
|
658
|
-
this
|
|
658
|
+
this.#elementContainer.appendTab(id, tabTitle, view, true);
|
|
659
659
|
}
|
|
660
660
|
|
|
661
661
|
private fontInfoToFragment(fontInfo: Map<string, Map<string, Map<string, number[]>>>): UI.Fragment.Fragment {
|
|
@@ -833,27 +833,27 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
|
|
|
833
833
|
static readonly pushedNodes = new Set<Protocol.DOM.BackendNodeId>();
|
|
834
834
|
}
|
|
835
835
|
export class DetailsView extends Common.ObjectWrapper.eventMixin<EventTypes, typeof UI.Widget.VBox>(UI.Widget.VBox) {
|
|
836
|
-
|
|
836
|
+
#tabbedPane: UI.TabbedPane.TabbedPane;
|
|
837
837
|
constructor() {
|
|
838
838
|
super();
|
|
839
839
|
|
|
840
|
-
this
|
|
841
|
-
this
|
|
842
|
-
this
|
|
843
|
-
this.dispatchEventToListeners(Events.TabClosed, this
|
|
840
|
+
this.#tabbedPane = new UI.TabbedPane.TabbedPane();
|
|
841
|
+
this.#tabbedPane.show(this.element);
|
|
842
|
+
this.#tabbedPane.addEventListener(UI.TabbedPane.Events.TabClosed, () => {
|
|
843
|
+
this.dispatchEventToListeners(Events.TabClosed, this.#tabbedPane.tabIds().length);
|
|
844
844
|
});
|
|
845
845
|
}
|
|
846
846
|
|
|
847
847
|
appendTab(id: string, tabTitle: string, view: UI.Widget.Widget, isCloseable?: boolean): void {
|
|
848
|
-
if (!this
|
|
849
|
-
this
|
|
848
|
+
if (!this.#tabbedPane.hasTab(id)) {
|
|
849
|
+
this.#tabbedPane.appendTab(id, tabTitle, view, undefined, undefined, isCloseable);
|
|
850
850
|
}
|
|
851
851
|
|
|
852
|
-
this
|
|
852
|
+
this.#tabbedPane.selectTab(id);
|
|
853
853
|
}
|
|
854
854
|
|
|
855
855
|
closeTabs(): void {
|
|
856
|
-
this
|
|
856
|
+
this.#tabbedPane.closeTabs(this.#tabbedPane.tabIds());
|
|
857
857
|
}
|
|
858
858
|
}
|
|
859
859
|
|
|
@@ -866,24 +866,24 @@ export type EventTypes = {
|
|
|
866
866
|
};
|
|
867
867
|
|
|
868
868
|
export class ElementDetailsView extends UI.Widget.Widget {
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
869
|
+
readonly #controller: OverviewController;
|
|
870
|
+
#domModel: SDK.DOMModel.DOMModel;
|
|
871
|
+
readonly #cssModel: SDK.CSSModel.CSSModel;
|
|
872
|
+
readonly #linkifier: Components.Linkifier.Linkifier;
|
|
873
|
+
readonly #elementGridColumns: DataGrid.DataGrid.ColumnDescriptor[];
|
|
874
|
+
#elementGrid: DataGrid.SortableDataGrid.SortableDataGrid<unknown>;
|
|
875
875
|
|
|
876
876
|
constructor(
|
|
877
877
|
controller: OverviewController, domModel: SDK.DOMModel.DOMModel, cssModel: SDK.CSSModel.CSSModel,
|
|
878
878
|
linkifier: Components.Linkifier.Linkifier) {
|
|
879
879
|
super();
|
|
880
880
|
|
|
881
|
-
this
|
|
882
|
-
this
|
|
883
|
-
this
|
|
884
|
-
this
|
|
881
|
+
this.#controller = controller;
|
|
882
|
+
this.#domModel = domModel;
|
|
883
|
+
this.#cssModel = cssModel;
|
|
884
|
+
this.#linkifier = linkifier;
|
|
885
885
|
|
|
886
|
-
this
|
|
886
|
+
this.#elementGridColumns = [
|
|
887
887
|
{
|
|
888
888
|
id: 'nodeId',
|
|
889
889
|
title: i18nString(UIStrings.element),
|
|
@@ -958,29 +958,29 @@ export class ElementDetailsView extends UI.Widget.Widget {
|
|
|
958
958
|
},
|
|
959
959
|
];
|
|
960
960
|
|
|
961
|
-
this
|
|
961
|
+
this.#elementGrid = new DataGrid.SortableDataGrid.SortableDataGrid({
|
|
962
962
|
displayName: i18nString(UIStrings.cssOverviewElements),
|
|
963
|
-
columns: this
|
|
963
|
+
columns: this.#elementGridColumns,
|
|
964
964
|
editCallback: undefined,
|
|
965
965
|
deleteCallback: undefined,
|
|
966
966
|
refreshCallback: undefined,
|
|
967
967
|
});
|
|
968
|
-
this
|
|
969
|
-
this
|
|
970
|
-
this
|
|
971
|
-
this
|
|
968
|
+
this.#elementGrid.element.classList.add('element-grid');
|
|
969
|
+
this.#elementGrid.element.addEventListener('mouseover', this.onMouseOver.bind(this));
|
|
970
|
+
this.#elementGrid.setStriped(true);
|
|
971
|
+
this.#elementGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, this.sortMediaQueryDataGrid.bind(this));
|
|
972
972
|
|
|
973
|
-
this.element.appendChild(this
|
|
973
|
+
this.element.appendChild(this.#elementGrid.element);
|
|
974
974
|
}
|
|
975
975
|
|
|
976
976
|
private sortMediaQueryDataGrid(): void {
|
|
977
|
-
const sortColumnId = this
|
|
977
|
+
const sortColumnId = this.#elementGrid.sortColumnId();
|
|
978
978
|
if (!sortColumnId) {
|
|
979
979
|
return;
|
|
980
980
|
}
|
|
981
981
|
|
|
982
982
|
const comparator = DataGrid.SortableDataGrid.SortableDataGrid.StringComparator.bind(null, sortColumnId);
|
|
983
|
-
this
|
|
983
|
+
this.#elementGrid.sortNodes(comparator, !this.#elementGrid.isSortOrderAscending());
|
|
984
984
|
}
|
|
985
985
|
|
|
986
986
|
private onMouseOver(evt: Event): void {
|
|
@@ -992,11 +992,11 @@ export class ElementDetailsView extends UI.Widget.Widget {
|
|
|
992
992
|
}
|
|
993
993
|
|
|
994
994
|
const backendNodeId = Number(node.dataset.backendNodeId);
|
|
995
|
-
this
|
|
995
|
+
this.#controller.dispatchEventToListeners(CSSOverViewControllerEvents.RequestNodeHighlight, backendNodeId);
|
|
996
996
|
}
|
|
997
997
|
|
|
998
998
|
async populateNodes(data: PopulateNodesEventNodes): Promise<void> {
|
|
999
|
-
this
|
|
999
|
+
this.#elementGrid.rootNode().removeChildren();
|
|
1000
1000
|
|
|
1001
1001
|
if (!data.length) {
|
|
1002
1002
|
return;
|
|
@@ -1021,7 +1021,7 @@ export class ElementDetailsView extends UI.Widget.Widget {
|
|
|
1021
1021
|
CSSOverviewCompletedView.pushedNodes.add(nodeId);
|
|
1022
1022
|
return prev.add(nodeId);
|
|
1023
1023
|
}, new Set<Protocol.DOM.BackendNodeId>());
|
|
1024
|
-
relatedNodesMap = await this
|
|
1024
|
+
relatedNodesMap = await this.#domModel.pushNodesByBackendIdsToFrontend(nodeIds);
|
|
1025
1025
|
}
|
|
1026
1026
|
|
|
1027
1027
|
for (const item of data) {
|
|
@@ -1036,35 +1036,35 @@ export class ElementDetailsView extends UI.Widget.Widget {
|
|
|
1036
1036
|
}
|
|
1037
1037
|
}
|
|
1038
1038
|
|
|
1039
|
-
const node = new ElementNode(item, frontendNode, this
|
|
1039
|
+
const node = new ElementNode(item, frontendNode, this.#linkifier, this.#cssModel);
|
|
1040
1040
|
node.selectable = false;
|
|
1041
|
-
this
|
|
1041
|
+
this.#elementGrid.insertChild(node);
|
|
1042
1042
|
}
|
|
1043
1043
|
|
|
1044
|
-
this
|
|
1045
|
-
this
|
|
1046
|
-
this
|
|
1044
|
+
this.#elementGrid.setColumnsVisiblity(visibility);
|
|
1045
|
+
this.#elementGrid.renderInline();
|
|
1046
|
+
this.#elementGrid.wasShown();
|
|
1047
1047
|
}
|
|
1048
1048
|
}
|
|
1049
1049
|
|
|
1050
1050
|
export class ElementNode extends DataGrid.SortableDataGrid.SortableDataGridNode<ElementNode> {
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1051
|
+
readonly #linkifier: Components.Linkifier.Linkifier;
|
|
1052
|
+
readonly #cssModel: SDK.CSSModel.CSSModel;
|
|
1053
|
+
readonly #frontendNode: SDK.DOMModel.DOMNode|null|undefined;
|
|
1054
1054
|
|
|
1055
1055
|
constructor(
|
|
1056
1056
|
data: PopulateNodesEventNodeTypes, frontendNode: SDK.DOMModel.DOMNode|null|undefined,
|
|
1057
1057
|
linkifier: Components.Linkifier.Linkifier, cssModel: SDK.CSSModel.CSSModel) {
|
|
1058
1058
|
super(data);
|
|
1059
1059
|
|
|
1060
|
-
this
|
|
1061
|
-
this
|
|
1062
|
-
this
|
|
1060
|
+
this.#frontendNode = frontendNode;
|
|
1061
|
+
this.#linkifier = linkifier;
|
|
1062
|
+
this.#cssModel = cssModel;
|
|
1063
1063
|
}
|
|
1064
1064
|
|
|
1065
1065
|
createCell(columnId: string): HTMLElement {
|
|
1066
1066
|
// Nodes.
|
|
1067
|
-
const
|
|
1067
|
+
const frontendNode = this.#frontendNode;
|
|
1068
1068
|
if (columnId === 'nodeId') {
|
|
1069
1069
|
const cell = this.createTD(columnId);
|
|
1070
1070
|
cell.textContent = '...';
|
|
@@ -1093,7 +1093,7 @@ export class ElementNode extends DataGrid.SortableDataGrid.SortableDataGridNode<
|
|
|
1093
1093
|
|
|
1094
1094
|
if (this.data.range) {
|
|
1095
1095
|
const link = this.linkifyRuleLocation(
|
|
1096
|
-
this
|
|
1096
|
+
this.#cssModel, this.#linkifier, this.data.styleSheetId,
|
|
1097
1097
|
TextUtils.TextRange.TextRange.fromObject(this.data.range));
|
|
1098
1098
|
|
|
1099
1099
|
if (!link || link.textContent === '') {
|
|
@@ -42,20 +42,20 @@ export interface GlobalStyleStats {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export class CSSOverviewModel extends SDK.SDKModel.SDKModel<void> {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
readonly #runtimeAgent: ProtocolProxyApi.RuntimeApi;
|
|
46
|
+
readonly #cssAgent: ProtocolProxyApi.CSSApi;
|
|
47
|
+
readonly #domAgent: ProtocolProxyApi.DOMApi;
|
|
48
|
+
readonly #domSnapshotAgent: ProtocolProxyApi.DOMSnapshotApi;
|
|
49
|
+
readonly #overlayAgent: ProtocolProxyApi.OverlayApi;
|
|
50
50
|
|
|
51
51
|
constructor(target: SDK.Target.Target) {
|
|
52
52
|
super(target);
|
|
53
53
|
|
|
54
|
-
this
|
|
55
|
-
this
|
|
56
|
-
this
|
|
57
|
-
this
|
|
58
|
-
this
|
|
54
|
+
this.#runtimeAgent = target.runtimeAgent();
|
|
55
|
+
this.#cssAgent = target.cssAgent();
|
|
56
|
+
this.#domAgent = target.domAgent();
|
|
57
|
+
this.#domSnapshotAgent = target.domsnapshotAgent();
|
|
58
|
+
this.#overlayAgent = target.overlayAgent();
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
highlightNode(node: Protocol.DOM.BackendNodeId): void {
|
|
@@ -66,8 +66,8 @@ export class CSSOverviewModel extends SDK.SDKModel.SDKModel<void> {
|
|
|
66
66
|
Protocol.Overlay.ContrastAlgorithm.Aa,
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
this
|
|
70
|
-
this
|
|
69
|
+
this.#overlayAgent.invoke_hideHighlight();
|
|
70
|
+
this.#overlayAgent.invoke_highlightNode({backendNodeId: node, highlightConfig});
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
async getNodeStyleStats(): Promise<NodeStyleStats> {
|
|
@@ -175,7 +175,7 @@ export class CSSOverviewModel extends SDK.SDKModel.SDKModel<void> {
|
|
|
175
175
|
|
|
176
176
|
let elementCount = 0;
|
|
177
177
|
|
|
178
|
-
const {documents, strings} = await this
|
|
178
|
+
const {documents, strings} = await this.#domSnapshotAgent.invoke_captureSnapshot(snapshotConfig);
|
|
179
179
|
for (const {nodes, layout} of documents) {
|
|
180
180
|
// Track the number of elements in the documents.
|
|
181
181
|
elementCount += layout.nodeIndex.length;
|
|
@@ -357,11 +357,11 @@ export class CSSOverviewModel extends SDK.SDKModel.SDKModel<void> {
|
|
|
357
357
|
}
|
|
358
358
|
|
|
359
359
|
getComputedStyleForNode(nodeId: Protocol.DOM.NodeId): Promise<Protocol.CSS.GetComputedStyleForNodeResponse> {
|
|
360
|
-
return this
|
|
360
|
+
return this.#cssAgent.invoke_getComputedStyleForNode({nodeId});
|
|
361
361
|
}
|
|
362
362
|
|
|
363
363
|
async getMediaQueries(): Promise<Map<string, Protocol.CSS.CSSMedia[]>> {
|
|
364
|
-
const queries = await this
|
|
364
|
+
const queries = await this.#cssAgent.invoke_getMediaQueries();
|
|
365
365
|
const queryMap = new Map<string, Protocol.CSS.CSSMedia[]>();
|
|
366
366
|
|
|
367
367
|
if (!queries) {
|
|
@@ -469,7 +469,7 @@ export class CSSOverviewModel extends SDK.SDKModel.SDKModel<void> {
|
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
471
|
})()`;
|
|
472
|
-
const {result} = await this
|
|
472
|
+
const {result} = await this.#runtimeAgent.invoke_evaluate({expression, returnByValue: true});
|
|
473
473
|
|
|
474
474
|
// TODO(paullewis): Handle errors properly.
|
|
475
475
|
if (result.type !== 'object') {
|