chrome-devtools-frontend 1.0.953776 → 1.0.954427
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 +1 -0
- package/front_end/core/common/Settings.ts +10 -0
- package/front_end/core/i18n/locales/en-US.json +4 -16
- package/front_end/core/i18n/locales/en-XL.json +4 -16
- package/front_end/core/platform/number-utilities.ts +5 -7
- package/front_end/core/platform/string-utilities.ts +45 -205
- package/front_end/core/sdk/EmulationModel.ts +18 -19
- package/front_end/core/sdk/ResourceTreeModel.ts +12 -2
- package/front_end/core/sdk/sdk-meta.ts +2 -39
- package/front_end/entrypoints/inspector_main/RenderingOptions.ts +13 -9
- package/front_end/generated/InspectorBackendCommands.js +3 -1
- package/front_end/generated/protocol.d.ts +19 -0
- package/front_end/models/extensions/ExtensionServer.ts +2 -3
- package/front_end/panels/application/components/BackForwardCacheView.ts +6 -4
- package/front_end/panels/application/storageView.css +1 -1
- package/front_end/panels/console/ConsoleFormat.ts +197 -0
- package/front_end/panels/console/ConsoleViewMessage.ts +54 -155
- package/front_end/panels/console/console.ts +3 -0
- package/front_end/panels/elements/components/AdornerSettingsPane.ts +2 -1
- package/front_end/panels/elements/components/LayoutPane.ts +2 -0
- package/front_end/panels/elements/elementStatePaneWidget.css +1 -1
- package/front_end/panels/elements/layoutPane.css +0 -4
- package/front_end/panels/emulation/components/DeviceSizeInputElement.ts +5 -1
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +2 -1
- package/front_end/panels/sources/SourcesPanel.ts +1 -1
- package/front_end/panels/web_audio/webAudio.css +1 -1
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +2 -1
- package/front_end/ui/components/settings/SettingCheckbox.ts +3 -2
- package/front_end/ui/legacy/SettingsUI.ts +1 -0
- package/front_end/ui/legacy/themeColors.css +2 -2
- package/front_end/ui/legacy/treeoutline.css +1 -1
- package/package.json +1 -1
|
@@ -10719,6 +10719,21 @@ declare namespace Protocol {
|
|
|
10719
10719
|
reason: BackForwardCacheNotRestoredReason;
|
|
10720
10720
|
}
|
|
10721
10721
|
|
|
10722
|
+
export interface BackForwardCacheNotRestoredExplanationTree {
|
|
10723
|
+
/**
|
|
10724
|
+
* URL of each frame
|
|
10725
|
+
*/
|
|
10726
|
+
url: string;
|
|
10727
|
+
/**
|
|
10728
|
+
* Not restored reasons of each frame
|
|
10729
|
+
*/
|
|
10730
|
+
explanations: BackForwardCacheNotRestoredExplanation[];
|
|
10731
|
+
/**
|
|
10732
|
+
* Array of children frame
|
|
10733
|
+
*/
|
|
10734
|
+
children: BackForwardCacheNotRestoredExplanationTree[];
|
|
10735
|
+
}
|
|
10736
|
+
|
|
10722
10737
|
export interface AddScriptToEvaluateOnLoadRequest {
|
|
10723
10738
|
scriptSource: string;
|
|
10724
10739
|
}
|
|
@@ -11708,6 +11723,10 @@ declare namespace Protocol {
|
|
|
11708
11723
|
* Array of reasons why the page could not be cached. This must not be empty.
|
|
11709
11724
|
*/
|
|
11710
11725
|
notRestoredExplanations: BackForwardCacheNotRestoredExplanation[];
|
|
11726
|
+
/**
|
|
11727
|
+
* Tree structure of reasons why the page could not be cached for each frame.
|
|
11728
|
+
*/
|
|
11729
|
+
notRestoredExplanationsTree?: BackForwardCacheNotRestoredExplanationTree;
|
|
11711
11730
|
}
|
|
11712
11731
|
|
|
11713
11732
|
export interface LoadEventFiredEvent {
|
|
@@ -1145,12 +1145,11 @@ export class ExtensionStatus {
|
|
|
1145
1145
|
E_FAILED: (...args: unknown[]) => Record;
|
|
1146
1146
|
|
|
1147
1147
|
constructor() {
|
|
1148
|
-
function makeStatus(code: string, description: string): Record {
|
|
1149
|
-
const details = Array.prototype.slice.call(arguments, 2);
|
|
1148
|
+
function makeStatus(code: string, description: string, ...details: unknown[]): Record {
|
|
1150
1149
|
const status: Record = {code, description, details};
|
|
1151
1150
|
if (code !== 'OK') {
|
|
1152
1151
|
status.isError = true;
|
|
1153
|
-
console.error('Extension server error: ' + Platform.StringUtilities.
|
|
1152
|
+
console.error('Extension server error: ' + Platform.StringUtilities.sprintf(description, ...details));
|
|
1154
1153
|
}
|
|
1155
1154
|
return status;
|
|
1156
1155
|
}
|
|
@@ -238,7 +238,9 @@ export class BackForwardCacheView extends HTMLElement {
|
|
|
238
238
|
`;
|
|
239
239
|
// clang-format on
|
|
240
240
|
}
|
|
241
|
-
const
|
|
241
|
+
const isTestRunning = (this.#screenStatus === ScreenStatusType.Running);
|
|
242
|
+
// Prevent running BFCache test on the DevTools window itself via DevTools on DevTools
|
|
243
|
+
const isTestingForbidden = this.#frame.url.startsWith('devtools://');
|
|
242
244
|
// clang-format off
|
|
243
245
|
return LitHtml.html`
|
|
244
246
|
${this.#renderBackForwardCacheStatus(this.#frame.backForwardCacheDetails.restoredFromCache)}
|
|
@@ -252,11 +254,11 @@ export class BackForwardCacheView extends HTMLElement {
|
|
|
252
254
|
</div>
|
|
253
255
|
<${ReportView.ReportView.ReportSection.litTagName}>
|
|
254
256
|
<${Buttons.Button.Button.litTagName}
|
|
255
|
-
.disabled=${
|
|
256
|
-
.spinner=${
|
|
257
|
+
.disabled=${isTestRunning || isTestingForbidden}
|
|
258
|
+
.spinner=${isTestRunning}
|
|
257
259
|
.variant=${Buttons.Button.Variant.PRIMARY}
|
|
258
260
|
@click=${this.#navigateAwayAndBack}>
|
|
259
|
-
${
|
|
261
|
+
${isTestRunning ? LitHtml.html`
|
|
260
262
|
${i18nString(UIStrings.runningTest)}`:`
|
|
261
263
|
${i18nString(UIStrings.runTest)}
|
|
262
264
|
`}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// Copyright 2021 The Chromium Authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import type * as SDK from '../../core/sdk/sdk.js';
|
|
6
|
+
|
|
7
|
+
// VGA color palette
|
|
8
|
+
const ANSI_COLORS = ['#000000', '#AA0000', '#00AA00', '#AA5500', '#0000AA', '#AA00AA', '#00AAAA', '#AAAAAA'];
|
|
9
|
+
const ANSI_BRIGHT_COLORS = ['#555555', '#FF5555', '#55FF55', '#FFFF55', '#5555FF', '#FF55FF', '#55FFFF', '#FFFFFF'];
|
|
10
|
+
|
|
11
|
+
export type FormatToken = {
|
|
12
|
+
type: 'generic'|'optimal',
|
|
13
|
+
value: SDK.RemoteObject.RemoteObject,
|
|
14
|
+
}|{
|
|
15
|
+
type: 'string' | 'style',
|
|
16
|
+
value: string,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* This is the front-end part of the Formatter function specified in the
|
|
21
|
+
* Console Standard (https://console.spec.whatwg.org/#formatter). Here we
|
|
22
|
+
* assume that all type conversions have already happened in V8 before and
|
|
23
|
+
* are only concerned with performing the actual substitutions and dealing
|
|
24
|
+
* with generic and optimal object formatting as well as styling.
|
|
25
|
+
*
|
|
26
|
+
* @param fmt the format string.
|
|
27
|
+
* @param args the substitution arguments for `fmt`.
|
|
28
|
+
* @returns a list of `FormatToken`s as well as the unused arguments.
|
|
29
|
+
*/
|
|
30
|
+
export const format = (fmt: string, args: SDK.RemoteObject.RemoteObject[]): {
|
|
31
|
+
tokens: FormatToken[],
|
|
32
|
+
args: SDK.RemoteObject.RemoteObject[],
|
|
33
|
+
} => {
|
|
34
|
+
const tokens: FormatToken[] = [];
|
|
35
|
+
|
|
36
|
+
// Current maintained style for ANSI color codes.
|
|
37
|
+
const currentStyle = new Map<string, string>();
|
|
38
|
+
function addTextDecoration(value: string): void {
|
|
39
|
+
const textDecoration = currentStyle.get('text-decoration') ?? '';
|
|
40
|
+
if (!textDecoration.includes(value)) {
|
|
41
|
+
currentStyle.set('text-decoration', `${textDecoration} ${value}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function removeTextDecoration(value: string): void {
|
|
45
|
+
const textDecoration = currentStyle.get('text-decoration')?.replace(` ${value}`, '');
|
|
46
|
+
if (textDecoration) {
|
|
47
|
+
currentStyle.set('text-decoration', textDecoration);
|
|
48
|
+
} else {
|
|
49
|
+
currentStyle.delete('text-decoration');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function addStringToken(value: string): void {
|
|
54
|
+
if (!value) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (tokens.length && tokens[tokens.length - 1].type === 'string') {
|
|
58
|
+
tokens[tokens.length - 1].value += value;
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
tokens.push({type: 'string', value});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
let argIndex = 0;
|
|
65
|
+
const re = /%([%_Oocsdfi])|\x1B\[([\d;]*)m/;
|
|
66
|
+
for (let match = re.exec(fmt); match !== null; match = re.exec(fmt)) {
|
|
67
|
+
addStringToken(match.input.substring(0, match.index));
|
|
68
|
+
let substitution: number|string|undefined = undefined;
|
|
69
|
+
const specifier = match[1];
|
|
70
|
+
switch (specifier) {
|
|
71
|
+
case '%':
|
|
72
|
+
addStringToken('%');
|
|
73
|
+
substitution = '';
|
|
74
|
+
break;
|
|
75
|
+
case 's':
|
|
76
|
+
if (argIndex < args.length) {
|
|
77
|
+
const {description} = args[argIndex++];
|
|
78
|
+
substitution = description ?? '';
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
case 'c':
|
|
82
|
+
if (argIndex < args.length) {
|
|
83
|
+
const type = 'style';
|
|
84
|
+
const value = args[argIndex++].description ?? '';
|
|
85
|
+
tokens.push({type, value});
|
|
86
|
+
substitution = '';
|
|
87
|
+
}
|
|
88
|
+
break;
|
|
89
|
+
case 'o':
|
|
90
|
+
case 'O':
|
|
91
|
+
if (argIndex < args.length) {
|
|
92
|
+
const type = specifier === 'O' ? 'generic' : 'optimal';
|
|
93
|
+
const value = args[argIndex++];
|
|
94
|
+
tokens.push({type, value});
|
|
95
|
+
substitution = '';
|
|
96
|
+
}
|
|
97
|
+
break;
|
|
98
|
+
case '_':
|
|
99
|
+
if (argIndex < args.length) {
|
|
100
|
+
argIndex++;
|
|
101
|
+
substitution = '';
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
case 'd':
|
|
105
|
+
case 'f':
|
|
106
|
+
case 'i':
|
|
107
|
+
if (argIndex < args.length) {
|
|
108
|
+
const {value} = args[argIndex++];
|
|
109
|
+
substitution = typeof value !== 'number' ? NaN : value;
|
|
110
|
+
if (specifier !== 'f') {
|
|
111
|
+
substitution = Math.floor(substitution);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
case undefined: {
|
|
116
|
+
const codes = (match[2] || '0').split(';').map(code => code ? parseInt(code, 10) : 0);
|
|
117
|
+
while (codes.length) {
|
|
118
|
+
const code = codes.shift() as number;
|
|
119
|
+
switch (code) {
|
|
120
|
+
case 0:
|
|
121
|
+
currentStyle.clear();
|
|
122
|
+
break;
|
|
123
|
+
case 1:
|
|
124
|
+
currentStyle.set('font-weight', 'bold');
|
|
125
|
+
break;
|
|
126
|
+
case 2:
|
|
127
|
+
currentStyle.set('font-weight', 'lighter');
|
|
128
|
+
break;
|
|
129
|
+
case 3:
|
|
130
|
+
currentStyle.set('font-style', 'italic');
|
|
131
|
+
break;
|
|
132
|
+
case 4:
|
|
133
|
+
addTextDecoration('underline');
|
|
134
|
+
break;
|
|
135
|
+
case 9:
|
|
136
|
+
addTextDecoration('line-through');
|
|
137
|
+
break;
|
|
138
|
+
case 22:
|
|
139
|
+
currentStyle.delete('font-weight');
|
|
140
|
+
break;
|
|
141
|
+
case 23:
|
|
142
|
+
currentStyle.delete('font-style');
|
|
143
|
+
break;
|
|
144
|
+
case 24:
|
|
145
|
+
removeTextDecoration('underline');
|
|
146
|
+
break;
|
|
147
|
+
case 29:
|
|
148
|
+
removeTextDecoration('line-through');
|
|
149
|
+
break;
|
|
150
|
+
case 38:
|
|
151
|
+
case 48:
|
|
152
|
+
if (codes.shift() === 2) {
|
|
153
|
+
const r = codes.shift() ?? 0, g = codes.shift() ?? 0, b = codes.shift() ?? 0;
|
|
154
|
+
currentStyle.set(code === 38 ? 'color' : 'background', `rgb(${r},${g},${b})`);
|
|
155
|
+
}
|
|
156
|
+
break;
|
|
157
|
+
case 39:
|
|
158
|
+
case 49:
|
|
159
|
+
currentStyle.delete(code === 39 ? 'color' : 'background');
|
|
160
|
+
break;
|
|
161
|
+
case 53:
|
|
162
|
+
addTextDecoration('overline');
|
|
163
|
+
break;
|
|
164
|
+
case 55:
|
|
165
|
+
removeTextDecoration('overline');
|
|
166
|
+
break;
|
|
167
|
+
default: {
|
|
168
|
+
const color = ANSI_COLORS[code - 30] ?? ANSI_BRIGHT_COLORS[code - 90];
|
|
169
|
+
if (color !== undefined) {
|
|
170
|
+
currentStyle.set('color', color);
|
|
171
|
+
} else {
|
|
172
|
+
const background = ANSI_COLORS[code - 40] ?? ANSI_BRIGHT_COLORS[code - 100];
|
|
173
|
+
if (background !== undefined) {
|
|
174
|
+
currentStyle.set('background', background);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
const value = [...currentStyle.entries()].map(([key, val]) => `${key}:${val.trimStart()}`).join(';');
|
|
182
|
+
const type = 'style';
|
|
183
|
+
tokens.push({type, value});
|
|
184
|
+
substitution = '';
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (substitution === undefined) {
|
|
189
|
+
// If there's no substitution, emit the original specifier / sequence verbatim.
|
|
190
|
+
addStringToken(match[0]);
|
|
191
|
+
substitution = '';
|
|
192
|
+
}
|
|
193
|
+
fmt = substitution + match.input.substring(match.index + match[0].length);
|
|
194
|
+
}
|
|
195
|
+
addStringToken(fmt);
|
|
196
|
+
return {tokens, args: args.slice(argIndex)};
|
|
197
|
+
};
|
|
@@ -53,6 +53,7 @@ import * as UI from '../../ui/legacy/legacy.js';
|
|
|
53
53
|
import objectValueStyles from '../../ui/legacy/components/object_ui/objectValue.css.js';
|
|
54
54
|
import type {Chrome} from '../../../extension-api/ExtensionAPI.js'; // eslint-disable-line rulesdir/es_modules_import
|
|
55
55
|
|
|
56
|
+
import {format} from './ConsoleFormat.js';
|
|
56
57
|
import type {ConsoleViewportElement} from './ConsoleViewport.js';
|
|
57
58
|
import consoleViewStyles from './consoleView.css.js';
|
|
58
59
|
|
|
@@ -586,9 +587,8 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
|
|
|
586
587
|
|
|
587
588
|
// Multiple parameters with the first being a format string. Save unused substitutions.
|
|
588
589
|
if (shouldFormatMessage) {
|
|
589
|
-
|
|
590
|
+
parameters = this.formatWithSubstitutionString(
|
|
590
591
|
(parameters[0].description as string), parameters.slice(1), formattedResult);
|
|
591
|
-
parameters = Array.from(result.unusedSubstitutions || []);
|
|
592
592
|
if (parameters.length) {
|
|
593
593
|
UI.UIUtils.createTextChild(formattedResult, ' ');
|
|
594
594
|
}
|
|
@@ -866,165 +866,64 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
|
|
|
866
866
|
}
|
|
867
867
|
|
|
868
868
|
private formatWithSubstitutionString(
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
}
|
|
879
|
-
return stringFormatter(obj);
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
function stringFormatter(obj?: string|SDK.RemoteObject.RemoteObject): string|undefined {
|
|
883
|
-
if (obj === undefined) {
|
|
884
|
-
return undefined;
|
|
885
|
-
}
|
|
886
|
-
if (typeof obj === 'string') {
|
|
887
|
-
return obj;
|
|
888
|
-
}
|
|
889
|
-
return obj.description;
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
function floatFormatter(obj?: string|SDK.RemoteObject.RemoteObject): number|string|undefined {
|
|
893
|
-
if (obj instanceof SDK.RemoteObject.RemoteObject) {
|
|
894
|
-
if (typeof obj.value !== 'number') {
|
|
895
|
-
return 'NaN';
|
|
896
|
-
}
|
|
897
|
-
return obj.value;
|
|
898
|
-
}
|
|
899
|
-
return undefined;
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
function integerFormatter(obj?: string|SDK.RemoteObject.RemoteObject): string|number|undefined {
|
|
903
|
-
if (obj instanceof SDK.RemoteObject.RemoteObject) {
|
|
904
|
-
if (obj.type === 'bigint') {
|
|
905
|
-
return obj.description;
|
|
906
|
-
}
|
|
907
|
-
if (typeof obj.value !== 'number') {
|
|
908
|
-
return 'NaN';
|
|
869
|
+
formatString: string, parameters: SDK.RemoteObject.RemoteObject[],
|
|
870
|
+
formattedResult: HTMLElement): SDK.RemoteObject.RemoteObject[] {
|
|
871
|
+
const currentStyle = new Map();
|
|
872
|
+
const {tokens, args} = format(formatString, parameters);
|
|
873
|
+
for (const token of tokens) {
|
|
874
|
+
switch (token.type) {
|
|
875
|
+
case 'generic': {
|
|
876
|
+
formattedResult.append(this.formatParameter(token.value, true /* force */, false /* includePreview */));
|
|
877
|
+
break;
|
|
909
878
|
}
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
function bypassFormatter(obj?: string|SDK.RemoteObject.RemoteObject): Node|string {
|
|
916
|
-
return (obj instanceof Node) ? obj : '';
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
let currentStyle: Map<string, {value: string, priority: string}>|null = null;
|
|
920
|
-
function styleFormatter(obj?: string|SDK.RemoteObject.RemoteObject): void {
|
|
921
|
-
currentStyle = new Map();
|
|
922
|
-
const buffer = document.createElement('span');
|
|
923
|
-
if (obj === undefined) {
|
|
924
|
-
return;
|
|
925
|
-
}
|
|
926
|
-
if (typeof obj === 'string' || !obj.description) {
|
|
927
|
-
return;
|
|
928
|
-
}
|
|
929
|
-
buffer.setAttribute('style', obj.description);
|
|
930
|
-
for (const property of buffer.style) {
|
|
931
|
-
if (isAllowedProperty(property)) {
|
|
932
|
-
const info = {
|
|
933
|
-
value: buffer.style.getPropertyValue(property),
|
|
934
|
-
priority: buffer.style.getPropertyPriority(property),
|
|
935
|
-
};
|
|
936
|
-
currentStyle.set(property, info);
|
|
879
|
+
case 'optimal': {
|
|
880
|
+
formattedResult.append(this.formatParameter(token.value, false /* force */, true /* includePreview */));
|
|
881
|
+
break;
|
|
937
882
|
}
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
for (const prefix of prefixes) {
|
|
960
|
-
if (property.startsWith(prefix)) {
|
|
961
|
-
return true;
|
|
883
|
+
case 'string': {
|
|
884
|
+
if (currentStyle.size === 0) {
|
|
885
|
+
formattedResult.append(this.linkifyStringAsFragment(token.value));
|
|
886
|
+
} else {
|
|
887
|
+
const lines = token.value.split('\n');
|
|
888
|
+
for (let i = 0; i < lines.length; i++) {
|
|
889
|
+
if (i > 0) {
|
|
890
|
+
formattedResult.append(document.createElement('br'));
|
|
891
|
+
}
|
|
892
|
+
const wrapper = document.createElement('span');
|
|
893
|
+
wrapper.style.setProperty('contain', 'paint');
|
|
894
|
+
wrapper.style.setProperty('display', 'inline-block');
|
|
895
|
+
wrapper.style.setProperty('max-width', '100%');
|
|
896
|
+
wrapper.appendChild(this.linkifyStringAsFragment(lines[i]));
|
|
897
|
+
for (const [property, {value, priority}] of currentStyle) {
|
|
898
|
+
wrapper.style.setProperty(property, value, priority);
|
|
899
|
+
}
|
|
900
|
+
formattedResult.append(wrapper);
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
break;
|
|
962
904
|
}
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
// Support %O to force object formatting, instead of the type-based %o formatting.
|
|
982
|
-
formatters.O = parameterFormatter.bind(this, true /* force */, false /* includePreview */);
|
|
983
|
-
|
|
984
|
-
formatters._ = bypassFormatter;
|
|
985
|
-
|
|
986
|
-
function append(this: ConsoleViewMessage, a: HTMLElement, b?: string|Node): HTMLElement {
|
|
987
|
-
if (b instanceof Node) {
|
|
988
|
-
a.appendChild(b);
|
|
989
|
-
return a;
|
|
990
|
-
}
|
|
991
|
-
if (typeof b === 'undefined') {
|
|
992
|
-
return a;
|
|
993
|
-
}
|
|
994
|
-
if (!currentStyle) {
|
|
995
|
-
a.appendChild(this.linkifyStringAsFragment(String(b)));
|
|
996
|
-
return a;
|
|
997
|
-
}
|
|
998
|
-
const lines = String(b).split('\n');
|
|
999
|
-
for (let i = 0; i < lines.length; i++) {
|
|
1000
|
-
const line = lines[i];
|
|
1001
|
-
const lineFragment = this.linkifyStringAsFragment(line);
|
|
1002
|
-
const wrapper = document.createElement('span');
|
|
1003
|
-
wrapper.style.setProperty('contain', 'paint');
|
|
1004
|
-
wrapper.style.setProperty('display', 'inline-block');
|
|
1005
|
-
wrapper.style.setProperty('max-width', '100%');
|
|
1006
|
-
wrapper.appendChild(lineFragment);
|
|
1007
|
-
applyCurrentStyle(wrapper);
|
|
1008
|
-
|
|
1009
|
-
a.appendChild(wrapper);
|
|
1010
|
-
if (i < lines.length - 1) {
|
|
1011
|
-
a.appendChild(document.createElement('br'));
|
|
905
|
+
case 'style': {
|
|
906
|
+
// Make sure that allowed properties do not interfere with link visibility.
|
|
907
|
+
const ALLOWED_PROPERTY_PREFIXES =
|
|
908
|
+
['background', 'border', 'color', 'font', 'line', 'margin', 'padding', 'text'];
|
|
909
|
+
currentStyle.clear();
|
|
910
|
+
const buffer = document.createElement('span');
|
|
911
|
+
buffer.setAttribute('style', token.value);
|
|
912
|
+
for (const property of buffer.style) {
|
|
913
|
+
if (!ALLOWED_PROPERTY_PREFIXES.some(
|
|
914
|
+
prefix => property.startsWith(prefix) || property.startsWith(`-webkit-${prefix}`))) {
|
|
915
|
+
continue;
|
|
916
|
+
}
|
|
917
|
+
currentStyle.set(property, {
|
|
918
|
+
value: buffer.style.getPropertyValue(property),
|
|
919
|
+
priority: buffer.style.getPropertyPriority(property),
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
break;
|
|
1012
923
|
}
|
|
1013
924
|
}
|
|
1014
|
-
return a;
|
|
1015
925
|
}
|
|
1016
|
-
|
|
1017
|
-
function applyCurrentStyle(element: HTMLElement): void {
|
|
1018
|
-
if (!currentStyle) {
|
|
1019
|
-
return;
|
|
1020
|
-
}
|
|
1021
|
-
for (const [property, {value, priority}] of currentStyle.entries()) {
|
|
1022
|
-
element.style.setProperty((property as string), value, priority);
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
|
-
// Platform.StringUtilities.format does treat formattedResult like a Builder, result is an object.
|
|
1027
|
-
return Platform.StringUtilities.format(format, parameters, formatters, formattedResult, append.bind(this));
|
|
926
|
+
return args;
|
|
1028
927
|
}
|
|
1029
928
|
|
|
1030
929
|
matchesFilterRegex(regexObject: RegExp): boolean {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import './ConsoleContextSelector.js';
|
|
6
6
|
import './ConsoleFilter.js';
|
|
7
|
+
import './ConsoleFormat.js';
|
|
7
8
|
import './ConsolePinPane.js';
|
|
8
9
|
import './ConsoleSidebar.js';
|
|
9
10
|
import './ConsoleViewport.js';
|
|
@@ -14,6 +15,7 @@ import './ConsolePanel.js';
|
|
|
14
15
|
|
|
15
16
|
import * as ConsoleContextSelector from './ConsoleContextSelector.js';
|
|
16
17
|
import * as ConsoleFilter from './ConsoleFilter.js';
|
|
18
|
+
import * as ConsoleFormat from './ConsoleFormat.js';
|
|
17
19
|
import * as ConsolePanel from './ConsolePanel.js';
|
|
18
20
|
import * as ConsolePinPane from './ConsolePinPane.js';
|
|
19
21
|
import * as ConsolePrompt from './ConsolePrompt.js';
|
|
@@ -25,6 +27,7 @@ import * as ConsoleViewport from './ConsoleViewport.js';
|
|
|
25
27
|
export {
|
|
26
28
|
ConsoleContextSelector,
|
|
27
29
|
ConsoleFilter,
|
|
30
|
+
ConsoleFormat,
|
|
28
31
|
ConsolePanel,
|
|
29
32
|
ConsolePinPane,
|
|
30
33
|
ConsolePrompt,
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as i18n from '../../../core/i18n/i18n.js';
|
|
6
6
|
import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
|
|
7
|
+
import * as Input from '../../../ui/components/input/input.js';
|
|
7
8
|
import * as LitHtml from '../../../ui/lit-html/lit-html.js';
|
|
8
9
|
import adornerSettingsPaneStyles from './adornerSettingsPane.css.js';
|
|
9
10
|
|
|
@@ -48,7 +49,7 @@ export class AdornerSettingsPane extends HTMLElement {
|
|
|
48
49
|
#settings: AdornerSettingsMap = new Map();
|
|
49
50
|
|
|
50
51
|
connectedCallback(): void {
|
|
51
|
-
this.#shadow.adoptedStyleSheets = [adornerSettingsPaneStyles];
|
|
52
|
+
this.#shadow.adoptedStyleSheets = [Input.checkboxStyles, adornerSettingsPaneStyles];
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
set data(data: AdornerSettingsPaneData) {
|
|
@@ -13,6 +13,7 @@ import {LayoutElement} from './LayoutPaneUtils.js';
|
|
|
13
13
|
import type {NodeTextData} from './NodeText.js';
|
|
14
14
|
import {NodeText} from './NodeText.js';
|
|
15
15
|
import layoutPaneStyles from '../layoutPane.css.js';
|
|
16
|
+
import * as Input from '../../../ui/components/input/input.js';
|
|
16
17
|
// eslint-disable-next-line rulesdir/es_modules_import
|
|
17
18
|
import inspectorCommonStyles from '../../../ui/legacy/inspectorCommon.css.js';
|
|
18
19
|
|
|
@@ -103,6 +104,7 @@ export class LayoutPane extends HTMLElement {
|
|
|
103
104
|
constructor() {
|
|
104
105
|
super();
|
|
105
106
|
this.#shadow.adoptedStyleSheets = [
|
|
107
|
+
Input.checkboxStyles,
|
|
106
108
|
layoutPaneStyles,
|
|
107
109
|
inspectorCommonStyles,
|
|
108
110
|
];
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
overflow: hidden;
|
|
9
9
|
padding-left: 2px;
|
|
10
10
|
background-color: var(--color-background-elevation-1);
|
|
11
|
-
border-bottom: 1px solid var(--color-
|
|
11
|
+
border-bottom: 1px solid var(--color-details-hairline);
|
|
12
12
|
margin-top: 0;
|
|
13
13
|
padding-bottom: 2px;
|
|
14
14
|
}
|
|
@@ -181,7 +181,3 @@ that uses the dimensions to draw an outline around the element. */
|
|
|
181
181
|
.node-text-container:hover {
|
|
182
182
|
background-color: var(--item-hover-color);
|
|
183
183
|
}
|
|
184
|
-
|
|
185
|
-
:host-context(.-theme-with-dark-background) input[type="checkbox"] {
|
|
186
|
-
filter: invert(80%);
|
|
187
|
-
}
|
|
@@ -104,13 +104,17 @@ export class SizeInputElement extends HTMLElement {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
#handleModifierKeys(event: Event): void {
|
|
107
|
-
|
|
107
|
+
let modifiedValue = UILegacy.UIUtils.modifiedFloatNumber(getInputValue(event), event);
|
|
108
108
|
if (modifiedValue === null) {
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
modifiedValue = Math.min(modifiedValue, EmulationModel.DeviceModeModel.MaxDeviceSize);
|
|
113
|
+
modifiedValue = Math.max(modifiedValue, EmulationModel.DeviceModeModel.MinDeviceSize);
|
|
114
|
+
|
|
112
115
|
event.preventDefault();
|
|
113
116
|
(event.target as HTMLInputElement).value = String(modifiedValue);
|
|
117
|
+
this.dispatchEvent(new SizeChangedEvent(modifiedValue));
|
|
114
118
|
}
|
|
115
119
|
}
|
|
116
120
|
|
|
@@ -10,6 +10,7 @@ import * as LitHtml from '../../../../ui/lit-html/lit-html.js';
|
|
|
10
10
|
import userAgentClientHintsFormStyles from './userAgentClientHintsForm.css.js';
|
|
11
11
|
|
|
12
12
|
import type * as Protocol from '../../../../generated/protocol.js';
|
|
13
|
+
import * as Input from '../../../../ui/components/input/input.js';
|
|
13
14
|
import * as IconButton from '../../../../ui/components/icon_button/icon_button.js';
|
|
14
15
|
import type * as UI from '../../../../ui/legacy/legacy.js';
|
|
15
16
|
import * as EmulationUtils from '../utils/utils.js';
|
|
@@ -193,7 +194,7 @@ export class UserAgentClientHintsForm extends HTMLElement {
|
|
|
193
194
|
#brandsModifiedAriaMessage: string = '';
|
|
194
195
|
|
|
195
196
|
connectedCallback(): void {
|
|
196
|
-
this.#shadow.adoptedStyleSheets = [userAgentClientHintsFormStyles];
|
|
197
|
+
this.#shadow.adoptedStyleSheets = [Input.checkboxStyles, userAgentClientHintsFormStyles];
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
set value(data: UserAgentClientHintsFormData) {
|
|
@@ -293,7 +293,7 @@ export class SourcesPanel extends UI.Panel.Panel implements UI.ContextMenu.Provi
|
|
|
293
293
|
Extensions.ExtensionServer.ExtensionServer.instance().addEventListener(
|
|
294
294
|
Extensions.ExtensionServer.Events.SidebarPaneAdded, this.extensionSidebarPaneAdded, this);
|
|
295
295
|
SDK.TargetManager.TargetManager.instance().observeTargets(this);
|
|
296
|
-
this.lastModificationTime =
|
|
296
|
+
this.lastModificationTime = -Infinity;
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
static instance(opts: {
|