chrome-devtools-frontend 1.0.1587905 → 1.0.1588580
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/front_end/core/sdk/DOMModel.ts +3 -0
- package/front_end/core/sdk/PreloadingModel.ts +15 -6
- package/front_end/generated/InspectorBackendCommands.ts +5 -3
- package/front_end/generated/SupportedCSSProperties.js +46 -0
- package/front_end/generated/protocol-mapping.d.ts +4 -0
- package/front_end/generated/protocol-proxy-api.d.ts +5 -0
- package/front_end/generated/protocol.ts +49 -0
- package/front_end/models/computed_style/ComputedStyleModel.ts +2 -1
- package/front_end/models/javascript_metadata/NativeFunctions.js +4 -16
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +15 -21
- package/front_end/panels/application/preloading/PreloadingView.ts +18 -0
- package/front_end/panels/application/preloading/components/RuleSetDetailsView.css +12 -0
- package/front_end/panels/application/preloading/components/RuleSetDetailsView.ts +3 -3
- package/front_end/panels/console/ConsoleViewMessage.ts +3 -3
- package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +1 -1
- package/front_end/panels/elements/ComputedStyleWidget.ts +2 -16
- package/front_end/panels/elements/ElementsPanel.ts +12 -4
- package/front_end/panels/elements/PropertiesWidget.ts +62 -61
- package/front_end/panels/elements/StylePropertyTreeElement.ts +11 -12
- package/front_end/panels/elements/StylesSidebarPane.ts +25 -5
- package/front_end/panels/elements/elementsPanel.css +6 -2
- package/front_end/panels/network/RequestHeadersView.ts +113 -128
- package/front_end/panels/sources/CSSPlugin.ts +1 -1
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/legacy/components/inline_editor/ColorSwatch.ts +32 -28
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +31 -6
- package/front_end/ui/visual_logging/KnownContextValues.ts +7 -0
- package/package.json +1 -1
|
@@ -106,15 +106,118 @@ interface ViewInput {
|
|
|
106
106
|
}
|
|
107
107
|
type View = (input: ViewInput, output: object, target: HTMLElement) => void;
|
|
108
108
|
export const DEFAULT_VIEW: View = (input, output, target) => {
|
|
109
|
+
const requestHeadersText = input.request.requestHeadersText();
|
|
110
|
+
const statusClasses = ['status'];
|
|
111
|
+
if (input.request.statusCode < 300 || input.request.statusCode === 304) {
|
|
112
|
+
statusClasses.push('green-circle');
|
|
113
|
+
} else if (input.request.statusCode < 400) {
|
|
114
|
+
statusClasses.push('yellow-circle');
|
|
115
|
+
} else {
|
|
116
|
+
statusClasses.push('red-circle');
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
let comment = '';
|
|
120
|
+
if (input.request.cachedInMemory()) {
|
|
121
|
+
comment = i18nString(UIStrings.fromMemoryCache);
|
|
122
|
+
} else if (input.request.fromEarlyHints()) {
|
|
123
|
+
comment = i18nString(UIStrings.fromEarlyHints);
|
|
124
|
+
} else if (input.request.fetchedViaServiceWorker) {
|
|
125
|
+
comment = i18nString(UIStrings.fromServiceWorker);
|
|
126
|
+
} else if (input.request.redirectSourceSignedExchangeInfoHasNoErrors()) {
|
|
127
|
+
comment = i18nString(UIStrings.fromSignedexchange);
|
|
128
|
+
} else if (input.request.fromPrefetchCache()) {
|
|
129
|
+
comment = i18nString(UIStrings.fromPrefetchCache);
|
|
130
|
+
} else if (input.request.cached()) {
|
|
131
|
+
comment = i18nString(UIStrings.fromDiskCache);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (comment) {
|
|
135
|
+
statusClasses.push('status-with-comment');
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const statusText = [input.request.statusCode, input.request.getInferredStatusText(), comment].join(' ');
|
|
139
|
+
// clang-format off
|
|
109
140
|
render(
|
|
110
141
|
html`
|
|
111
142
|
<style>${NetworkComponents.RequestHeaderSection.requestHeadersViewStyles}</style>
|
|
112
143
|
<style>${Input.checkboxStyles}</style>
|
|
113
|
-
${
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
144
|
+
${renderCategory({
|
|
145
|
+
name: 'general',
|
|
146
|
+
title: i18nString(UIStrings.general),
|
|
147
|
+
forceOpen: input.toReveal?.section === NetworkForward.UIRequestLocation.UIHeaderSection.GENERAL,
|
|
148
|
+
loggingContext: 'general',
|
|
149
|
+
contents: html`<div jslog=${VisualLogging.section('general')}>
|
|
150
|
+
${renderGeneralRow(input, i18nString(UIStrings.requestUrl), input.request.url(), 'request-url')}
|
|
151
|
+
${input.request.statusCode? renderGeneralRow(input, i18nString(UIStrings.requestMethod),
|
|
152
|
+
input.request.requestMethod, 'request-method') : Lit.nothing}
|
|
153
|
+
${input.request.statusCode? renderGeneralRow(input, i18nString(UIStrings.statusCode),
|
|
154
|
+
statusText, 'status-code', statusClasses) : Lit.nothing}
|
|
155
|
+
${input.request.remoteAddress()? renderGeneralRow(input, i18nString(UIStrings.remoteAddress),
|
|
156
|
+
input.request.remoteAddress(), 'remote-address') : Lit.nothing}
|
|
157
|
+
${input.request.referrerPolicy()? renderGeneralRow(input, i18nString(UIStrings.referrerPolicy),
|
|
158
|
+
String(input.request.referrerPolicy()), 'referrer-policy') : Lit.nothing}
|
|
159
|
+
</div>`
|
|
160
|
+
})}
|
|
161
|
+
${!input.request?.earlyHintsHeaders || input.request.earlyHintsHeaders.length === 0
|
|
162
|
+
? Lit.nothing
|
|
163
|
+
: renderCategory({
|
|
164
|
+
name: 'early-hints-headers',
|
|
165
|
+
onToggleRawHeaders: input.toggleShowRawResponseHeaders,
|
|
166
|
+
title: i18nString(UIStrings.earlyHintsHeaders),
|
|
167
|
+
headerCount: input.request.earlyHintsHeaders.length,
|
|
168
|
+
checked: undefined,
|
|
169
|
+
additionalContent: undefined,
|
|
170
|
+
forceOpen: input.toReveal?.section === NetworkForward.UIRequestLocation.UIHeaderSection.EARLY_HINTS,
|
|
171
|
+
loggingContext: 'early-hints-headers',
|
|
172
|
+
contents: input.showResponseHeadersText ?
|
|
173
|
+
renderRawHeaders(input.request.responseHeadersText) :
|
|
174
|
+
html`
|
|
175
|
+
<devtools-early-hints-header-section .data=${
|
|
176
|
+
{
|
|
177
|
+
request: input.request,
|
|
178
|
+
toReveal: input.toReveal,
|
|
179
|
+
} as NetworkComponents.ResponseHeaderSection
|
|
180
|
+
.ResponseHeaderSectionData}></devtools-early-hints-header-section>
|
|
181
|
+
`
|
|
182
|
+
})}
|
|
183
|
+
${renderCategory({
|
|
184
|
+
name: 'response-headers',
|
|
185
|
+
onToggleRawHeaders: input.toggleShowRawResponseHeaders,
|
|
186
|
+
title: i18nString(UIStrings.responseHeaders),
|
|
187
|
+
headerCount: input.request.sortedResponseHeaders.length,
|
|
188
|
+
checked: input.request.responseHeadersText ? input.showResponseHeadersText : undefined,
|
|
189
|
+
additionalContent: renderHeaderOverridesLink(input),
|
|
190
|
+
forceOpen: input.toReveal?.section === NetworkForward.UIRequestLocation.UIHeaderSection.RESPONSE,
|
|
191
|
+
loggingContext: 'response-headers',
|
|
192
|
+
contents: input.showResponseHeadersText ?
|
|
193
|
+
renderRawHeaders(input.request.responseHeadersText) :
|
|
194
|
+
html`
|
|
195
|
+
<devtools-response-header-section .data=${{
|
|
196
|
+
request: input.request,
|
|
197
|
+
toReveal: input.toReveal,
|
|
198
|
+
} as NetworkComponents.ResponseHeaderSection.ResponseHeaderSectionData} jslog=${
|
|
199
|
+
VisualLogging.section('response-headers')}></devtools-response-header-section>
|
|
200
|
+
`
|
|
201
|
+
})}
|
|
202
|
+
${renderCategory({
|
|
203
|
+
name: 'request-headers',
|
|
204
|
+
onToggleRawHeaders: input.toggleShowRawRequestHeaders,
|
|
205
|
+
title: i18nString(UIStrings.requestHeaders),
|
|
206
|
+
headerCount: input.request.requestHeaders().length,
|
|
207
|
+
checked: requestHeadersText ? input.showRequestHeadersText : undefined,
|
|
208
|
+
forceOpen: input.toReveal?.section === NetworkForward.UIRequestLocation.UIHeaderSection.REQUEST,
|
|
209
|
+
loggingContext: 'request-headers',
|
|
210
|
+
contents: (input.showRequestHeadersText && requestHeadersText) ?
|
|
211
|
+
renderRawHeaders(requestHeadersText) :
|
|
212
|
+
html`
|
|
213
|
+
<devtools-widget .widgetConfig=${
|
|
214
|
+
UI.Widget.widgetConfig(NetworkComponents.RequestHeaderSection.RequestHeaderSection, {
|
|
215
|
+
request: input.request,
|
|
216
|
+
toReveal: input.toReveal,
|
|
217
|
+
})} jslog=${VisualLogging.section('request-headers')}></devtools-widget>`
|
|
218
|
+
})}
|
|
117
219
|
`,
|
|
220
|
+
// clang-format on
|
|
118
221
|
target);
|
|
119
222
|
};
|
|
120
223
|
|
|
@@ -247,52 +350,6 @@ export class RequestHeadersView extends UI.Widget.Widget {
|
|
|
247
350
|
}
|
|
248
351
|
}
|
|
249
352
|
|
|
250
|
-
function renderEarlyHintsHeaders(input: ViewInput): Lit.LitTemplate {
|
|
251
|
-
if (!input.request?.earlyHintsHeaders || input.request.earlyHintsHeaders.length === 0) {
|
|
252
|
-
return Lit.nothing;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// Disabled until https://crbug.com/1079231 is fixed.
|
|
256
|
-
return renderCategory({
|
|
257
|
-
onToggleRawHeaders: input.toggleShowRawResponseHeaders,
|
|
258
|
-
name: 'early-hints-headers',
|
|
259
|
-
title: i18nString(UIStrings.earlyHintsHeaders),
|
|
260
|
-
headerCount: input.request.earlyHintsHeaders.length,
|
|
261
|
-
checked: undefined,
|
|
262
|
-
additionalContent: undefined,
|
|
263
|
-
forceOpen: input.toReveal?.section === NetworkForward.UIRequestLocation.UIHeaderSection.EARLY_HINTS,
|
|
264
|
-
loggingContext: 'early-hints-headers',
|
|
265
|
-
contents: input.showResponseHeadersText ? renderRawHeaders(input.request.responseHeadersText) : html`
|
|
266
|
-
<devtools-early-hints-header-section .data=${{
|
|
267
|
-
request: input.request,
|
|
268
|
-
toReveal: input.toReveal,
|
|
269
|
-
} as NetworkComponents.ResponseHeaderSection.ResponseHeaderSectionData}></devtools-early-hints-header-section>
|
|
270
|
-
`
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
function renderResponseHeaders(input: ViewInput): Lit.LitTemplate {
|
|
275
|
-
return renderCategory({
|
|
276
|
-
onToggleRawHeaders: input.toggleShowRawResponseHeaders,
|
|
277
|
-
name: 'response-headers',
|
|
278
|
-
title: i18nString(UIStrings.responseHeaders),
|
|
279
|
-
headerCount: input.request.sortedResponseHeaders.length,
|
|
280
|
-
checked: input.request.responseHeadersText ? input.showResponseHeadersText : undefined,
|
|
281
|
-
additionalContent: renderHeaderOverridesLink(input),
|
|
282
|
-
forceOpen: input.toReveal?.section === NetworkForward.UIRequestLocation.UIHeaderSection.RESPONSE,
|
|
283
|
-
loggingContext: 'response-headers',
|
|
284
|
-
contents: input.showResponseHeadersText ?
|
|
285
|
-
renderRawHeaders(input.request.responseHeadersText) :
|
|
286
|
-
html`
|
|
287
|
-
<devtools-response-header-section .data=${{
|
|
288
|
-
request: input.request,
|
|
289
|
-
toReveal: input.toReveal,
|
|
290
|
-
} as NetworkComponents.ResponseHeaderSection.ResponseHeaderSectionData} jslog=${
|
|
291
|
-
VisualLogging.section('response-headers')}></devtools-response-header-section>
|
|
292
|
-
`
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
|
|
296
353
|
function renderHeaderOverridesLink(input: ViewInput): Lit.LitTemplate {
|
|
297
354
|
if (!input.revealHeadersFile) {
|
|
298
355
|
return Lit.nothing;
|
|
@@ -334,88 +391,17 @@ function renderHeaderOverridesLink(input: ViewInput): Lit.LitTemplate {
|
|
|
334
391
|
// clang-format on
|
|
335
392
|
}
|
|
336
393
|
|
|
337
|
-
function renderRequestHeaders(input: ViewInput): Lit.LitTemplate {
|
|
338
|
-
const requestHeadersText = input.request.requestHeadersText();
|
|
339
|
-
|
|
340
|
-
return renderCategory({
|
|
341
|
-
onToggleRawHeaders: input.toggleShowRawRequestHeaders,
|
|
342
|
-
name: 'request-headers',
|
|
343
|
-
title: i18nString(UIStrings.requestHeaders),
|
|
344
|
-
headerCount: input.request.requestHeaders().length,
|
|
345
|
-
checked: requestHeadersText ? input.showRequestHeadersText : undefined,
|
|
346
|
-
forceOpen: input.toReveal?.section === NetworkForward.UIRequestLocation.UIHeaderSection.REQUEST,
|
|
347
|
-
loggingContext: 'request-headers',
|
|
348
|
-
contents: (input.showRequestHeadersText && requestHeadersText) ?
|
|
349
|
-
renderRawHeaders(requestHeadersText) :
|
|
350
|
-
html`
|
|
351
|
-
<devtools-widget .widgetConfig=${
|
|
352
|
-
UI.Widget.widgetConfig(NetworkComponents.RequestHeaderSection.RequestHeaderSection, {
|
|
353
|
-
request: input.request,
|
|
354
|
-
toReveal: input.toReveal,
|
|
355
|
-
})} jslog=${VisualLogging.section('request-headers')}></devtools-widget>`
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
|
|
359
394
|
function renderRawHeaders(text: string): Lit.TemplateResult {
|
|
360
395
|
return html`<div class="row raw-headers-row"><devtools-widget class=raw-headers .widgetConfig=${
|
|
361
396
|
UI.Widget.widgetConfig(ShowMoreDetailsWidget, {text})}></devtools-widget></div>`;
|
|
362
397
|
}
|
|
363
398
|
|
|
364
|
-
function
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
} else {
|
|
371
|
-
statusClasses.push('red-circle');
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
let comment = '';
|
|
375
|
-
if (input.request.cachedInMemory()) {
|
|
376
|
-
comment = i18nString(UIStrings.fromMemoryCache);
|
|
377
|
-
} else if (input.request.fromEarlyHints()) {
|
|
378
|
-
comment = i18nString(UIStrings.fromEarlyHints);
|
|
379
|
-
} else if (input.request.fetchedViaServiceWorker) {
|
|
380
|
-
comment = i18nString(UIStrings.fromServiceWorker);
|
|
381
|
-
} else if (input.request.redirectSourceSignedExchangeInfoHasNoErrors()) {
|
|
382
|
-
comment = i18nString(UIStrings.fromSignedexchange);
|
|
383
|
-
} else if (input.request.fromPrefetchCache()) {
|
|
384
|
-
comment = i18nString(UIStrings.fromPrefetchCache);
|
|
385
|
-
} else if (input.request.cached()) {
|
|
386
|
-
comment = i18nString(UIStrings.fromDiskCache);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
if (comment) {
|
|
390
|
-
statusClasses.push('status-with-comment');
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
const statusText = [input.request.statusCode, input.request.getInferredStatusText(), comment].join(' ');
|
|
394
|
-
|
|
395
|
-
return renderCategory({
|
|
396
|
-
name: 'general',
|
|
397
|
-
title: i18nString(UIStrings.general),
|
|
398
|
-
forceOpen: input.toReveal?.section === NetworkForward.UIRequestLocation.UIHeaderSection.GENERAL,
|
|
399
|
-
loggingContext: 'general',
|
|
400
|
-
// clang-format off
|
|
401
|
-
contents: html`<div jslog=${VisualLogging.section('general')}>
|
|
402
|
-
${renderGeneralRow(i18nString(UIStrings.requestUrl), input.request.url(), 'request-url')}
|
|
403
|
-
${input.request.statusCode? renderGeneralRow(i18nString(UIStrings.requestMethod),
|
|
404
|
-
input.request.requestMethod, 'request-method') : Lit.nothing}
|
|
405
|
-
${input.request.statusCode? renderGeneralRow(i18nString(UIStrings.statusCode),
|
|
406
|
-
statusText, 'status-code', statusClasses) : Lit.nothing}
|
|
407
|
-
${input.request.remoteAddress()? renderGeneralRow(i18nString(UIStrings.remoteAddress),
|
|
408
|
-
input.request.remoteAddress(), 'remote-address') : Lit.nothing}
|
|
409
|
-
${input.request.referrerPolicy()? renderGeneralRow(i18nString(UIStrings.referrerPolicy),
|
|
410
|
-
String(input.request.referrerPolicy()), 'referrer-policy') : Lit.nothing}
|
|
411
|
-
</div>`});
|
|
412
|
-
// clang-format on
|
|
413
|
-
|
|
414
|
-
function renderGeneralRow(
|
|
415
|
-
name: Common.UIString.LocalizedString, value: string, id: string, classNames?: string[]): Lit.LitTemplate {
|
|
416
|
-
const isHighlighted = input.toReveal?.section === NetworkForward.UIRequestLocation.UIHeaderSection.GENERAL &&
|
|
417
|
-
name.toLowerCase() === input.toReveal?.header?.toLowerCase();
|
|
418
|
-
return html`
|
|
399
|
+
function renderGeneralRow(
|
|
400
|
+
input: ViewInput, name: Common.UIString.LocalizedString, value: string, id: string,
|
|
401
|
+
classNames?: string[]): Lit.LitTemplate {
|
|
402
|
+
const isHighlighted = input.toReveal?.section === NetworkForward.UIRequestLocation.UIHeaderSection.GENERAL &&
|
|
403
|
+
name.toLowerCase() === input.toReveal?.header?.toLowerCase();
|
|
404
|
+
return html`
|
|
419
405
|
<div class="row ${isHighlighted ? 'header-highlight' : ''}">
|
|
420
406
|
<div class="header-name">${name}</div>
|
|
421
407
|
<div
|
|
@@ -425,7 +411,6 @@ function renderGeneralSection(input: ViewInput): Lit.LitTemplate {
|
|
|
425
411
|
>${value}</div>
|
|
426
412
|
</div>
|
|
427
413
|
`;
|
|
428
|
-
}
|
|
429
414
|
}
|
|
430
415
|
|
|
431
416
|
export function renderCategory(data: {
|
|
@@ -163,7 +163,7 @@ class ColorSwatchWidget extends CodeMirror.WidgetType {
|
|
|
163
163
|
|
|
164
164
|
toDOM(view: CodeMirror.EditorView): HTMLElement {
|
|
165
165
|
const swatch = new InlineEditor.ColorSwatch.ColorSwatch(i18nString(UIStrings.openColorPicker));
|
|
166
|
-
swatch.
|
|
166
|
+
swatch.renderColor(this.#color);
|
|
167
167
|
const value = swatch.createChild('span');
|
|
168
168
|
value.textContent = this.#text;
|
|
169
169
|
value.setAttribute('hidden', 'true');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Name: Dependencies sourced from the upstream `chromium` repository
|
|
2
2
|
URL: https://chromium.googlesource.com/chromium/src
|
|
3
3
|
Version: N/A
|
|
4
|
-
Revision:
|
|
4
|
+
Revision: c3aaee8e909f41cc5fa17a5d5cd3d5c7074895d0
|
|
5
5
|
Update Mechanism: Manual (https://crbug.com/428069060)
|
|
6
6
|
License: BSD-3-Clause
|
|
7
7
|
License File: LICENSE
|
|
@@ -53,45 +53,45 @@ export class ClickEvent extends Event {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
export class ColorSwatch extends HTMLElement {
|
|
56
|
-
readonly
|
|
57
|
-
|
|
56
|
+
private readonly shadow = this.attachShadow({mode: 'open'});
|
|
57
|
+
private tooltip: string = i18nString(UIStrings.shiftclickToChangeColorFormat);
|
|
58
58
|
#color: Common.Color.Color|null = null;
|
|
59
|
-
|
|
59
|
+
private readonly = false;
|
|
60
60
|
|
|
61
61
|
constructor(tooltip?: string) {
|
|
62
62
|
super();
|
|
63
63
|
if (tooltip) {
|
|
64
|
-
this
|
|
64
|
+
this.tooltip = tooltip;
|
|
65
65
|
}
|
|
66
66
|
this.tabIndex = -1;
|
|
67
|
-
this.addEventListener('keydown', e => this
|
|
67
|
+
this.addEventListener('keydown', e => this.onActivate(e));
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
static isColorSwatch(element: Element): element is ColorSwatch {
|
|
71
71
|
return element.localName === 'devtools-color-swatch';
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
set readonly(readonly: boolean) {
|
|
79
|
-
if (this.#readonly === readonly) {
|
|
74
|
+
setReadonly(readonly: boolean): void {
|
|
75
|
+
if (this.readonly === readonly) {
|
|
80
76
|
return;
|
|
81
77
|
}
|
|
82
78
|
|
|
83
|
-
this
|
|
79
|
+
this.readonly = readonly;
|
|
84
80
|
if (this.#color) {
|
|
85
|
-
this.
|
|
81
|
+
this.renderColor(this.#color);
|
|
86
82
|
}
|
|
87
83
|
}
|
|
88
84
|
|
|
85
|
+
set color(color: Common.Color.Color) {
|
|
86
|
+
this.renderColor(color);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
89
|
get color(): Common.Color.Color|null {
|
|
90
90
|
return this.#color;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
get anchorBox(): AnchorBox|null {
|
|
94
|
-
const swatch = this
|
|
94
|
+
const swatch = this.shadow.querySelector('.color-swatch');
|
|
95
95
|
return swatch ? swatch.boxInWindow() : null;
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -103,12 +103,12 @@ export class ColorSwatch extends HTMLElement {
|
|
|
103
103
|
* Render this swatch given a color object or text to be parsed as a color.
|
|
104
104
|
* @param color The color object or string to use for this swatch.
|
|
105
105
|
*/
|
|
106
|
-
|
|
106
|
+
renderColor(color: Common.Color.Color): void {
|
|
107
107
|
this.#color = color;
|
|
108
108
|
|
|
109
109
|
const colorSwatchClasses = Lit.Directives.classMap({
|
|
110
110
|
'color-swatch': true,
|
|
111
|
-
readonly: this
|
|
111
|
+
readonly: this.readonly,
|
|
112
112
|
});
|
|
113
113
|
|
|
114
114
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
@@ -120,20 +120,19 @@ export class ColorSwatch extends HTMLElement {
|
|
|
120
120
|
Lit.render(
|
|
121
121
|
html`<style>${colorSwatchStyles}</style><span
|
|
122
122
|
class=${colorSwatchClasses}
|
|
123
|
-
title=${this
|
|
123
|
+
title=${this.tooltip}><span
|
|
124
124
|
class="color-swatch-inner"
|
|
125
125
|
style="background-color: ${color.asString()};"
|
|
126
126
|
jslog=${VisualLogging.showStyleEditor('color').track({click: true})}
|
|
127
|
-
@click=${this
|
|
128
|
-
@mousedown=${this
|
|
129
|
-
@dblclick=${this
|
|
130
|
-
this
|
|
127
|
+
@click=${this.onActivate}
|
|
128
|
+
@mousedown=${this.consume}
|
|
129
|
+
@dblclick=${this.consume}></span></span>`,
|
|
130
|
+
this.shadow, {host: this});
|
|
131
131
|
// clang-format on
|
|
132
|
-
this.dispatchEvent(new ColorChangedEvent(color));
|
|
133
132
|
}
|
|
134
133
|
|
|
135
|
-
|
|
136
|
-
if (this
|
|
134
|
+
private onActivate(e: KeyboardEvent|MouseEvent): void {
|
|
135
|
+
if (this.readonly) {
|
|
137
136
|
return;
|
|
138
137
|
}
|
|
139
138
|
|
|
@@ -144,19 +143,24 @@ export class ColorSwatch extends HTMLElement {
|
|
|
144
143
|
|
|
145
144
|
if (e.shiftKey) {
|
|
146
145
|
e.stopPropagation();
|
|
147
|
-
this
|
|
146
|
+
this.showFormatPicker(e);
|
|
148
147
|
return;
|
|
149
148
|
}
|
|
150
149
|
|
|
151
150
|
this.dispatchEvent(new ClickEvent());
|
|
152
|
-
this
|
|
151
|
+
this.consume(e);
|
|
153
152
|
}
|
|
154
153
|
|
|
155
|
-
|
|
154
|
+
private consume(e: Event): void {
|
|
156
155
|
e.stopPropagation();
|
|
157
156
|
}
|
|
158
157
|
|
|
159
|
-
|
|
158
|
+
setColor(color: Common.Color.Color): void {
|
|
159
|
+
this.renderColor(color);
|
|
160
|
+
this.dispatchEvent(new ColorChangedEvent(color));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
private showFormatPicker(e: Event): void {
|
|
160
164
|
if (!this.#color) {
|
|
161
165
|
return;
|
|
162
166
|
}
|
|
@@ -150,12 +150,14 @@ interface NodeChildren {
|
|
|
150
150
|
|
|
151
151
|
abstract class ObjectTreeNodeBase extends Common.ObjectWrapper.ObjectWrapper<ObjectTreeNodeBase.EventTypes> {
|
|
152
152
|
#children?: NodeChildren;
|
|
153
|
+
protected filter: {includeNullOrUndefinedValues: boolean, regex: RegExp|null}|null = null;
|
|
153
154
|
protected extraProperties: ObjectTreeNode[] = [];
|
|
154
155
|
expanded = false;
|
|
155
156
|
constructor(
|
|
156
157
|
readonly parent?: ObjectTreeNodeBase,
|
|
157
158
|
readonly propertiesMode: ObjectPropertiesMode = ObjectPropertiesMode.OWN_AND_INTERNAL_AND_INHERITED) {
|
|
158
159
|
super();
|
|
160
|
+
this.filter = parent?.filter ?? null;
|
|
159
161
|
}
|
|
160
162
|
|
|
161
163
|
// Performs a pre-order tree traversal over the populated children. If any children need to be populated, callers must
|
|
@@ -189,6 +191,15 @@ abstract class ObjectTreeNodeBase extends Common.ObjectWrapper.ObjectWrapper<Obj
|
|
|
189
191
|
}
|
|
190
192
|
}
|
|
191
193
|
|
|
194
|
+
setFilter(filter: {includeNullOrUndefinedValues: boolean, regex: RegExp|null}|null): void {
|
|
195
|
+
this.filter = filter;
|
|
196
|
+
this.dispatchEventToListeners(ObjectTreeNodeBase.Events.FILTER_CHANGED);
|
|
197
|
+
this.#walk().forEach(c => {
|
|
198
|
+
c.filter = filter;
|
|
199
|
+
c.dispatchEventToListeners(ObjectTreeNodeBase.Events.FILTER_CHANGED);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
192
203
|
abstract get object(): SDK.RemoteObject.RemoteObject|undefined;
|
|
193
204
|
|
|
194
205
|
removeChildren(): void {
|
|
@@ -222,9 +233,13 @@ abstract class ObjectTreeNodeBase extends Common.ObjectWrapper.ObjectWrapper<Obj
|
|
|
222
233
|
}
|
|
223
234
|
|
|
224
235
|
async populateChildrenIfNeeded(): Promise<NodeChildren> {
|
|
225
|
-
if (this.#children) {
|
|
226
|
-
|
|
236
|
+
if (!this.#children) {
|
|
237
|
+
this.#children = await this.populateChildrenIfNeededImpl();
|
|
227
238
|
}
|
|
239
|
+
return this.#children;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
protected async populateChildrenIfNeededImpl(): Promise<NodeChildren> {
|
|
228
243
|
const object = this.object;
|
|
229
244
|
if (!object) {
|
|
230
245
|
return {};
|
|
@@ -315,10 +330,12 @@ namespace ObjectTreeNodeBase {
|
|
|
315
330
|
export const enum Events {
|
|
316
331
|
VALUE_CHANGED = 'value-changed',
|
|
317
332
|
CHILDREN_CHANGED = 'children-changed',
|
|
333
|
+
FILTER_CHANGED = 'filter-changed',
|
|
318
334
|
}
|
|
319
335
|
export interface EventTypes {
|
|
320
336
|
[Events.VALUE_CHANGED]: void;
|
|
321
337
|
[Events.CHILDREN_CHANGED]: void;
|
|
338
|
+
[Events.FILTER_CHANGED]: void;
|
|
322
339
|
}
|
|
323
340
|
}
|
|
324
341
|
|
|
@@ -348,10 +365,7 @@ class ArrayGroupTreeNode extends ObjectTreeNodeBase {
|
|
|
348
365
|
this.#range = range;
|
|
349
366
|
}
|
|
350
367
|
|
|
351
|
-
override async
|
|
352
|
-
if (this.children) {
|
|
353
|
-
return this.children;
|
|
354
|
-
}
|
|
368
|
+
override async populateChildrenIfNeededImpl(): Promise<NodeChildren> {
|
|
355
369
|
if (this.#range.count > ArrayGroupingTreeElement.bucketThreshold) {
|
|
356
370
|
const ranges = await arrayRangeGroups(this.object, this.#range.fromIndex, this.#range.toIndex);
|
|
357
371
|
const arrayRanges = ranges?.ranges.map(
|
|
@@ -405,6 +419,10 @@ export class ObjectTreeNode extends ObjectTreeNodeBase {
|
|
|
405
419
|
return this.property.value;
|
|
406
420
|
}
|
|
407
421
|
|
|
422
|
+
get isFiltered(): boolean {
|
|
423
|
+
return Boolean(this.filter && !this.property.match(this.filter));
|
|
424
|
+
}
|
|
425
|
+
|
|
408
426
|
get name(): string {
|
|
409
427
|
return this.property.name;
|
|
410
428
|
}
|
|
@@ -1274,8 +1292,10 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
1274
1292
|
|
|
1275
1293
|
this.#widget = new ObjectPropertyWidget();
|
|
1276
1294
|
this.property = property;
|
|
1295
|
+
this.hidden = property.isFiltered;
|
|
1277
1296
|
this.property.addEventListener(ObjectTreeNodeBase.Events.VALUE_CHANGED, this.#updateValue, this);
|
|
1278
1297
|
this.property.addEventListener(ObjectTreeNodeBase.Events.CHILDREN_CHANGED, this.#updateChildren, this);
|
|
1298
|
+
this.property.addEventListener(ObjectTreeNodeBase.Events.FILTER_CHANGED, this.#updateFilter, this);
|
|
1279
1299
|
this.toggleOnClick = true;
|
|
1280
1300
|
this.linkifier = linkifier;
|
|
1281
1301
|
this.maxNumPropertiesToShow = InitialVisibleChildrenLimit;
|
|
@@ -1355,6 +1375,7 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
1355
1375
|
revertHighlightChanges(): void {
|
|
1356
1376
|
this.#widget.revertHighlightChanges();
|
|
1357
1377
|
}
|
|
1378
|
+
|
|
1358
1379
|
setSearchRegex(regex: RegExp, additionalCssClassName?: string): boolean {
|
|
1359
1380
|
return this.#widget.setSearchRegex(regex, additionalCssClassName);
|
|
1360
1381
|
}
|
|
@@ -1457,6 +1478,10 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
1457
1478
|
void this.onpopulate();
|
|
1458
1479
|
}
|
|
1459
1480
|
|
|
1481
|
+
#updateFilter(): void {
|
|
1482
|
+
this.hidden = this.property.isFiltered;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1460
1485
|
getContextMenu(event: Event): UI.ContextMenu.ContextMenu {
|
|
1461
1486
|
const contextMenu = new UI.ContextMenu.ContextMenu(event);
|
|
1462
1487
|
contextMenu.appendApplicableItems(this);
|
|
@@ -765,6 +765,7 @@ export const knownContextValues = new Set([
|
|
|
765
765
|
'clear-palette',
|
|
766
766
|
'clear-replace-input',
|
|
767
767
|
'clear-search-input',
|
|
768
|
+
'clear-speculative-loads',
|
|
768
769
|
'clear-storage',
|
|
769
770
|
'clear-storage-cache-storage',
|
|
770
771
|
'clear-storage-cookies',
|
|
@@ -825,6 +826,8 @@ export const knownContextValues = new Set([
|
|
|
825
826
|
'column-rule-edge-start-inset',
|
|
826
827
|
'column-rule-edge-start-outset',
|
|
827
828
|
'column-rule-inset',
|
|
829
|
+
'column-rule-inset-end',
|
|
830
|
+
'column-rule-inset-start',
|
|
828
831
|
'column-rule-interior-end-inset',
|
|
829
832
|
'column-rule-interior-end-outset',
|
|
830
833
|
'column-rule-interior-inset',
|
|
@@ -3250,6 +3253,8 @@ export const knownContextValues = new Set([
|
|
|
3250
3253
|
'row-rule-edge-start-inset',
|
|
3251
3254
|
'row-rule-edge-start-outset',
|
|
3252
3255
|
'row-rule-inset',
|
|
3256
|
+
'row-rule-inset-end',
|
|
3257
|
+
'row-rule-inset-start',
|
|
3253
3258
|
'row-rule-interior-end-inset',
|
|
3254
3259
|
'row-rule-interior-end-outset',
|
|
3255
3260
|
'row-rule-interior-inset',
|
|
@@ -3272,6 +3277,8 @@ export const knownContextValues = new Set([
|
|
|
3272
3277
|
'rule-color',
|
|
3273
3278
|
'rule-edge-inset',
|
|
3274
3279
|
'rule-inset',
|
|
3280
|
+
'rule-inset-end',
|
|
3281
|
+
'rule-inset-start',
|
|
3275
3282
|
'rule-interior-inset',
|
|
3276
3283
|
'rule-outset',
|
|
3277
3284
|
'rule-overlap',
|
package/package.json
CHANGED