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

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

Issue 662793002: [DevTools] Replace usages of document with custom functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 /** 54 /**
55 * @constructor 55 * @constructor
56 * @extends {WebInspector.SidebarPane} 56 * @extends {WebInspector.SidebarPane}
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.SidebarPane.call(this, categoryResult.title);
62 var treeOutlineElement = document.createElement("ol"); 62 var treeOutlineElement = createElement("ol");
63 this.bodyElement.classList.add("audit-result-tree"); 63 this.bodyElement.classList.add("audit-result-tree");
64 this.bodyElement.appendChild(treeOutlineElement); 64 this.bodyElement.appendChild(treeOutlineElement);
65 65
66 this._treeOutline = new TreeOutline(treeOutlineElement); 66 this._treeOutline = new TreeOutline(treeOutlineElement);
67 this._treeOutline.expandTreeElementsWhenArrowing = true; 67 this._treeOutline.expandTreeElementsWhenArrowing = true;
68 68
69 function ruleSorter(a, b) 69 function ruleSorter(a, b)
70 { 70 {
71 var result = WebInspector.AuditRule.SeverityOrder[a.severity || 0] - Web Inspector.AuditRule.SeverityOrder[b.severity || 0]; 71 var result = WebInspector.AuditRule.SeverityOrder[a.severity || 0] - Web Inspector.AuditRule.SeverityOrder[b.severity || 0];
72 if (!result) 72 if (!result)
(...skipping 20 matching lines...) Expand all
93 _appendResult: function(parentTreeElement, result, severity) 93 _appendResult: function(parentTreeElement, result, severity)
94 { 94 {
95 var title = ""; 95 var title = "";
96 96
97 if (typeof result.value === "string") { 97 if (typeof result.value === "string") {
98 title = result.value; 98 title = result.value;
99 if (result.violationCount) 99 if (result.violationCount)
100 title = String.sprintf("%s (%d)", title, result.violationCount); 100 title = String.sprintf("%s (%d)", title, result.violationCount);
101 } 101 }
102 102
103 var titleFragment = document.createDocumentFragment(); 103 var titleFragment = createDocumentFragment();
104 if (severity) { 104 if (severity) {
105 var severityElement = document.createElement("div"); 105 var severityElement = createElement("div");
106 severityElement.className = "severity-" + severity; 106 severityElement.className = "severity-" + severity;
107 titleFragment.appendChild(severityElement); 107 titleFragment.appendChild(severityElement);
108 } 108 }
109 titleFragment.createTextChild(title); 109 titleFragment.createTextChild(title);
110 110
111 var treeElement = new TreeElement(titleFragment, null, !!result.children ); 111 var treeElement = new TreeElement(titleFragment, null, !!result.children );
112 parentTreeElement.appendChild(treeElement); 112 parentTreeElement.appendChild(treeElement);
113 113
114 if (result.className) 114 if (result.className)
115 treeElement.listItemElement.classList.add(result.className); 115 treeElement.listItemElement.classList.add(result.className);
116 if (typeof result.value !== "string") 116 if (typeof result.value !== "string")
117 treeElement.listItemElement.appendChild(WebInspector.auditFormatters .apply(result.value)); 117 treeElement.listItemElement.appendChild(WebInspector.auditFormatters .apply(result.value));
118 118
119 if (result.children) { 119 if (result.children) {
120 for (var i = 0; i < result.children.length; ++i) 120 for (var i = 0; i < result.children.length; ++i)
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.SidebarPane.prototype
132 } 132 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/audits/AuditLauncherView.js ('k') | Source/devtools/front_end/audits/AuditsPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698