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 * @param {!WebInspector.RemoteObject} object | 7 * @param {!WebInspector.RemoteObject} object |
8 * @param {!Array.<*>=} prefixML | 8 * @param {!Array.<*>=} prefixML |
9 */ | 9 */ |
10 WebInspector.CustomPreviewSection = function(object, prefixML) | 10 WebInspector.CustomPreviewSection = function(object, prefixML) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 * @param {*} jsonML | 91 * @param {*} jsonML |
92 * @return {!Node} | 92 * @return {!Node} |
93 */ | 93 */ |
94 _renderJSONMLTag: function(jsonML) | 94 _renderJSONMLTag: function(jsonML) |
95 { | 95 { |
96 if (!Array.isArray(jsonML)) | 96 if (!Array.isArray(jsonML)) |
97 return createTextNode(jsonML + ""); | 97 return createTextNode(jsonML + ""); |
98 | 98 |
99 var array = /** @type {!Array.<*>} */(jsonML); | 99 var array = /** @type {!Array.<*>} */(jsonML); |
100 if (array[0] === "object") | 100 if (array[0] === "object") |
101 return this._renderObjectTag(array); | 101 return this._layoutObjectTag(array); |
102 else | 102 else |
103 return this._renderElement(array); | 103 return this._renderElement(array); |
104 }, | 104 }, |
105 | 105 |
106 /** | 106 /** |
107 * | 107 * |
108 * @param {!Array.<*>} object | 108 * @param {!Array.<*>} object |
109 * @return {!Node} | 109 * @return {!Node} |
110 */ | 110 */ |
111 _renderElement: function(object) | 111 _renderElement: function(object) |
(...skipping 16 matching lines...) Expand all Loading... |
128 } | 128 } |
129 | 129 |
130 this._appendJsonMLTags(element, object); | 130 this._appendJsonMLTags(element, object); |
131 return element; | 131 return element; |
132 }, | 132 }, |
133 | 133 |
134 /** | 134 /** |
135 * @param {!Array.<*>} objectTag | 135 * @param {!Array.<*>} objectTag |
136 * @return {!Node} | 136 * @return {!Node} |
137 */ | 137 */ |
138 _renderObjectTag: function(objectTag) | 138 _layoutObjectTag: function(objectTag) |
139 { | 139 { |
140 objectTag.shift(); | 140 objectTag.shift(); |
141 var attributes = objectTag.shift(); | 141 var attributes = objectTag.shift(); |
142 var remoteObject = this._object.target().runtimeModel.createRemoteObject
(/** @type {!RuntimeAgent.RemoteObject} */ (attributes)); | 142 var remoteObject = this._object.target().runtimeModel.createRemoteObject
(/** @type {!RuntimeAgent.RemoteObject} */ (attributes)); |
143 if (!remoteObject.customPreview()) { | 143 if (!remoteObject.customPreview()) { |
144 var header = createElement("span"); | 144 var header = createElement("span"); |
145 this._appendJsonMLTags(header, objectTag); | 145 this._appendJsonMLTags(header, objectTag); |
146 var objectPropertiesSection = new WebInspector.ObjectPropertiesSecti
on(remoteObject, header); | 146 var objectPropertiesSection = new WebInspector.ObjectPropertiesSecti
on(remoteObject, header); |
147 return objectPropertiesSection.element; | 147 return objectPropertiesSection.element; |
148 } | 148 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 function onBodyLoaded(bodyJsonML) | 241 function onBodyLoaded(bodyJsonML) |
242 { | 242 { |
243 if (!bodyJsonML) | 243 if (!bodyJsonML) |
244 return; | 244 return; |
245 | 245 |
246 this._cachedContent = this._renderJSONMLTag(bodyJsonML); | 246 this._cachedContent = this._renderJSONMLTag(bodyJsonML); |
247 this._toggleExpand(); | 247 this._toggleExpand(); |
248 } | 248 } |
249 } | 249 } |
250 } | 250 } |
OLD | NEW |