Skip to content

Commit e12ae49

Browse files
bmeurerDevtools-frontend LUCI CQ
authored and
Devtools-frontend LUCI CQ
committed
[unified-css] Migrate files in front_end/panels/linear_memory_inspector.
Bug: 391381439 Change-Id: Ibfb8e41ce7477b9d22546e2989bdd5e42ad892c8 Fixed: 404267862, 404268323, 404266916, 404268068 Fixed: 404267933, 404267790, 404267969 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6450701 Auto-Submit: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Alex Rudenko <alexrudenko@chromium.org> Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
1 parent e697df4 commit e12ae49

7 files changed

+20
-74
lines changed

front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,9 @@ import * as i18n from '../../../core/i18n/i18n.js';
99
import * as Lit from '../../../ui/lit/lit.js';
1010
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
1111

12-
import linearMemoryHighlightChipListStylesRaw from './linearMemoryHighlightChipList.css.js';
12+
import linearMemoryHighlightChipListStyles from './linearMemoryHighlightChipList.css.js';
1313
import type {HighlightInfo} from './LinearMemoryViewerUtils.js';
1414

15-
// TODO(crbug.com/391381439): Fully migrate off of constructed style sheets.
16-
const linearMemoryHighlightChipListStyles = new CSSStyleSheet();
17-
linearMemoryHighlightChipListStyles.replaceSync(linearMemoryHighlightChipListStylesRaw.cssText);
18-
1915
const UIStrings = {
2016
/**
2117
*@description Tooltip text that appears when hovering over an inspected variable's button in the Linear Memory Highlight Chip List.
@@ -64,10 +60,6 @@ export class LinearMemoryHighlightChipList extends HTMLElement {
6460
#highlightedAreas: HighlightInfo[] = [];
6561
#focusedMemoryHighlight?: HighlightInfo;
6662

67-
connectedCallback(): void {
68-
this.#shadow.adoptedStyleSheets = [linearMemoryHighlightChipListStyles];
69-
}
70-
7163
set data(data: LinearMemoryHighlightChipListData) {
7264
this.#highlightedAreas = data.highlightInfos;
7365
this.#focusedMemoryHighlight = data.focusedMemoryHighlight;
@@ -82,6 +74,7 @@ export class LinearMemoryHighlightChipList extends HTMLElement {
8274
chips.push(this.#createChip(highlightInfo));
8375
}
8476
const result = html`
77+
<style>${linearMemoryHighlightChipListStyles.cssText}</style>
8578
<div class="highlight-chip-list">
8679
${chips}
8780
</div>

front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import * as i18n from '../../../core/i18n/i18n.js';
1212
import {html, nothing, render} from '../../../ui/lit/lit.js';
1313

1414
import type {DeleteMemoryHighlightEvent, JumpToHighlightedMemoryEvent} from './LinearMemoryHighlightChipList.js';
15-
import linearMemoryInspectorStylesRaw from './linearMemoryInspector.css.js';
15+
import linearMemoryInspectorStyles from './linearMemoryInspector.css.js';
1616
import {formatAddress, parseAddress} from './LinearMemoryInspectorUtils.js';
1717
import {
1818
type AddressInputChangedEvent,
@@ -33,10 +33,6 @@ import {
3333
type ValueTypeMode,
3434
} from './ValueInterpreterDisplayUtils.js';
3535

36-
// TODO(crbug.com/391381439): Fully migrate off of constructed style sheets.
37-
const linearMemoryInspectorStyles = new CSSStyleSheet();
38-
linearMemoryInspectorStyles.replaceSync(linearMemoryInspectorStylesRaw.cssText);
39-
4036
const UIStrings = {
4137
/**
4238
*@description Tooltip text that appears when hovering over an invalid address in the address line in the Linear memory inspector
@@ -143,10 +139,6 @@ export class LinearMemoryInspector extends HTMLElement {
143139

144140
#hideValueInspector = false;
145141

146-
connectedCallback(): void {
147-
this.#shadow.adoptedStyleSheets = [linearMemoryInspectorStyles];
148-
}
149-
150142
set data(data: LinearMemoryInspectorData) {
151143
if (data.address < data.memoryOffset || data.address > data.memoryOffset + data.memory.length || data.address < 0) {
152144
throw new Error('Address is out of bounds.');
@@ -198,6 +190,7 @@ export class LinearMemoryInspector extends HTMLElement {
198190
// Disabled until https://crbug.com/1079231 is fixed.
199191
// clang-format off
200192
render(html`
193+
<style>${linearMemoryInspectorStyles.cssText}</style>
201194
<div class="view">
202195
<devtools-linear-memory-inspector-navigator
203196
.data=${{address: navigatorAddressToShow, valid: navigatorAddressIsValid, mode: this.#currentNavigatorMode, error: errorMsg, canGoBackInHistory, canGoForwardInHistory}}

front_end/panels/linear_memory_inspector/components/LinearMemoryNavigator.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ import * as Buttons from '../../../ui/components/buttons/buttons.js';
1010
import * as Lit from '../../../ui/lit/lit.js';
1111
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
1212

13-
import linearMemoryNavigatorStylesRaw from './linearMemoryNavigator.css.js';
14-
15-
// TODO(crbug.com/391381439): Fully migrate off of constructed style sheets.
16-
const linearMemoryNavigatorStyles = new CSSStyleSheet();
17-
linearMemoryNavigatorStyles.replaceSync(linearMemoryNavigatorStylesRaw.cssText);
13+
import linearMemoryNavigatorStyles from './linearMemoryNavigator.css.js';
1814

1915
const UIStrings = {
2016
/**
@@ -113,10 +109,6 @@ export class LinearMemoryNavigator extends HTMLElement {
113109
#canGoBackInHistory = false;
114110
#canGoForwardInHistory = false;
115111

116-
connectedCallback(): void {
117-
this.#shadow.adoptedStyleSheets = [linearMemoryNavigatorStyles];
118-
}
119-
120112
set data(data: LinearMemoryNavigatorData) {
121113
this.#address = data.address;
122114
this.#error = data.error;
@@ -139,6 +131,7 @@ export class LinearMemoryNavigator extends HTMLElement {
139131
// Disabled until https://crbug.com/1079231 is fixed.
140132
// clang-format off
141133
const result = html`
134+
<style>${linearMemoryNavigatorStyles.cssText}</style>
142135
<div class="navigator">
143136
<div class="navigator-item">
144137
${this.#createButton({icon: 'undo', title: i18nString(UIStrings.goBackInAddressHistory),

front_end/panels/linear_memory_inspector/components/LinearMemoryValueInterpreter.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,14 @@ import * as i18n from '../../../core/i18n/i18n.js';
1111
import * as Platform from '../../../core/platform/platform.js';
1212
import * as Buttons from '../../../ui/components/buttons/buttons.js';
1313
// eslint-disable-next-line rulesdir/es-modules-import
14-
import inspectorCommonStylesRaw from '../../../ui/legacy/inspectorCommon.css.js';
14+
import inspectorCommonStyles from '../../../ui/legacy/inspectorCommon.css.js';
1515
import * as Lit from '../../../ui/lit/lit.js';
1616
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
1717

18-
import linearMemoryValueInterpreterStylesRaw from './linearMemoryValueInterpreter.css.js';
18+
import linearMemoryValueInterpreterStyles from './linearMemoryValueInterpreter.css.js';
1919
import {Endianness, type ValueType, type ValueTypeMode} from './ValueInterpreterDisplayUtils.js';
2020
import type {TypeToggleEvent} from './ValueInterpreterSettings.js';
2121

22-
// TODO(crbug.com/391381439): Fully migrate off of constructed style sheets.
23-
const inspectorCommonStyles = new CSSStyleSheet();
24-
inspectorCommonStyles.replaceSync(inspectorCommonStylesRaw.cssText);
25-
26-
// TODO(crbug.com/391381439): Fully migrate off of constructed style sheets.
27-
const linearMemoryValueInterpreterStyles = new CSSStyleSheet();
28-
linearMemoryValueInterpreterStyles.replaceSync(linearMemoryValueInterpreterStylesRaw.cssText);
29-
3022
const UIStrings = {
3123
/**
3224
*@description Tooltip text that appears when hovering over the gear button to open and close settings in the Linear memory inspector. These settings
@@ -81,10 +73,6 @@ export class LinearMemoryValueInterpreter extends HTMLElement {
8173
#memoryLength = 0;
8274
#showSettings = false;
8375

84-
connectedCallback(): void {
85-
this.#shadow.adoptedStyleSheets = [inspectorCommonStyles, linearMemoryValueInterpreterStyles];
86-
}
87-
8876
set data(data: LinearMemoryValueInterpreterData) {
8977
this.#endianness = data.endianness;
9078
this.#buffer = data.value;
@@ -98,6 +86,8 @@ export class LinearMemoryValueInterpreter extends HTMLElement {
9886
// Disabled until https://crbug.com/1079231 is fixed.
9987
// clang-format off
10088
render(html`
89+
<style>${inspectorCommonStyles.cssText}</style>
90+
<style>${linearMemoryValueInterpreterStyles.cssText}</style>
10191
<div class="value-interpreter">
10292
<div class="settings-toolbar">
10393
${this.#renderEndiannessSetting()}

front_end/panels/linear_memory_inspector/components/LinearMemoryViewer.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@ import * as Lit from '../../../ui/lit/lit.js';
77
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
88

99
import {toHexString} from './LinearMemoryInspectorUtils.js';
10-
import linearMemoryViewerStylesRaw from './linearMemoryViewer.css.js';
10+
import linearMemoryViewerStyles from './linearMemoryViewer.css.js';
1111
import type {HighlightInfo} from './LinearMemoryViewerUtils.js';
1212

13-
// TODO(crbug.com/391381439): Fully migrate off of constructed style sheets.
14-
const linearMemoryViewerStyles = new CSSStyleSheet();
15-
linearMemoryViewerStyles.replaceSync(linearMemoryViewerStylesRaw.cssText);
16-
1713
const {render, html} = Lit;
1814

1915
export interface LinearMemoryViewerData {
@@ -87,7 +83,6 @@ export class LinearMemoryViewer extends HTMLElement {
8783

8884
connectedCallback(): void {
8985
this.style.setProperty('--byte-group-margin', `${BYTE_GROUP_MARGIN}px`);
90-
this.#shadow.adoptedStyleSheets = [linearMemoryViewerStyles];
9186
}
9287

9388
disconnectedCallback(): void {
@@ -186,6 +181,7 @@ export class LinearMemoryViewer extends HTMLElement {
186181
// Disabled until https://crbug.com/1079231 is fixed.
187182
// clang-format off
188183
render(html`
184+
<style>${linearMemoryViewerStyles.cssText}</style>
189185
<div class="view" tabindex="0" @keydown=${this.#onKeyDown} jslog=${jslog}>
190186
${this.#renderView()}
191187
</div>

front_end/panels/linear_memory_inspector/components/ValueInterpreterDisplay.ts

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import '../../../ui/components/icon_button/icon_button.js';
77

88
import * as i18n from '../../../core/i18n/i18n.js';
99
// eslint-disable-next-line rulesdir/es-modules-import
10-
import inspectorCommonStylesRaw from '../../../ui/legacy/inspectorCommon.css.js';
10+
import inspectorCommonStyles from '../../../ui/legacy/inspectorCommon.css.js';
1111
import * as Lit from '../../../ui/lit/lit.js';
1212
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
1313

14-
import valueInterpreterDisplayStylesRaw from './valueInterpreterDisplay.css.js';
14+
import valueInterpreterDisplayStyles from './valueInterpreterDisplay.css.js';
1515
import {
1616
Endianness,
1717
format,
@@ -25,14 +25,6 @@ import {
2525
ValueTypeMode,
2626
} from './ValueInterpreterDisplayUtils.js';
2727

28-
// TODO(crbug.com/391381439): Fully migrate off of constructed style sheets.
29-
const inspectorCommonStyles = new CSSStyleSheet();
30-
inspectorCommonStyles.replaceSync(inspectorCommonStylesRaw.cssText);
31-
32-
// TODO(crbug.com/391381439): Fully migrate off of constructed style sheets.
33-
const valueInterpreterDisplayStyles = new CSSStyleSheet();
34-
valueInterpreterDisplayStyles.replaceSync(valueInterpreterDisplayStylesRaw.cssText);
35-
3628
const UIStrings = {
3729
/**
3830
*@description Tooltip text that appears when hovering over an unsigned interpretation of the memory under the Value Interpreter
@@ -107,13 +99,6 @@ export class ValueInterpreterDisplay extends HTMLElement {
10799

108100
constructor() {
109101
super();
110-
this.#shadow.adoptedStyleSheets = [
111-
inspectorCommonStyles,
112-
];
113-
}
114-
115-
connectedCallback(): void {
116-
this.#shadow.adoptedStyleSheets = [inspectorCommonStyles, valueInterpreterDisplayStyles];
117102
}
118103

119104
set data(data: ValueDisplayData) {
@@ -137,6 +122,8 @@ export class ValueInterpreterDisplay extends HTMLElement {
137122
// Disabled until https://crbug.com/1079231 is fixed.
138123
// clang-format off
139124
render(html`
125+
<style>${inspectorCommonStyles.cssText}</style>
126+
<style>${valueInterpreterDisplayStyles.cssText}</style>
140127
<div class="value-types">
141128
${SORTED_VALUE_TYPES.map(type => this.#valueTypes.has(type) ? this.#showValue(type) : '')}
142129
</div>

front_end/panels/linear_memory_inspector/components/ValueInterpreterSettings.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) 2020 The Chromium Authors. All rights reserved.
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
4-
/* eslint-disable rulesdir/no-lit-render-outside-of-view */
4+
/* eslint-disable rulesdir/no-lit-render-outside-of-view, rulesdir/inject-checkbox-styles */
55

66
import * as i18n from '../../../core/i18n/i18n.js';
77
import * as Platform from '../../../core/platform/platform.js';
@@ -10,11 +10,7 @@ import * as Lit from '../../../ui/lit/lit.js';
1010
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
1111

1212
import {ValueType, valueTypeToLocalizedString} from './ValueInterpreterDisplayUtils.js';
13-
import valueInterpreterSettingsStylesRaw from './valueInterpreterSettings.css.js';
14-
15-
// TODO(crbug.com/391381439): Fully migrate off of constructed style sheets.
16-
const valueInterpreterSettingsStyles = new CSSStyleSheet();
17-
valueInterpreterSettingsStyles.replaceSync(valueInterpreterSettingsStylesRaw.cssText);
13+
import valueInterpreterSettingsStyles from './valueInterpreterSettings.css.js';
1814

1915
const {render, html} = Lit;
2016

@@ -70,10 +66,6 @@ export class ValueInterpreterSettings extends HTMLElement {
7066
readonly #shadow = this.attachShadow({mode: 'open'});
7167
#valueTypes = new Set<ValueType>();
7268

73-
connectedCallback(): void {
74-
this.#shadow.adoptedStyleSheets = [Input.checkboxStyles, valueInterpreterSettingsStyles];
75-
}
76-
7769
set data(data: ValueInterpreterSettingsData) {
7870
this.#valueTypes = data.valueTypes;
7971
this.#render();
@@ -83,6 +75,8 @@ export class ValueInterpreterSettings extends HTMLElement {
8375
// Disabled until https://crbug.com/1079231 is fixed.
8476
// clang-format off
8577
render(html`
78+
<style>${Input.checkboxStylesRaw.cssText}</style>
79+
<style>${valueInterpreterSettingsStyles.cssText}</style>
8680
<div class="settings" jslog=${VisualLogging.pane('settings')}>
8781
${[...GROUP_TO_TYPES.keys()].map(group => {
8882
return html`

0 commit comments

Comments
 (0)