Skip to content

Commit 008c047

Browse files
ktranDevtools-frontend LUCI CQ
authored andcommitted
[GM3Restyling] Update Headers key value pairs
Changes the key-value pair styles in the Headers tab of the Network panel. Before: https://i.imgur.com/mradPDQ.png After: https://i.imgur.com/KlwZuue.png Bug: 325443308 Change-Id: Ic613c567c366ab440445d7f4069dcc3111e73924 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6372906 Commit-Queue: Kim-Anh Tran <[email protected]> Reviewed-by: Kateryna Prokopenko <[email protected]>
1 parent fa15b1b commit 008c047

11 files changed

+159
-155
lines changed

front_end/panels/network/components/HeaderSectionRow.css

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010

1111
.row {
1212
display: flex;
13-
line-height: 20px;
13+
line-height: 18px;
1414
padding-left: 8px;
15-
gap: 12px;
15+
gap: var(--sys-size-6);
1616
user-select: text;
17+
margin: var(--sys-size-3) 0;
1718
}
1819

1920
.row.header-editable {
@@ -22,8 +23,8 @@
2223
}
2324

2425
.header-name {
25-
color: var(--sys-color-on-surface);
26-
font-weight: 400;
26+
font: var(--sys-typescale-body5-medium);
27+
color: var(--sys-color-on-surface-subtle);
2728
width: 30%;
2829
min-width: 160px;
2930
max-width: 240px;
@@ -56,6 +57,7 @@
5657
display: flex;
5758
overflow-wrap: anywhere;
5859
margin-inline-end: 14px;
60+
font: var(--sys-typescale-body4-regular);
5961
}
6062

