chrome-devtools-frontend 1.0.1515796 → 1.0.1515988
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/docs/contributing/infrastructure.md +131 -82
- package/front_end/Tests.js +3 -29
- package/front_end/core/common/Progress.ts +73 -55
- package/front_end/core/host/UserMetrics.ts +0 -1
- package/front_end/core/protocol_client/InspectorBackend.ts +2 -0
- package/front_end/core/root/Runtime.ts +0 -1
- package/front_end/core/sdk/CSSMatchedStyles.ts +12 -10
- package/front_end/core/sdk/CSSModel.ts +1 -31
- package/front_end/core/sdk/CSSPropertyParserMatchers.ts +27 -7
- package/front_end/core/sdk/DebuggerModel.ts +1 -31
- package/front_end/core/sdk/EnhancedTracesParser.ts +81 -50
- package/front_end/core/sdk/NetworkManager.ts +1 -31
- package/front_end/core/sdk/NetworkRequest.ts +1 -31
- package/front_end/core/sdk/RehydratingConnection.snapshot.txt +1003 -0
- package/front_end/core/sdk/RehydratingConnection.ts +13 -18
- package/front_end/core/sdk/RehydratingObject.ts +8 -31
- package/front_end/core/sdk/RemoteObject.ts +1 -31
- package/front_end/core/sdk/ResourceTreeModel.ts +1 -31
- package/front_end/core/sdk/RuntimeModel.ts +1 -31
- package/front_end/core/sdk/ServiceWorkerManager.ts +1 -31
- package/front_end/core/sdk/SourceMap.ts +1 -31
- package/front_end/core/sdk/TraceObject.ts +8 -3
- package/front_end/entrypoints/main/MainImpl.ts +0 -2
- package/front_end/models/ai_assistance/AiHistoryStorage.ts +1 -3
- package/front_end/models/ai_assistance/ConversationHandler.ts +4 -6
- package/front_end/models/ai_assistance/agents/AiAgent.ts +4 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +107 -72
- package/front_end/models/ai_assistance/agents/PerformanceAnnotationsAgent.ts +2 -2
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +2 -2
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +178 -85
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +308 -218
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +100 -100
- package/front_end/models/ai_assistance/data_formatters/UnitFormatters.ts +10 -1
- package/front_end/models/ai_assistance/performance/AIContext.ts +19 -21
- package/front_end/models/bindings/ContentProviderBasedProject.ts +6 -4
- package/front_end/models/breakpoints/BreakpointManager.ts +3 -3
- package/front_end/models/har/Writer.ts +11 -11
- package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +3 -3
- package/front_end/models/persistence/IsolatedFileSystem.ts +4 -4
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +7 -7
- package/front_end/models/persistence/PersistenceImpl.ts +8 -8
- package/front_end/models/persistence/PlatformFileSystem.ts +1 -1
- package/front_end/models/trace/ModelImpl.ts +2 -16
- package/front_end/models/trace/Processor.ts +15 -9
- package/front_end/models/trace/handlers/AuctionWorkletsHandler.ts +4 -4
- package/front_end/models/trace/handlers/FramesHandler.ts +2 -2
- package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +7 -10
- package/front_end/models/trace/handlers/MetaHandler.ts +11 -9
- package/front_end/models/trace/handlers/ScreenshotsHandler.ts +1 -1
- package/front_end/models/trace/handlers/ScriptsHandler.ts +5 -5
- package/front_end/models/trace/handlers/UserInteractionsHandler.ts +2 -14
- package/front_end/models/trace/handlers/UserTimingsHandler.ts +3 -4
- package/front_end/models/trace/insights/CLSCulprits.ts +1 -1
- package/front_end/models/trace/insights/DocumentLatency.ts +3 -4
- package/front_end/models/trace/insights/DuplicatedJavaScript.ts +1 -1
- package/front_end/models/trace/insights/INPBreakdown.ts +1 -1
- package/front_end/models/trace/insights/ImageDelivery.ts +1 -1
- package/front_end/models/trace/insights/LCPBreakdown.ts +1 -1
- package/front_end/models/trace/insights/LCPDiscovery.ts +1 -1
- package/front_end/models/trace/insights/ModernHTTP.ts +1 -1
- package/front_end/models/trace/insights/NetworkDependencyTree.ts +1 -1
- package/front_end/models/trace/insights/RenderBlocking.ts +1 -1
- package/front_end/models/trace/insights/types.ts +2 -0
- package/front_end/models/trace/types/TraceEvents.ts +41 -64
- package/front_end/models/trace_source_maps_resolver/trace_source_maps_resolver.ts +1 -1
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +21 -99
- package/front_end/panels/application/ServiceWorkersView.ts +0 -1
- package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +2 -3
- package/front_end/panels/common/GdpSignUpDialog.ts +6 -3
- package/front_end/panels/console/ConsoleView.ts +23 -28
- package/front_end/panels/console/ConsoleViewport.ts +2 -2
- package/front_end/panels/console/consoleView.css +11 -1
- package/front_end/panels/coverage/CoverageView.ts +2 -2
- package/front_end/panels/elements/ElementsTreeOutline.ts +2 -2
- package/front_end/panels/elements/StyleEditorWidget.ts +8 -19
- package/front_end/panels/elements/StylePropertyTreeElement.ts +39 -25
- package/front_end/panels/elements/StylesSidebarPane.ts +2 -2
- package/front_end/panels/elements/stylePropertiesTreeOutline.css +4 -3
- package/front_end/panels/layer_viewer/Layers3DView.ts +2 -2
- package/front_end/panels/layers/LayerTreeModel.ts +3 -3
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +4 -4
- package/front_end/panels/network/NetworkLogView.ts +1 -1
- package/front_end/panels/network/NetworkLogViewColumns.ts +3 -3
- package/front_end/panels/network/NetworkSearchScope.ts +6 -6
- package/front_end/panels/search/SearchView.ts +33 -32
- package/front_end/panels/settings/components/SyncSection.ts +6 -1
- package/front_end/panels/sources/SourcesSearchScope.ts +4 -4
- package/front_end/panels/sources/TabbedEditorContainer.ts +5 -5
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +10 -5
- package/front_end/panels/timeline/TimelineFlameChartView.ts +18 -15
- package/front_end/panels/timeline/TimelinePanel.ts +41 -22
- package/front_end/panels/timeline/TracingLayerTree.ts +4 -5
- package/front_end/panels/timeline/components/ExportTraceOptions.ts +37 -22
- package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +17 -7
- package/front_end/third_party/axe-core/README.chromium +1 -0
- package/front_end/third_party/codemirror/README.chromium +1 -0
- package/front_end/third_party/codemirror.next/README.chromium +1 -0
- package/front_end/third_party/csp_evaluator/README.chromium +1 -0
- package/front_end/third_party/diff/README.chromium +1 -0
- package/front_end/third_party/i18n/README.chromium +1 -0
- package/front_end/third_party/intl-messageformat/README.chromium +1 -0
- package/front_end/third_party/json5/README.chromium +1 -0
- package/front_end/third_party/legacy-javascript/README.chromium +1 -0
- package/front_end/third_party/lighthouse/README.chromium +1 -0
- package/front_end/third_party/lit/README.chromium +1 -0
- package/front_end/third_party/marked/README.chromium +1 -0
- package/front_end/third_party/puppeteer-replay/README.chromium +1 -0
- package/front_end/third_party/third-party-web/README.chromium +1 -0
- package/front_end/third_party/vscode.web-custom-data/README.chromium +1 -0
- package/front_end/third_party/wasmparser/README.chromium +1 -0
- package/front_end/third_party/web-vitals/README.chromium +1 -0
- package/front_end/ui/components/tooltips/Tooltip.ts +17 -1
- package/front_end/ui/legacy/ContextMenu.ts +2 -2
- package/front_end/ui/legacy/GlassPane.ts +7 -3
- package/front_end/ui/legacy/ProgressIndicator.ts +29 -16
- package/front_end/ui/legacy/TabbedPane.ts +2 -2
- package/front_end/ui/legacy/Treeoutline.ts +10 -5
- package/front_end/ui/legacy/UIUtils.ts +42 -10
- package/front_end/ui/legacy/components/color_picker/Spectrum.ts +14 -14
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +6 -6
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +3 -29
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +14 -14
- package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
- package/inspector_overlay/highlight_common.ts +1 -27
- package/inspector_overlay/highlight_grid_common.ts +1 -27
- package/inspector_overlay/tool_highlight.ts +1 -27
- package/inspector_overlay/tool_persistent.ts +1 -27
- package/inspector_overlay/tool_source_order.ts +1 -27
- package/package.json +1 -1
@@ -176,7 +176,6 @@ export const DEFAULT_VIEW = (input: ViewInput, output: ViewOutput, target: HTMLE
|
|
176
176
|
}
|
177
177
|
};
|
178
178
|
|
179
|
-
const {on} = UI.UIUtils.HTMLElementWithLightDOMTemplate;
|
180
179
|
const classes =
|
181
180
|
(breakpoint: SDK.CategorizedBreakpoint.CategorizedBreakpoint): ReturnType<typeof Lit.Directives.classMap> =>
|
182
181
|
Lit.Directives.classMap({
|
@@ -239,7 +238,7 @@ export const DEFAULT_VIEW = (input: ViewInput, output: ViewOutput, target: HTMLE
|
|
239
238
|
?indeterminate=${breakpoints.some(breakpoint => !breakpoint.enabled()) &&
|
240
239
|
breakpoints.some(breakpoint => breakpoint.enabled())}
|
241
240
|
?checked=${!breakpoints.some(breakpoint => !breakpoint.enabled())}
|
242
|
-
@change=${
|
241
|
+
@change=${(e: Event) => onCheckboxClicked(e, category)}
|
243
242
|
>${getLocalizedCategory(category)}</devtools-checkbox>
|
244
243
|
<ul
|
245
244
|
role="group"
|
@@ -257,7 +256,7 @@ export const DEFAULT_VIEW = (input: ViewInput, output: ViewOutput, target: HTMLE
|
|
257
256
|
?checked=${breakpoint.enabled()}
|
258
257
|
aria-description=${breakpoint === input.highlightedItem ? i18nString(UIStrings.breakpointHit)
|
259
258
|
: Lit.nothing}
|
260
|
-
@change=${
|
259
|
+
@change=${(e: Event) => onCheckboxClicked(e, breakpoint)}
|
261
260
|
>${Sources.CategorizedBreakpointL10n.getLocalizedBreakpointName(breakpoint.name)}</devtools-checkbox>
|
262
261
|
</li>`)}
|
263
262
|
</ul>
|
@@ -193,10 +193,12 @@ export class GdpSignUpDialog extends UI.Widget.VBox {
|
|
193
193
|
#dialog: UI.Dialog.Dialog;
|
194
194
|
#keepMeUpdated = false;
|
195
195
|
#isSigningUp = false;
|
196
|
+
#onSuccess?: () => void;
|
196
197
|
|
197
|
-
constructor(options: {dialog: UI.Dialog.Dialog}, view?: View) {
|
198
|
+
constructor(options: {dialog: UI.Dialog.Dialog, onSuccess?: () => void}, view?: View) {
|
198
199
|
super();
|
199
200
|
this.#dialog = options.dialog;
|
201
|
+
this.#onSuccess = options.onSuccess;
|
200
202
|
this.#view = view ?? DEFAULT_VIEW;
|
201
203
|
this.requestUpdate();
|
202
204
|
}
|
@@ -215,6 +217,7 @@ export class GdpSignUpDialog extends UI.Widget.VBox {
|
|
215
217
|
Common.Settings.Settings.instance().moduleSetting('receive-gdp-badges').set(true);
|
216
218
|
await Badges.UserBadges.instance().initialize();
|
217
219
|
Badges.UserBadges.instance().recordAction(Badges.BadgeAction.GDP_SIGN_UP_COMPLETE);
|
220
|
+
this.#onSuccess?.();
|
218
221
|
this.#dialog.hide();
|
219
222
|
} else {
|
220
223
|
Snackbars.Snackbar.Snackbar.show({message: i18nString(UIStrings.signUpFailed)}, this.#dialog.contentElement);
|
@@ -240,14 +243,14 @@ export class GdpSignUpDialog extends UI.Widget.VBox {
|
|
240
243
|
this.#view(viewInput, undefined, this.contentElement);
|
241
244
|
}
|
242
245
|
|
243
|
-
static show(): void {
|
246
|
+
static show({onSuccess}: {onSuccess?: () => void} = {}): void {
|
244
247
|
const dialog = new UI.Dialog.Dialog();
|
245
248
|
dialog.setAriaLabel(i18nString(UIStrings.gdpDialogAriaLabel));
|
246
249
|
dialog.setMaxContentSize(new Geometry.Size(384, 500));
|
247
250
|
dialog.setSizeBehavior(UI.GlassPane.SizeBehavior.SET_EXACT_WIDTH_MAX_HEIGHT);
|
248
251
|
dialog.setDimmed(true);
|
249
252
|
|
250
|
-
new GdpSignUpDialog({dialog}).show(dialog.contentElement);
|
253
|
+
new GdpSignUpDialog({dialog, onSuccess}).show(dialog.contentElement);
|
251
254
|
dialog.show(undefined, /* stack */ true);
|
252
255
|
}
|
253
256
|
}
|
@@ -322,7 +322,7 @@ export class ConsoleView extends UI.Widget.VBox implements
|
|
322
322
|
private buildHiddenCacheTimeout?: number;
|
323
323
|
private searchShouldJumpBackwards?: boolean;
|
324
324
|
private searchProgressIndicator?: UI.ProgressIndicator.ProgressIndicator;
|
325
|
-
|
325
|
+
#searchTimeoutId?: number;
|
326
326
|
private muteViewportUpdates?: boolean;
|
327
327
|
private waitForScrollTimeout?: number;
|
328
328
|
private issueCounter: IssueCounter.IssueCounter.IssueCounter;
|
@@ -1051,18 +1051,13 @@ export class ConsoleView extends UI.Widget.VBox implements
|
|
1051
1051
|
return;
|
1052
1052
|
}
|
1053
1053
|
|
1054
|
-
// Track any adjacent messages.
|
1055
|
-
const originatingMessage = viewMessage.consoleMessage().originatingMessage();
|
1056
|
-
const adjacent = Boolean(originatingMessage && lastMessage?.consoleMessage() === originatingMessage);
|
1057
|
-
viewMessage.setAdjacentUserCommandResult(adjacent);
|
1058
|
-
|
1059
|
-
// Ensure any parent groups for this message are shown.
|
1060
1054
|
const currentGroup = viewMessage.consoleGroup();
|
1061
|
-
showGroup(currentGroup, this.visibleViewMessages);
|
1062
1055
|
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1056
|
+
if (!currentGroup?.messagesHidden()) {
|
1057
|
+
const originatingMessage = viewMessage.consoleMessage().originatingMessage();
|
1058
|
+
const adjacent = Boolean(originatingMessage && lastMessage?.consoleMessage() === originatingMessage);
|
1059
|
+
viewMessage.setAdjacentUserCommandResult(adjacent);
|
1060
|
+
showGroup(currentGroup, this.visibleViewMessages);
|
1066
1061
|
this.visibleViewMessages.push(viewMessage);
|
1067
1062
|
this.searchMessage(this.visibleViewMessages.length - 1);
|
1068
1063
|
}
|
@@ -1216,8 +1211,8 @@ export class ConsoleView extends UI.Widget.VBox implements
|
|
1216
1211
|
const stream = new Bindings.FileUtils.FileOutputStream();
|
1217
1212
|
|
1218
1213
|
const progressIndicator = document.createElement('devtools-progress');
|
1219
|
-
progressIndicator.
|
1220
|
-
progressIndicator.
|
1214
|
+
progressIndicator.title = i18nString(UIStrings.writingFile);
|
1215
|
+
progressIndicator.totalWork = this.itemCount();
|
1221
1216
|
|
1222
1217
|
const chunkSize = 350;
|
1223
1218
|
|
@@ -1227,7 +1222,7 @@ export class ConsoleView extends UI.Widget.VBox implements
|
|
1227
1222
|
this.progressToolbarItem.element.appendChild(progressIndicator);
|
1228
1223
|
|
1229
1224
|
let messageIndex = 0;
|
1230
|
-
while (messageIndex < this.itemCount() && !progressIndicator.
|
1225
|
+
while (messageIndex < this.itemCount() && !progressIndicator.canceled) {
|
1231
1226
|
const messageContents = [];
|
1232
1227
|
let i;
|
1233
1228
|
for (i = 0; i < chunkSize && i + messageIndex < this.itemCount(); ++i) {
|
@@ -1236,11 +1231,11 @@ export class ConsoleView extends UI.Widget.VBox implements
|
|
1236
1231
|
}
|
1237
1232
|
messageIndex += i;
|
1238
1233
|
await stream.write(messageContents.join('\n') + '\n');
|
1239
|
-
progressIndicator.
|
1234
|
+
progressIndicator.worked = messageIndex;
|
1240
1235
|
}
|
1241
1236
|
|
1242
1237
|
void stream.close();
|
1243
|
-
progressIndicator.done
|
1238
|
+
progressIndicator.done = true;
|
1244
1239
|
}
|
1245
1240
|
|
1246
1241
|
private async copyConsole(): Promise<void> {
|
@@ -1519,21 +1514,21 @@ export class ConsoleView extends UI.Widget.VBox implements
|
|
1519
1514
|
}
|
1520
1515
|
|
1521
1516
|
this.searchProgressIndicator = document.createElement('devtools-progress');
|
1522
|
-
this.searchProgressIndicator.
|
1523
|
-
this.searchProgressIndicator.
|
1517
|
+
this.searchProgressIndicator.title = i18nString(UIStrings.searching);
|
1518
|
+
this.searchProgressIndicator.totalWork = this.visibleViewMessages.length;
|
1524
1519
|
this.progressToolbarItem.element.appendChild(this.searchProgressIndicator);
|
1525
1520
|
|
1526
|
-
this
|
1521
|
+
this.#search(0);
|
1527
1522
|
}
|
1528
1523
|
|
1529
1524
|
private cleanupAfterSearch(): void {
|
1530
1525
|
delete this.searchShouldJumpBackwards;
|
1531
|
-
if (this
|
1532
|
-
clearTimeout(this
|
1533
|
-
|
1526
|
+
if (this.#searchTimeoutId) {
|
1527
|
+
clearTimeout(this.#searchTimeoutId);
|
1528
|
+
this.#searchTimeoutId = undefined;
|
1534
1529
|
}
|
1535
1530
|
if (this.searchProgressIndicator) {
|
1536
|
-
this.searchProgressIndicator.done
|
1531
|
+
this.searchProgressIndicator.done = true;
|
1537
1532
|
delete this.searchProgressIndicator;
|
1538
1533
|
}
|
1539
1534
|
}
|
@@ -1542,9 +1537,9 @@ export class ConsoleView extends UI.Widget.VBox implements
|
|
1542
1537
|
// This method is sniffed in tests.
|
1543
1538
|
}
|
1544
1539
|
|
1545
|
-
|
1546
|
-
|
1547
|
-
if (this.searchProgressIndicator?.
|
1540
|
+
#search(index: number): void {
|
1541
|
+
this.#searchTimeoutId = undefined;
|
1542
|
+
if (this.searchProgressIndicator?.canceled) {
|
1548
1543
|
this.cleanupAfterSearch();
|
1549
1544
|
return;
|
1550
1545
|
}
|
@@ -1566,9 +1561,9 @@ export class ConsoleView extends UI.Widget.VBox implements
|
|
1566
1561
|
return;
|
1567
1562
|
}
|
1568
1563
|
|
1569
|
-
this
|
1564
|
+
this.#searchTimeoutId = window.setTimeout(this.#search.bind(this, index), 100);
|
1570
1565
|
if (this.searchProgressIndicator) {
|
1571
|
-
this.searchProgressIndicator.
|
1566
|
+
this.searchProgressIndicator.worked = index;
|
1572
1567
|
}
|
1573
1568
|
}
|
1574
1569
|
|
@@ -435,13 +435,13 @@ export class ConsoleViewport {
|
|
435
435
|
|
436
436
|
refresh(): void {
|
437
437
|
this.observer.disconnect();
|
438
|
-
this
|
438
|
+
this.#refresh();
|
439
439
|
if (this.#stickToBottom) {
|
440
440
|
this.observer.observe(this.#contentElement, this.observerConfig);
|
441
441
|
}
|
442
442
|
}
|
443
443
|
|
444
|
-
|
444
|
+
#refresh(): void {
|
445
445
|
if (!this.visibleHeight()) {
|
446
446
|
return;
|
447
447
|
} // Do nothing for invisible controls.
|
@@ -325,14 +325,24 @@
|
|
325
325
|
.console-view-object-properties-section {
|
326
326
|
padding: 0;
|
327
327
|
position: relative;
|
328
|
-
vertical-align: top;
|
329
328
|
color: inherit;
|
330
329
|
display: inline-block;
|
331
330
|
overflow-wrap: break-word;
|
332
331
|
max-width: 100%;
|
332
|
+
vertical-align: top;
|
333
333
|
margin-top: -1.5px;
|
334
334
|
}
|
335
335
|
|
336
|
+
/* Console content is rendered in "Noto Sans Mono" on Linux, which has a
|
337
|
+
* different actual line-height than the fonts used on Windows or MacOS.
|
338
|
+
* "vertical-align: middle" breaks the layout when expanding an object such
|
339
|
+
* that it spans multiple lines. We therefore align to the top, and use a
|
340
|
+
* different "margin-top" on Linux to compensate for the line-height difference.
|
341
|
+
*/
|
342
|
+
.platform-linux .console-view-object-properties-section {
|
343
|
+
margin-top: 0;
|
344
|
+
}
|
345
|
+
|
336
346
|
.info-note {
|
337
347
|
background-color: var(--sys-color-tonal-container);
|
338
348
|
}
|
@@ -643,12 +643,12 @@ export class ActionDelegate implements UI.ActionRegistration.ActionDelegate {
|
|
643
643
|
const view = UI.ViewManager.ViewManager.instance().view(coverageViewId);
|
644
644
|
return view?.widget();
|
645
645
|
})
|
646
|
-
.then(widget => this
|
646
|
+
.then(widget => this.#handleAction(widget as CoverageView, actionId));
|
647
647
|
|
648
648
|
return true;
|
649
649
|
}
|
650
650
|
|
651
|
-
|
651
|
+
#handleAction(coverageView: CoverageView, actionId: string): void {
|
652
652
|
switch (actionId) {
|
653
653
|
case 'coverage.toggle-recording':
|
654
654
|
coverageView.toggleRecording();
|
@@ -1830,7 +1830,7 @@ export class ElementsTreeOutline extends
|
|
1830
1830
|
|
1831
1831
|
console.assert(!treeElement.isClosingTag());
|
1832
1832
|
|
1833
|
-
this
|
1833
|
+
this.#updateChildren(treeElement);
|
1834
1834
|
}
|
1835
1835
|
|
1836
1836
|
insertChildElement(
|
@@ -1858,7 +1858,7 @@ export class ElementsTreeOutline extends
|
|
1858
1858
|
}
|
1859
1859
|
}
|
1860
1860
|
|
1861
|
-
|
1861
|
+
#updateChildren(treeElement: ElementsTreeElement): void {
|
1862
1862
|
if (this.treeElementsBeingUpdated.has(treeElement)) {
|
1863
1863
|
return;
|
1864
1864
|
}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
// found in the LICENSE file.
|
4
4
|
/* eslint-disable rulesdir/no-imperative-dom-api */
|
5
5
|
|
6
|
-
import * as
|
6
|
+
import * as IconButton from '../../ui/components/icon_button/icon_button.js';
|
7
7
|
import * as UI from '../../ui/legacy/legacy.js';
|
8
8
|
|
9
9
|
import type * as ElementsComponents from './components/components.js';
|
@@ -120,7 +120,9 @@ export class StyleEditorWidget extends UI.Widget.VBox {
|
|
120
120
|
static createTriggerButton(
|
121
121
|
pane: StylesSidebarPane, section: StylePropertiesSection, editorClass: {new(): Editor}, buttonTitle: string,
|
122
122
|
triggerKey: string): HTMLElement {
|
123
|
-
const triggerButton =
|
123
|
+
const triggerButton = IconButton.Icon.create('flex-wrap', 'styles-pane-button');
|
124
|
+
triggerButton.title = buttonTitle;
|
125
|
+
triggerButton.role = 'button';
|
124
126
|
|
125
127
|
triggerButton.onclick = async event => {
|
126
128
|
event.stopPropagation();
|
@@ -146,28 +148,15 @@ export class StyleEditorWidget extends UI.Widget.VBox {
|
|
146
148
|
scrollerElement.addEventListener('scroll', onScroll);
|
147
149
|
}
|
148
150
|
};
|
151
|
+
triggerButton.onmouseup = event => {
|
152
|
+
// Stop propagation to prevent the property editor from being activated.
|
153
|
+
event.stopPropagation();
|
154
|
+
};
|
149
155
|
|
150
156
|
return triggerButton;
|
151
157
|
}
|
152
158
|
}
|
153
159
|
|
154
|
-
function createButton(buttonTitle: string): Buttons.Button.Button {
|
155
|
-
const button = new Buttons.Button.Button();
|
156
|
-
button.data = {
|
157
|
-
variant: Buttons.Button.Variant.ICON,
|
158
|
-
size: Buttons.Button.Size.SMALL,
|
159
|
-
iconName: 'flex-wrap',
|
160
|
-
title: buttonTitle,
|
161
|
-
jslogContext: 'flex-wrap',
|
162
|
-
};
|
163
|
-
button.classList.add('styles-pane-button');
|
164
|
-
button.onmouseup = event => {
|
165
|
-
// Stop propagation to prevent the property editor from being activated.
|
166
|
-
event.stopPropagation();
|
167
|
-
};
|
168
|
-
return button;
|
169
|
-
}
|
170
|
-
|
171
160
|
function ensureTreeElementForProperty(section: StylePropertiesSection, propertyName: string): StylePropertyTreeElement {
|
172
161
|
const target = section.propertiesTreeOutline.rootElement().children().find(
|
173
162
|
child => child instanceof StylePropertyTreeElement && child.property.name === propertyName);
|
@@ -1046,13 +1046,6 @@ export class LinkableNameRenderer extends rendererBase(SDK.CSSPropertyParserMatc
|
|
1046
1046
|
ruleBlock: '@position-try',
|
1047
1047
|
isDefined: Boolean(this.#matchedStyles.positionTryRules().find(pt => pt.name().text === match.text)),
|
1048
1048
|
};
|
1049
|
-
case SDK.CSSPropertyParserMatchers.LinkableNameProperties.FUNCTION:
|
1050
|
-
return {
|
1051
|
-
jslogContext: 'css-function',
|
1052
|
-
metric: null,
|
1053
|
-
ruleBlock: '@function',
|
1054
|
-
isDefined: Boolean(this.#matchedStyles.getRegisteredFunction(match.text)),
|
1055
|
-
};
|
1056
1049
|
}
|
1057
1050
|
}
|
1058
1051
|
|
@@ -1065,15 +1058,7 @@ export class LinkableNameRenderer extends rendererBase(SDK.CSSPropertyParserMatc
|
|
1065
1058
|
isDefined,
|
1066
1059
|
onLinkActivate: (): void => {
|
1067
1060
|
metric && Host.userMetrics.swatchActivated(metric);
|
1068
|
-
|
1069
|
-
const functionName = this.#matchedStyles.getRegisteredFunction(match.text);
|
1070
|
-
if (!functionName) {
|
1071
|
-
return;
|
1072
|
-
}
|
1073
|
-
this.#stylesPane.jumpToFunctionDefinition(functionName);
|
1074
|
-
} else {
|
1075
|
-
this.#stylesPane.jumpToSectionBlock(`${ruleBlock} ${match.text}`);
|
1076
|
-
}
|
1061
|
+
this.#stylesPane.jumpToSectionBlock(`${ruleBlock} ${match.text}`);
|
1077
1062
|
},
|
1078
1063
|
jslogContext,
|
1079
1064
|
};
|
@@ -1609,7 +1594,7 @@ export class LengthRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.L
|
|
1609
1594
|
}
|
1610
1595
|
|
1611
1596
|
// clang-format off
|
1612
|
-
export class
|
1597
|
+
export class BaseFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.BaseFunctionMatch) {
|
1613
1598
|
// clang-format on
|
1614
1599
|
readonly #stylesPane: StylesSidebarPane;
|
1615
1600
|
readonly #matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles;
|
@@ -1627,7 +1612,7 @@ export class MathFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatc
|
|
1627
1612
|
this.#propertyName = propertyName;
|
1628
1613
|
}
|
1629
1614
|
|
1630
|
-
override render(match: SDK.CSSPropertyParserMatchers.
|
1615
|
+
override render(match: SDK.CSSPropertyParserMatchers.BaseFunctionMatch<string>, context: RenderingContext): Node[] {
|
1631
1616
|
const childTracingContexts = context.tracing?.evaluation(match.args, {match, context});
|
1632
1617
|
const renderedArgs = match.args.map((arg, idx) => {
|
1633
1618
|
const span = document.createElement('span');
|
@@ -1651,7 +1636,7 @@ export class MathFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatc
|
|
1651
1636
|
if (evaluation) {
|
1652
1637
|
return evaluation;
|
1653
1638
|
}
|
1654
|
-
} else if (!match.isArithmeticFunctionCall()) {
|
1639
|
+
} else if (match instanceof SDK.CSSPropertyParserMatchers.MathFunctionMatch && !match.isArithmeticFunctionCall()) {
|
1655
1640
|
void this.applyMathFunction(renderedArgs, match, context);
|
1656
1641
|
}
|
1657
1642
|
|
@@ -1659,7 +1644,7 @@ export class MathFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatc
|
|
1659
1644
|
}
|
1660
1645
|
|
1661
1646
|
async applyEvaluation(
|
1662
|
-
span: HTMLSpanElement, match: SDK.CSSPropertyParserMatchers.
|
1647
|
+
span: HTMLSpanElement, match: SDK.CSSPropertyParserMatchers.BaseFunctionMatch<string>,
|
1663
1648
|
context: RenderingContext): Promise<boolean> {
|
1664
1649
|
const value = context.matchedResult.getComputedText(match.node, match => {
|
1665
1650
|
if (match instanceof SDK.CSSPropertyParserMatchers.RelativeColorChannelMatch) {
|
@@ -1678,7 +1663,7 @@ export class MathFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatc
|
|
1678
1663
|
}
|
1679
1664
|
|
1680
1665
|
async applyMathFunction(
|
1681
|
-
renderedArgs: HTMLElement[], match: SDK.CSSPropertyParserMatchers.
|
1666
|
+
renderedArgs: HTMLElement[], match: SDK.CSSPropertyParserMatchers.BaseFunctionMatch<string>,
|
1682
1667
|
context: RenderingContext): Promise<void> {
|
1683
1668
|
// To understand which argument was selected by the function, we evaluate the function as well as all the arguments
|
1684
1669
|
// and compare the function result to the values of all its arguments. Evaluating the arguments eliminates nested
|
@@ -1701,6 +1686,14 @@ export class MathFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatc
|
|
1701
1686
|
}
|
1702
1687
|
}
|
1703
1688
|
|
1689
|
+
export class MathFunctionRenderer extends BaseFunctionRenderer {
|
1690
|
+
override readonly matchType = SDK.CSSPropertyParserMatchers.MathFunctionMatch;
|
1691
|
+
}
|
1692
|
+
|
1693
|
+
export class CustomFunctionRenderer extends BaseFunctionRenderer {
|
1694
|
+
override readonly matchType = SDK.CSSPropertyParserMatchers.CustomFunctionMatch;
|
1695
|
+
}
|
1696
|
+
|
1704
1697
|
// clang-format off
|
1705
1698
|
export class AnchorFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.AnchorFunctionMatch) {
|
1706
1699
|
// clang-format on
|
@@ -1871,6 +1864,7 @@ export function getPropertyRenderers(
|
|
1871
1864
|
new PositionTryRenderer(matchedStyles),
|
1872
1865
|
new LengthRenderer(stylesPane, propertyName, treeElement),
|
1873
1866
|
new MathFunctionRenderer(stylesPane, matchedStyles, computedStyles, propertyName, treeElement),
|
1867
|
+
new CustomFunctionRenderer(stylesPane, matchedStyles, computedStyles, propertyName, treeElement),
|
1874
1868
|
new AutoBaseRenderer(computedStyles),
|
1875
1869
|
new BinOpRenderer(),
|
1876
1870
|
new RelativeColorChannelRenderer(treeElement),
|
@@ -2264,15 +2258,15 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
2264
2258
|
return;
|
2265
2259
|
}
|
2266
2260
|
this.lastComputedValue = computedValue;
|
2267
|
-
this
|
2261
|
+
this.#updateTitle();
|
2268
2262
|
}
|
2269
2263
|
|
2270
2264
|
updateTitle(): void {
|
2271
2265
|
this.lastComputedValue = this.#computeCSSExpression(this.property.ownerStyle, this.property.value);
|
2272
|
-
this
|
2266
|
+
this.#updateTitle();
|
2273
2267
|
}
|
2274
2268
|
|
2275
|
-
|
2269
|
+
#updateTitle(): void {
|
2276
2270
|
this.#tooltipKeyCounts.clear();
|
2277
2271
|
this.updateState();
|
2278
2272
|
if (this.isExpandable()) {
|
@@ -2460,6 +2454,26 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
2460
2454
|
return container;
|
2461
2455
|
}
|
2462
2456
|
|
2457
|
+
#getLinkableFunction(functionName: string, matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles):
|
2458
|
+
InlineEditor.LinkSwatch.LinkSwatch {
|
2459
|
+
const swatch = new InlineEditor.LinkSwatch.LinkSwatch();
|
2460
|
+
const registeredFunction = matchedStyles.getRegisteredFunction(functionName);
|
2461
|
+
const isDefined = Boolean(registeredFunction);
|
2462
|
+
swatch.data = {
|
2463
|
+
jslogContext: 'css-function',
|
2464
|
+
text: functionName,
|
2465
|
+
tooltip: isDefined ? undefined : {title: i18nString(UIStrings.sIsNotDefined, {PH1: functionName})},
|
2466
|
+
isDefined,
|
2467
|
+
onLinkActivate: (): void => {
|
2468
|
+
if (!registeredFunction) {
|
2469
|
+
return;
|
2470
|
+
}
|
2471
|
+
this.#parentPane.jumpToFunctionDefinition(registeredFunction);
|
2472
|
+
},
|
2473
|
+
};
|
2474
|
+
return swatch;
|
2475
|
+
}
|
2476
|
+
|
2463
2477
|
getTracingTooltip(
|
2464
2478
|
functionName: string, node: CodeMirror.SyntaxNode, matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles,
|
2465
2479
|
computedStyles: Map<string, string>, context: RenderingContext): Lit.TemplateResult {
|
@@ -2474,7 +2488,7 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
2474
2488
|
const tooltipId = this.getTooltipId(`${functionName}-trace`);
|
2475
2489
|
// clang-format off
|
2476
2490
|
return html`
|
2477
|
-
<span tabIndex=-1 class=tracing-anchor aria-details=${tooltipId}>${functionName}</span>
|
2491
|
+
<span tabIndex=-1 class=tracing-anchor aria-details=${tooltipId}>${functionName.startsWith('--') ? this.#getLinkableFunction(functionName, matchedStyles) : functionName}</span>
|
2478
2492
|
<devtools-tooltip
|
2479
2493
|
id=${tooltipId}
|
2480
2494
|
use-hotkey
|
@@ -623,10 +623,10 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
|
|
623
623
|
}
|
624
624
|
|
625
625
|
override onResize(): void {
|
626
|
-
void this.resizeThrottler.schedule(this.
|
626
|
+
void this.resizeThrottler.schedule(this.#resize.bind(this));
|
627
627
|
}
|
628
628
|
|
629
|
-
|
629
|
+
#resize(): Promise<void> {
|
630
630
|
const width = this.contentElement.getBoundingClientRect().width + 'px';
|
631
631
|
this.allSections().forEach(section => {
|
632
632
|
section.propertiesTreeOutline.element.style.width = width;
|
@@ -220,13 +220,14 @@ devtools-icon.icon-link {
|
|
220
220
|
}
|
221
221
|
|
222
222
|
.styles-pane-button {
|
223
|
-
|
224
|
-
|
223
|
+
width: var(--sys-size-8);
|
224
|
+
height: var(--sys-size-8);
|
225
|
+
margin-left: var(--sys-size-4);
|
225
226
|
position: absolute;
|
226
|
-
top: -1px;
|
227
227
|
display: inline-flex;
|
228
228
|
align-items: center;
|
229
229
|
justify-content: center;
|
230
|
+
user-select: none;
|
230
231
|
}
|
231
232
|
/* Matched styles */
|
232
233
|
|
@@ -735,12 +735,12 @@ export class Layers3DView extends Common.ObjectWrapper.eventMixin<EventTypes, ty
|
|
735
735
|
this.updateScheduled = true;
|
736
736
|
requestAnimationFrame(() => requestAnimationFrame(() => {
|
737
737
|
this.updateScheduled = false;
|
738
|
-
this
|
738
|
+
this.#update();
|
739
739
|
}));
|
740
740
|
}
|
741
741
|
}
|
742
742
|
|
743
|
-
|
743
|
+
#update(): void {
|
744
744
|
if (!this.layerTree?.root()) {
|
745
745
|
this.failBanner.show(this.contentElement);
|
746
746
|
return;
|
@@ -138,7 +138,7 @@ export class AgentLayerTree extends SDK.LayerTreeBase.LayerTreeBase {
|
|
138
138
|
|
139
139
|
async setLayers(payload: Protocol.LayerTree.Layer[]|null): Promise<void> {
|
140
140
|
if (!payload) {
|
141
|
-
this
|
141
|
+
this.#setLayers(payload);
|
142
142
|
return;
|
143
143
|
}
|
144
144
|
const idsToResolve = new Set<Protocol.DOM.BackendNodeId>();
|
@@ -150,10 +150,10 @@ export class AgentLayerTree extends SDK.LayerTreeBase.LayerTreeBase {
|
|
150
150
|
idsToResolve.add(backendNodeId);
|
151
151
|
}
|
152
152
|
await this.resolveBackendNodeIds(idsToResolve);
|
153
|
-
this
|
153
|
+
this.#setLayers(payload);
|
154
154
|
}
|
155
155
|
|
156
|
-
|
156
|
+
#setLayers(layers: Protocol.LayerTree.Layer[]|null): void {
|
157
157
|
this.setRoot(null);
|
158
158
|
this.setContentRoot(null);
|
159
159
|
// Payload will be null when not in the composited mode.
|
@@ -400,8 +400,8 @@ export class CPUThrottlingCard {
|
|
400
400
|
}
|
401
401
|
|
402
402
|
private async runCalibration(): Promise<void> {
|
403
|
-
this.progress.
|
404
|
-
this.progress.
|
403
|
+
this.progress.worked = 0;
|
404
|
+
this.progress.totalWork = 1;
|
405
405
|
|
406
406
|
this.controller = new CalibrationController();
|
407
407
|
|
@@ -412,7 +412,7 @@ export class CPUThrottlingCard {
|
|
412
412
|
}
|
413
413
|
|
414
414
|
for await (const result of this.controller.iterator()) {
|
415
|
-
this.progress.
|
415
|
+
this.progress.worked = result.progress;
|
416
416
|
}
|
417
417
|
} catch (e) {
|
418
418
|
console.error(e);
|
@@ -424,7 +424,7 @@ export class CPUThrottlingCard {
|
|
424
424
|
if (result && (result.low || result.mid)) {
|
425
425
|
this.setting.set(result);
|
426
426
|
// Let the user bask in the glory of a 100% progress bar, for a bit.
|
427
|
-
this.progress.
|
427
|
+
this.progress.worked = 1;
|
428
428
|
await new Promise(resolve => setTimeout(resolve, 200));
|
429
429
|
}
|
430
430
|
|
@@ -1963,7 +1963,7 @@ export class NetworkLogView extends Common.ObjectWrapper.eventMixin<EventTypes,
|
|
1963
1963
|
|
1964
1964
|
const progressIndicator = this.progressBarContainer.createChild('devtools-progress');
|
1965
1965
|
await HAR.Writer.Writer.write(stream, this.harRequests(), options, progressIndicator);
|
1966
|
-
progressIndicator.done
|
1966
|
+
progressIndicator.done = true;
|
1967
1967
|
void stream.close();
|
1968
1968
|
}
|
1969
1969
|
|
@@ -279,7 +279,7 @@ export class NetworkLogViewColumns {
|
|
279
279
|
|
280
280
|
this.updateColumns();
|
281
281
|
this.#dataGrid.addEventListener(DataGrid.DataGrid.Events.SORTING_CHANGED, this.sortHandler, this);
|
282
|
-
this.#dataGrid.setHeaderContextMenuCallback(this.
|
282
|
+
this.#dataGrid.setHeaderContextMenuCallback(this.#headerContextMenu.bind(this));
|
283
283
|
|
284
284
|
this.activeWaterfallSortId = WaterfallSortIds.StartTime;
|
285
285
|
this.#dataGrid.markColumnAsSortedBy(INITIAL_SORT_COLUMN, DataGrid.DataGrid.Order.Ascending);
|
@@ -405,7 +405,7 @@ export class NetworkLogViewColumns {
|
|
405
405
|
this.waterfallHeaderElement.addEventListener('click', waterfallHeaderClicked.bind(this));
|
406
406
|
this.waterfallHeaderElement.addEventListener('contextmenu', event => {
|
407
407
|
const contextMenu = new UI.ContextMenu.ContextMenu(event);
|
408
|
-
this
|
408
|
+
this.#headerContextMenu(contextMenu);
|
409
409
|
void contextMenu.show();
|
410
410
|
});
|
411
411
|
this.waterfallHeaderElement.createChild('div', 'hover-layer');
|
@@ -627,7 +627,7 @@ export class NetworkLogViewColumns {
|
|
627
627
|
return fragment;
|
628
628
|
}
|
629
629
|
|
630
|
-
|
630
|
+
#headerContextMenu(contextMenu: UI.ContextMenu.SubMenu): void {
|
631
631
|
const columnConfigs = this.columns.filter(columnConfig => columnConfig.hideable);
|
632
632
|
const nonRequestResponseHeaders =
|
633
633
|
columnConfigs.filter(columnConfig => !columnConfig.isRequestHeader && !columnConfig.isResponseHeader);
|
@@ -29,7 +29,7 @@ export class NetworkSearchScope implements Search.SearchScope.SearchScope {
|
|
29
29
|
|
30
30
|
performIndexing(progress: Common.Progress.Progress): void {
|
31
31
|
queueMicrotask(() => {
|
32
|
-
progress.done
|
32
|
+
progress.done = true;
|
33
33
|
});
|
34
34
|
}
|
35
35
|
|
@@ -40,14 +40,14 @@ export class NetworkSearchScope implements Search.SearchScope.SearchScope {
|
|
40
40
|
const promises = [];
|
41
41
|
const requests =
|
42
42
|
this.#networkLog.requests().filter(request => searchConfig.filePathMatchesFileQuery(request.url()));
|
43
|
-
progress.
|
43
|
+
progress.totalWork = requests.length;
|
44
44
|
for (const request of requests) {
|
45
45
|
const promise = this.searchRequest(searchConfig, request, progress);
|
46
46
|
promises.push(promise);
|
47
47
|
}
|
48
48
|
const resultsWithNull = await Promise.all(promises);
|
49
49
|
const results = (resultsWithNull.filter(result => result !== null));
|
50
|
-
if (progress.
|
50
|
+
if (progress.canceled) {
|
51
51
|
searchFinishedCallback(false);
|
52
52
|
return;
|
53
53
|
}
|
@@ -56,7 +56,7 @@ export class NetworkSearchScope implements Search.SearchScope.SearchScope {
|
|
56
56
|
searchResultCallback(result);
|
57
57
|
}
|
58
58
|
}
|
59
|
-
progress.done
|
59
|
+
progress.done = true;
|
60
60
|
searchFinishedCallback(true);
|
61
61
|
}
|
62
62
|
|
@@ -64,7 +64,7 @@ export class NetworkSearchScope implements Search.SearchScope.SearchScope {
|
|
64
64
|
searchConfig: Workspace.SearchConfig.SearchConfig, request: SDK.NetworkRequest.NetworkRequest,
|
65
65
|
progress: Common.Progress.Progress): Promise<NetworkSearchResult|null> {
|
66
66
|
const bodyMatches = await NetworkSearchScope.#responseBodyMatches(searchConfig, request);
|
67
|
-
if (progress.
|
67
|
+
if (progress.canceled) {
|
68
68
|
return null;
|
69
69
|
}
|
70
70
|
const locations = [];
|
@@ -84,7 +84,7 @@ export class NetworkSearchScope implements Search.SearchScope.SearchScope {
|
|
84
84
|
for (const match of bodyMatches) {
|
85
85
|
locations.push(NetworkForward.UIRequestLocation.UIRequestLocation.bodyMatch(request, match));
|
86
86
|
}
|
87
|
-
progress.
|
87
|
+
++progress.worked;
|
88
88
|
return new NetworkSearchResult(request, locations);
|
89
89
|
|
90
90
|
function headerMatchesQuery(header: SDK.NetworkRequest.NameValue): boolean {
|