Skip to content

Commit 6e78bbc

Browse files
committed
squash 'resources/unpacked/devtools' changes from 87b161b..e71b776
e71b776 DevTools: fix 'Make a copy' context menu item in navigator 99bb354 DevTools: get rid of hand-crafted binary search in SourceMap.findEntry c3b7bfe [Devtools] Restructure network nodes for friendlier products/grouping aeac81e [DevTools] Enable "auto attach to sub frames" by default 1bbdb1c DevTools: add command menu entries for adding new snippet, workspace folder f950ef8 DevTools: support uiLocationToRawLocations for CSS cab282d DevTools: Roll lighthouse w/ artifact delivery ab11d5c [Devtools] Fix network grouping experiment 624ea04 DevTools: Migrate from -webkit-user-modify to contenteditable dff718f Revert of DevTools: support resolving a UILocation to multiple raw script locations (patchset #3 id:60001 of https://codereview.chromium.org/2857453002/ ) 59c0d0a DevTools: Fix "Unwanted blue dot is seen in 'Performance' section of devtools" 85245cf DevTools: Make domains promisified by default 7cefcda DevTools: Remove script/OWNERS git-subtree-dir: resources/unpacked/devtools git-subtree-split: e71b776
1 parent 2b4a04b commit 6e78bbc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+58300
-57922
lines changed

BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ all_devtools_files = [
318318
"front_end/network/networkLogView.css",
319319
"front_end/network/NetworkLogView.js",
320320
"front_end/network/NetworkLogViewColumns.js",
321-
"front_end/network/NetworkGroupers.js",
321+
"front_end/network/NetworkFrameGrouper.js",
322322
"front_end/network/networkManageCustomHeadersView.css",
323323
"front_end/network/NetworkManageCustomHeadersView.js",
324324
"front_end/network/NetworkOverview.js",

front_end/audits2/Audits2Panel.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ Audits2.Audits2Panel.TreeElement = class extends UI.TreeElement {
500500
return;
501501
}
502502

503-
this._reportContainer = this._resultsView.createChild('div', 'report-container lh-root');
503+
this._reportContainer = this._resultsView.createChild('div', 'report-container lh-vars lh-root');
504504

505505
var dom = new DOM(/** @type {!Document} */ (this._resultsView.ownerDocument));
506506
var detailsRenderer = new DetailsRenderer(dom);
@@ -528,7 +528,7 @@ Audits2.Audits2Panel.TreeSubElement = class extends UI.TreeElement {
528528
this._id = id;
529529
this.listItemElement.textContent = name;
530530
var label = Util.calculateRating(score);
531-
var subtitleElement = this.listItemElement.createChild('span', 'lh-root audits2-tree-subtitle-' + label);
531+
var subtitleElement = this.listItemElement.createChild('span', 'lh-vars audits2-tree-subtitle-' + label);
532532
subtitleElement.textContent = String(Math.round(score));
533533
}
534534

front_end/audits2/audits2Tree.css

+1-3
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
flex: auto;
2121
text-align: end;
2222
margin-right: 10px;
23-
font-size: inherit;
24-
background: inherit;
2523
}
2624

2725
.audits2-tree-subtitle-pass {
@@ -34,4 +32,4 @@
3432

3533
.audits2-tree-subtitle-fail {
3634
color: var(--fail-color);
37-
}
35+
}

front_end/audits2/lighthouse/renderer/category-renderer.js

+108-2
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,15 @@ class CategoryRenderer {
5656

5757
// Append audit details to header section so the entire audit is within a <details>.
5858
const header = /** @type {!HTMLDetailsElement} */ (this._dom.find('.lh-score__header', tmpl));
59-
header.open = audit.score < 100; // expand failed audits
6059
if (audit.result.details) {
6160
header.appendChild(this._detailsRenderer.render(audit.result.details));
6261
}
6362

63+
const scoreEl = this._dom.find('.lh-score', tmpl);
64+
if (audit.result.informative) {
65+
scoreEl.classList.add('lh-score--informative');
66+
}
67+
6468
return this._populateScore(tmpl, audit.score, scoringMode, title, description);
6569
}
6670

@@ -93,6 +97,11 @@ class CategoryRenderer {
9397
_renderCategoryScore(category) {
9498
const tmpl = this._dom.cloneTemplate('#tmpl-lh-category-score', this._templateContext);
9599
const score = Math.round(category.score);
100+
101+
const gaugeContainerEl = this._dom.find('.lh-score__gauge', tmpl);
102+
const gaugeEl = this.renderScoreGauge(category);
103+
gaugeContainerEl.appendChild(gaugeEl);
104+
96105
return this._populateScore(tmpl, score, 'numeric', category.name, category.description);
97106
}
98107

@@ -142,11 +151,25 @@ class CategoryRenderer {
142151
return tmpl;
143152
}
144153

154+
/**
155+
* @param {!ReportRenderer.CategoryJSON} category
156+
* @param {!Object<string, !ReportRenderer.GroupJSON>} groups
157+
* @return {!Element}
158+
*/
159+
render(category, groups) {
160+
switch (category.id) {
161+
case 'accessibility':
162+
return this._renderAccessibilityCategory(category, groups);
163+
default:
164+
return this._renderDefaultCategory(category);
165+
}
166+
}
167+
145168
/**
146169
* @param {!ReportRenderer.CategoryJSON} category
147170
* @return {!Element}
148171
*/
149-
render(category) {
172+
_renderDefaultCategory(category) {
150173
const element = this._dom.createElement('div', 'lh-category');
151174
element.id = category.id;
152175
element.appendChild(this._renderCategoryScore(category));
@@ -174,6 +197,89 @@ class CategoryRenderer {
174197
element.appendChild(passedElem);
175198
return element;
176199
}
200+
201+
/**
202+
* @param {!Array<!ReportRenderer.AuditJSON>} audits
203+
* @param {!ReportRenderer.GroupJSON} group
204+
* @return {!Element}
205+
*/
206+
_renderAuditGroup(audits, group) {
207+
const auditGroupElem = this._dom.createElement('details',
208+
'lh-audit-group lh-expandable-details');
209+
const auditGroupHeader = this._dom.createElement('div',
210+
'lh-audit-group__header lh-expandable-details__header');
211+
auditGroupHeader.textContent = group.title;
212+
213+
const auditGroupDescription = this._dom.createElement('div', 'lh-audit-group__description');
214+
auditGroupDescription.textContent = group.description;
215+
216+
const auditGroupSummary = this._dom.createElement('summary',
217+
'lh-audit-group__summary lh-expandable-details__summary');
218+
const auditGroupArrow = this._dom.createElement('div', 'lh-toggle-arrow', {
219+
title: 'See audits',
220+
});
221+
auditGroupSummary.appendChild(auditGroupHeader);
222+
auditGroupSummary.appendChild(auditGroupArrow);
223+
224+
auditGroupElem.appendChild(auditGroupSummary);
225+
auditGroupElem.appendChild(auditGroupDescription);
226+
audits.forEach(audit => auditGroupElem.appendChild(this._renderAudit(audit)));
227+
return auditGroupElem;
228+
}
229+
230+
/**
231+
* @param {!ReportRenderer.CategoryJSON} category
232+
* @param {!Object<string, !ReportRenderer.GroupJSON>} groupDefinitions
233+
* @return {!Element}
234+
*/
235+
_renderAccessibilityCategory(category, groupDefinitions) {
236+
const element = this._dom.createElement('div', 'lh-category');
237+
element.id = category.id;
238+
element.appendChild(this._renderCategoryScore(category));
239+
240+
const auditsGroupedByGroup = /** @type {!Object<string,
241+
{passed: !Array<!ReportRenderer.AuditJSON>,
242+
failed: !Array<!ReportRenderer.AuditJSON>}>} */ ({});
243+
category.audits.forEach(audit => {
244+
const groupId = audit.group;
245+
const groups = auditsGroupedByGroup[groupId] || {passed: [], failed: []};
246+
247+
if (audit.score === 100) {
248+
groups.passed.push(audit);
249+
} else {
250+
groups.failed.push(audit);
251+
}
252+
253+
auditsGroupedByGroup[groupId] = groups;
254+
});
255+
256+
const passedElements = /** @type {!Array<!Element>} */ ([]);
257+
Object.keys(auditsGroupedByGroup).forEach(groupId => {
258+
const group = groupDefinitions[groupId];
259+
const groups = auditsGroupedByGroup[groupId];
260+
if (groups.failed.length) {
261+
const auditGroupElem = this._renderAuditGroup(groups.failed, group);
262+
auditGroupElem.open = true;
263+
element.appendChild(auditGroupElem);
264+
}
265+
266+
if (groups.passed.length) {
267+
const auditGroupElem = this._renderAuditGroup(groups.passed, group);
268+
passedElements.push(auditGroupElem);
269+
}
270+
});
271+
272+
// don't create a passed section if there are no passed
273+
if (!passedElements.length) return element;
274+
275+
const passedElem = this._dom.createElement('details', 'lh-passed-audits');
276+
const passedSummary = this._dom.createElement('summary', 'lh-passed-audits-summary');
277+
passedElem.appendChild(passedSummary);
278+
passedSummary.textContent = `View ${passedElements.length} passed items`;
279+
passedElements.forEach(elem => passedElem.appendChild(elem));
280+
element.appendChild(passedElem);
281+
return element;
282+
}
177283
}
178284

179285
if (typeof module !== 'undefined' && module.exports) {

front_end/audits2/lighthouse/renderer/report-renderer.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class ReportRenderer {
149149
const categories = reportSection.appendChild(this._dom.createElement('div', 'lh-categories'));
150150
for (const category of report.reportCategories) {
151151
scoreHeader.appendChild(this._categoryRenderer.renderScoreGauge(category));
152-
categories.appendChild(this._categoryRenderer.render(category));
152+
categories.appendChild(this._categoryRenderer.render(category, report.reportGroups));
153153
}
154154

155155
reportSection.appendChild(this._renderReportFooter(report));
@@ -169,8 +169,10 @@ if (typeof module !== 'undefined' && module.exports) {
169169
* id: string,
170170
* weight: number,
171171
* score: number,
172+
* group: string,
172173
* result: {
173174
* description: string,
175+
* informative: boolean,
174176
* debugString: string,
175177
* displayValue: string,
176178
* helpText: string,
@@ -195,13 +197,23 @@ ReportRenderer.AuditJSON; // eslint-disable-line no-unused-expressions
195197
*/
196198
ReportRenderer.CategoryJSON; // eslint-disable-line no-unused-expressions
197199

200+
/**
201+
* @typedef {{
202+
* title: string,
203+
* description: string,
204+
* }}
205+
*/
206+
ReportRenderer.GroupJSON; // eslint-disable-line no-unused-expressions
207+
198208
/**
199209
* @typedef {{
200210
* lighthouseVersion: string,
201211
* generatedTime: string,
202212
* initialUrl: string,
203213
* url: string,
214+
* artifacts: {traces: !Object},
204215
* reportCategories: !Array<!ReportRenderer.CategoryJSON>,
216+
* reportGroups: !Object<string, !ReportRenderer.GroupJSON>,
205217
* runtimeConfig: {
206218
* blockedUrlPatterns: !Array<string>,
207219
* environment: !Array<{description: string, enabled: boolean, name: string}>

0 commit comments

Comments
 (0)