6163
.header-badge-text {

front_end/panels/network/components/HeaderSectionRow.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ describeWithEnvironment('HeaderSectionRow', () => {
109109

110110
const headerName = component.shadowRoot.querySelector('.header-name');
111111
assert.instanceOf(headerName, HTMLDivElement);
112-
const regex = /^\s*not-set\s*cross-origin-resource-policy:\s*$/;
112+
const regex = /^\s*not-set\s*cross-origin-resource-policy\s*$/;
113113
assert.isTrue(regex.test(headerName.textContent || ''));
114114

115115
const headerValue = component.shadowRoot.querySelector('.header-value');
@@ -137,7 +137,7 @@ describeWithEnvironment('HeaderSectionRow', () => {
137137

138138
const headerName = component.shadowRoot.querySelector('.header-name');
139139
assert.instanceOf(headerName, HTMLDivElement);
140-
assert.strictEqual(headerName.textContent?.trim(), 'x-client-data:');
140+
assert.strictEqual(headerName.textContent?.trim(), 'x-client-data');
141141

142142
const headerValue = component.shadowRoot.querySelector('.header-value');
143143
assert.instanceOf(headerValue, HTMLDivElement);
@@ -165,7 +165,7 @@ describeWithEnvironment('HeaderSectionRow', () => {
165165

166166
const headerName = component.shadowRoot.querySelector('.header-name');
167167
assert.instanceOf(headerName, HTMLDivElement);
168-
assert.strictEqual(headerName.textContent?.trim(), 'set-cookie:');
168+
assert.strictEqual(headerName.textContent?.trim(), 'set-cookie');
169169

170170
const headerValue = component.shadowRoot.querySelector('.header-value');
171171
assert.instanceOf(headerValue, HTMLDivElement);

front_end/panels/network/components/HeaderSectionRow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export class HeaderSectionRow extends HTMLElement {
203203
@paste=${this.#onHeaderNamePaste}
204204
.data=${{value: this.#header.name}}
205205
></devtools-editable-span>` :
206-
this.#header.name}:
206+
this.#header.name}
207207
</div>
208208
<div
209209
class=${headerValueClasses}

front_end/panels/network/components/RequestHeaderSection.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ describeWithEnvironment('RequestHeaderSection', () => {
6969
];
7070
});
7171
assert.deepEqual(sorted, [
72-
['aa:', 'first'],
73-
['ab:', 'second'],
74-
['abc:', 'third'],
75-
['name:', 'fourth'],
76-
['test:', 'fifth'],
72+
['aa', 'first'],
73+
['ab', 'second'],
74+
['abc', 'third'],
75+
['name', 'fourth'],
76+
['test', 'fifth'],
7777
]);
7878
});
7979

front_end/panels/network/components/RequestHeadersView.css

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,28 @@ details summary input {
3939

4040
.row {
4141
display: flex;
42-
line-height: 20px;
42+
line-height: 18px;
4343
padding-left: 8px;
44-
gap: 12px;
44+
gap: var(--sys-size-6);
4545
user-select: text;
46+
margin: var(--sys-size-3) 0;
4647
}
4748

4849
div.raw-headers-row {
4950
display: block;
5051
}
5152

5253
.row:first-of-type {
53-
margin-top: 2px;
54+
margin-top: var(--sys-size-5);
5455
}
5556

5657
.row:last-child {
57-
margin-bottom: 10px;
58+
margin-bottom: var(--sys-size-5);
5859
}
5960

6061
.header-name {
61-
color: var(--sys-color-on-surface);
62-
font-weight: 400;
62+
color: var(--sys-color-on-surface-subtle);
63+
font: var(--sys-typescale-body5-medium);
6364
width: 30%;
6465
min-width: 160px;
6566
max-width: 240px;
@@ -72,6 +73,7 @@ div.raw-headers-row {
7273
display: flex;
7374
align-items: center;
7475
gap: 2px;
76+
font: var(--sys-typescale-body4-regular);
7577
}
7678

7779
.header-name,

front_end/panels/network/components/RequestHeadersView.test.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ describeWithMockConnection('RequestHeadersView', () => {
132132

133133
const names = getCleanTextContentFromElements(generalCategory, '.header-name');
134134
assert.deepEqual(names, [
135-
'Request URL:',
136-
'Request Method:',
137-
'Status Code:',
138-
'Remote Address:',
139-
'Referrer Policy:',
135+
'Request URL',
136+
'Request Method',
137+
'Status Code',
138+
'Remote Address',
139+
'Referrer Policy',
140140
]);
141141

142142
const values = getCleanTextContentFromElements(generalCategory, '.header-value');
@@ -170,13 +170,13 @@ describeWithMockConnection('RequestHeadersView', () => {
170170
assert.instanceOf(responseHeadersCategory, HTMLElement);
171171
assert.deepEqual(
172172
getRowsTextFromCategory(responseHeadersCategory),
173-
[['age:', '0'], ['cache-control:', 'max-age=600'], ['content-encoding:', 'gzip'], ['content-length:', '661']]);
173+
[['age', '0'], ['cache-control', 'max-age=600'], ['content-encoding', 'gzip'], ['content-length', '661']]);
174174

175175
const requestHeadersCategory = component.shadowRoot.querySelector('[aria-label="Request Headers"]');
176176
assert.instanceOf(requestHeadersCategory, HTMLElement);
177177
assert.deepEqual(
178178
getRowsTextFromCategory(requestHeadersCategory),
179-
[[':method:', 'GET'], ['accept-encoding:', 'gzip, deflate, br'], ['cache-control:', 'no-cache']]);
179+
[[':method', 'GET'], ['accept-encoding', 'gzip, deflate, br'], ['cache-control', 'no-cache']]);
180180
});
181181

182182
it('renders early hints headers', async () => {
@@ -185,7 +185,7 @@ describeWithMockConnection('RequestHeadersView', () => {
185185

186186
const earlyHintsCategory = component.shadowRoot.querySelector('[aria-label="Early Hints Headers"]');
187187
assert.instanceOf(earlyHintsCategory, HTMLElement);
188-
assert.deepEqual(getRowsTextFromCategory(earlyHintsCategory), [['link:', '<src="/script.js" as="script">']]);
188+
assert.deepEqual(getRowsTextFromCategory(earlyHintsCategory), [['link', '<src="/script.js" as="script">']]);
189189
});
190190

191191
it('emits UMA event when a header value is being copied', async () => {
@@ -228,7 +228,7 @@ describeWithMockConnection('RequestHeadersView', () => {
228228

229229
assert.deepEqual(
230230
getRowsTextFromCategory(responseHeadersCategory),
231-
[['age:', '0'], ['cache-control:', 'max-age=600'], ['content-encoding:', 'gzip'], ['content-length:', '661']]);
231+
[['age', '0'], ['cache-control', 'max-age=600'], ['content-encoding', 'gzip'], ['content-length', '661']]);
232232
});
233233

234234
it('cuts off long raw headers and shows full content on button click', async () => {
@@ -282,12 +282,12 @@ describeWithMockConnection('RequestHeadersView', () => {
282282

283283
const spy = sinon.spy(component, 'render');
284284
assert.isTrue(spy.notCalled);
285-
assert.deepEqual(getRowsTextFromCategory(responseHeadersCategory), [['originalname:', 'originalValue']]);
285+
assert.deepEqual(getRowsTextFromCategory(responseHeadersCategory), [['originalname', 'originalValue']]);
286286

287287
request.responseHeaders = [{name: 'updatedName', value: 'updatedValue'}];
288288
assert.isTrue(spy.calledOnce);
289289
await RenderCoordinator.done();
290-
assert.deepEqual(getRowsTextFromCategory(responseHeadersCategory), [['updatedname:', 'updatedValue']]);
290+
assert.deepEqual(getRowsTextFromCategory(responseHeadersCategory), [['updatedname', 'updatedValue']]);
291291
});
292292

293293
it('can highlight individual response headers', async () => {
@@ -307,7 +307,7 @@ describeWithMockConnection('RequestHeadersView', () => {
307307
assert.instanceOf(responseHeadersCategory, HTMLElement);
308308
assert.deepEqual(
309309
getRowsTextFromCategory(responseHeadersCategory),
310-
[['devtools:', 'rock'], ['foo:', 'bar'], ['highlightme:', 'some value']]);
310+
[['devtools', 'rock'], ['foo', 'bar'], ['highlightme', 'some value']]);
311311

312312
assert.deepEqual(getRowHighlightStatus(responseHeadersCategory), [false, false, false]);
313313
component.revealHeader(NetworkForward.UIRequestLocation.UIHeaderSection.RESPONSE, 'HiGhLiGhTmE');
@@ -332,7 +332,7 @@ describeWithMockConnection('RequestHeadersView', () => {
332332
assert.instanceOf(requestHeadersCategory, HTMLElement);
333333
assert.deepEqual(
334334
getRowsTextFromCategory(requestHeadersCategory),
335-
[['devtools:', 'rock'], ['foo:', 'bar'], ['highlightme:', 'some value']]);
335+
[['devtools', 'rock'], ['foo', 'bar'], ['highlightme', 'some value']]);
336336

337337
assert.deepEqual(getRowHighlightStatus(requestHeadersCategory), [false, false, false]);
338338
component.revealHeader(NetworkForward.UIRequestLocation.UIHeaderSection.REQUEST, 'HiGhLiGhTmE');
@@ -428,14 +428,14 @@ describeWithMockConnection('RequestHeadersView', () => {
428428
}
429429
};
430430

431-
checkRow(headerRow.shadowRoot, 'foo:', 'bar', false);
431+
checkRow(headerRow.shadowRoot, 'foo', 'bar', false);
432432

433433
const pencilButton = headerRow.shadowRoot.querySelector('.enable-editing');
434434
assert.instanceOf(pencilButton, HTMLElement);
435435
pencilButton.click();
436436
await RenderCoordinator.done();
437437

438-
checkRow(headerRow.shadowRoot, 'foo:', 'bar', true);
438+
checkRow(headerRow.shadowRoot, 'foo', 'bar', true);
439439
assert.isTrue(recordedMetricsContain(
440440
Host.InspectorFrontendHostAPI.EnumeratedHistogram.ActionTaken,
441441
Host.UserMetrics.Action.HeaderOverrideEnableEditingClicked));

front_end/panels/network/components/RequestHeadersView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ export class RequestHeadersView extends LegacyWrapper.LegacyWrapper.WrappableCom
505505
name.toLowerCase() === this.#toReveal?.header?.toLowerCase();
506506
return html`
507507
<div class="row ${isHighlighted ? 'header-highlight' : ''}">
508-
<div class="header-name">${name}:</div>
508+
<div class="header-name">${name}</div>
509509
<div
510510
class="header-value ${classNames?.join(' ')}"
511511
@copy=${() => Host.userMetrics.actionTaken(Host.UserMetrics.Action.NetworkPanelCopyValue)}

front_end/panels/network/components/ResponseHeaderSection.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
}
1010

1111
devtools-header-section-row:last-of-type {
12-
margin-bottom: 10px;
12+
margin-bottom: var(--sys-size-5);
1313
}
1414

1515
devtools-header-section-row:first-of-type {
16-
margin-top: 2px;
16+
margin-top: var(--sys-size-5);
1717
}
1818

1919
.add-header-button {

0 commit comments

Comments
 (0)