chrome-devtools-frontend 1.0.940255 → 1.0.942095
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/all_devtools_files.gni +0 -13
- package/config/gni/devtools_grd_files.gni +13 -13
- package/config/gni/devtools_image_files.gni +1 -2
- package/front_end/.eslintrc.js +1 -0
- package/front_end/Images/src/feedback_button_icon.svg +3 -0
- package/front_end/Tests.js +15 -0
- package/front_end/core/common/Color.ts +5 -0
- package/front_end/core/i18n/locales/en-US.json +39 -30
- package/front_end/core/i18n/locales/en-XL.json +39 -30
- package/front_end/core/sdk/DOMDebuggerModel.ts +18 -1
- package/front_end/core/sdk/sdk-meta.ts +17 -3
- package/front_end/entrypoints/devtools_app/devtools_app.json +1 -7
- package/front_end/entrypoints/main/MainImpl.ts +26 -0
- package/front_end/entrypoints/shell/shell.js +0 -11
- package/front_end/entrypoints/shell/shell.json +0 -1
- package/front_end/entrypoints/worker_app/worker_app.json +0 -4
- package/front_end/generated/InspectorBackendCommands.js +1 -0
- package/front_end/generated/protocol.d.ts +2 -0
- package/front_end/global_typings/global_defs.d.ts +5 -0
- package/front_end/legacy_test_runner/console_test_runner/console_test_runner.js +14 -2
- package/front_end/legacy_test_runner/legacy_test_runner.ts +10 -1
- package/front_end/legacy_test_runner/test_runner/TestRunner.js +9 -0
- package/front_end/models/formatter/SourceFormatter.ts +0 -10
- package/front_end/models/workspace/UISourceCode.ts +9 -42
- package/front_end/panels/animation/AnimationTimeline.ts +3 -3
- package/front_end/panels/application/ApplicationPanelSidebar.ts +3 -3
- package/front_end/panels/application/application-meta.ts +0 -3
- package/front_end/panels/console/ConsolePinPane.ts +21 -26
- package/front_end/panels/coverage/CoverageDecorationManager.ts +4 -5
- package/front_end/panels/coverage/CoverageView.ts +2 -105
- package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +11 -56
- package/front_end/panels/css_overview/components/cssOverviewStartView.css +1 -8
- package/front_end/panels/elements/ElementsTreeElement.ts +4 -9
- package/front_end/panels/elements/components/adornerSettingsPane.css +0 -4
- package/front_end/panels/emulation/emulation-meta.ts +2 -2
- package/front_end/panels/issues/IssueKindView.ts +22 -4
- package/front_end/panels/issues/issues-meta.ts +0 -2
- package/front_end/panels/layers/module.json +0 -1
- package/front_end/panels/lighthouse/lighthouseStartView.css +4 -0
- package/front_end/panels/media/media-meta.ts +0 -3
- package/front_end/panels/network/NetworkLogView.ts +3 -0
- package/front_end/panels/network/ResourceWebSocketFrameView.ts +2 -1
- package/front_end/panels/network/network-meta.ts +0 -3
- package/front_end/panels/profiler/module.json +1 -2
- package/front_end/panels/security/security-meta.ts +0 -3
- package/front_end/panels/sources/BreakpointEditDialog.ts +16 -30
- package/front_end/panels/sources/CSSPlugin.ts +310 -331
- package/front_end/panels/sources/CallStackSidebarPane.ts +28 -34
- package/front_end/panels/sources/CoveragePlugin.ts +121 -6
- package/front_end/panels/sources/DebuggerPlugin.ts +1166 -1243
- package/front_end/panels/sources/EditingLocationHistoryManager.ts +71 -101
- package/front_end/panels/sources/GoToLineQuickOpen.ts +4 -3
- package/front_end/panels/sources/InplaceFormatterEditorAction.ts +3 -3
- package/front_end/panels/sources/JavaScriptCompilerPlugin.ts +26 -23
- package/front_end/panels/sources/Plugin.ts +20 -4
- package/front_end/panels/sources/ProfilePlugin.ts +185 -0
- package/front_end/panels/sources/ScriptFormatterEditorAction.ts +3 -3
- package/front_end/panels/sources/ScriptOriginPlugin.ts +0 -10
- package/front_end/panels/sources/SnippetsPlugin.ts +1 -10
- package/front_end/panels/sources/SourcesPanel.ts +15 -10
- package/front_end/panels/sources/SourcesView.ts +10 -8
- package/front_end/panels/sources/TabbedEditorContainer.ts +31 -27
- package/front_end/panels/sources/UISourceCodeFrame.ts +335 -470
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +3 -2
- package/front_end/panels/sources/sources-legacy.ts +0 -6
- package/front_end/panels/sources/sources.ts +0 -2
- package/front_end/panels/timeline/module.json +0 -2
- package/front_end/third_party/codemirror.next/bundle.ts +9 -13
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/javascript.js +2 -2
- package/front_end/third_party/codemirror.next/chunk/markdown.js +2 -6
- package/front_end/third_party/codemirror.next/chunk/php.js +2 -6
- package/front_end/third_party/codemirror.next/chunk/python.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/wast.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/xml.js +2 -2
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +279 -198
- package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +13 -11
- package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +60 -68
- package/front_end/ui/components/data_grid/dataGrid.css +12 -10
- package/front_end/ui/components/docs/css_overview/start_view.html +25 -0
- package/front_end/ui/components/docs/css_overview/start_view.ts +14 -0
- package/front_end/ui/components/docs/panel_feedback/basic.html +25 -0
- package/front_end/ui/components/docs/panel_feedback/basic.ts +20 -0
- package/front_end/ui/components/docs/panel_feedback/button.html +25 -0
- package/front_end/ui/components/docs/panel_feedback/button.ts +18 -0
- package/front_end/ui/components/helpers/get-stylesheet.ts +1 -0
- package/front_end/ui/components/panel_feedback/FeedbackButton.ts +67 -0
- package/front_end/ui/components/panel_feedback/PanelFeedback.ts +100 -0
- package/front_end/ui/components/panel_feedback/panelFeedback.css +76 -0
- package/front_end/ui/components/panel_feedback/panel_feedback.ts +6 -0
- package/front_end/ui/components/report_view/reportValue.css +1 -0
- package/front_end/ui/components/text_editor/TextEditor.ts +79 -36
- package/front_end/ui/components/text_editor/config.ts +42 -26
- package/front_end/ui/components/text_editor/javascript.ts +2 -3
- package/front_end/ui/components/text_editor/position.ts +17 -0
- package/front_end/ui/components/text_editor/text_editor.ts +1 -0
- package/front_end/ui/components/text_editor/theme.ts +5 -1
- package/front_end/ui/legacy/Infobar.ts +2 -6
- package/front_end/ui/legacy/ShortcutRegistry.ts +11 -7
- package/front_end/ui/legacy/Widget.ts +1 -1
- package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +2 -1
- package/front_end/ui/legacy/components/perf_ui/FilmStripView.ts +3 -1
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +2 -1
- package/front_end/ui/legacy/components/perf_ui/LineLevelProfile.ts +35 -131
- package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +2 -1
- package/front_end/ui/legacy/components/perf_ui/TimelineGrid.ts +3 -1
- package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +2 -1
- package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.ts +3 -6
- package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +18 -14
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +502 -252
- package/front_end/ui/legacy/components/source_frame/source_frame-legacy.ts +0 -11
- package/front_end/ui/legacy/components/source_frame/source_frame.ts +0 -2
- package/front_end/ui/legacy/components/text_editor/cmdevtools.css +3 -1
- package/front_end/ui/legacy/radioButton.css +1 -13
- package/front_end/ui/legacy/softContextMenu.css +1 -0
- package/front_end/ui/legacy/themeColors.css +36 -0
- package/front_end/ui/legacy/utils/append-style.ts +9 -4
- package/package.json +1 -1
- package/scripts/build/generate_css_js_files.js +23 -9
- package/scripts/build/ninja/generate_css.gni +10 -1
- package/scripts/eslint_rules/lib/check_css_import.js +2 -2
- package/scripts/eslint_rules/tests/check_css_import_test.js +12 -0
- package/front_end/Images/radioDot-dark-theme.png +0 -0
- package/front_end/Images/radioDot.png +0 -0
- package/front_end/panels/application/module.json +0 -7
- package/front_end/panels/issues/module.json +0 -6
- package/front_end/panels/layer_viewer/module.json +0 -6
- package/front_end/panels/media/module.json +0 -6
- package/front_end/panels/network/module.json +0 -6
- package/front_end/panels/security/module.json +0 -5
- package/front_end/ui/legacy/components/perf_ui/module.json +0 -13
- package/front_end/ui/legacy/components/source_frame/SourcesTextEditor.ts +0 -1030
|
@@ -2,37 +2,19 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
|
-
import * as i18n from '../../../../core/i18n/i18n.js';
|
|
6
|
-
import * as Platform from '../../../../core/platform/platform.js';
|
|
7
5
|
import * as SDK from '../../../../core/sdk/sdk.js';
|
|
8
6
|
import * as Bindings from '../../../../models/bindings/bindings.js';
|
|
9
7
|
import * as Workspace from '../../../../models/workspace/workspace.js';
|
|
10
8
|
import * as SourceFrame from '../source_frame/source_frame.js';
|
|
11
9
|
import type * as Protocol from '../../../../generated/protocol.js';
|
|
12
10
|
|
|
13
|
-
const UIStrings = {
|
|
14
|
-
/**
|
|
15
|
-
*@description The milisecond unit
|
|
16
|
-
*/
|
|
17
|
-
ms: 'ms',
|
|
18
|
-
/**
|
|
19
|
-
*@description Unit for data size in DevTools
|
|
20
|
-
*/
|
|
21
|
-
mb: 'MB',
|
|
22
|
-
/**
|
|
23
|
-
*@description A unit
|
|
24
|
-
*/
|
|
25
|
-
kb: 'kB',
|
|
26
|
-
};
|
|
27
|
-
const str_ = i18n.i18n.registerUIStrings('ui/legacy/components/perf_ui/LineLevelProfile.ts', UIStrings);
|
|
28
|
-
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
29
11
|
let performanceInstance: Performance;
|
|
30
12
|
|
|
31
13
|
export class Performance {
|
|
32
14
|
private readonly helper: Helper;
|
|
33
15
|
|
|
34
16
|
private constructor() {
|
|
35
|
-
this.helper = new Helper(
|
|
17
|
+
this.helper = new Helper(SourceFrame.SourceFrame.DecoratorType.PERFORMANCE);
|
|
36
18
|
}
|
|
37
19
|
|
|
38
20
|
static instance(opts: {
|
|
@@ -112,7 +94,7 @@ let memoryInstance: Memory;
|
|
|
112
94
|
export class Memory {
|
|
113
95
|
private readonly helper: Helper;
|
|
114
96
|
private constructor() {
|
|
115
|
-
this.helper = new Helper(
|
|
97
|
+
this.helper = new Helper(SourceFrame.SourceFrame.DecoratorType.MEMORY);
|
|
116
98
|
}
|
|
117
99
|
|
|
118
100
|
static instance(opts: {
|
|
@@ -193,10 +175,12 @@ export class Helper {
|
|
|
193
175
|
}, 0);
|
|
194
176
|
}
|
|
195
177
|
|
|
196
|
-
private doUpdate(): void {
|
|
178
|
+
private async doUpdate(): Promise<void> {
|
|
197
179
|
this.locationPool.disposeAll();
|
|
198
|
-
|
|
199
|
-
|
|
180
|
+
// Map from sources to line->value profile maps.
|
|
181
|
+
const decorationsBySource = new Map<Workspace.UISourceCode.UISourceCode, Map<number, number>>();
|
|
182
|
+
const pending: Promise<void>[] = [];
|
|
183
|
+
|
|
200
184
|
for (const targetToScript of this.lineData) {
|
|
201
185
|
const target = (targetToScript[0] as SDK.Target.Target | null);
|
|
202
186
|
const debuggerModel = target ? target.model(SDK.DebuggerModel.DebuggerModel) : null;
|
|
@@ -206,124 +190,44 @@ export class Helper {
|
|
|
206
190
|
const lineToDataMap = (scriptToLine[1] as Map<number, number>);
|
|
207
191
|
// debuggerModel is null when the profile is loaded from file.
|
|
208
192
|
// Try to get UISourceCode by the URL in this case.
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
for (const lineToData of lineToDataMap) {
|
|
216
|
-
const line = (lineToData[0] as number) - 1;
|
|
217
|
-
const data = (lineToData[1] as number);
|
|
218
|
-
if (uiSourceCode) {
|
|
219
|
-
uiSourceCode.addLineDecoration(line, this.type, data);
|
|
220
|
-
continue;
|
|
221
|
-
}
|
|
222
|
-
if (debuggerModel) {
|
|
193
|
+
const workspace = Workspace.Workspace.WorkspaceImpl.instance();
|
|
194
|
+
if (debuggerModel) {
|
|
195
|
+
const workspaceBinding = Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance();
|
|
196
|
+
for (const lineToData of lineToDataMap) {
|
|
197
|
+
const line = lineToData[0] - 1;
|
|
198
|
+
const data = lineToData[1];
|
|
223
199
|
const rawLocation = typeof scriptIdOrUrl === 'string' ?
|
|
224
200
|
debuggerModel.createRawLocationByURL(scriptIdOrUrl, line, 0) :
|
|
225
201
|
debuggerModel.createRawLocationByScriptId(String(scriptIdOrUrl) as Protocol.Runtime.ScriptId, line, 0);
|
|
226
202
|
if (rawLocation) {
|
|
227
|
-
|
|
203
|
+
pending.push(workspaceBinding.rawLocationToUILocation(rawLocation).then((uiLocation): void => {
|
|
204
|
+
if (uiLocation) {
|
|
205
|
+
let lineMap = decorationsBySource.get(uiLocation.uiSourceCode);
|
|
206
|
+
if (!lineMap) {
|
|
207
|
+
lineMap = new Map<number, number>();
|
|
208
|
+
decorationsBySource.set(uiLocation.uiSourceCode, lineMap);
|
|
209
|
+
}
|
|
210
|
+
lineMap.set(uiLocation.lineNumber + 1, data);
|
|
211
|
+
}
|
|
212
|
+
}));
|
|
228
213
|
}
|
|
229
214
|
}
|
|
215
|
+
} else if (typeof scriptIdOrUrl === 'string') {
|
|
216
|
+
const uiSourceCode = workspace.uiSourceCodeForURL(scriptIdOrUrl);
|
|
217
|
+
if (uiSourceCode) {
|
|
218
|
+
decorationsBySource.set(uiSourceCode, lineToDataMap);
|
|
219
|
+
}
|
|
230
220
|
}
|
|
231
221
|
}
|
|
222
|
+
await Promise.all(pending);
|
|
223
|
+
for (const [uiSourceCode, lineMap] of decorationsBySource) {
|
|
224
|
+
uiSourceCode.setDecorationData(this.type, lineMap);
|
|
225
|
+
}
|
|
232
226
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
export class Presentation {
|
|
237
|
-
private readonly type: string;
|
|
238
|
-
private readonly time: number;
|
|
239
|
-
private uiLocation: Workspace.UISourceCode.UILocation|null;
|
|
240
|
-
|
|
241
|
-
constructor(
|
|
242
|
-
rawLocation: SDK.DebuggerModel.Location, type: string, time: number,
|
|
243
|
-
locationPool: Bindings.LiveLocation.LiveLocationPool) {
|
|
244
|
-
this.type = type;
|
|
245
|
-
this.time = time;
|
|
246
|
-
this.uiLocation = null;
|
|
247
|
-
Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().createLiveLocation(
|
|
248
|
-
rawLocation, this.updateLocation.bind(this), locationPool);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
async updateLocation(liveLocation: Bindings.LiveLocation.LiveLocation): Promise<void> {
|
|
252
|
-
if (this.uiLocation) {
|
|
253
|
-
this.uiLocation.uiSourceCode.removeDecorationsForType(this.type);
|
|
254
|
-
}
|
|
255
|
-
this.uiLocation = await liveLocation.uiLocation();
|
|
256
|
-
if (this.uiLocation) {
|
|
257
|
-
this.uiLocation.uiSourceCode.addLineDecoration(this.uiLocation.lineNumber, this.type, this.time);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
let lineDecoratorInstance: LineDecorator;
|
|
263
|
-
|
|
264
|
-
export class LineDecorator implements SourceFrame.SourceFrame.LineDecorator {
|
|
265
|
-
static instance(opts: {
|
|
266
|
-
forceNew: boolean|null,
|
|
267
|
-
} = {forceNew: null}): LineDecorator {
|
|
268
|
-
const {forceNew} = opts;
|
|
269
|
-
if (!lineDecoratorInstance || forceNew) {
|
|
270
|
-
lineDecoratorInstance = new LineDecorator();
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
return lineDecoratorInstance;
|
|
274
|
-
}
|
|
275
|
-
decorate(
|
|
276
|
-
uiSourceCode: Workspace.UISourceCode.UISourceCode, textEditor: SourceFrame.SourcesTextEditor.SourcesTextEditor,
|
|
277
|
-
type: string): void {
|
|
278
|
-
const gutterType = `CodeMirror-gutter-${type}`;
|
|
279
|
-
const decorations = uiSourceCode.decorationsForType(type);
|
|
280
|
-
textEditor.uninstallGutter(gutterType);
|
|
281
|
-
if (!decorations || !decorations.size) {
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
textEditor.installGutter(gutterType, false);
|
|
285
|
-
for (const decoration of decorations) {
|
|
286
|
-
const value = (decoration.data() as number);
|
|
287
|
-
const element = this.createElement(type, value);
|
|
288
|
-
textEditor.setGutterDecoration(decoration.range().startLine, gutterType, element);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
private createElement(type: string, value: number): Element {
|
|
293
|
-
const element = document.createElement('div');
|
|
294
|
-
element.classList.add('text-editor-line-marker-text');
|
|
295
|
-
if (type === 'performance') {
|
|
296
|
-
const intensity = Platform.NumberUtilities.clamp(Math.log10(1 + 10 * value) / 5, 0.02, 1);
|
|
297
|
-
element.textContent = value.toFixed(1);
|
|
298
|
-
element.style.backgroundColor = `hsla(44, 100%, 50%, ${intensity.toFixed(3)})`;
|
|
299
|
-
element.createChild('span', 'line-marker-units').textContent = i18nString(UIStrings.ms);
|
|
300
|
-
} else {
|
|
301
|
-
const intensity = Platform.NumberUtilities.clamp(Math.log10(1 + 2e-3 * value) / 5, 0.02, 1);
|
|
302
|
-
element.style.backgroundColor = `hsla(217, 100%, 70%, ${intensity.toFixed(3)})`;
|
|
303
|
-
value /= 1e3;
|
|
304
|
-
let units;
|
|
305
|
-
let fractionDigits;
|
|
306
|
-
if (value >= 1e3) {
|
|
307
|
-
units = i18nString(UIStrings.mb);
|
|
308
|
-
value /= 1e3;
|
|
309
|
-
fractionDigits = value >= 20 ? 0 : 1;
|
|
310
|
-
} else {
|
|
311
|
-
units = i18nString(UIStrings.kb);
|
|
312
|
-
fractionDigits = 0;
|
|
227
|
+
for (const uiSourceCode of Workspace.Workspace.WorkspaceImpl.instance().uiSourceCodes()) {
|
|
228
|
+
if (!decorationsBySource.has(uiSourceCode)) {
|
|
229
|
+
uiSourceCode.setDecorationData(this.type, undefined);
|
|
313
230
|
}
|
|
314
|
-
element.textContent = value.toFixed(fractionDigits);
|
|
315
|
-
element.createChild('span', 'line-marker-units').textContent = units;
|
|
316
231
|
}
|
|
317
|
-
return element;
|
|
318
232
|
}
|
|
319
233
|
}
|
|
320
|
-
|
|
321
|
-
SourceFrame.SourceFrame.registerLineDecorator({
|
|
322
|
-
lineDecorator: LineDecorator.instance,
|
|
323
|
-
decoratorType: SourceFrame.SourceFrame.DecoratorType.MEMORY,
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
SourceFrame.SourceFrame.registerLineDecorator({
|
|
327
|
-
lineDecorator: LineDecorator.instance,
|
|
328
|
-
decoratorType: SourceFrame.SourceFrame.DecoratorType.PERFORMANCE,
|
|
329
|
-
});
|
|
@@ -35,6 +35,7 @@ import * as UI from '../../legacy.js';
|
|
|
35
35
|
|
|
36
36
|
import type {Calculator} from './TimelineGrid.js';
|
|
37
37
|
import {TimelineGrid} from './TimelineGrid.js';
|
|
38
|
+
import overviewGridStyles from './overviewGrid.css.legacy.js';
|
|
38
39
|
|
|
39
40
|
const UIStrings = {
|
|
40
41
|
/**
|
|
@@ -161,7 +162,7 @@ export class Window extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
|
|
|
161
162
|
|
|
162
163
|
this.parentElement.addEventListener('wheel', this.onMouseWheel.bind(this), true);
|
|
163
164
|
this.parentElement.addEventListener('dblclick', this.resizeWindowMaximum.bind(this), true);
|
|
164
|
-
UI.Utils.appendStyle(this.parentElement,
|
|
165
|
+
UI.Utils.appendStyle(this.parentElement, overviewGridStyles);
|
|
165
166
|
|
|
166
167
|
this.leftResizeElement = parentElement.createChild('div', 'overview-grid-window-resizer') as HTMLElement;
|
|
167
168
|
UI.UIUtils.installDragHandle(
|
|
@@ -36,6 +36,8 @@ import * as Host from '../../../../core/host/host.js';
|
|
|
36
36
|
import * as UI from '../../legacy.js';
|
|
37
37
|
import * as ThemeSupport from '../../theme_support/theme_support.js';
|
|
38
38
|
|
|
39
|
+
import timelineGridStyles from './timelineGrid.css.legacy.js';
|
|
40
|
+
|
|
39
41
|
const labelMap = new Map<HTMLDivElement|HTMLElement, HTMLDivElement>();
|
|
40
42
|
|
|
41
43
|
export class TimelineGrid {
|
|
@@ -47,7 +49,7 @@ export class TimelineGrid {
|
|
|
47
49
|
|
|
48
50
|
constructor() {
|
|
49
51
|
this.element = document.createElement('div');
|
|
50
|
-
UI.Utils.appendStyle(this.element,
|
|
52
|
+
UI.Utils.appendStyle(this.element, timelineGridStyles);
|
|
51
53
|
|
|
52
54
|
this.dividersElementInternal = this.element.createChild('div', 'resources-dividers');
|
|
53
55
|
|
|
@@ -36,6 +36,7 @@ import * as i18n from '../../../../core/i18n/i18n.js';
|
|
|
36
36
|
import type {WindowChangedWithPositionEvent} from './OverviewGrid.js';
|
|
37
37
|
import {Events as OverviewGridEvents, OverviewGrid} from './OverviewGrid.js';
|
|
38
38
|
import type {Calculator} from './TimelineGrid.js';
|
|
39
|
+
import timelineOverviewInfoStyles from './timelineOverviewInfo.css.js';
|
|
39
40
|
|
|
40
41
|
export class TimelineOverviewPane extends Common.ObjectWrapper.eventMixin<EventTypes, typeof UI.Widget.VBox>(
|
|
41
42
|
UI.Widget.VBox) {
|
|
@@ -426,7 +427,7 @@ export class OverviewInfo {
|
|
|
426
427
|
this.visible = false;
|
|
427
428
|
this.element = UI.Utils
|
|
428
429
|
.createShadowRootWithCoreStyles(this.glassPane.contentElement, {
|
|
429
|
-
cssFile:
|
|
430
|
+
cssFile: [timelineOverviewInfoStyles],
|
|
430
431
|
delegatesFocus: undefined,
|
|
431
432
|
})
|
|
432
433
|
.createChild('div', 'overview-info');
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import type * as Common from '../../../../core/common/common.js';
|
|
6
6
|
import * as TextUtils from '../../../../models/text_utils/text_utils.js';
|
|
7
|
-
import type * as UI from '../../legacy.js';
|
|
8
7
|
|
|
9
8
|
import {ResourceSourceFrame} from './ResourceSourceFrame.js';
|
|
10
9
|
|
|
@@ -64,7 +63,7 @@ export class BinaryResourceViewFactory {
|
|
|
64
63
|
return new ResourceSourceFrame(
|
|
65
64
|
TextUtils.StaticContentProvider.StaticContentProvider.fromString(
|
|
66
65
|
this.contentUrl, this.resourceType, this.base64content),
|
|
67
|
-
|
|
66
|
+
this.resourceType.canonicalMimeType(), {lineNumbers: false, lineWrapping: true});
|
|
68
67
|
}
|
|
69
68
|
|
|
70
69
|
createHexView(): ResourceSourceFrame {
|
|
@@ -75,8 +74,7 @@ export class BinaryResourceViewFactory {
|
|
|
75
74
|
return {content, isEncoded: false};
|
|
76
75
|
});
|
|
77
76
|
return new ResourceSourceFrame(
|
|
78
|
-
hexViewerContentProvider,
|
|
79
|
-
/* autoPrettyPrint */ false, ({lineNumbers: false, lineWrapping: false} as UI.TextEditor.Options));
|
|
77
|
+
hexViewerContentProvider, this.resourceType.canonicalMimeType(), {lineNumbers: false, lineWrapping: false});
|
|
80
78
|
}
|
|
81
79
|
|
|
82
80
|
createUtf8View(): ResourceSourceFrame {
|
|
@@ -84,8 +82,7 @@ export class BinaryResourceViewFactory {
|
|
|
84
82
|
const utf8ContentProvider =
|
|
85
83
|
new TextUtils.StaticContentProvider.StaticContentProvider(this.contentUrl, this.resourceType, utf8fn);
|
|
86
84
|
return new ResourceSourceFrame(
|
|
87
|
-
utf8ContentProvider,
|
|
88
|
-
/* autoPrettyPrint */ false, ({lineNumbers: true, lineWrapping: true} as UI.TextEditor.Options));
|
|
85
|
+
utf8ContentProvider, this.resourceType.canonicalMimeType(), {lineNumbers: true, lineWrapping: true});
|
|
89
86
|
}
|
|
90
87
|
|
|
91
88
|
static uint8ArrayToHexString(uint8Array: Uint8Array): string {
|
|
@@ -35,6 +35,7 @@ import * as i18n from '../../../../core/i18n/i18n.js';
|
|
|
35
35
|
import type * as TextUtils from '../../../../models/text_utils/text_utils.js';
|
|
36
36
|
import * as UI from '../../legacy.js';
|
|
37
37
|
|
|
38
|
+
import type {SourceFrameOptions} from './SourceFrame.js';
|
|
38
39
|
import {SourceFrameImpl} from './SourceFrame.js';
|
|
39
40
|
|
|
40
41
|
const UIStrings = {
|
|
@@ -50,40 +51,43 @@ export class ResourceSourceFrame extends SourceFrameImpl {
|
|
|
50
51
|
private readonly resourceInternal: TextUtils.ContentProvider.ContentProvider;
|
|
51
52
|
|
|
52
53
|
constructor(
|
|
53
|
-
resource: TextUtils.ContentProvider.ContentProvider,
|
|
54
|
-
|
|
55
|
-
super(() => resource.requestContent(),
|
|
54
|
+
resource: TextUtils.ContentProvider.ContentProvider, private readonly givenContentType: string,
|
|
55
|
+
options?: SourceFrameOptions) {
|
|
56
|
+
super(() => resource.requestContent(), options);
|
|
56
57
|
this.resourceInternal = resource;
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
static createSearchableView(
|
|
60
|
-
resource: TextUtils.ContentProvider.ContentProvider,
|
|
61
|
+
resource: TextUtils.ContentProvider.ContentProvider, contentType: string,
|
|
61
62
|
autoPrettyPrint?: boolean): UI.Widget.Widget {
|
|
62
|
-
return new SearchableContainer(resource,
|
|
63
|
+
return new SearchableContainer(resource, contentType, autoPrettyPrint);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
protected getContentType(): string {
|
|
67
|
+
return this.givenContentType;
|
|
63
68
|
}
|
|
64
69
|
|
|
65
70
|
get resource(): TextUtils.ContentProvider.ContentProvider {
|
|
66
71
|
return this.resourceInternal;
|
|
67
72
|
}
|
|
68
73
|
|
|
69
|
-
populateTextAreaContextMenu(
|
|
70
|
-
|
|
74
|
+
protected populateTextAreaContextMenu(
|
|
75
|
+
contextMenu: UI.ContextMenu.ContextMenu, lineNumber: number, columnNumber: number): void {
|
|
76
|
+
super.populateTextAreaContextMenu(contextMenu, lineNumber, columnNumber);
|
|
71
77
|
contextMenu.appendApplicableItems(this.resourceInternal);
|
|
72
|
-
return Promise.resolve();
|
|
73
78
|
}
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
export class SearchableContainer extends UI.Widget.VBox {
|
|
77
82
|
private readonly sourceFrame: ResourceSourceFrame;
|
|
78
83
|
|
|
79
|
-
constructor(resource: TextUtils.ContentProvider.ContentProvider,
|
|
84
|
+
constructor(resource: TextUtils.ContentProvider.ContentProvider, contentType: string, autoPrettyPrint?: boolean) {
|
|
80
85
|
super(true);
|
|
81
86
|
this.registerRequiredCSS('ui/legacy/components/source_frame/resourceSourceFrame.css');
|
|
82
|
-
const sourceFrame = new ResourceSourceFrame(resource,
|
|
87
|
+
const sourceFrame = new ResourceSourceFrame(resource, contentType);
|
|
83
88
|
this.sourceFrame = sourceFrame;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
sourceFrame.highlighterType() === 'application/json';
|
|
89
|
+
const canPrettyPrint =
|
|
90
|
+
sourceFrame.resource.contentType().isDocumentOrScriptOrStyleSheet() || contentType === 'application/json';
|
|
87
91
|
sourceFrame.setCanPrettyPrint(canPrettyPrint, autoPrettyPrint);
|
|
88
92
|
const searchableView = new UI.SearchableView.SearchableView(sourceFrame, sourceFrame);
|
|
89
93
|
searchableView.element.classList.add('searchable-view');
|
|
@@ -99,6 +103,6 @@ export class SearchableContainer extends UI.Widget.VBox {
|
|
|
99
103
|
}
|
|
100
104
|
|
|
101
105
|
async revealPosition(lineNumber: number, columnNumber?: number): Promise<void> {
|
|
102
|
-
this.sourceFrame.revealPosition(lineNumber, columnNumber, true);
|
|
106
|
+
this.sourceFrame.revealPosition({lineNumber, columnNumber}, true);
|
|
103
107
|
}
|
|
104
108
|
}
|