chrome-devtools-frontend 1.0.945329 → 1.0.946351
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 -5
- package/config/gni/devtools_grd_files.gni +1 -33
- package/config/gni/devtools_image_files.gni +1 -0
- package/front_end/Images/src/circled_exclamation_icon.svg +3 -0
- package/front_end/core/host/UserMetrics.ts +0 -1
- package/front_end/core/i18n/locales/en-US.json +12 -12
- package/front_end/core/i18n/locales/en-XL.json +12 -12
- package/front_end/core/root/Runtime.ts +0 -1
- package/front_end/core/sdk/CSSMetadata.ts +0 -1
- package/front_end/core/sdk/CSSProperty.ts +16 -9
- package/front_end/core/sdk/sdk-meta.ts +20 -8
- package/front_end/devtools_compatibility.js +0 -7
- package/front_end/entrypoints/devtools_app/devtools_app.js +3 -0
- package/front_end/entrypoints/devtools_app/devtools_app.json +1 -2
- package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +1 -3
- package/front_end/entrypoints/formatter_worker/FormatterActions.ts +0 -2
- package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +0 -120
- package/front_end/entrypoints/formatter_worker/formatter_worker-entrypoint.ts +1 -11
- package/front_end/entrypoints/formatter_worker/formatter_worker.ts +5 -0
- package/front_end/entrypoints/js_app/js_app.js +3 -0
- package/front_end/entrypoints/js_app/js_app.json +1 -2
- package/front_end/entrypoints/main/MainImpl.ts +0 -6
- package/front_end/entrypoints/ndb_app/ndb_app.js +3 -0
- package/front_end/entrypoints/ndb_app/ndb_app.json +1 -2
- package/front_end/entrypoints/node_app/node_app.js +3 -0
- package/front_end/entrypoints/node_app/node_app.json +1 -2
- package/front_end/entrypoints/shell/shell.js +18 -1
- package/front_end/entrypoints/worker_app/worker_app.js +3 -0
- package/front_end/entrypoints/worker_app/worker_app.json +1 -2
- package/front_end/generated/protocol.d.ts +0 -4
- package/front_end/legacy_test_runner/sources_test_runner/sources_test_runner.js +0 -1
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +1 -1
- package/front_end/models/bindings/ResourceMapping.ts +1 -1
- package/front_end/models/emulation/EmulatedDevices.ts +2 -4
- package/front_end/models/formatter/FormatterWorkerPool.ts +0 -18
- package/front_end/models/text_utils/CodeMirrorUtils.ts +6 -51
- package/front_end/models/text_utils/TextUtils.ts +1 -2
- package/front_end/models/text_utils/text_utils-legacy.ts +0 -5
- package/front_end/panels/animation/AnimationTimeline.ts +1 -1
- package/front_end/panels/application/ApplicationPanelSidebar.ts +2 -4
- package/front_end/panels/application/BackForwardCacheView.ts +8 -1
- package/front_end/panels/elements/StyleEditorWidget.ts +13 -2
- package/front_end/panels/elements/StylePropertyTreeElement.ts +8 -12
- package/front_end/panels/elements/StylesSidebarPane.ts +35 -9
- package/front_end/panels/elements/elementsTreeOutline.css +0 -13
- package/front_end/panels/network/NetworkConfigView.ts +10 -0
- package/front_end/panels/network/NetworkItemView.ts +10 -1
- package/front_end/panels/network/networkConfigView.css +5 -0
- package/front_end/panels/profiler/heapProfiler.css +2 -5
- package/front_end/panels/profiler/profilesPanel.css +1 -1
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +6 -4
- package/front_end/panels/settings/emulation/components/userAgentClientHintsForm.css +0 -12
- package/front_end/panels/sources/DebuggerPlugin.ts +6 -2
- package/front_end/panels/sources/sourcesView.css +0 -130
- package/front_end/panels/webauthn/WebauthnPane.ts +31 -32
- package/front_end/third_party/codemirror/codemirror-tsconfig.json +1 -25
- package/front_end/ui/components/adorners/Adorner.ts +14 -14
- package/front_end/ui/components/buttons/Button.ts +133 -42
- package/front_end/ui/components/buttons/button.css +31 -0
- package/front_end/ui/components/data_grid/DataGrid.ts +131 -122
- package/front_end/ui/components/data_grid/DataGridController.ts +42 -42
- package/front_end/ui/components/diff_view/DiffView.ts +4 -4
- package/front_end/ui/components/docs/button/basic.html +3 -0
- package/front_end/ui/components/docs/button/basic.ts +58 -0
- package/front_end/ui/components/expandable_list/ExpandableList.ts +11 -11
- package/front_end/ui/components/icon_button/Icon.ts +24 -21
- package/front_end/ui/components/icon_button/IconButton.ts +31 -31
- package/front_end/ui/components/issue_counter/IssueCounter.ts +52 -52
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +42 -42
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +67 -67
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +22 -22
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +36 -36
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryNavigator.ts +19 -19
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryValueInterpreter.ts +24 -32
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +52 -52
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplay.ts +21 -21
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +6 -6
- package/front_end/ui/components/markdown_view/MarkdownImage.ts +14 -14
- package/front_end/ui/components/markdown_view/MarkdownLink.ts +8 -8
- package/front_end/ui/components/markdown_view/MarkdownView.ts +6 -6
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +33 -33
- package/front_end/ui/components/report_view/ReportView.ts +18 -18
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +53 -53
- package/front_end/ui/components/settings/SettingCheckbox.ts +15 -15
- package/front_end/ui/components/survey_link/SurveyLink.ts +28 -28
- package/front_end/ui/components/text_editor/TextEditor.ts +55 -52
- package/front_end/ui/components/text_editor/config.ts +3 -3
- package/front_end/ui/components/text_editor/javascript.ts +27 -9
- package/front_end/ui/components/text_editor/theme.ts +1 -0
- package/front_end/ui/components/text_prompt/TextPrompt.ts +19 -19
- package/front_end/ui/components/tree_outline/TreeOutline.ts +56 -56
- package/front_end/ui/legacy/Infobar.ts +9 -0
- package/front_end/ui/legacy/ListWidget.ts +2 -2
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +2 -3
- package/front_end/ui/legacy/components/object_ui/objectPropertiesSection.css +0 -1
- package/front_end/ui/legacy/components/object_ui/object_ui-legacy.ts +0 -8
- package/front_end/ui/legacy/components/object_ui/object_ui.ts +0 -4
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +3 -0
- package/front_end/ui/legacy/inspectorSyntaxHighlight.css +0 -211
- package/front_end/ui/legacy/legacy-legacy.ts +0 -6
- package/front_end/ui/legacy/legacy.ts +0 -2
- package/front_end/ui/legacy/tabbedPane.css +1 -1
- package/inspector_overlay/main.ts +12 -2
- package/package.json +1 -1
- package/scripts/check_gn.js +1 -1
- package/scripts/eslint_rules/lib/l10n_filename_matches.js +17 -4
- package/scripts/eslint_rules/tests/l10n_filename_matches_test.js +21 -0
- package/scripts/hosted_mode/server.js +17 -2
- package/front_end/entrypoints/shell/shell-meta-files.ts +0 -22
- package/front_end/entrypoints/shell/shell.json +0 -5
- package/front_end/ui/legacy/TextEditor.ts +0 -82
- package/front_end/ui/legacy/components/object_ui/JavaScriptAutocomplete.ts +0 -836
- package/front_end/ui/legacy/components/text_editor/CodeMirrorTextEditor.ts +0 -1676
- package/front_end/ui/legacy/components/text_editor/TextEditorAutocompleteController.ts +0 -586
- package/front_end/ui/legacy/components/text_editor/autocompleteTooltip.css +0 -20
- package/front_end/ui/legacy/components/text_editor/cm_modes.ts +0 -23
- package/front_end/ui/legacy/components/text_editor/cmdevtools.css +0 -995
- package/front_end/ui/legacy/components/text_editor/module.json +0 -7
- package/front_end/ui/legacy/components/text_editor/text_editor-legacy.ts +0 -33
- package/front_end/ui/legacy/components/text_editor/text_editor.ts +0 -13
|
@@ -40,21 +40,21 @@ export class LinearMemoryViewer extends HTMLElement {
|
|
|
40
40
|
|
|
41
41
|
private static readonly BYTE_GROUP_MARGIN = 8;
|
|
42
42
|
private static readonly BYTE_GROUP_SIZE = 4;
|
|
43
|
-
|
|
43
|
+
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
readonly #resizeObserver = new ResizeObserver(() => this.resize());
|
|
46
|
+
#isObservingResize = false;
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
#memory = new Uint8Array();
|
|
49
|
+
#address = 0;
|
|
50
|
+
#memoryOffset = 0;
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
#numRows = 1;
|
|
53
|
+
#numBytesInRow = LinearMemoryViewer.BYTE_GROUP_SIZE;
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
#focusOnByte = true;
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
#lastKeyUpdateSent: number|undefined = undefined;
|
|
58
58
|
|
|
59
59
|
set data(data: LinearMemoryViewerData) {
|
|
60
60
|
if (data.address < data.memoryOffset || data.address > data.memoryOffset + data.memory.length || data.address < 0) {
|
|
@@ -65,21 +65,21 @@ export class LinearMemoryViewer extends HTMLElement {
|
|
|
65
65
|
throw new Error('Memory offset has to be greater or equal to zero.');
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
this
|
|
69
|
-
this
|
|
70
|
-
this
|
|
71
|
-
this
|
|
68
|
+
this.#memory = data.memory;
|
|
69
|
+
this.#address = data.address;
|
|
70
|
+
this.#memoryOffset = data.memoryOffset;
|
|
71
|
+
this.#focusOnByte = data.focus;
|
|
72
72
|
this.update();
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
connectedCallback(): void {
|
|
76
76
|
ComponentHelpers.SetCSSProperty.set(this, '--byte-group-margin', `${LinearMemoryViewer.BYTE_GROUP_MARGIN}px`);
|
|
77
|
-
this
|
|
77
|
+
this.#shadow.adoptedStyleSheets = [linearMemoryViewerStyles];
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
disconnectedCallback(): void {
|
|
81
|
-
this
|
|
82
|
-
this
|
|
81
|
+
this.#isObservingResize = false;
|
|
82
|
+
this.#resizeObserver.disconnect();
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
private update(): void {
|
|
@@ -90,8 +90,8 @@ export class LinearMemoryViewer extends HTMLElement {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
private focusOnView(): void {
|
|
93
|
-
if (this
|
|
94
|
-
const view = this
|
|
93
|
+
if (this.#focusOnByte) {
|
|
94
|
+
const view = this.#shadow.querySelector<HTMLDivElement>('.view');
|
|
95
95
|
if (view) {
|
|
96
96
|
view.focus();
|
|
97
97
|
}
|
|
@@ -100,14 +100,14 @@ export class LinearMemoryViewer extends HTMLElement {
|
|
|
100
100
|
|
|
101
101
|
private resize(): void {
|
|
102
102
|
this.update();
|
|
103
|
-
this.dispatchEvent(new ResizeEvent(this
|
|
103
|
+
this.dispatchEvent(new ResizeEvent(this.#numBytesInRow * this.#numRows));
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
/** Recomputes the number of rows and (byte) columns that fit into the current view. */
|
|
107
107
|
private updateDimensions(): void {
|
|
108
108
|
if (this.clientWidth === 0 || this.clientHeight === 0 || !this.shadowRoot) {
|
|
109
|
-
this
|
|
110
|
-
this
|
|
109
|
+
this.#numBytesInRow = LinearMemoryViewer.BYTE_GROUP_SIZE;
|
|
110
|
+
this.#numRows = 1;
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -126,8 +126,8 @@ export class LinearMemoryViewer extends HTMLElement {
|
|
|
126
126
|
const rowElement = this.shadowRoot.querySelector('.row');
|
|
127
127
|
|
|
128
128
|
if (!firstByteCell || !textCell || !divider || !rowElement) {
|
|
129
|
-
this
|
|
130
|
-
this
|
|
129
|
+
this.#numBytesInRow = LinearMemoryViewer.BYTE_GROUP_SIZE;
|
|
130
|
+
this.#numRows = 1;
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -144,22 +144,22 @@ export class LinearMemoryViewer extends HTMLElement {
|
|
|
144
144
|
const widthToFill = this.clientWidth - 1 -
|
|
145
145
|
(firstByteCell.getBoundingClientRect().left - this.getBoundingClientRect().left) - dividerWidth;
|
|
146
146
|
if (widthToFill < groupWidth) {
|
|
147
|
-
this
|
|
148
|
-
this
|
|
147
|
+
this.#numBytesInRow = LinearMemoryViewer.BYTE_GROUP_SIZE;
|
|
148
|
+
this.#numRows = 1;
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
this
|
|
153
|
-
this
|
|
152
|
+
this.#numBytesInRow = Math.floor(widthToFill / groupWidth) * LinearMemoryViewer.BYTE_GROUP_SIZE;
|
|
153
|
+
this.#numRows = Math.floor(this.clientHeight / rowElement.clientHeight);
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
private engageResizeObserver(): void {
|
|
157
|
-
if (!this
|
|
157
|
+
if (!this.#resizeObserver || this.#isObservingResize) {
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
this
|
|
162
|
-
this
|
|
161
|
+
this.#resizeObserver.observe(this);
|
|
162
|
+
this.#isObservingResize = true;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
private render(): void {
|
|
@@ -169,50 +169,50 @@ export class LinearMemoryViewer extends HTMLElement {
|
|
|
169
169
|
<div class="view" tabindex="0" @keydown=${this.onKeyDown}>
|
|
170
170
|
${this.renderView()}
|
|
171
171
|
</div>
|
|
172
|
-
`, this
|
|
172
|
+
`, this.#shadow, {host: this});
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
private onKeyDown(event: Event): void {
|
|
176
176
|
const keyboardEvent = event as KeyboardEvent;
|
|
177
177
|
let newAddress = undefined;
|
|
178
178
|
if (keyboardEvent.code === 'ArrowUp') {
|
|
179
|
-
newAddress = this
|
|
179
|
+
newAddress = this.#address - this.#numBytesInRow;
|
|
180
180
|
} else if (keyboardEvent.code === 'ArrowDown') {
|
|
181
|
-
newAddress = this
|
|
181
|
+
newAddress = this.#address + this.#numBytesInRow;
|
|
182
182
|
} else if (keyboardEvent.code === 'ArrowLeft') {
|
|
183
|
-
newAddress = this
|
|
183
|
+
newAddress = this.#address - 1;
|
|
184
184
|
} else if (keyboardEvent.code === 'ArrowRight') {
|
|
185
|
-
newAddress = this
|
|
185
|
+
newAddress = this.#address + 1;
|
|
186
186
|
} else if (keyboardEvent.code === 'PageUp') {
|
|
187
|
-
newAddress = this
|
|
187
|
+
newAddress = this.#address - this.#numBytesInRow * this.#numRows;
|
|
188
188
|
} else if (keyboardEvent.code === 'PageDown') {
|
|
189
|
-
newAddress = this
|
|
189
|
+
newAddress = this.#address + this.#numBytesInRow * this.#numRows;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
if (newAddress !== undefined && newAddress !== this
|
|
193
|
-
this
|
|
192
|
+
if (newAddress !== undefined && newAddress !== this.#lastKeyUpdateSent) {
|
|
193
|
+
this.#lastKeyUpdateSent = newAddress;
|
|
194
194
|
this.dispatchEvent(new ByteSelectedEvent(newAddress));
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
private renderView(): LitHtml.TemplateResult {
|
|
199
199
|
const itemTemplates = [];
|
|
200
|
-
for (let i = 0; i < this
|
|
200
|
+
for (let i = 0; i < this.#numRows; ++i) {
|
|
201
201
|
itemTemplates.push(this.renderRow(i));
|
|
202
202
|
}
|
|
203
203
|
return html`${itemTemplates}`;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
private renderRow(row: number): LitHtml.TemplateResult {
|
|
207
|
-
const {startIndex, endIndex} = {startIndex: row * this
|
|
207
|
+
const {startIndex, endIndex} = {startIndex: row * this.#numBytesInRow, endIndex: (row + 1) * this.#numBytesInRow};
|
|
208
208
|
|
|
209
209
|
const classMap = {
|
|
210
210
|
address: true,
|
|
211
|
-
selected: Math.floor((this
|
|
211
|
+
selected: Math.floor((this.#address - this.#memoryOffset) / this.#numBytesInRow) === row,
|
|
212
212
|
};
|
|
213
213
|
return html`
|
|
214
214
|
<div class="row">
|
|
215
|
-
<span class="${LitHtml.Directives.classMap(classMap)}">${toHexString({number: startIndex + this
|
|
215
|
+
<span class="${LitHtml.Directives.classMap(classMap)}">${toHexString({number: startIndex + this.#memoryOffset, pad: 8, prefix: false})}</span>
|
|
216
216
|
<span class="divider"></span>
|
|
217
217
|
${this.renderByteValues(startIndex, endIndex)}
|
|
218
218
|
<span class="divider"></span>
|
|
@@ -226,16 +226,16 @@ export class LinearMemoryViewer extends HTMLElement {
|
|
|
226
226
|
for (let i = startIndex; i < endIndex; ++i) {
|
|
227
227
|
// Add margin after each group of bytes of size byteGroupSize.
|
|
228
228
|
const addMargin = i !== startIndex && (i - startIndex) % LinearMemoryViewer.BYTE_GROUP_SIZE === 0;
|
|
229
|
-
const selected = i === this
|
|
229
|
+
const selected = i === this.#address - this.#memoryOffset;
|
|
230
230
|
const classMap = {
|
|
231
231
|
'cell': true,
|
|
232
232
|
'byte-cell': true,
|
|
233
233
|
'byte-group-margin': addMargin,
|
|
234
234
|
selected,
|
|
235
235
|
};
|
|
236
|
-
const isSelectableCell = i < this
|
|
237
|
-
const byteValue = isSelectableCell ? html`${toHexString({number: this
|
|
238
|
-
const actualIndex = i + this
|
|
236
|
+
const isSelectableCell = i < this.#memory.length;
|
|
237
|
+
const byteValue = isSelectableCell ? html`${toHexString({number: this.#memory[i], pad: 2, prefix: false})}` : '';
|
|
238
|
+
const actualIndex = i + this.#memoryOffset;
|
|
239
239
|
const onSelectedByte = isSelectableCell ? this.onSelectedByte.bind(this, actualIndex) : '';
|
|
240
240
|
cells.push(html`<span class="${LitHtml.Directives.classMap(classMap)}" @click=${onSelectedByte}>${byteValue}</span>`);
|
|
241
241
|
}
|
|
@@ -248,11 +248,11 @@ export class LinearMemoryViewer extends HTMLElement {
|
|
|
248
248
|
const classMap = {
|
|
249
249
|
'cell': true,
|
|
250
250
|
'text-cell': true,
|
|
251
|
-
selected: this
|
|
251
|
+
selected: this.#address - this.#memoryOffset === i,
|
|
252
252
|
};
|
|
253
|
-
const isSelectableCell = i < this
|
|
254
|
-
const value = isSelectableCell ? html`${this.toAscii(this
|
|
255
|
-
const onSelectedByte = isSelectableCell ? this.onSelectedByte.bind(this, i + this
|
|
253
|
+
const isSelectableCell = i < this.#memory.length;
|
|
254
|
+
const value = isSelectableCell ? html`${this.toAscii(this.#memory[i])}` : '';
|
|
255
|
+
const onSelectedByte = isSelectableCell ? this.onSelectedByte.bind(this, i + this.#memoryOffset) : '';
|
|
256
256
|
cells.push(html`<span class="${LitHtml.Directives.classMap(classMap)}" @click=${onSelectedByte}>${value}</span>`);
|
|
257
257
|
}
|
|
258
258
|
return html`${cells}`;
|
|
@@ -76,34 +76,34 @@ export class JumpToPointerAddressEvent extends Event {
|
|
|
76
76
|
export class ValueInterpreterDisplay extends HTMLElement {
|
|
77
77
|
static readonly litTagName = LitHtml.literal`devtools-linear-memory-inspector-interpreter-display`;
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
80
|
+
#endianness = Endianness.Little;
|
|
81
|
+
#buffer = new ArrayBuffer(0);
|
|
82
|
+
#valueTypes: Set<ValueType> = new Set();
|
|
83
|
+
#valueTypeModeConfig: Map<ValueType, ValueTypeMode> = getDefaultValueTypeMapping();
|
|
84
|
+
#memoryLength = 0;
|
|
85
85
|
|
|
86
86
|
constructor() {
|
|
87
87
|
super();
|
|
88
|
-
this
|
|
88
|
+
this.#shadow.adoptedStyleSheets = [
|
|
89
89
|
inspectorCommonStyles,
|
|
90
90
|
];
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
connectedCallback(): void {
|
|
94
|
-
this
|
|
94
|
+
this.#shadow.adoptedStyleSheets = [valueInterpreterDisplayStyles];
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
set data(data: ValueDisplayData) {
|
|
98
|
-
this
|
|
99
|
-
this
|
|
100
|
-
this
|
|
101
|
-
this
|
|
98
|
+
this.#buffer = data.buffer;
|
|
99
|
+
this.#endianness = data.endianness;
|
|
100
|
+
this.#valueTypes = data.valueTypes;
|
|
101
|
+
this.#memoryLength = data.memoryLength;
|
|
102
102
|
|
|
103
103
|
if (data.valueTypeModes) {
|
|
104
104
|
data.valueTypeModes.forEach((mode, valueType) => {
|
|
105
105
|
if (isValidMode(valueType, mode)) {
|
|
106
|
-
this
|
|
106
|
+
this.#valueTypeModeConfig.set(valueType, mode);
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
109
|
}
|
|
@@ -116,9 +116,9 @@ export class ValueInterpreterDisplay extends HTMLElement {
|
|
|
116
116
|
// clang-format off
|
|
117
117
|
render(html`
|
|
118
118
|
<div class="value-types">
|
|
119
|
-
${SORTED_VALUE_TYPES.map(type => this
|
|
119
|
+
${SORTED_VALUE_TYPES.map(type => this.#valueTypes.has(type) ? this.showValue(type) : '')}
|
|
120
120
|
</div>
|
|
121
|
-
`, this
|
|
121
|
+
`, this.#shadow, {host: this},
|
|
122
122
|
);
|
|
123
123
|
// clang-format on
|
|
124
124
|
}
|
|
@@ -135,8 +135,8 @@ export class ValueInterpreterDisplay extends HTMLElement {
|
|
|
135
135
|
|
|
136
136
|
private renderPointerValue(type: ValueType): LitHtml.TemplateResult {
|
|
137
137
|
const unsignedValue = this.parse({type, signed: false});
|
|
138
|
-
const address = getPointerAddress(type, this
|
|
139
|
-
const jumpDisabled = Number.isNaN(address) || BigInt(address) >= BigInt(this
|
|
138
|
+
const address = getPointerAddress(type, this.#buffer, this.#endianness);
|
|
139
|
+
const jumpDisabled = Number.isNaN(address) || BigInt(address) >= BigInt(this.#memoryLength);
|
|
140
140
|
const buttonTitle = jumpDisabled ? i18nString(UIStrings.addressOutOfRange) : i18nString(UIStrings.jumpToPointer);
|
|
141
141
|
const iconColor = jumpDisabled ? 'var(--color-text-secondary)' : 'var(--color-primary)';
|
|
142
142
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
@@ -177,7 +177,7 @@ export class ValueInterpreterDisplay extends HTMLElement {
|
|
|
177
177
|
@change=${this.onValueTypeModeChange.bind(this, type)}>
|
|
178
178
|
${VALUE_TYPE_MODE_LIST.filter(x => isValidMode(type, x)).map(mode => {
|
|
179
179
|
return html`
|
|
180
|
-
<option value=${mode} .selected=${this
|
|
180
|
+
<option value=${mode} .selected=${this.#valueTypeModeConfig.get(type) === mode}>${
|
|
181
181
|
i18n.i18n.lockedString(mode)}
|
|
182
182
|
</option>`;
|
|
183
183
|
})}
|
|
@@ -191,7 +191,7 @@ export class ValueInterpreterDisplay extends HTMLElement {
|
|
|
191
191
|
private renderSignedAndUnsigned(type: ValueType): LitHtml.TemplateResult {
|
|
192
192
|
const unsignedValue = this.parse({type, signed: false});
|
|
193
193
|
const signedValue = this.parse({type, signed: true});
|
|
194
|
-
const mode = this
|
|
194
|
+
const mode = this.#valueTypeModeConfig.get(type);
|
|
195
195
|
const showSignedAndUnsigned =
|
|
196
196
|
signedValue !== unsignedValue && mode !== ValueTypeMode.Hexadecimal && mode !== ValueTypeMode.Octal;
|
|
197
197
|
|
|
@@ -232,9 +232,9 @@ export class ValueInterpreterDisplay extends HTMLElement {
|
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
private parse(data: {type: ValueType, signed?: boolean}): string {
|
|
235
|
-
const mode = this
|
|
235
|
+
const mode = this.#valueTypeModeConfig.get(data.type);
|
|
236
236
|
return format(
|
|
237
|
-
{buffer: this
|
|
237
|
+
{buffer: this.#buffer, type: data.type, endianness: this.#endianness, signed: data.signed || false, mode});
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
|
|
@@ -61,15 +61,15 @@ export class TypeToggleEvent extends Event {
|
|
|
61
61
|
export class ValueInterpreterSettings extends HTMLElement {
|
|
62
62
|
static readonly litTagName = LitHtml.literal`devtools-linear-memory-inspector-interpreter-settings`;
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
65
|
+
#valueTypes: Set<ValueType> = new Set();
|
|
66
66
|
|
|
67
67
|
connectedCallback(): void {
|
|
68
|
-
this
|
|
68
|
+
this.#shadow.adoptedStyleSheets = [valueInterpreterSettingsStyles];
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
set data(data: ValueInterpreterSettingsData) {
|
|
72
|
-
this
|
|
72
|
+
this.#valueTypes = data.valueTypes;
|
|
73
73
|
this.render();
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -86,7 +86,7 @@ export class ValueInterpreterSettings extends HTMLElement {
|
|
|
86
86
|
</div>
|
|
87
87
|
`;})}
|
|
88
88
|
</div>
|
|
89
|
-
`, this
|
|
89
|
+
`, this.#shadow, {host: this});
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
private plotTypeSelections(group: ValueTypeGroup): LitHtml.TemplateResult {
|
|
@@ -98,7 +98,7 @@ export class ValueInterpreterSettings extends HTMLElement {
|
|
|
98
98
|
${types.map(type => {
|
|
99
99
|
return html`
|
|
100
100
|
<label class="type-label" title=${valueTypeToLocalizedString(type)}>
|
|
101
|
-
<input data-input="true" type="checkbox" .checked=${this
|
|
101
|
+
<input data-input="true" type="checkbox" .checked=${this.#valueTypes.has(type)} @change=${(e: Event): void => this.onTypeToggle(type, e)}>
|
|
102
102
|
<span data-title="true">${valueTypeToLocalizedString(type)}</span>
|
|
103
103
|
</label>
|
|
104
104
|
`;})}`;
|
|
@@ -23,31 +23,31 @@ export interface MarkdownImageData {
|
|
|
23
23
|
export class MarkdownImage extends HTMLElement {
|
|
24
24
|
static readonly litTagName = LitHtml.literal`devtools-markdown-image`;
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
27
|
+
#imageData?: ImageData;
|
|
28
|
+
#imageTitle?: string;
|
|
29
29
|
|
|
30
30
|
constructor() {
|
|
31
31
|
super();
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
connectedCallback(): void {
|
|
35
|
-
this
|
|
35
|
+
this.#shadow.adoptedStyleSheets = [markdownImageStyles];
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
set data(data: MarkdownImageData) {
|
|
39
39
|
const {key, title} = data;
|
|
40
40
|
const markdownImage = getMarkdownImage(key);
|
|
41
|
-
this
|
|
42
|
-
this
|
|
41
|
+
this.#imageData = markdownImage;
|
|
42
|
+
this.#imageTitle = title;
|
|
43
43
|
this.render();
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
private getIconComponent(): LitHtml.TemplateResult {
|
|
47
|
-
if (!this
|
|
47
|
+
if (!this.#imageData) {
|
|
48
48
|
return LitHtml.html``;
|
|
49
49
|
}
|
|
50
|
-
const {src, color, width = '100%', height = '100%'} = this
|
|
50
|
+
const {src, color, width = '100%', height = '100%'} = this.#imageData;
|
|
51
51
|
return LitHtml.html`
|
|
52
52
|
<${IconButton.Icon.Icon.litTagName} .data=${
|
|
53
53
|
{iconPath: src, color, width, height} as IconButton.Icon.IconData}></${IconButton.Icon.Icon.litTagName}>
|
|
@@ -55,22 +55,22 @@ export class MarkdownImage extends HTMLElement {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
private getImageComponent(): LitHtml.TemplateResult {
|
|
58
|
-
if (!this
|
|
58
|
+
if (!this.#imageData) {
|
|
59
59
|
return LitHtml.html``;
|
|
60
60
|
}
|
|
61
|
-
const {src, width = '100%', height = '100%'} = this
|
|
61
|
+
const {src, width = '100%', height = '100%'} = this.#imageData;
|
|
62
62
|
return LitHtml.html`
|
|
63
|
-
<img class="markdown-image" src=${src} alt=${this
|
|
63
|
+
<img class="markdown-image" src=${src} alt=${this.#imageTitle} width=${width} height=${height}/>
|
|
64
64
|
`;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
private render(): void {
|
|
68
|
-
if (!this
|
|
68
|
+
if (!this.#imageData) {
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
const {isIcon} = this
|
|
71
|
+
const {isIcon} = this.#imageData;
|
|
72
72
|
const imageComponent = isIcon ? this.getIconComponent() : this.getImageComponent();
|
|
73
|
-
LitHtml.render(imageComponent, this
|
|
73
|
+
LitHtml.render(imageComponent, this.#shadow, {host: this});
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -23,28 +23,28 @@ export interface MarkdownLinkData {
|
|
|
23
23
|
export class MarkdownLink extends HTMLElement {
|
|
24
24
|
static readonly litTagName = LitHtml.literal`devtools-markdown-link`;
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
27
|
+
#linkText: string = '';
|
|
28
|
+
#linkUrl: string = '';
|
|
29
29
|
|
|
30
30
|
connectedCallback(): void {
|
|
31
|
-
this
|
|
31
|
+
this.#shadow.adoptedStyleSheets = [markdownLinkStyles];
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
set data(data: MarkdownLinkData) {
|
|
35
35
|
const {key, title} = data;
|
|
36
36
|
const markdownLink = getMarkdownLink(key);
|
|
37
|
-
this
|
|
38
|
-
this
|
|
37
|
+
this.#linkText = title;
|
|
38
|
+
this.#linkUrl = markdownLink;
|
|
39
39
|
this.render();
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
private render(): void {
|
|
43
43
|
// clang-format off
|
|
44
44
|
const output = LitHtml.html`
|
|
45
|
-
<x-link class="devtools-link" href=${this
|
|
45
|
+
<x-link class="devtools-link" href=${this.#linkUrl}>${this.#linkText}</x-link>
|
|
46
46
|
`;
|
|
47
|
-
LitHtml.render(output, this
|
|
47
|
+
LitHtml.render(output, this.#shadow, {host: this});
|
|
48
48
|
// clang-format on
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -21,17 +21,17 @@ export interface MarkdownViewData {
|
|
|
21
21
|
|
|
22
22
|
export class MarkdownView extends HTMLElement {
|
|
23
23
|
static readonly litTagName = LitHtml.literal`devtools-markdown-view`;
|
|
24
|
-
|
|
24
|
+
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
25
25
|
|
|
26
26
|
// TODO(crbug.com/1108699): Replace with `Marked.Marked.Token[]` once AST types are fixed upstream.
|
|
27
|
-
|
|
27
|
+
#tokenData: readonly Object[] = [];
|
|
28
28
|
|
|
29
29
|
connectedCallback(): void {
|
|
30
|
-
this
|
|
30
|
+
this.#shadow.adoptedStyleSheets = [markdownViewStyles];
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
set data(data: MarkdownViewData) {
|
|
34
|
-
this
|
|
34
|
+
this.#tokenData = data.tokens;
|
|
35
35
|
this.update();
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -44,9 +44,9 @@ export class MarkdownView extends HTMLElement {
|
|
|
44
44
|
// clang-format off
|
|
45
45
|
render(html`
|
|
46
46
|
<div class='message'>
|
|
47
|
-
${this
|
|
47
|
+
${this.#tokenData.map(renderToken)}
|
|
48
48
|
</div>
|
|
49
|
-
`, this
|
|
49
|
+
`, this.#shadow);
|
|
50
50
|
// clang-format on
|
|
51
51
|
}
|
|
52
52
|
}
|