chrome-devtools-frontend 1.0.1038685 → 1.0.1039140

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.
@@ -12165,10 +12165,10 @@
12165
12165
  "message": "Show Memory Inspector"
12166
12166
  },
12167
12167
  "ui/components/linear_memory_inspector/LinearMemoryHighlightChipList.ts | deleteHighlight": {
12168
- "message": "Delete memory highlight"
12168
+ "message": "Stop highlighting this memory"
12169
12169
  },
12170
12170
  "ui/components/linear_memory_inspector/LinearMemoryHighlightChipList.ts | jumpToAddress": {
12171
- "message": "Jump to highlighted memory"
12171
+ "message": "Jump to this memory"
12172
12172
  },
12173
12173
  "ui/components/linear_memory_inspector/LinearMemoryInspector.ts | addressHasToBeANumberBetweenSAnd": {
12174
12174
  "message": "Address has to be a number between {PH1} and {PH2}"
@@ -12165,10 +12165,10 @@
12165
12165
  "message": "Ŝh́ôẃ M̂ém̂ór̂ý Îńŝṕêćt̂ór̂"
12166
12166
  },
12167
12167
  "ui/components/linear_memory_inspector/LinearMemoryHighlightChipList.ts | deleteHighlight": {
12168
- "message": "D̂él̂ét̂é m̂ém̂ór̂ý ĥíĝh́l̂íĝh́t̂"
12168
+ "message": "Ŝt́ôṕ ĥíĝh́l̂íĝh́t̂ín̂ǵ t̂h́îś m̂ém̂ór̂ý"
12169
12169
  },
12170
12170
  "ui/components/linear_memory_inspector/LinearMemoryHighlightChipList.ts | jumpToAddress": {
12171
- "message": "Ĵúm̂ṕ t̂ó ĥíĝíĝh́t̂éḿêḿôŕ"
12171
+ "message": "Ĵúm̂ṕ t̂ó t̂h́îś m̂ém̂ór̂ý"
12172
12172
  },
