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 * @implements {UI.Searchable} | 5 * @implements {UI.Searchable} |
6 * @unrestricted | 6 * @unrestricted |
7 */ | 7 */ |
8 Network.XMLView = class extends UI.Widget { | 8 Network.XMLView = class extends UI.Widget { |
9 /** | 9 /** |
10 * @param {!Document} parsedXML | 10 * @param {!Document} parsedXML |
11 */ | 11 */ |
12 constructor(parsedXML) { | 12 constructor(parsedXML) { |
13 super(true); | 13 super(true); |
14 this.registerRequiredCSS('network/xmlView.css'); | 14 this.registerRequiredCSS('network/xmlView.css'); |
15 this.contentElement.classList.add('shadow-xml-view', 'source-code'); | 15 this.contentElement.classList.add('shadow-xml-view', 'source-code'); |
16 this._treeOutline = new TreeOutlineInShadow(); | 16 this._treeOutline = new UI.TreeOutlineInShadow(); |
17 this._treeOutline.registerRequiredCSS('network/xmlTree.css'); | 17 this._treeOutline.registerRequiredCSS('network/xmlTree.css'); |
18 this.contentElement.appendChild(this._treeOutline.element); | 18 this.contentElement.appendChild(this._treeOutline.element); |
19 | 19 |
20 /** @type {?UI.SearchableView} */ | 20 /** @type {?UI.SearchableView} */ |
21 this._searchableView; | 21 this._searchableView; |
22 /** @type {number} */ | 22 /** @type {number} */ |
23 this._currentSearchFocusIndex = 0; | 23 this._currentSearchFocusIndex = 0; |
24 /** @type {!Array.<!TreeElement>} */ | 24 /** @type {!Array.<!UI.TreeElement>} */ |
25 this._currentSearchTreeElements = []; | 25 this._currentSearchTreeElements = []; |
26 /** @type {?UI.SearchableView.SearchConfig} */ | 26 /** @type {?UI.SearchableView.SearchConfig} */ |
27 this._searchConfig; | 27 this._searchConfig; |
28 | 28 |
29 Network.XMLView.Node.populate(this._treeOutline, parsedXML, this); | 29 Network.XMLView.Node.populate(this._treeOutline, parsedXML, this); |
30 } | 30 } |
31 | 31 |
32 /** | 32 /** |
33 * @param {!Document} parsedXML | 33 * @param {!Document} parsedXML |
34 * @return {!UI.SearchableView} | 34 * @return {!UI.SearchableView} |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 */ | 206 */ |
207 supportsRegexSearch() { | 207 supportsRegexSearch() { |
208 return true; | 208 return true; |
209 } | 209 } |
210 }; | 210 }; |
211 | 211 |
212 | 212 |
213 /** | 213 /** |
214 * @unrestricted | 214 * @unrestricted |
215 */ | 215 */ |
216 Network.XMLView.Node = class extends TreeElement { | 216 Network.XMLView.Node = class extends UI.TreeElement { |
217 /** | 217 /** |
218 * @param {!Node} node | 218 * @param {!Node} node |
219 * @param {boolean} closeTag | 219 * @param {boolean} closeTag |
220 * @param {!Network.XMLView} xmlView | 220 * @param {!Network.XMLView} xmlView |
221 */ | 221 */ |
222 constructor(node, closeTag, xmlView) { | 222 constructor(node, closeTag, xmlView) { |
223 super('', !closeTag && !!node.childElementCount); | 223 super('', !closeTag && !!node.childElementCount); |
224 this._node = node; | 224 this._node = node; |
225 this._closeTag = closeTag; | 225 this._closeTag = closeTag; |
226 this.selectable = false; | 226 this.selectable = false; |
227 /** @type {!Array.<!Object>} */ | 227 /** @type {!Array.<!Object>} */ |
228 this._highlightChanges = []; | 228 this._highlightChanges = []; |
229 this._xmlView = xmlView; | 229 this._xmlView = xmlView; |
230 this._updateTitle(); | 230 this._updateTitle(); |
231 } | 231 } |
232 | 232 |
233 /** | 233 /** |
234 * @param {!TreeOutline|!TreeElement} root | 234 * @param {!UI.TreeOutline|!UI.TreeElement} root |
235 * @param {!Node} xmlNode | 235 * @param {!Node} xmlNode |
236 * @param {!Network.XMLView} xmlView | 236 * @param {!Network.XMLView} xmlView |
237 */ | 237 */ |
238 static populate(root, xmlNode, xmlView) { | 238 static populate(root, xmlNode, xmlView) { |
239 var node = xmlNode.firstChild; | 239 var node = xmlNode.firstChild; |
240 while (node) { | 240 while (node) { |
241 var currentNode = node; | 241 var currentNode = node; |
242 node = node.nextSibling; | 242 node = node.nextSibling; |
243 var nodeType = currentNode.nodeType; | 243 var nodeType = currentNode.nodeType; |
244 // ignore empty TEXT | 244 // ignore empty TEXT |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 } | 366 } |
367 | 367 |
368 /** | 368 /** |
369 * @override | 369 * @override |
370 */ | 370 */ |
371 onpopulate() { | 371 onpopulate() { |
372 Network.XMLView.Node.populate(this, this._node, this._xmlView); | 372 Network.XMLView.Node.populate(this, this._node, this._xmlView); |
373 this.appendChild(new Network.XMLView.Node(this._node, true, this._xmlView)); | 373 this.appendChild(new Network.XMLView.Node(this._node, true, this._xmlView)); |
374 } | 374 } |
375 }; | 375 }; |
OLD | NEW |