OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 * @constructor | 198 * @constructor |
199 * @extends {WebInspector.VBox} | 199 * @extends {WebInspector.VBox} |
200 */ | 200 */ |
201 WebInspector.PaintProfilerCommandLogView = function() | 201 WebInspector.PaintProfilerCommandLogView = function() |
202 { | 202 { |
203 WebInspector.VBox.call(this); | 203 WebInspector.VBox.call(this); |
204 this.setMinimumSize(100, 25); | 204 this.setMinimumSize(100, 25); |
205 this.element.classList.add("outline-disclosure"); | 205 this.element.classList.add("outline-disclosure"); |
206 var sidebarTreeElement = this.element.createChild("ol", "sidebar-tree"); | 206 var sidebarTreeElement = this.element.createChild("ol", "sidebar-tree"); |
207 this.sidebarTree = new TreeOutline(sidebarTreeElement); | 207 this.sidebarTree = new TreeOutline(sidebarTreeElement); |
208 this._popoverHelper = new WebInspector.ObjectPopoverHelper(this.element, thi s._getHoverAnchor.bind(this), this._resolveObjectForPopover.bind(this), undefine d, true); | |
208 | 209 |
209 this._log = []; | 210 this._log = []; |
210 } | 211 } |
211 | 212 |
212 WebInspector.PaintProfilerCommandLogView.prototype = { | 213 WebInspector.PaintProfilerCommandLogView.prototype = { |
213 setLog: function(log) | 214 setLog: function(log) |
214 { | 215 { |
215 this._log = log; | 216 this._log = log; |
216 }, | 217 }, |
217 | 218 |
218 /** | 219 /** |
219 * @param {number=} stepLeft | 220 * @param {number=} stepLeft |
220 * @param {number=} stepRight | 221 * @param {number=} stepRight |
221 */ | 222 */ |
222 updateLog: function(stepLeft, stepRight) | 223 updateLog: function(stepLeft, stepRight) |
223 { | 224 { |
224 var log = this._log; | 225 var log = this._log; |
225 stepLeft = stepLeft || 0; | 226 stepLeft = stepLeft || 0; |
226 stepRight = stepRight || log.length - 1; | 227 stepRight = stepRight || log.length - 1; |
227 this.sidebarTree.removeChildren(); | 228 this.sidebarTree.removeChildren(); |
228 for (var i = stepLeft; i <= stepRight; ++i) { | 229 for (var i = stepLeft; i <= stepRight; ++i) { |
229 var node = new WebInspector.LogTreeElement(log[i]); | 230 var node = new WebInspector.LogTreeElement(log[i]); |
230 this.sidebarTree.appendChild(node); | 231 this.sidebarTree.appendChild(node); |
231 } | 232 } |
232 }, | 233 }, |
233 | 234 |
235 /** | |
236 * @param {!Element} target | |
237 * @return {!Element} | |
238 */ | |
239 _getHoverAnchor: function(target) | |
240 { | |
241 return target.enclosingNodeOrSelfWithNodeName("span"); | |
242 }, | |
243 | |
244 /** | |
245 * @param {!Element} element | |
246 * @param {function(!WebInspector.RemoteObject, boolean=, !Element=):undefin ed} showCallback | |
247 */ | |
248 _resolveObjectForPopover: function(element, showCallback) | |
249 { | |
250 var liElement = element.enclosingNodeOrSelfWithNodeName("li"); | |
251 var logItem = liElement.__logItem; | |
caseq
2014/06/11 16:03:21
can you use liElement.treeElement.representedObjec
malch
2014/06/11 16:32:58
Done.
| |
252 var obj = {"method": liElement.__logItem.method}; | |
253 if (logItem.params) | |
254 obj.params = logItem.params; | |
255 showCallback(WebInspector.RemoteObject.fromLocalObject(obj)); | |
256 }, | |
257 | |
234 __proto__: WebInspector.VBox.prototype | 258 __proto__: WebInspector.VBox.prototype |
235 }; | 259 }; |
236 | 260 |
237 /** | 261 /** |
238 * @constructor | 262 * @constructor |
239 * @param {!Object} logItem | 263 * @param {!Object} logItem |
240 * @extends {TreeElement} | 264 * @extends {TreeElement} |
241 */ | 265 */ |
242 WebInspector.LogTreeElement = function(logItem) | 266 WebInspector.LogTreeElement = function(logItem) |
243 { | 267 { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
280 str += this._paramToString(params[key], key); | 304 str += this._paramToString(params[key], key); |
281 } | 305 } |
282 return str; | 306 return str; |
283 }, | 307 }, |
284 | 308 |
285 _update: function() | 309 _update: function() |
286 { | 310 { |
287 var logItem = this.representedObject; | 311 var logItem = this.representedObject; |
288 var title = document.createDocumentFragment(); | 312 var title = document.createDocumentFragment(); |
289 title.createChild("div", "selection"); | 313 title.createChild("div", "selection"); |
314 var span = title.createChild("span"); | |
290 var textContent = logItem.method; | 315 var textContent = logItem.method; |
291 if (logItem.params) | 316 if (logItem.params) |
292 textContent += "(" + this._paramsToString(logItem.params) + ")"; | 317 textContent += "(" + this._paramsToString(logItem.params) + ")"; |
293 title.appendChild(document.createTextNode(textContent)); | 318 span.textContent = textContent; |
294 this.title = title; | 319 this.title = title; |
295 }, | 320 }, |
296 | 321 |
297 /** | 322 /** |
298 * @param {boolean} hovered | 323 * @param {boolean} hovered |
299 */ | 324 */ |
300 setHovered: function(hovered) | 325 setHovered: function(hovered) |
301 { | 326 { |
302 this.listItemElement.classList.toggle("hovered", hovered); | 327 this.listItemElement.classList.toggle("hovered", hovered); |
303 }, | 328 }, |
304 | 329 |
330 onattach: function() | |
331 { | |
332 this.listItemElement.__logItem = this.representedObject; | |
caseq
2014/06/11 16:03:21
...you won't need this then.
malch
2014/06/11 16:32:58
Done.
| |
333 }, | |
334 | |
305 __proto__: TreeElement.prototype | 335 __proto__: TreeElement.prototype |
306 }; | 336 }; |
OLD | NEW |