Commit 0f32f3cf authored by malch@chromium.org's avatar malch@chromium.org

Remove popover and add properties section for paint profiler log.

Review URL: https://codereview.chromium.org/393123007

Review URL: https://codereview.chromium.org/393123007

git-svn-id: svn://svn.chromium.org/blink/trunk@180458 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 770a69e2
...@@ -3,8 +3,6 @@ Canvas log: ...@@ -3,8 +3,6 @@ Canvas log:
{ {
0 : { 0 : {
method : "save" method : "save"
params : {
}
} }
1 : { 1 : {
method : "drawRect" method : "drawRect"
...@@ -147,8 +145,6 @@ Canvas log: ...@@ -147,8 +145,6 @@ Canvas log:
} }
4 : { 4 : {
method : "save" method : "save"
params : {
}
} }
5 : { 5 : {
method : "clipRect" method : "clipRect"
...@@ -172,8 +168,6 @@ Canvas log: ...@@ -172,8 +168,6 @@ Canvas log:
} }
7 : { 7 : {
method : "save" method : "save"
params : {
}
} }
8 : { 8 : {
method : "clipRect" method : "clipRect"
......
...@@ -110,3 +110,16 @@ ...@@ -110,3 +110,16 @@
.paint-profiler-canvas-container .overview-grid-window-resizer { .paint-profiler-canvas-container .overview-grid-window-resizer {
z-index: 2000; z-index: 2000;
} }
.paint-profiler-view canvas {
height: 100%;
width: 100%;
}
.profiler-log-view .console-formatted-string {
white-space: nowrap;
}
.profiler-log-view.section .properties {
display: block;
}
\ No newline at end of file
...@@ -651,7 +651,7 @@ WebInspector.Layers3DView.prototype = { ...@@ -651,7 +651,7 @@ WebInspector.Layers3DView.prototype = {
var node = activeObject && activeObject.layer && activeObject.layer.nodeForSelfOrAncestor(); var node = activeObject && activeObject.layer && activeObject.layer.nodeForSelfOrAncestor();
var contextMenu = new WebInspector.ContextMenu(event); var contextMenu = new WebInspector.ContextMenu(event);
contextMenu.appendItem(WebInspector.UIString("Reset View"), this._transformController.resetAndNotify.bind(this._transformController), false); contextMenu.appendItem(WebInspector.UIString("Reset View"), this._transformController.resetAndNotify.bind(this._transformController), false);
if (activeObject.type() === WebInspector.Layers3DView.ActiveObject.Type.Tile) if (activeObject && activeObject.type() === WebInspector.Layers3DView.ActiveObject.Type.Tile)
contextMenu.appendItem(WebInspector.UIString("Jump to Paint Event"), this.dispatchEventToListeners.bind(this, WebInspector.Layers3DView.Events.JumpToPaintEventRequested, activeObject.traceEvent), false); contextMenu.appendItem(WebInspector.UIString("Jump to Paint Event"), this.dispatchEventToListeners.bind(this, WebInspector.Layers3DView.Events.JumpToPaintEventRequested, activeObject.traceEvent), false);
if (node) if (node)
contextMenu.appendApplicableItems(node); contextMenu.appendApplicableItems(node);
......
...@@ -245,13 +245,12 @@ WebInspector.PaintProfilerCommandLogView = function() ...@@ -245,13 +245,12 @@ WebInspector.PaintProfilerCommandLogView = function()
{ {
WebInspector.VBox.call(this); WebInspector.VBox.call(this);
this.setMinimumSize(100, 25); this.setMinimumSize(100, 25);
this.element.classList.add("outline-disclosure"); this.element.classList.add("outline-disclosure", "profiler-log-view", "section");
var sidebarTreeElement = this.element.createChild("ol", "sidebar-tree"); var sidebarTreeElement = this.element.createChild("ol", "sidebar-tree properties monospace");
sidebarTreeElement.addEventListener("mousemove", this._onMouseMove.bind(this), false); sidebarTreeElement.addEventListener("mousemove", this._onMouseMove.bind(this), false);
sidebarTreeElement.addEventListener("mouseout", this._onMouseMove.bind(this), false); sidebarTreeElement.addEventListener("mouseout", this._onMouseMove.bind(this), false);
sidebarTreeElement.addEventListener("contextmenu", this._onContextMenu.bind(this), true); sidebarTreeElement.addEventListener("contextmenu", this._onContextMenu.bind(this), true);
this.sidebarTree = new TreeOutline(sidebarTreeElement); this.sidebarTree = new TreeOutline(sidebarTreeElement);
this._popoverHelper = new WebInspector.ObjectPopoverHelper(this.element, this._getHoverAnchor.bind(this), this._resolveObjectForPopover.bind(this), undefined, true);
this._reset(); this._reset();
} }
...@@ -268,6 +267,16 @@ WebInspector.PaintProfilerCommandLogView.prototype = { ...@@ -268,6 +267,16 @@ WebInspector.PaintProfilerCommandLogView.prototype = {
this.updateWindow(); this.updateWindow();
}, },
/**
* @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=} stepLeft
* @param {number=} stepRight * @param {number=} stepRight
...@@ -277,10 +286,8 @@ WebInspector.PaintProfilerCommandLogView.prototype = { ...@@ -277,10 +286,8 @@ WebInspector.PaintProfilerCommandLogView.prototype = {
stepLeft = stepLeft || 0; stepLeft = stepLeft || 0;
stepRight = stepRight || this._log.length - 1; stepRight = stepRight || this._log.length - 1;
this.sidebarTree.removeChildren(); this.sidebarTree.removeChildren();
for (var i = stepLeft; i <= stepRight; ++i) { for (var i = stepLeft; i <= stepRight; ++i)
var node = new WebInspector.LogTreeElement(this, this._log[i]); this._appendLogItem(this.sidebarTree, this._log[i]);
this.sidebarTree.appendChild(node);
}
}, },
_reset: function() _reset: function()
...@@ -288,36 +295,13 @@ WebInspector.PaintProfilerCommandLogView.prototype = { ...@@ -288,36 +295,13 @@ WebInspector.PaintProfilerCommandLogView.prototype = {
this._log = []; this._log = [];
}, },
/**
* @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 * @param {?Event} event
*/ */
_onMouseMove: function(event) _onMouseMove: function(event)
{ {
var node = this.sidebarTree.treeElementFromPoint(event.pageX, event.pageY); var node = this.sidebarTree.treeElementFromPoint(event.pageX, event.pageY);
if (node === this._lastHoveredNode) if (node === this._lastHoveredNode || !(node instanceof WebInspector.LogTreeElement))
return; return;
if (this._lastHoveredNode) if (this._lastHoveredNode)
this._lastHoveredNode.setHovered(false); this._lastHoveredNode.setHovered(false);
...@@ -334,7 +318,7 @@ WebInspector.PaintProfilerCommandLogView.prototype = { ...@@ -334,7 +318,7 @@ WebInspector.PaintProfilerCommandLogView.prototype = {
if (!this._target) if (!this._target)
return; return;
var node = this.sidebarTree.treeElementFromPoint(event.pageX, event.pageY); var node = this.sidebarTree.treeElementFromPoint(event.pageX, event.pageY);
if (!node || !node.representedObject) if (!node || !node.representedObject || !(node instanceof WebInspector.LogTreeElement))
return; return;
var logItem = /** @type {!WebInspector.PaintProfilerLogItem} */ (node.representedObject); var logItem = /** @type {!WebInspector.PaintProfilerLogItem} */ (node.representedObject);
if (!logItem.nodeId()) if (!logItem.nodeId())
...@@ -358,10 +342,25 @@ WebInspector.LogTreeElement = function(ownerView, logItem) ...@@ -358,10 +342,25 @@ WebInspector.LogTreeElement = function(ownerView, logItem)
{ {
TreeElement.call(this, "", logItem); TreeElement.call(this, "", logItem);
this._ownerView = ownerView; this._ownerView = ownerView;
this._update(); this._filled = false;
} }
WebInspector.LogTreeElement.prototype = { 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 {!Object} param
* @param {string} name * @param {string} name
...@@ -403,11 +402,7 @@ WebInspector.LogTreeElement.prototype = { ...@@ -403,11 +402,7 @@ WebInspector.LogTreeElement.prototype = {
var logItem = this.representedObject; var logItem = this.representedObject;
var title = document.createDocumentFragment(); var title = document.createDocumentFragment();
title.createChild("div", "selection"); title.createChild("div", "selection");
var span = title.createChild("span"); title.createTextChild(logItem.method + "(" + this._paramsToString(logItem.params) + ")");
var textContent = logItem.method;
if (logItem.params)
textContent += "(" + this._paramsToString(logItem.params) + ")";
span.textContent = textContent;
this.title = title; this.title = title;
}, },
...@@ -444,6 +439,52 @@ WebInspector.LogTreeElement.prototype = { ...@@ -444,6 +439,52 @@ WebInspector.LogTreeElement.prototype = {
__proto__: TreeElement.prototype __proto__: TreeElement.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()
{
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-" + property.value === null ? "null" : typeof property.value);
}
this.title = title;
},
__proto__: TreeElement.prototype
}
/** /**
* @return {!Object.<string, !WebInspector.PaintProfilerCategory>} * @return {!Object.<string, !WebInspector.PaintProfilerCategory>}
*/ */
......
...@@ -391,7 +391,7 @@ void LoggingCanvas::didConcat(const SkMatrix& matrix) ...@@ -391,7 +391,7 @@ void LoggingCanvas::didConcat(const SkMatrix& matrix)
void LoggingCanvas::willSave() void LoggingCanvas::willSave()
{ {
AutoLogger logger(this); AutoLogger logger(this);
RefPtr<JSONObject> params = logger.logItemWithParams("save"); RefPtr<JSONObject> params = logger.logItem("save");
this->SkCanvas::willSave(); this->SkCanvas::willSave();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment