| OLD | NEW |
| 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 12 matching lines...) Expand all Loading... |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @extends {WebInspector.View} | 33 * @extends {WebInspector.SimpleView} |
| 34 * @param {!WebInspector.AuditCategoryResult} categoryResult | 34 * @param {!WebInspector.AuditCategoryResult} categoryResult |
| 35 */ | 35 */ |
| 36 WebInspector.AuditCategoryResultPane = function(categoryResult) | 36 WebInspector.AuditCategoryResultPane = function(categoryResult) |
| 37 { | 37 { |
| 38 WebInspector.View.call(this, categoryResult.title); | 38 WebInspector.SimpleView.call(this, categoryResult.title); |
| 39 this._treeOutline = new TreeOutlineInShadow(); | 39 this._treeOutline = new TreeOutlineInShadow(); |
| 40 this._treeOutline.registerRequiredCSS("audits/auditResultTree.css"); | 40 this._treeOutline.registerRequiredCSS("audits/auditResultTree.css"); |
| 41 this._treeOutline.element.classList.add("audit-result-tree"); | 41 this._treeOutline.element.classList.add("audit-result-tree"); |
| 42 this.element.appendChild(this._treeOutline.element); | 42 this.element.appendChild(this._treeOutline.element); |
| 43 this._treeOutline.expandTreeElementsWhenArrowing = true; | 43 this._treeOutline.expandTreeElementsWhenArrowing = true; |
| 44 | 44 |
| 45 function ruleSorter(a, b) | 45 function ruleSorter(a, b) |
| 46 { | 46 { |
| 47 var result = WebInspector.AuditRule.SeverityOrder[a.severity || 0] - Web
Inspector.AuditRule.SeverityOrder[b.severity || 0]; | 47 var result = WebInspector.AuditRule.SeverityOrder[a.severity || 0] - Web
Inspector.AuditRule.SeverityOrder[b.severity || 0]; |
| 48 if (!result) | 48 if (!result) |
| 49 result = (a.value || "").localeCompare(b.value || ""); | 49 result = (a.value || "").localeCompare(b.value || ""); |
| 50 return result; | 50 return result; |
| 51 } | 51 } |
| 52 | 52 |
| 53 categoryResult.ruleResults.sort(ruleSorter); | 53 categoryResult.ruleResults.sort(ruleSorter); |
| 54 | 54 |
| 55 for (var i = 0; i < categoryResult.ruleResults.length; ++i) { | 55 for (var i = 0; i < categoryResult.ruleResults.length; ++i) { |
| 56 var ruleResult = categoryResult.ruleResults[i]; | 56 var ruleResult = categoryResult.ruleResults[i]; |
| 57 var treeElement = this._appendResult(this._treeOutline.rootElement(), ru
leResult, ruleResult.severity); | 57 var treeElement = this._appendResult(this._treeOutline.rootElement(), ru
leResult, ruleResult.severity); |
| 58 treeElement.listItemElement.classList.add("audit-result"); | 58 treeElement.listItemElement.classList.add("audit-result"); |
| 59 } | 59 } |
| 60 this.revealWidget(); | 60 this.revealView(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 WebInspector.AuditCategoryResultPane.prototype = { | 63 WebInspector.AuditCategoryResultPane.prototype = { |
| 64 /** | 64 /** |
| 65 * @param {!TreeElement} parentTreeNode | 65 * @param {!TreeElement} parentTreeNode |
| 66 * @param {!WebInspector.AuditRuleResult} result | 66 * @param {!WebInspector.AuditRuleResult} result |
| 67 * @param {?WebInspector.AuditRule.Severity=} severity | 67 * @param {?WebInspector.AuditRule.Severity=} severity |
| 68 */ | 68 */ |
| 69 _appendResult: function(parentTreeNode, result, severity) | 69 _appendResult: function(parentTreeNode, result, severity) |
| 70 { | 70 { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 98 this._appendResult(treeElement, result.children[i]); | 98 this._appendResult(treeElement, result.children[i]); |
| 99 } | 99 } |
| 100 if (result.expanded) { | 100 if (result.expanded) { |
| 101 treeElement.listItemElement.classList.remove("parent"); | 101 treeElement.listItemElement.classList.remove("parent"); |
| 102 treeElement.listItemElement.classList.add("parent-expanded"); | 102 treeElement.listItemElement.classList.add("parent-expanded"); |
| 103 treeElement.expand(); | 103 treeElement.expand(); |
| 104 } | 104 } |
| 105 return treeElement; | 105 return treeElement; |
| 106 }, | 106 }, |
| 107 | 107 |
| 108 __proto__: WebInspector.View.prototype | 108 __proto__: WebInspector.SimpleView.prototype |
| 109 } | 109 } |
| OLD | NEW |