Chromium Code Reviews| Index: Source/devtools/front_end/timeline/TracingTimelineUIUtils.js |
| diff --git a/Source/devtools/front_end/timeline/TracingTimelineUIUtils.js b/Source/devtools/front_end/timeline/TracingTimelineUIUtils.js |
| index 943d718acb0d136e62a16815726aceb0182b2def..ea8905a81b0534021536283fec46c8a17d3e42f6 100644 |
| --- a/Source/devtools/front_end/timeline/TracingTimelineUIUtils.js |
| +++ b/Source/devtools/front_end/timeline/TracingTimelineUIUtils.js |
| @@ -632,6 +632,7 @@ WebInspector.TracingTimelineUIUtils._buildTraceEventDetailsSynchronously = funct |
| case recordTypes.RecalculateStyles: // We don't want to see default details. |
| contentHelper.appendTextRow(WebInspector.UIString("Elements affected"), event.args["elementCount"]); |
| callStackLabel = WebInspector.UIString("Styles recalculation forced"); |
| + // FIXME: Show invalidation tracking for updating style. |
| break; |
| case recordTypes.Layout: |
| var beginData = event.args["beginData"]; |
| @@ -642,6 +643,10 @@ WebInspector.TracingTimelineUIUtils._buildTraceEventDetailsSynchronously = funct |
| callSiteStackTraceLabel = WebInspector.UIString("Layout invalidated"); |
| callStackLabel = WebInspector.UIString("Layout forced"); |
| relatedNodeLabel = WebInspector.UIString("Layout root"); |
| + // FIXME: Show invalidation tracking for updating layout. |
| + break; |
| + case recordTypes.UpdateLayerTree: |
| + // FIXME: Show invalidation tracking for updating the layer tree. |
| break; |
| case recordTypes.ConsoleTime: |
| contentHelper.appendTextRow(WebInspector.UIString("Message"), eventData["message"]); |
| @@ -691,6 +696,17 @@ WebInspector.TracingTimelineUIUtils._buildTraceEventDetailsSynchronously = funct |
| } |
| if (event.previewElement) |
| contentHelper.appendElementRow(WebInspector.UIString("Preview"), event.previewElement); |
| + |
| + // Show invalidation tracking. |
| + if (event.styleInvalidationTrackingEvents && event.styleInvalidationTrackingEvents.length) { |
| + contentHelper.element.appendChild( |
| + this._buildInvalidationDetailsNode("Style invalidations", linkifier, event, event.styleInvalidationTrackingEvents)); |
|
caseq
2014/08/26 12:19:07
Display strings should be passed via WebInspector.
|
| + } |
| + if (event.layoutInvalidationTrackingEvents && event.layoutInvalidationTrackingEvents.length) { |
| + contentHelper.element.appendChild( |
| + this._buildInvalidationDetailsNode("Layout invalidations", linkifier, event, event.layoutInvalidationTrackingEvents)); |
| + } |
| + |
| fragment.appendChild(contentHelper.element); |
| return fragment; |
| } |
| @@ -801,6 +817,53 @@ WebInspector.TracingTimelineUIUtils._createEventDivider = function(recordType, t |
| } |
| /** |
| + * TODO: write me |
| + */ |
| +WebInspector.TracingTimelineUIUtils._buildInvalidationDetailsNode = function(title, linkifier, event, invalidationEvents) |
| +{ |
| + var detailsNode = document.createElement("div"); |
| + detailsNode.className = "timeline-details-view-row"; |
| + var titleElement = document.createElement("span"); |
| + titleElement.className = "timeline-details-view-row-title"; |
| + titleElement.textContent = WebInspector.UIString("%s: ", title); |
| + detailsNode.appendChild(titleElement); |
| + var eventsList = document.createElement("ol"); |
| + detailsNode.appendChild(eventsList); |
| + |
| + invalidationEvents.forEach(function(invalidationEvent, idx) { |
|
caseq
2014/08/26 12:19:08
Does this produce readable output for large invali
|
| + var row = document.createElement("li"); |
| + eventsList.appendChild(row); |
| + |
| + var nodeRow = document.createElement("div"); |
| + row.appendChild(nodeRow); |
| + var target = event.thread.target(); |
| + var node = target.domModel.nodeForId(invalidationEvent.nodeId); |
|
caseq
2014/08/26 12:19:07
Does this actually work? It looks like it shouldn'
|
| + if (node) |
| + nodeRow.appendChild(WebInspector.DOMPresentationUtils.linkifyNodeReference(node)); |
| + else if (invalidationEvent.nodeName) |
| + nodeRow.textContent = '[' + invalidationEvent.nodeName + ']'; |
| + else |
| + nodeRow.textContent = '[ unknown node ]'; |
| + |
| + var callstack = invalidationEvent.callstack ? JSON.parse(invalidationEvent.callstack) : []; |
| + if (callstack.length > 0) { |
| + var callstackRow = document.createElement("div"); |
| + row.appendChild(callstackRow); |
| + callstack.forEach(function(stackFrame) { |
| + var frameRow = document.createElement("div"); |
| + frameRow.className = "timeline-details-view-row monospace"; |
| + callstackRow.appendChild(frameRow); |
| + frameRow.textContent = stackFrame.functionName || WebInspector.UIString("(anonymous function)"); |
| + frameRow.textContent += " @ "; |
| + var urlElement = linkifier.linkifyScriptLocation(target, stackFrame.scriptId, stackFrame.url, stackFrame.lineNumber - 1, stackFrame.columnNumber - 1); |
| + frameRow.appendChild(urlElement); |
| + }); |
| + } |
| + }); |
| + return detailsNode; |
| +} |
| + |
| +/** |
| * @return {!Array.<string>} |
| */ |
| WebInspector.TracingTimelineUIUtils._visibleTypes = function() |