Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1339)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/audits/AuditResultView.js

Issue 2157713002: DevTools: introduce View: a named widget with the toolbar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lcean Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 for (var i = 0; i < categoryResults.length; ++i) 46 for (var i = 0; i < categoryResults.length; ++i)
47 this.addPane(new WebInspector.AuditCategoryResultPane(categoryResults[i] )); 47 this.addPane(new WebInspector.AuditCategoryResultPane(categoryResults[i] ));
48 } 48 }
49 49
50 WebInspector.AuditResultView.prototype = { 50 WebInspector.AuditResultView.prototype = {
51 __proto__: WebInspector.SidebarPaneStack.prototype 51 __proto__: WebInspector.SidebarPaneStack.prototype
52 } 52 }
53 53
54 /** 54 /**
55 * @constructor 55 * @constructor
56 * @extends {WebInspector.SidebarPane} 56 * @extends {WebInspector.View}
57 * @param {!WebInspector.AuditCategoryResult} categoryResult 57 * @param {!WebInspector.AuditCategoryResult} categoryResult
58 */ 58 */
59 WebInspector.AuditCategoryResultPane = function(categoryResult) 59 WebInspector.AuditCategoryResultPane = function(categoryResult)
60 { 60 {
61 WebInspector.SidebarPane.call(this, categoryResult.title); 61 WebInspector.View.call(this, categoryResult.title);
62 this._treeOutline = new TreeOutlineInShadow(); 62 this._treeOutline = new TreeOutlineInShadow();
63 this._treeOutline.registerRequiredCSS("audits/auditResultTree.css"); 63 this._treeOutline.registerRequiredCSS("audits/auditResultTree.css");
64 this._treeOutline.element.classList.add("audit-result-tree"); 64 this._treeOutline.element.classList.add("audit-result-tree");
65 this.element.appendChild(this._treeOutline.element); 65 this.element.appendChild(this._treeOutline.element);
66 this._treeOutline.expandTreeElementsWhenArrowing = true; 66 this._treeOutline.expandTreeElementsWhenArrowing = true;
67 67
68 function ruleSorter(a, b) 68 function ruleSorter(a, b)
69 { 69 {
70 var result = WebInspector.AuditRule.SeverityOrder[a.severity || 0] - Web Inspector.AuditRule.SeverityOrder[b.severity || 0]; 70 var result = WebInspector.AuditRule.SeverityOrder[a.severity || 0] - Web Inspector.AuditRule.SeverityOrder[b.severity || 0];
71 if (!result) 71 if (!result)
72 result = (a.value || "").localeCompare(b.value || ""); 72 result = (a.value || "").localeCompare(b.value || "");
73 return result; 73 return result;
74 } 74 }
75 75
76 categoryResult.ruleResults.sort(ruleSorter); 76 categoryResult.ruleResults.sort(ruleSorter);
77 77
78 for (var i = 0; i < categoryResult.ruleResults.length; ++i) { 78 for (var i = 0; i < categoryResult.ruleResults.length; ++i) {
79 var ruleResult = categoryResult.ruleResults[i]; 79 var ruleResult = categoryResult.ruleResults[i];
80 var treeElement = this._appendResult(this._treeOutline.rootElement(), ru leResult, ruleResult.severity); 80 var treeElement = this._appendResult(this._treeOutline.rootElement(), ru leResult, ruleResult.severity);
81 treeElement.listItemElement.classList.add("audit-result"); 81 treeElement.listItemElement.classList.add("audit-result");
82 } 82 }
83 this.expandPane(); 83 this.requestReveal();
84 } 84 }
85 85
86 WebInspector.AuditCategoryResultPane.prototype = { 86 WebInspector.AuditCategoryResultPane.prototype = {
87 /** 87 /**
88 * @param {!TreeElement} parentTreeNode 88 * @param {!TreeElement} parentTreeNode
89 * @param {!WebInspector.AuditRuleResult} result 89 * @param {!WebInspector.AuditRuleResult} result
90 * @param {?WebInspector.AuditRule.Severity=} severity 90 * @param {?WebInspector.AuditRule.Severity=} severity
91 */ 91 */
92 _appendResult: function(parentTreeNode, result, severity) 92 _appendResult: function(parentTreeNode, result, severity)
93 { 93 {
(...skipping 27 matching lines...) Expand all
121 this._appendResult(treeElement, result.children[i]); 121 this._appendResult(treeElement, result.children[i]);
122 } 122 }
123 if (result.expanded) { 123 if (result.expanded) {
124 treeElement.listItemElement.classList.remove("parent"); 124 treeElement.listItemElement.classList.remove("parent");
125 treeElement.listItemElement.classList.add("parent-expanded"); 125 treeElement.listItemElement.classList.add("parent-expanded");
126 treeElement.expand(); 126 treeElement.expand();
127 } 127 }
128 return treeElement; 128 return treeElement;
129 }, 129 },
130 130
131 __proto__: WebInspector.SidebarPane.prototype 131 __proto__: WebInspector.View.prototype
132 } 132 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698