| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.View} | 7 * @extends {WebInspector.View} |
| 8 * @param {!Document} parsedXML | 8 * @param {!Document} parsedXML |
| 9 */ | 9 */ |
| 10 WebInspector.XMLView = function(parsedXML) | 10 WebInspector.XMLView = function(parsedXML) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 /** | 42 /** |
| 43 * @constructor | 43 * @constructor |
| 44 * @extends {TreeElement} | 44 * @extends {TreeElement} |
| 45 * @param {!Node} node | 45 * @param {!Node} node |
| 46 * @param {boolean} closeTag | 46 * @param {boolean} closeTag |
| 47 */ | 47 */ |
| 48 WebInspector.XMLView.Node = function(node, closeTag) | 48 WebInspector.XMLView.Node = function(node, closeTag) |
| 49 { | 49 { |
| 50 TreeElement.call(this, "", true); | 50 TreeElement.call(this, "", !closeTag && !!node.childElementCount); |
| 51 this._node = node; | 51 this._node = node; |
| 52 this._closeTag = closeTag; | 52 this._closeTag = closeTag; |
| 53 this._populated = false; | |
| 54 this.selectable = false; | 53 this.selectable = false; |
| 55 this.hasChildren = !closeTag && !!node.childElementCount; | |
| 56 this._updateTitle(); | 54 this._updateTitle(); |
| 57 } | 55 } |
| 58 | 56 |
| 59 /** | 57 /** |
| 60 * @param {!TreeOutline|!TreeElement} root | 58 * @param {!TreeOutline|!TreeElement} root |
| 61 * @param {!Node} xmlNode | 59 * @param {!Node} xmlNode |
| 62 */ | 60 */ |
| 63 WebInspector.XMLView.Node.populate = function(root, xmlNode) | 61 WebInspector.XMLView.Node.populate = function(root, xmlNode) |
| 64 { | 62 { |
| 65 var node = xmlNode.firstChild; | 63 var node = xmlNode.firstChild; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 this._updateTitle(); | 154 this._updateTitle(); |
| 157 }, | 155 }, |
| 158 | 156 |
| 159 oncollapse: function() | 157 oncollapse: function() |
| 160 { | 158 { |
| 161 this._updateTitle(); | 159 this._updateTitle(); |
| 162 }, | 160 }, |
| 163 | 161 |
| 164 onpopulate: function() | 162 onpopulate: function() |
| 165 { | 163 { |
| 166 if (this._populated || this._closeTag) | |
| 167 return; | |
| 168 WebInspector.XMLView.Node.populate(this, this._node); | 164 WebInspector.XMLView.Node.populate(this, this._node); |
| 169 this.appendChild(new WebInspector.XMLView.Node(this._node, true)); | 165 this.appendChild(new WebInspector.XMLView.Node(this._node, true)); |
| 170 this._populated = true; | |
| 171 }, | 166 }, |
| 172 | 167 |
| 173 __proto__: TreeElement.prototype | 168 __proto__: TreeElement.prototype |
| 174 } | 169 } |
| OLD | NEW |