12173
12173
  "ui/components/linear_memory_inspector/LinearMemoryInspector.ts | addressHasToBeANumberBetweenSAnd": {
12174
12174
  "message": "Âd́d̂ŕêśŝ h́âś t̂ó b̂é â ńûḿb̂ér̂ b́êt́ŵéêń {PH1} âńd̂ {PH2}"
@@ -12,13 +12,16 @@ import linearMemoryHighlightChipListStyles from './linearMemoryHighlightChipList
12
12
 
13
13
  const UIStrings = {
14
14
  /**
15
- *@description Tooltip text that appears when hovering over a 'jump-to-highlight-button' button that is on the left side of a 'highlight-chip' chip.
15
+ *@description Tooltip text that appears when hovering over an inspected variable's button in the Linear Memory Highlight Chip List.
16
+ Clicking the button changes the displayed slice of computer memory in the Linear Memory Inspector to contain the inspected variable's bytes.
16
17
  */
17
- jumpToAddress: 'Jump to highlighted memory',
18
+ jumpToAddress: 'Jump to this memory',
18
19
  /**
19
- *@description Tooltip text that appears when hovering over a 'remove-highlight-button' button that is on the right end of a 'highlight-chip' chip.
20
+ *@description Tooltip text that appears when hovering over an inspected variable's delete button in the Linear Memory Highlight Chip List.
21
+ Clicking the delete button stops highlighting the variable's memory in the Linear Memory Inspector.
22
+ 'Memory' is a slice of bytes in the computer memory.
20
23
  */
21
- deleteHighlight: 'Delete memory highlight',
24
+ deleteHighlight: 'Stop highlighting this memory',
22
25
  };
23
26
  const str_ =
24
27
  i18n.i18n.registerUIStrings('ui/components/linear_memory_inspector/LinearMemoryHighlightChipList.ts', UIStrings);
@@ -27,6 +30,7 @@ const {render, html} = LitHtml;
27
30
 
28
31
  export interface LinearMemoryHighlightChipListData {
29
32
  highlightInfos: Array<HighlightInfo>;
33
+ focusedMemoryHighlight?: HighlightInfo;
30
34
  }
31
35
 
32
36
  export class DeleteMemoryHighlightEvent extends Event {
@@ -54,6 +58,7 @@ export class LinearMemoryHighlightChipList extends HTMLElement {
54
58
 
55
59
  readonly #shadow = this.attachShadow({mode: 'open'});
56
60
  #highlightedAreas: HighlightInfo[] = [];
61
+ #focusedMemoryHighlight?: HighlightInfo;
57
62
 
58
63
  connectedCallback(): void {
59
64
  this.#shadow.adoptedStyleSheets = [linearMemoryHighlightChipListStyles];
@@ -61,6 +66,7 @@ export class LinearMemoryHighlightChipList extends HTMLElement {
61
66
 
62
67
  set data(data: LinearMemoryHighlightChipListData) {
63
68
  this.#highlightedAreas = data.highlightInfos;
69
+ this.#focusedMemoryHighlight = data.focusedMemoryHighlight;
64
70
  this.#render();
65
71
  }
66
72
 
@@ -83,11 +89,15 @@ export class LinearMemoryHighlightChipList extends HTMLElement {
83
89
  #createChip(highlightInfo: HighlightInfo): LitHtml.TemplateResult {
84
90
  const expressionName = highlightInfo.name || '<anonymous>';
85
91
  const expressionType = highlightInfo.type;
86
-
92
+ const isFocused = highlightInfo === this.#focusedMemoryHighlight;
93
+ const classMap = {
94
+ focused: isFocused,
95
+ 'highlight-chip': true,
96
+ };
87
97
  // Disabled until https://crbug.com/1079231 is fixed.
88
98
  // clang-format off
89
99
  return html`
90
- <div class="highlight-chip">
100
+ <div class=${LitHtml.Directives.classMap(classMap)}>
91
101
  <button class="jump-to-highlight-button" title=${
92
102
  i18nString(UIStrings.jumpToAddress)}
93
103
  @click=${():void => this.#onJumpToHighlightClick(highlightInfo.startAddress)}>
@@ -203,6 +203,7 @@ export class LinearMemoryInspector extends HTMLElement {
203
203
  const canGoForwardInHistory = this.#history.canRollover();
204
204
 
205
205
  const highlightedMemoryAreas = this.#highlightInfo ? [this.#highlightInfo] : [];
206
+ const focusedMemoryHighlight = this.#getSmallestEnclosingMemoryHighlight(highlightedMemoryAreas, this.#address);
206
207
  // Disabled until https://crbug.com/1079231 is fixed.
207
208
  // clang-format off
208
209
  render(html`
@@ -214,9 +215,8 @@ export class LinearMemoryInspector extends HTMLElement {
214
215
  @pagenavigation=${this.#navigatePage}
215
216
  @historynavigation=${this.#navigateHistory}></${LinearMemoryNavigator.litTagName}>
216
217
  <${LinearMemoryHighlightChipList.litTagName}
217
- .data=${{highlightInfos: highlightedMemoryAreas} as LinearMemoryHighlightChipListData}
218
- @jumptohighlightedmemory=${this.#onJumpToAddress}
219
- @>
218
+ .data=${{highlightInfos: highlightedMemoryAreas, focusedMemoryHighlight: focusedMemoryHighlight } as LinearMemoryHighlightChipListData}
219
+ @jumptohighlightedmemory=${this.#onJumpToAddress}>
220
220
  </${LinearMemoryHighlightChipList.litTagName}>
221
221
  <${LinearMemoryViewer.litTagName}
222
222
  .data=${{
@@ -224,7 +224,8 @@ export class LinearMemoryInspector extends HTMLElement {
224
224
  end - this.#memoryOffset),
225
225
  address: this.#address, memoryOffset: start,
226
226
  focus: this.#currentNavigatorMode === Mode.Submitted,
227
- highlightInfo: this.#highlightInfo } as LinearMemoryViewerData}
227
+ highlightInfo: this.#highlightInfo,
228
+ focusedMemoryHighlight: focusedMemoryHighlight } as LinearMemoryViewerData}
228
229
  @byteselected=${this.#onByteSelected}
229
230
  @resize=${this.#resize}>
230
231
  </${LinearMemoryViewer.litTagName}>
@@ -375,6 +376,29 @@ export class LinearMemoryInspector extends HTMLElement {
375
376
  this.#address = address;
376
377
  this.dispatchEvent(new AddressChangedEvent(this.#address));
377
378
  }
379
+
380
+ // Returns the highlightInfo with the smallest size property that encloses the provided address.
381
+ // If there are multiple smallest enclosing highlights, we pick the one appearing the earliest in highlightedMemoryAreas.
382
+ // If no such highlightInfo exists, it returns undefined.
383
+ //
384
+ // Selecting the smallest enclosing memory highlight is a heuristic that aims to pick the
385
+ // most specific highlight given a provided address. This way, objects contained in other objects are
386
+ // potentially still accessible.
387
+ #getSmallestEnclosingMemoryHighlight(highlightedMemoryAreas: HighlightInfo[], address: number): HighlightInfo
388
+ |undefined {
389
+ let smallestEnclosingHighlight;
390
+ for (const highlightedMemory of highlightedMemoryAreas) {
391
+ if (highlightedMemory.startAddress <= address &&
392
+ address < highlightedMemory.startAddress + highlightedMemory.size) {
393
+ if (!smallestEnclosingHighlight) {
394
+ smallestEnclosingHighlight = highlightedMemory;
395
+ } else if (highlightedMemory.size < smallestEnclosingHighlight.size) {
396
+ smallestEnclosingHighlight = highlightedMemory;
397
+ }
398
+ }
399
+ }
400
+ return smallestEnclosingHighlight;
401
+ }
378
402
  }
379
403
 
380
404
  ComponentHelpers.CustomElements.defineComponent('devtools-linear-memory-inspector-inspector', LinearMemoryInspector);
@@ -16,6 +16,7 @@ export interface LinearMemoryViewerData {
16
16
  memoryOffset: number;
17
17
  focus: boolean;
18
18
  highlightInfo?: HighlightInfo;
19
+ focusedMemoryHighlight?: HighlightInfo;
19
20
  }
20
21
 
21
22
  export class ByteSelectedEvent extends Event {
@@ -53,6 +54,7 @@ export class LinearMemoryViewer extends HTMLElement {
53
54
  #address = 0;
54
55
  #memoryOffset = 0;
55
56
  #highlightInfo?: HighlightInfo;
57
+ #focusedMemoryHighlight?: HighlightInfo;
56
58
 
57
59
  #numRows = 1;
58
60
  #numBytesInRow = BYTE_GROUP_SIZE;
@@ -73,6 +75,7 @@ export class LinearMemoryViewer extends HTMLElement {
73
75
  this.#memory = data.memory;
74
76
  this.#address = data.address;
75
77
  this.#highlightInfo = data.highlightInfo;
78
+ this.#focusedMemoryHighlight = data.focusedMemoryHighlight;
76
79
  this.#memoryOffset = data.memoryOffset;
77
80
  this.#focusOnByte = data.focus;
78
81
  this.#update();
@@ -239,12 +242,14 @@ export class LinearMemoryViewer extends HTMLElement {
239
242
  const addMargin = i !== startIndex && (i - startIndex) % BYTE_GROUP_SIZE === 0;
240
243
  const selected = i === this.#address - this.#memoryOffset;
241
244
  const shouldBeHighlighted = this.#shouldBeHighlighted(actualIndex);
245
+ const focusedMemoryArea = this.#isFocusedArea(actualIndex);
242
246
  const classMap = {
243
247
  'cell': true,
244
248
  'byte-cell': true,
245
249
  'byte-group-margin': addMargin,
246
250
  selected,
247
251
  'highlight-area': shouldBeHighlighted,
252
+ 'focused-area': focusedMemoryArea,
248
253
  };
249
254
  const isSelectableCell = i < this.#memory.length;
250
255
  const byteValue = isSelectableCell ? html`${toHexString({number: this.#memory[i], pad: 2, prefix: false})}` : '';
@@ -259,11 +264,13 @@ export class LinearMemoryViewer extends HTMLElement {
259
264
  for (let i = startIndex; i < endIndex; ++i) {
260
265
  const actualIndex = i + this.#memoryOffset;
261
266
  const shouldBeHighlighted = this.#shouldBeHighlighted(actualIndex);
267
+ const focusedMemoryArea = this.#isFocusedArea(actualIndex);
262
268
  const classMap = {
263
269
  'cell': true,
264
270
  'text-cell': true,
265
271
  selected: this.#address - this.#memoryOffset === i,
266
272
  'highlight-area': shouldBeHighlighted,
273
+ 'focused-area': focusedMemoryArea,
267
274
  };
268
275
  const isSelectableCell = i < this.#memory.length;
269
276
  const value = isSelectableCell ? html`${this.#toAscii(this.#memory[i])}` : '';
@@ -291,6 +298,14 @@ export class LinearMemoryViewer extends HTMLElement {
291
298
  return this.#highlightInfo.startAddress <= index
292
299
  && index < this.#highlightInfo.startAddress + this.#highlightInfo.size;
293
300
  }
301
+
302
+ #isFocusedArea(index: number): boolean {
303
+ if (!this.#focusedMemoryHighlight) {
304
+ return false;
305
+ }
306
+ return this.#focusedMemoryHighlight.startAddress <= index
307
+ && index < this.#focusedMemoryHighlight.startAddress + this.#focusedMemoryHighlight.size;
308
+ }
294
309
  }
295
310
 
296
311
  ComponentHelpers.CustomElements.defineComponent('devtools-linear-memory-inspector-viewer', LinearMemoryViewer);
@@ -59,18 +59,6 @@
59
59
  border-radius: 50%;
60
60
  }
61
61
 
62
- .highlight-chip:hover > .delete-highlight-container {
63
- display: flex;
64
- /* To avoid issues with stacking semi-transparent colors, we use a hardcoded solid color here. */
65
- background: linear-gradient(90deg, transparent 0%, rgb(241 243 244) 25%); /* stylelint-disable-line plugin/use_theme_colors */
66
- }
67
-
68
- :host-context(.-theme-with-dark-background) .highlight-chip:hover > .delete-highlight-container {
69
- display: flex;
70
- /* To avoid issues with stacking semi-transparent colors, we use a hardcoded solid color here. */
71
- background: linear-gradient(90deg, transparent 0%, rgb(41 42 45) 25%); /* stylelint-disable-line plugin/use_theme_colors */
72
- }
73
-
74
62
  .jump-to-highlight-button {
75
63
  cursor: pointer;
76
64
  padding: 0;
@@ -108,3 +96,30 @@
108
96
  white-space: pre;
109
97
  flex-shrink: 0;
110
98
  }
99
+
100
+ .highlight-chip.focused {
101
+ border-color: var(--color-primary);
102
+ background-color: var(--color-button-secondary-background-hovering);
103
+ }
104
+
105
+ .highlight-chip:hover > .delete-highlight-container {
106
+ display: flex;
107
+ /* To avoid issues with stacking semi-transparent colors, we use a hardcoded solid color here. */
108
+ background: linear-gradient(90deg, transparent 0%, rgb(241 243 244) 25%); /* stylelint-disable-line plugin/use_theme_colors */
109
+ }
110
+
111
+ .highlight-chip.focused:hover > .delete-highlight-container {
112
+ /* To avoid issues with stacking semi-transparent colors, we use a hardcoded solid color here. */
113
+ background: linear-gradient(90deg, transparent 0%, rgb(231 241 253) 25%); /* stylelint-disable-line plugin/use_theme_colors */
114
+ }
115
+
116
+ :host-context(.-theme-with-dark-background) .highlight-chip:hover > .delete-highlight-container {
117
+ display: flex;
118
+ /* To avoid issues with stacking semi-transparent colors, we use a hardcoded solid color here. */
119
+ background: linear-gradient(90deg, transparent 0%, rgb(41 42 45) 25%); /* stylelint-disable-line plugin/use_theme_colors */
120
+ }
121
+
122
+ :host-context(.-theme-with-dark-background) .highlight-chip.focused:hover > .delete-highlight-container {
123
+ /* To avoid issues with stacking semi-transparent colors, we use a hardcoded solid color here. */
124
+ background: linear-gradient(90deg, transparent 0%, rgb(48 55 68) 25%); /* stylelint-disable-line plugin/use_theme_colors */
125
+ }
@@ -36,10 +36,6 @@
36
36
  background-color: var(--legacy-item-selection-bg-color);
37
37
  }
38
38
 
39
- .highlight-area {
40
- background-color: var(--legacy-item-selection-bg-color);
41
- }
42
-
43
39
  .byte-cell {
44
40
  min-width: 21px;
45
41
  color: var(--color-text-primary);
@@ -69,3 +65,22 @@
69
65
  background-color: var(--color-details-hairline);
70
66
  margin: 0 4px;
71
67
  }
68
+
69
+ .highlight-area {
70
+ background-color: var(--color-background-elevation-2);
71
+ }
72
+
73
+ .cell.focused-area {
74
+ background-color: var(--color-primary-variant);
75
+ color: var(--color-button-primary-text);
76
+ }
77
+
78
+ .cell.focused-area.selected {
79
+ background: rgb(1 74 195); /* stylelint-disable-line plugin/use_theme_colors */
80
+ border-color: var(--color-button-outline-focus);
81
+ }
82
+
83
+ :host-context(.-theme-with-dark-background) .cell.focused-area.selected {
84
+ background: rgb(192 216 255); /* stylelint-disable-line plugin/use_theme_colors */
85
+ border-color: var(--color-button-outline-focus);
86
+ }
package/package.json CHANGED
@@ -56,5 +56,5 @@
56
56
  "unittest": "scripts/test/run_unittests.py --no-text-coverage",
57
57
  "watch": "vpython third_party/node/node.py --output scripts/watch_build.js"
58
58
  },
59
- "version": "1.0.1038685"
59
+ "version": "1.0.1039140"
60
60
  }