Commit 2d8c7d99 authored by yurys@chromium.org's avatar yurys@chromium.org

Correctly calculate highlighted quad for tracing based timeline events

highlightQuad method is added to TimelineMode.Rectord. The method encapsulates logic specific to timeline events and trace events.

BUG=361045
R=caseq@chromium.org

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

git-svn-id: svn://svn.chromium.org/blink/trunk@175892 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 9154f23b
...@@ -387,6 +387,11 @@ WebInspector.TimelineModel.Record.prototype = { ...@@ -387,6 +387,11 @@ WebInspector.TimelineModel.Record.prototype = {
*/ */
data: function() { }, data: function() { },
/**
* @return {?Object}
*/
highlightQuad: function() { },
/** /**
* @return {string} * @return {string}
*/ */
......
...@@ -478,6 +478,26 @@ WebInspector.TimelineModel.RecordImpl.prototype = { ...@@ -478,6 +478,26 @@ WebInspector.TimelineModel.RecordImpl.prototype = {
return this._record.type; return this._record.type;
}, },
/**
* @return {?Object}
*/
highlightQuad: function()
{
var quad = null;
var recordTypes = WebInspector.TimelineModel.RecordType;
switch(this.type()) {
case recordTypes.Layout:
quad = this.data().root;
break;
case recordTypes.Paint:
quad = this.data().clip;
break;
default:
break;
}
return quad;
},
/** /**
* @return {string} * @return {string}
*/ */
......
...@@ -829,18 +829,7 @@ WebInspector.TimelineView.prototype = { ...@@ -829,18 +829,7 @@ WebInspector.TimelineView.prototype = {
return true; return true;
this._highlightedQuadRecord = record; this._highlightedQuadRecord = record;
var quad = null; var quad = record.highlightQuad();
var recordTypes = WebInspector.TimelineModel.RecordType;
switch(record.type()) {
case recordTypes.Layout:
quad = record.data().root;
break;
case recordTypes.Paint:
quad = record.data().clip;
break;
default:
return false;
}
if (!quad) if (!quad)
return false; return false;
record.target().domAgent().highlightQuad(quad, WebInspector.Color.PageHighlight.Content.toProtocolRGBA(), WebInspector.Color.PageHighlight.ContentOutline.toProtocolRGBA()); record.target().domAgent().highlightQuad(quad, WebInspector.Color.PageHighlight.Content.toProtocolRGBA(), WebInspector.Color.PageHighlight.ContentOutline.toProtocolRGBA());
......
...@@ -366,6 +366,7 @@ WebInspector.TracingTimelineModel.prototype = { ...@@ -366,6 +366,7 @@ WebInspector.TracingTimelineModel.prototype = {
var frameId = event.args["beginData"]["frame"]; var frameId = event.args["beginData"]["frame"];
event.initiator = this._layoutInvalidate[frameId]; event.initiator = this._layoutInvalidate[frameId];
event.backendNodeId = event.args["endData"]["rootNode"]; event.backendNodeId = event.args["endData"]["rootNode"];
event.highlightQuad = event.args["endData"]["root"];
this._layoutInvalidate[frameId] = null; this._layoutInvalidate[frameId] = null;
if (this._currentScriptEvent) if (this._currentScriptEvent)
event.warning = WebInspector.UIString("Forced synchronous layout is a possible performance bottleneck."); event.warning = WebInspector.UIString("Forced synchronous layout is a possible performance bottleneck.");
...@@ -392,6 +393,8 @@ WebInspector.TracingTimelineModel.prototype = { ...@@ -392,6 +393,8 @@ WebInspector.TracingTimelineModel.prototype = {
break; break;
case recordTypes.Paint: case recordTypes.Paint:
event.highlightQuad = event.args["data"]["clip"];
// Initionally fall through.
case recordTypes.ScrollLayer: case recordTypes.ScrollLayer:
event.backendNodeId = event.args["data"]["nodeId"]; event.backendNodeId = event.args["data"]["nodeId"];
break; break;
...@@ -580,6 +583,14 @@ WebInspector.TracingTimelineModel.TraceEventRecord.prototype = { ...@@ -580,6 +583,14 @@ WebInspector.TracingTimelineModel.TraceEventRecord.prototype = {
return this._event.name; return this._event.name;
}, },
/**
* @return {?Object}
*/
highlightQuad: function()
{
return this._event.highlightQuad || null;
},
/** /**
* @return {string} * @return {string}
*/ */
......
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