Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: Source/devtools/front_end/timeline/PaintProfilerView.js

Issue 393123007: DevTools: Remove popover and add properties section for paint profiler log. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed ObjectPropertiesSection. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/devtools/front_end/layersPanel.css ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 }; 238 };
239 239
240 /** 240 /**
241 * @constructor 241 * @constructor
242 * @extends {WebInspector.VBox} 242 * @extends {WebInspector.VBox}
243 */ 243 */
244 WebInspector.PaintProfilerCommandLogView = function() 244 WebInspector.PaintProfilerCommandLogView = function()
245 { 245 {
246 WebInspector.VBox.call(this); 246 WebInspector.VBox.call(this);
247 this.setMinimumSize(100, 25); 247 this.setMinimumSize(100, 25);
248 this.element.classList.add("outline-disclosure"); 248 this.element.classList.add("outline-disclosure", "profiler-log-view", "secti on");
249 var sidebarTreeElement = this.element.createChild("ol", "sidebar-tree"); 249 var sidebarTreeElement = this.element.createChild("ol", "sidebar-tree proper ties monospace");
250 sidebarTreeElement.addEventListener("mousemove", this._onMouseMove.bind(this ), false); 250 sidebarTreeElement.addEventListener("mousemove", this._onMouseMove.bind(this ), false);
251 sidebarTreeElement.addEventListener("mouseout", this._onMouseMove.bind(this) , false); 251 sidebarTreeElement.addEventListener("mouseout", this._onMouseMove.bind(this) , false);
252 sidebarTreeElement.addEventListener("contextmenu", this._onContextMenu.bind( this), true); 252 sidebarTreeElement.addEventListener("contextmenu", this._onContextMenu.bind( this), true);
253 this.sidebarTree = new TreeOutline(sidebarTreeElement); 253 this.sidebarTree = new TreeOutline(sidebarTreeElement);
254 this._popoverHelper = new WebInspector.ObjectPopoverHelper(this.element, thi s._getHoverAnchor.bind(this), this._resolveObjectForPopover.bind(this), undefine d, true);
255 254
256 this._reset(); 255 this._reset();
257 } 256 }
258 257
259 WebInspector.PaintProfilerCommandLogView.prototype = { 258 WebInspector.PaintProfilerCommandLogView.prototype = {
260 /** 259 /**
261 * @param {?WebInspector.Target} target 260 * @param {?WebInspector.Target} target
262 * @param {!Array.<!WebInspector.PaintProfilerLogItem>=} log 261 * @param {!Array.<!WebInspector.PaintProfilerLogItem>=} log
263 */ 262 */
264 setCommandLog: function(target, log) 263 setCommandLog: function(target, log)
265 { 264 {
266 this._target = target; 265 this._target = target;
267 this._log = log; 266 this._log = log;
268 this.updateWindow(); 267 this.updateWindow();
269 }, 268 },
270 269
271 /** 270 /**
272 * @param {number=} stepLeft 271 * @param {number=} stepLeft
273 * @param {number=} stepRight 272 * @param {number=} stepRight
274 */ 273 */
275 updateWindow: function(stepLeft, stepRight) 274 updateWindow: function(stepLeft, stepRight)
276 { 275 {
277 stepLeft = stepLeft || 0; 276 stepLeft = stepLeft || 0;
278 stepRight = stepRight || this._log.length - 1; 277 stepRight = stepRight || this._log.length - 1;
279 this.sidebarTree.removeChildren(); 278 this.sidebarTree.removeChildren();
280 for (var i = stepLeft; i <= stepRight; ++i) { 279 for (var i = stepLeft; i <= stepRight; ++i) {
281 var node = new WebInspector.LogTreeElement(this, this._log[i]); 280 WebInspector.LogTreeElement.appendLogItem(this.sidebarTree, this, th is._log[i]);
caseq 2014/07/31 13:00:11 Let's make it an instance method of PaintProfilerC
malch 2014/07/31 13:55:54 Done.
282 this.sidebarTree.appendChild(node);
283 } 281 }
284 }, 282 },
285 283
286 _reset: function() 284 _reset: function()
287 { 285 {
288 this._log = []; 286 this._log = [];
289 }, 287 },
290 288
291 /** 289 /**
292 * @param {!Element} target
293 * @return {!Element}
294 */
295 _getHoverAnchor: function(target)
296 {
297 return /** @type {!Element} */ (target.enclosingNodeOrSelfWithNodeName(" span"));
298 },
299
300 /**
301 * @param {!Element} element
302 * @param {function(!WebInspector.RemoteObject, boolean, !Element=):undefine d} showCallback
303 */
304 _resolveObjectForPopover: function(element, showCallback)
305 {
306 var liElement = element.enclosingNodeOrSelfWithNodeName("li");
307 var logItem = liElement.treeElement.representedObject;
308 var obj = {"method": logItem.method};
309 if (logItem.params)
310 obj.params = logItem.params;
311 showCallback(WebInspector.RemoteObject.fromLocalObject(obj), false);
312 },
313
314 /**
315 * @param {?Event} event 290 * @param {?Event} event
316 */ 291 */
317 _onMouseMove: function(event) 292 _onMouseMove: function(event)
318 { 293 {
319 var node = this.sidebarTree.treeElementFromPoint(event.pageX, event.page Y); 294 var node = this.sidebarTree.treeElementFromPoint(event.pageX, event.page Y);
320 if (node === this._lastHoveredNode) 295 if (node === this._lastHoveredNode || !(node instanceof WebInspector.Log TreeElement))
321 return; 296 return;
322 if (this._lastHoveredNode) 297 if (this._lastHoveredNode)
323 this._lastHoveredNode.setHovered(false); 298 this._lastHoveredNode.setHovered(false);
324 this._lastHoveredNode = node; 299 this._lastHoveredNode = node;
325 if (this._lastHoveredNode) 300 if (this._lastHoveredNode)
326 this._lastHoveredNode.setHovered(true); 301 this._lastHoveredNode.setHovered(true);
327 }, 302 },
328 303
329 /** 304 /**
330 * @param {?Event} event 305 * @param {?Event} event
331 */ 306 */
332 _onContextMenu: function(event) 307 _onContextMenu: function(event)
333 { 308 {
334 if (!this._target) 309 if (!this._target)
335 return; 310 return;
336 var node = this.sidebarTree.treeElementFromPoint(event.pageX, event.page Y); 311 var node = this.sidebarTree.treeElementFromPoint(event.pageX, event.page Y);
337 if (!node || !node.representedObject) 312 if (!node || !node.representedObject || !(node instanceof WebInspector.L ogTreeElement))
338 return; 313 return;
339 var logItem = /** @type {!WebInspector.PaintProfilerLogItem} */ (node.re presentedObject); 314 var logItem = /** @type {!WebInspector.PaintProfilerLogItem} */ (node.re presentedObject);
340 if (!logItem.nodeId()) 315 if (!logItem.nodeId())
341 return; 316 return;
342 var contextMenu = new WebInspector.ContextMenu(event); 317 var contextMenu = new WebInspector.ContextMenu(event);
343 var domNode = new WebInspector.DeferredDOMNode(this._target, logItem.nod eId()); 318 var domNode = new WebInspector.DeferredDOMNode(this._target, logItem.nod eId());
344 contextMenu.appendApplicableItems(domNode); 319 contextMenu.appendApplicableItems(domNode);
345 contextMenu.show(); 320 contextMenu.show();
346 }, 321 },
347 322
348 __proto__: WebInspector.VBox.prototype 323 __proto__: WebInspector.VBox.prototype
349 }; 324 };
350 325
351 /** 326 /**
352 * @constructor 327 * @constructor
353 * @param {!WebInspector.PaintProfilerCommandLogView} ownerView 328 * @param {!WebInspector.PaintProfilerCommandLogView} ownerView
354 * @param {!WebInspector.PaintProfilerLogItem} logItem 329 * @param {!WebInspector.PaintProfilerLogItem} logItem
355 * @extends {TreeElement} 330 * @extends {TreeElement}
356 */ 331 */
357 WebInspector.LogTreeElement = function(ownerView, logItem) 332 WebInspector.LogTreeElement = function(ownerView, logItem)
358 { 333 {
359 TreeElement.call(this, "", logItem); 334 TreeElement.call(this, "yo", logItem);
caseq 2014/07/31 13:00:11 yo!
malch 2014/07/31 13:55:53 Done.
360 this._ownerView = ownerView; 335 this._ownerView = ownerView;
361 this._update(); 336 this._update();
362 } 337 }
363 338
364 WebInspector.LogTreeElement.prototype = { 339 WebInspector.LogTreeElement.prototype = {
365 /** 340 /**
366 * @param {!Object} param 341 * @param {!Object} param
367 * @param {string} name 342 * @param {string} name
368 * @return {string} 343 * @return {string}
369 */ 344 */
(...skipping 26 matching lines...) Expand all
396 str += this._paramToString(params[key], key); 371 str += this._paramToString(params[key], key);
397 } 372 }
398 return str; 373 return str;
399 }, 374 },
400 375
401 _update: function() 376 _update: function()
402 { 377 {
403 var logItem = this.representedObject; 378 var logItem = this.representedObject;
404 var title = document.createDocumentFragment(); 379 var title = document.createDocumentFragment();
405 title.createChild("div", "selection"); 380 title.createChild("div", "selection");
406 var span = title.createChild("span");
407 var textContent = logItem.method; 381 var textContent = logItem.method;
408 if (logItem.params) 382 textContent += "(" + this._paramsToString(logItem.params) + ")";
caseq 2014/07/31 13:00:11 just inline above line + this one into the below c
malch 2014/07/31 13:55:54 Done.
409 textContent += "(" + this._paramsToString(logItem.params) + ")"; 383 title.createTextChild(textContent);
410 span.textContent = textContent;
411 this.title = title; 384 this.title = title;
412 }, 385 },
413 386
414 /** 387 /**
415 * @param {boolean} hovered 388 * @param {boolean} hovered
416 */ 389 */
417 setHovered: function(hovered) 390 setHovered: function(hovered)
418 { 391 {
419 this.listItemElement.classList.toggle("hovered", hovered); 392 this.listItemElement.classList.toggle("hovered", hovered);
420 var target = this._ownerView._target; 393 var target = this._ownerView._target;
(...skipping 17 matching lines...) Expand all
438 { 411 {
439 if (node) 412 if (node)
440 node.highlight(); 413 node.highlight();
441 } 414 }
442 }, 415 },
443 416
444 __proto__: TreeElement.prototype 417 __proto__: TreeElement.prototype
445 }; 418 };
446 419
447 /** 420 /**
421 * @param {!TreeOutline} treeOutline
422 * @param {!WebInspector.PaintProfilerCommandLogView} ownerView
423 * @param {!WebInspector.PaintProfilerLogItem} logItem
424 */
425 WebInspector.LogTreeElement.appendLogItem = function(treeOutline, ownerView, log Item)
426 {
427 var first = new WebInspector.LogTreeElement(ownerView, logItem);
428 treeOutline.appendChild(first);
429 for (var param in logItem.params)
430 WebInspector.LogPropertyTreeElement.appendLogPropertyItem(first, param, logItem.params[param]);
431 };
432
433 /**
434 * @constructor
435 * @param {!{name: string, value}} property
436 * @extends {TreeElement}
437 */
438 WebInspector.LogPropertyTreeElement = function(property)
439 {
440 TreeElement.call(this, "", property);
441 };
442
443 WebInspector.LogPropertyTreeElement.prototype = {
444 onattach: function()
445 {
446 this._update();
447 },
448
449 /**
450 * @param {*} value
451 * @return {string}
452 */
453 _type: function(value)
454 {
455 return value === null ? "null" : typeof value;
456 },
457
458 _update: function()
459 {
460 var property = this.representedObject;
461 var title = document.createDocumentFragment();
462 title.createChild("div", "selection");
463 var nameElement = title.createChild("span", "name");
464 nameElement.textContent = property.name;
465 var separatorElement = title.createChild("span", "separator");
466 separatorElement.textContent = ": ";
467 if (property.value === null || typeof property.value !== "object") {
468 var valueElement = title.createChild("span", "value");
469 valueElement.textContent = JSON.stringify(property.value);
470 valueElement.classList.add("console-formatted-" + this._type(propert y.value));
471 }
472 this.title = title;
473 },
474
475 __proto__: TreeElement.prototype
476 };
477
478 /**
479 * @param {!TreeElement} element
480 * @param {string} name
481 * @param {*} value
482 */
483 WebInspector.LogPropertyTreeElement.appendLogPropertyItem = function(element, na me, value)
caseq 2014/07/31 13:48:39 make it _private and move just after LogPropertyTr
malch 2014/07/31 13:55:53 Done.
484 {
485 var treeElement = new WebInspector.LogPropertyTreeElement({name: name, value : value});
486 element.appendChild(treeElement);
487 if (value && typeof value === "object") {
488 for (var property in value)
489 WebInspector.LogPropertyTreeElement.appendLogPropertyItem(treeElemen t, property, value[property]);
490 }
491 };
492
493 /**
448 * @return {!Object.<string, !WebInspector.PaintProfilerCategory>} 494 * @return {!Object.<string, !WebInspector.PaintProfilerCategory>}
449 */ 495 */
450 WebInspector.PaintProfilerView.categories = function() 496 WebInspector.PaintProfilerView.categories = function()
451 { 497 {
452 if (WebInspector.PaintProfilerView._categories) 498 if (WebInspector.PaintProfilerView._categories)
453 return WebInspector.PaintProfilerView._categories; 499 return WebInspector.PaintProfilerView._categories;
454 WebInspector.PaintProfilerView._categories = { 500 WebInspector.PaintProfilerView._categories = {
455 shapes: new WebInspector.PaintProfilerCategory("shapes", WebInspector.UI String("Shapes"), "rgb(255, 161, 129)"), 501 shapes: new WebInspector.PaintProfilerCategory("shapes", WebInspector.UI String("Shapes"), "rgb(255, 161, 129)"),
456 bitmap: new WebInspector.PaintProfilerCategory("bitmap", WebInspector.UI String("Bitmap"), "rgb(136, 196, 255)"), 502 bitmap: new WebInspector.PaintProfilerCategory("bitmap", WebInspector.UI String("Bitmap"), "rgb(136, 196, 255)"),
457 text: new WebInspector.PaintProfilerCategory("text", WebInspector.UIStri ng("Text"), "rgb(180, 255, 137)"), 503 text: new WebInspector.PaintProfilerCategory("text", WebInspector.UIStri ng("Text"), "rgb(180, 255, 137)"),
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 var method = logItem.method.toTitleCase(); 580 var method = logItem.method.toTitleCase();
535 581
536 var logItemCategories = WebInspector.PaintProfilerView._initLogItemCategorie s(); 582 var logItemCategories = WebInspector.PaintProfilerView._initLogItemCategorie s();
537 var result = logItemCategories[method]; 583 var result = logItemCategories[method];
538 if (!result) { 584 if (!result) {
539 result = WebInspector.PaintProfilerView.categories()["misc"]; 585 result = WebInspector.PaintProfilerView.categories()["misc"];
540 logItemCategories[method] = result; 586 logItemCategories[method] = result;
541 } 587 }
542 return result; 588 return result;
543 } 589 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/layersPanel.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698