| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 this._startToolbarPaneAnimation(this._pendingWidget); | 194 this._startToolbarPaneAnimation(this._pendingWidget); |
| 195 delete this._pendingWidget; | 195 delete this._pendingWidget; |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 }, | 198 }, |
| 199 | 199 |
| 200 _loadSidebarViews: function() | 200 _loadSidebarViews: function() |
| 201 { | 201 { |
| 202 var extensions = self.runtime.extensions("@WebInspector.View"); | 202 var extensions = self.runtime.extensions("@WebInspector.View"); |
| 203 | 203 |
| 204 var promises = []; |
| 204 for (var i = 0; i < extensions.length; ++i) { | 205 for (var i = 0; i < extensions.length; ++i) { |
| 205 var descriptor = extensions[i].descriptor(); | 206 var descriptor = extensions[i].descriptor(); |
| 206 if (descriptor["location"] !== "elements-panel") | 207 if (descriptor["location"] !== "elements-panel") |
| 207 continue; | 208 continue; |
| 208 | 209 |
| 209 var title = WebInspector.UIString(descriptor["title"]); | 210 var title = WebInspector.UIString(descriptor["title"]); |
| 210 extensions[i].instancePromise().then(addSidebarView.bind(this, title
)); | 211 promises.push(extensions[i].instancePromise().then(addSidebarView.bi
nd(this, title))); |
| 211 } | 212 } |
| 212 | 213 |
| 214 Promise.all(promises).then(this._sidebarViewsLoadedForTest.bind(this)); |
| 215 |
| 213 /** | 216 /** |
| 214 * @param {string} title | 217 * @param {string} title |
| 215 * @param {!Object} object | 218 * @param {!Object} object |
| 216 * @this {WebInspector.ElementsPanel} | 219 * @this {WebInspector.ElementsPanel} |
| 217 */ | 220 */ |
| 218 function addSidebarView(title, object) | 221 function addSidebarView(title, object) |
| 219 { | 222 { |
| 220 var view = /** @type {!WebInspector.View} */ (object); | 223 var view = /** @type {!WebInspector.View} */ (object); |
| 221 this._elementsSidebarViews.push(view); | 224 this._elementsSidebarViews.push(view); |
| 222 | 225 |
| 223 if (this.sidebarPaneView) | 226 if (this.sidebarPaneView) |
| 224 this.sidebarPaneView.appendView(view); | 227 this.sidebarPaneView.appendView(view); |
| 225 } | 228 } |
| 226 }, | 229 }, |
| 227 | 230 |
| 231 _sidebarViewsLoadedForTest: function() |
| 232 { |
| 233 // For sniffing in tests. |
| 234 }, |
| 235 |
| 228 /** | 236 /** |
| 229 * @override | 237 * @override |
| 230 * @param {!WebInspector.Target} target | 238 * @param {!WebInspector.Target} target |
| 231 */ | 239 */ |
| 232 targetAdded: function(target) | 240 targetAdded: function(target) |
| 233 { | 241 { |
| 234 var domModel = WebInspector.DOMModel.fromTarget(target); | 242 var domModel = WebInspector.DOMModel.fromTarget(target); |
| 235 if (!domModel) | 243 if (!domModel) |
| 236 return; | 244 return; |
| 237 var treeOutline = new WebInspector.ElementsTreeOutline(domModel, true, t
rue); | 245 var treeOutline = new WebInspector.ElementsTreeOutline(domModel, true, t
rue); |
| (...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 /** | 1185 /** |
| 1178 * @override | 1186 * @override |
| 1179 * @param {!WebInspector.DOMNode} node | 1187 * @param {!WebInspector.DOMNode} node |
| 1180 * @return {?{title: string, color: string}} | 1188 * @return {?{title: string, color: string}} |
| 1181 */ | 1189 */ |
| 1182 decorate: function(node) | 1190 decorate: function(node) |
| 1183 { | 1191 { |
| 1184 return { color: "orange", title: WebInspector.UIString("Element state: %
s", ":" + WebInspector.CSSModel.fromNode(node).pseudoState(node).join(", :")) }; | 1192 return { color: "orange", title: WebInspector.UIString("Element state: %
s", ":" + WebInspector.CSSModel.fromNode(node).pseudoState(node).join(", :")) }; |
| 1185 } | 1193 } |
| 1186 } | 1194 } |
| OLD | NEW |