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

Unified 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: More fixes. Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/timeline/Layers3DView.js ('k') | Source/platform/graphics/LoggingCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/timeline/PaintProfilerView.js
diff --git a/Source/devtools/front_end/timeline/PaintProfilerView.js b/Source/devtools/front_end/timeline/PaintProfilerView.js
index e71c33b97c097225103d0c4c508919603ddd2067..bb2b2b31c98b38822fe895374c2de7b7b3f0d6d9 100644
--- a/Source/devtools/front_end/timeline/PaintProfilerView.js
+++ b/Source/devtools/front_end/timeline/PaintProfilerView.js
@@ -245,13 +245,12 @@ WebInspector.PaintProfilerCommandLogView = function()
{
WebInspector.VBox.call(this);
this.setMinimumSize(100, 25);
- this.element.classList.add("outline-disclosure");
- var sidebarTreeElement = this.element.createChild("ol", "sidebar-tree");
+ this.element.classList.add("outline-disclosure", "profiler-log-view", "section");
+ var sidebarTreeElement = this.element.createChild("ol", "sidebar-tree properties monospace");
sidebarTreeElement.addEventListener("mousemove", this._onMouseMove.bind(this), false);
sidebarTreeElement.addEventListener("mouseout", this._onMouseMove.bind(this), false);
sidebarTreeElement.addEventListener("contextmenu", this._onContextMenu.bind(this), true);
this.sidebarTree = new TreeOutline(sidebarTreeElement);
- this._popoverHelper = new WebInspector.ObjectPopoverHelper(this.element, this._getHoverAnchor.bind(this), this._resolveObjectForPopover.bind(this), undefined, true);
this._reset();
}
@@ -269,6 +268,16 @@ WebInspector.PaintProfilerCommandLogView.prototype = {
},
/**
+ * @param {!TreeOutline} treeOutline
+ * @param {!WebInspector.PaintProfilerLogItem} logItem
+ */
+ _appendLogItem: function(treeOutline, logItem)
+ {
+ var treeElement = new WebInspector.LogTreeElement(this, logItem);
+ treeOutline.appendChild(treeElement);
+ },
+
+ /**
* @param {number=} stepLeft
* @param {number=} stepRight
*/
@@ -277,10 +286,8 @@ WebInspector.PaintProfilerCommandLogView.prototype = {
stepLeft = stepLeft || 0;
stepRight = stepRight || this._log.length - 1;
this.sidebarTree.removeChildren();
- for (var i = stepLeft; i <= stepRight; ++i) {
- var node = new WebInspector.LogTreeElement(this, this._log[i]);
- this.sidebarTree.appendChild(node);
- }
+ for (var i = stepLeft; i <= stepRight; ++i)
+ this._appendLogItem(this.sidebarTree, this._log[i]);
},
_reset: function()
@@ -289,35 +296,12 @@ WebInspector.PaintProfilerCommandLogView.prototype = {
},
/**
- * @param {!Element} target
- * @return {!Element}
- */
- _getHoverAnchor: function(target)
- {
- return /** @type {!Element} */ (target.enclosingNodeOrSelfWithNodeName("span"));
- },
-
- /**
- * @param {!Element} element
- * @param {function(!WebInspector.RemoteObject, boolean, !Element=):undefined} showCallback
- */
- _resolveObjectForPopover: function(element, showCallback)
- {
- var liElement = element.enclosingNodeOrSelfWithNodeName("li");
- var logItem = liElement.treeElement.representedObject;
- var obj = {"method": logItem.method};
- if (logItem.params)
- obj.params = logItem.params;
- showCallback(WebInspector.RemoteObject.fromLocalObject(obj), false);
- },
-
- /**
* @param {?Event} event
*/
_onMouseMove: function(event)
{
var node = this.sidebarTree.treeElementFromPoint(event.pageX, event.pageY);
- if (node === this._lastHoveredNode)
+ if (node === this._lastHoveredNode || !(node instanceof WebInspector.LogTreeElement))
return;
if (this._lastHoveredNode)
this._lastHoveredNode.setHovered(false);
@@ -334,7 +318,7 @@ WebInspector.PaintProfilerCommandLogView.prototype = {
if (!this._target)
return;
var node = this.sidebarTree.treeElementFromPoint(event.pageX, event.pageY);
- if (!node || !node.representedObject)
+ if (!node || !node.representedObject || !(node instanceof WebInspector.LogTreeElement))
return;
var logItem = /** @type {!WebInspector.PaintProfilerLogItem} */ (node.representedObject);
if (!logItem.nodeId())
@@ -358,10 +342,25 @@ WebInspector.LogTreeElement = function(ownerView, logItem)
{
TreeElement.call(this, "", logItem);
this._ownerView = ownerView;
- this._update();
+ this._filled = false;
}
WebInspector.LogTreeElement.prototype = {
+ onattach: function()
+ {
+ this._update();
+ this.hasChildren = !!this.representedObject.params;
+ },
+
+ onexpand: function()
+ {
+ if (this._filled)
+ return;
+ this._filled = true;
+ for (var param in this.representedObject.params)
+ WebInspector.LogPropertyTreeElement._appendLogPropertyItem(this, param, this.representedObject.params[param]);
+ },
+
/**
* @param {!Object} param
* @param {string} name
@@ -403,11 +402,7 @@ WebInspector.LogTreeElement.prototype = {
var logItem = this.representedObject;
var title = document.createDocumentFragment();
title.createChild("div", "selection");
- var span = title.createChild("span");
- var textContent = logItem.method;
- if (logItem.params)
- textContent += "(" + this._paramsToString(logItem.params) + ")";
- span.textContent = textContent;
+ title.createTextChild(logItem.method + "(" + this._paramsToString(logItem.params) + ")");
this.title = title;
},
@@ -445,6 +440,66 @@ WebInspector.LogTreeElement.prototype = {
};
/**
+ * @constructor
+ * @param {!{name: string, value}} property
+ * @extends {TreeElement}
+ */
+WebInspector.LogPropertyTreeElement = function(property)
+{
+ TreeElement.call(this, "", property);
+};
+
+/**
+ * @param {!TreeElement} element
+ * @param {string} name
+ * @param {*} value
+ */
+WebInspector.LogPropertyTreeElement._appendLogPropertyItem = function(element, name, value)
+{
+ var treeElement = new WebInspector.LogPropertyTreeElement({name: name, value: value});
+ element.appendChild(treeElement);
+ if (value && typeof value === "object") {
+ for (var property in value)
+ WebInspector.LogPropertyTreeElement._appendLogPropertyItem(treeElement, property, value[property]);
+ }
+};
+
+WebInspector.LogPropertyTreeElement.prototype = {
+ onattach: function()
+ {
+ this._update();
pfeldman 2014/07/31 16:34:28 inline?
malch 2014/08/13 08:46:52 Done.
+ },
+
+ /**
+ * @param {*} value
+ * @return {string}
+ */
+ _type: function(value)
+ {
+ return value === null ? "null" : typeof value;
pfeldman 2014/07/31 16:34:28 inline?
malch 2014/08/13 08:46:52 Done.
+ },
+
+ _update: function()
+ {
+ var property = this.representedObject;
+ var title = document.createDocumentFragment();
+ title.createChild("div", "selection");
+ var nameElement = title.createChild("span", "name");
+ nameElement.textContent = property.name;
+ var separatorElement = title.createChild("span", "separator");
+ separatorElement.textContent = ": ";
+ if (property.value === null || typeof property.value !== "object") {
+ var valueElement = title.createChild("span", "value");
+ valueElement.textContent = JSON.stringify(property.value);
+ valueElement.classList.add("console-formatted-" + this._type(property.value));
+ }
+ this.title = title;
+ },
+
+ __proto__: TreeElement.prototype
+};
pfeldman 2014/07/31 16:34:28 drop ;
malch 2014/08/13 08:46:52 Done.
+
+/**
* @return {!Object.<string, !WebInspector.PaintProfilerCategory>}
*/
WebInspector.PaintProfilerView.categories = function()
« no previous file with comments | « Source/devtools/front_end/timeline/Layers3DView.js ('k') | Source/platform/graphics/LoggingCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698