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 18 matching lines...) Expand all Loading... | |
29 */ | 29 */ |
30 | 30 |
31 /** | 31 /** |
32 * @constructor | 32 * @constructor |
33 * @param {function(string=)} showImageCallback | 33 * @param {function(string=)} showImageCallback |
34 * @extends {WebInspector.HBox} | 34 * @extends {WebInspector.HBox} |
35 */ | 35 */ |
36 WebInspector.PaintProfilerView = function(showImageCallback) | 36 WebInspector.PaintProfilerView = function(showImageCallback) |
37 { | 37 { |
38 WebInspector.HBox.call(this); | 38 WebInspector.HBox.call(this); |
39 this.registerRequiredCSS("paintProfilerView.css"); | |
39 this.element.classList.add("paint-profiler-view"); | 40 this.element.classList.add("paint-profiler-view"); |
40 | 41 |
41 this._showImageCallback = showImageCallback; | 42 this._showImageCallback = showImageCallback; |
42 | 43 |
43 this._canvas = this.element.createChild("canvas", "fill"); | 44 this._canvas = this.element.createChild("canvas", "fill"); |
44 this._context = this._canvas.getContext("2d"); | 45 this._context = this._canvas.getContext("2d"); |
45 this._selectionWindow = new WebInspector.OverviewGrid.Window(this.element, t his.element); | 46 this._selectionWindow = new WebInspector.OverviewGrid.Window(this.element, t his.element); |
46 this._selectionWindow.addEventListener(WebInspector.OverviewGrid.Events.Wind owChanged, this._onWindowChanged, this); | 47 this._selectionWindow.addEventListener(WebInspector.OverviewGrid.Events.Wind owChanged, this._onWindowChanged, this); |
47 | 48 |
48 this._innerBarWidth = 4 * window.devicePixelRatio; | 49 this._innerBarWidth = 4 * window.devicePixelRatio; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 }; | 208 }; |
208 | 209 |
209 /** | 210 /** |
210 * @constructor | 211 * @constructor |
211 * @extends {WebInspector.VBox} | 212 * @extends {WebInspector.VBox} |
212 */ | 213 */ |
213 WebInspector.PaintProfilerCommandLogView = function() | 214 WebInspector.PaintProfilerCommandLogView = function() |
214 { | 215 { |
215 WebInspector.VBox.call(this); | 216 WebInspector.VBox.call(this); |
216 this.setMinimumSize(100, 25); | 217 this.setMinimumSize(100, 25); |
217 this.element.classList.add("outline-disclosure"); | 218 this.element.classList.add("outline-disclosure", "profiler-log-view"); |
218 var sidebarTreeElement = this.element.createChild("ol", "sidebar-tree"); | 219 var sidebarTreeElement = this.element.createChild("ol", "sidebar-tree"); |
219 sidebarTreeElement.addEventListener("mousemove", this._onMouseMove.bind(this ), false); | 220 sidebarTreeElement.addEventListener("mousemove", this._onMouseMove.bind(this ), false); |
220 sidebarTreeElement.addEventListener("mouseout", this._onMouseMove.bind(this) , false); | 221 sidebarTreeElement.addEventListener("mouseout", this._onMouseMove.bind(this) , false); |
221 sidebarTreeElement.addEventListener("contextmenu", this._onContextMenu.bind( this), true); | 222 sidebarTreeElement.addEventListener("contextmenu", this._onContextMenu.bind( this), true); |
222 this.sidebarTree = new TreeOutline(sidebarTreeElement); | 223 this.sidebarTree = new TreeOutline(sidebarTreeElement); |
223 this._popoverHelper = new WebInspector.ObjectPopoverHelper(this.element, thi s._getHoverAnchor.bind(this), this._resolveObjectForPopover.bind(this), undefine d, true); | |
224 | 224 |
225 this._reset(); | 225 this._reset(); |
226 } | 226 } |
227 | 227 |
228 WebInspector.PaintProfilerCommandLogView.prototype = { | 228 WebInspector.PaintProfilerCommandLogView.prototype = { |
229 /** | 229 /** |
230 * @param {?WebInspector.Target} target | 230 * @param {?WebInspector.Target} target |
231 * @param {!Array.<!WebInspector.PaintProfilerLogItem>=} log | 231 * @param {!Array.<!WebInspector.PaintProfilerLogItem>=} log |
232 */ | 232 */ |
233 setCommandLog: function(target, log) | 233 setCommandLog: function(target, log) |
(...skipping 17 matching lines...) Expand all Loading... | |
251 this.sidebarTree.appendChild(node); | 251 this.sidebarTree.appendChild(node); |
252 } | 252 } |
253 }, | 253 }, |
254 | 254 |
255 _reset: function() | 255 _reset: function() |
256 { | 256 { |
257 this._log = []; | 257 this._log = []; |
258 }, | 258 }, |
259 | 259 |
260 /** | 260 /** |
261 * @param {!Element} target | |
262 * @return {!Element} | |
263 */ | |
264 _getHoverAnchor: function(target) | |
265 { | |
266 return /** @type {!Element} */ (target.enclosingNodeOrSelfWithNodeName(" span")); | |
267 }, | |
268 | |
269 /** | |
270 * @param {!Element} element | |
271 * @param {function(!WebInspector.RemoteObject, boolean, !Element=):undefine d} showCallback | |
272 */ | |
273 _resolveObjectForPopover: function(element, showCallback) | |
274 { | |
275 var liElement = element.enclosingNodeOrSelfWithNodeName("li"); | |
276 var logItem = liElement.treeElement.representedObject; | |
277 var obj = {"method": logItem.method}; | |
278 if (logItem.params) | |
279 obj.params = logItem.params; | |
280 showCallback(WebInspector.RemoteObject.fromLocalObject(obj), false); | |
281 }, | |
282 | |
283 /** | |
284 * @param {?Event} event | 261 * @param {?Event} event |
285 */ | 262 */ |
286 _onMouseMove: function(event) | 263 _onMouseMove: function(event) |
287 { | 264 { |
288 var node = this.sidebarTree.treeElementFromPoint(event.pageX, event.page Y); | 265 var node = this.sidebarTree.treeElementFromPoint(event.pageX, event.page Y); |
289 if (node === this._lastHoveredNode) | 266 if (node === this._lastHoveredNode || !(node instanceof WebInspector.Log TreeElement)) |
290 return; | 267 return; |
291 if (this._lastHoveredNode) | 268 if (this._lastHoveredNode) |
292 this._lastHoveredNode.setHovered(false); | 269 this._lastHoveredNode.setHovered(false); |
293 this._lastHoveredNode = node; | 270 this._lastHoveredNode = node; |
294 if (this._lastHoveredNode) | 271 if (this._lastHoveredNode) |
295 this._lastHoveredNode.setHovered(true); | 272 this._lastHoveredNode.setHovered(true); |
296 }, | 273 }, |
297 | 274 |
298 /** | 275 /** |
299 * @param {?Event} event | 276 * @param {?Event} event |
300 */ | 277 */ |
301 _onContextMenu: function(event) | 278 _onContextMenu: function(event) |
302 { | 279 { |
303 if (!this._target) | 280 if (!this._target) |
304 return; | 281 return; |
305 var node = this.sidebarTree.treeElementFromPoint(event.pageX, event.page Y); | 282 var node = this.sidebarTree.treeElementFromPoint(event.pageX, event.page Y); |
306 if (!node || !node.representedObject) | 283 if (!node || !node.representedObject || !(node instanceof WebInspector.L ogTreeElement)) |
307 return; | 284 return; |
308 var logItem = /** @type {!WebInspector.PaintProfilerLogItem} */ (node.re presentedObject); | 285 var logItem = /** @type {!WebInspector.PaintProfilerLogItem} */ (node.re presentedObject); |
309 if (!logItem.nodeId()) | 286 if (!logItem.nodeId()) |
310 return; | 287 return; |
311 var contextMenu = new WebInspector.ContextMenu(event); | 288 var contextMenu = new WebInspector.ContextMenu(event); |
312 var domNode = new WebInspector.DeferredDOMNode(this._target, logItem.nod eId()); | 289 var domNode = new WebInspector.DeferredDOMNode(this._target, logItem.nod eId()); |
313 contextMenu.appendApplicableItems(domNode); | 290 contextMenu.appendApplicableItems(domNode); |
314 contextMenu.show(); | 291 contextMenu.show(); |
315 }, | 292 }, |
316 | 293 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
365 str += this._paramToString(params[key], key); | 342 str += this._paramToString(params[key], key); |
366 } | 343 } |
367 return str; | 344 return str; |
368 }, | 345 }, |
369 | 346 |
370 _update: function() | 347 _update: function() |
371 { | 348 { |
372 var logItem = this.representedObject; | 349 var logItem = this.representedObject; |
373 var title = document.createDocumentFragment(); | 350 var title = document.createDocumentFragment(); |
374 title.createChild("div", "selection"); | 351 title.createChild("div", "selection"); |
375 var span = title.createChild("span"); | 352 var section = new WebInspector.ObjectPropertiesSection(WebInspector.Remo teObject.fromLocalObject(logItem.params), logItem.method); |
376 var textContent = logItem.method; | 353 title.appendChild(section.element); |
377 if (logItem.params) | |
378 textContent += "(" + this._paramsToString(logItem.params) + ")"; | |
caseq
2014/07/21 14:36:41
We still want this, so that we can have a quick ov
malch
2014/07/22 07:22:25
Done.
| |
379 span.textContent = textContent; | |
380 this.title = title; | 354 this.title = title; |
381 }, | 355 }, |
382 | 356 |
383 /** | 357 /** |
384 * @param {boolean} hovered | 358 * @param {boolean} hovered |
385 */ | 359 */ |
386 setHovered: function(hovered) | 360 setHovered: function(hovered) |
387 { | 361 { |
388 this.listItemElement.classList.toggle("hovered", hovered); | 362 this.listItemElement.classList.toggle("hovered", hovered); |
389 var target = this._ownerView._target; | 363 var target = this._ownerView._target; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
503 var method = logItem.method.toTitleCase(); | 477 var method = logItem.method.toTitleCase(); |
504 | 478 |
505 var logItemCategories = WebInspector.PaintProfilerView._initLogItemCategorie s(); | 479 var logItemCategories = WebInspector.PaintProfilerView._initLogItemCategorie s(); |
506 var result = logItemCategories[method]; | 480 var result = logItemCategories[method]; |
507 if (!result) { | 481 if (!result) { |
508 result = WebInspector.PaintProfilerView.categories()["misc"]; | 482 result = WebInspector.PaintProfilerView.categories()["misc"]; |
509 logItemCategories[method] = result; | 483 logItemCategories[method] = result; |
510 } | 484 } |
511 return result; | 485 return result; |
512 } | 486 } |
OLD | NEW |