Changeset 50034 in webkit
- Timestamp:
- Oct 24, 2009 4:08:15 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r50033 r50034 1 2009-10-24 Timothy Hatcher <timothy@apple.com> 2 3 Fix the Scope Bar in the Web Inspector's Resource panel, so that selecting 4 All will deselect the other filters. 5 6 https://bugs.webkit.org/show_bug.cgi?id=30744 7 8 Reviewed by Pavel Feldman. 9 10 * inspector/front-end/ResourcesPanel.js: 11 (WebInspector.ResourcesPanel.createFilterElement): Better syntax. 12 (WebInspector.ResourcesPanel): 13 (WebInspector.ResourcesPanel.prototype.filter): Use a normal for loop, 14 and the child variable instead of target in the loop. Other clean up. 15 1 16 2009-10-24 Timothy Hatcher <timothy@apple.com> 2 17 -
trunk/WebCore/inspector/front-end/ResourcesPanel.js
r50033 r50034 137 137 this.sortingSelectElement.addEventListener("change", this._changeSortingFunction.bind(this), false); 138 138 139 var createFilterElement = function (category) { 139 function createFilterElement(category) 140 { 141 if (category === "all") 142 var label = WebInspector.UIString("All"); 143 else if (WebInspector.resourceCategories[category]) 144 var label = WebInspector.resourceCategories[category].title; 145 140 146 var categoryElement = document.createElement("li"); 141 147 categoryElement.category = category; 142 148 categoryElement.addStyleClass(category); 143 var label = WebInspector.UIString("All");144 if (WebInspector.resourceCategories[category])145 label = WebInspector.resourceCategories[category].title;146 149 categoryElement.appendChild(document.createTextNode(label)); 147 150 categoryElement.addEventListener("click", this._updateFilter.bind(this), false); 148 151 this.filterBarElement.appendChild(categoryElement); 152 149 153 return categoryElement; 150 } ;154 } 151 155 152 156 this.allElement = createFilterElement.call(this, "all"); 153 157 154 158 // Add a divider 155 159 var dividerElement = document.createElement("div"); 156 160 dividerElement.addStyleClass("divider"); 157 161 this.filterBarElement.appendChild(dividerElement); 158 159 this.filter(this.allElement); 162 160 163 for (var category in this.categories) 161 164 createFilterElement.call(this, category); 162 165 166 this.filter(this.allElement); 167 163 168 this.reset(); 164 169 … … 173 178 if (!this._categories) { 174 179 this._categories = {documents: {color: {r: 47, g: 102, b: 236}}, stylesheets: {color: {r: 157, g: 231, b: 119}}, images: {color: {r: 164, g: 60, b: 255}}, scripts: {color: {r: 255, g: 121, b: 0}}, xhr: {color: {r: 231, g: 231, b: 10}}, fonts: {color: {r: 255, g: 82, b: 62}}, other: {color: {r: 186, g: 186, b: 186}}}; 175 for (var category in this._categories) {180 for (var category in this._categories) 176 181 this._categories[category].title = WebInspector.resourceCategories[category].title; 177 178 } 182 } 183 179 184 return this._categories; 180 185 }, 181 186 182 filter: function 183 { 184 if (target .category === "All") {187 filter: function(target) 188 { 189 if (target === this.allElement) { 185 190 if (target.hasStyleClass("selected")) { 186 // We can't unselect all, so we break early here191 // We can't unselect All, so we break early here 187 192 return; 188 193 } 189 190 // If all wasn't selected, and now is, unselect everything else. 191 for (var child in this.filterBarElement.childNodes) { 192 if (target.category !== "All") { 194 195 // If All wasn't selected, and now is, unselect everything else. 196 for (var i = 0; i < this.filterBarElement.childNodes.length; ++i) { 197 var child = this.filterBarElement.childNodes[i]; 198 if (!child.category) 199 continue; 200 201 if (child !== this.allElement) 193 202 child.removeStyleClass("selected"); 194 } 195 196 var filterClass = "filter-" + target.category; 203 204 var filterClass = "filter-" + child.category.toLowerCase(); 197 205 this.resourcesGraphsElement.removeStyleClass(filterClass); 198 206 this.resourcesTreeElement.childrenListElement.removeStyleClass(filterClass); 199 207 } 200 208 } else { 201 // Something other than all is being selected, so we want to unselect all209 // Something other than All is being selected, so we want to unselect All. 202 210 if (this.allElement.hasStyleClass("selected")) { 203 211 this.allElement.removeStyleClass("selected"); … … 206 214 } 207 215 } 208 216 209 217 if (target.hasStyleClass("selected")) { 210 218 target.removeStyleClass("selected"); 219 211 220 var filterClass = "filter-" + target.category.toLowerCase(); 212 213 221 this.resourcesGraphsElement.removeStyleClass(filterClass); 214 222 this.resourcesTreeElement.childrenListElement.removeStyleClass(filterClass); 215 223 } else { 216 224 target.addStyleClass("selected"); 225 217 226 var filterClass = "filter-" + target.category.toLowerCase(); 218 219 227 this.resourcesGraphsElement.addStyleClass(filterClass); 220 this.resourcesTreeElement.childrenListElement.addStyleClass(filterClass); 221 } 228 this.resourcesTreeElement.childrenListElement.addStyleClass(filterClass); 229 } 222 230 }, 223 231
Note: See TracChangeset
for help on using the changeset viewer.