Modified: trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js (144758 => 144759)
--- trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js 2013-03-05 15:00:00 UTC (rev 144758)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js 2013-03-05 15:29:16 UTC (rev 144759)
@@ -489,13 +489,13 @@
var duration = endTime - startTime;
var offset = this._minimumRecordTime;
- var contentHelper = new WebInspector.TimelinePresentationModel.PopupContentHelper(WebInspector.UIString("CPU"));
+ var contentHelper = new WebInspector.PopoverContentHelper(WebInspector.UIString("CPU"));
var durationText = WebInspector.UIString("%s (at %s)", Number.secondsToString(duration, true),
Number.secondsToString(startTime - offset, true));
- contentHelper._appendTextRow(WebInspector.UIString("Duration"), durationText);
- contentHelper._appendTextRow(WebInspector.UIString("CPU time"), Number.secondsToString(cpuTime, true));
- contentHelper._appendTextRow(WebInspector.UIString("Message Count"), messageCount);
- return contentHelper._contentTable;
+ contentHelper.appendTextRow(WebInspector.UIString("Duration"), durationText);
+ contentHelper.appendTextRow(WebInspector.UIString("CPU time"), Number.secondsToString(cpuTime, true));
+ contentHelper.appendTextRow(WebInspector.UIString("Message Count"), messageCount);
+ return contentHelper.contentTable();
},
__proto__: WebInspector.Object.prototype
@@ -872,15 +872,15 @@
*/
_generatePopupContentWithImagePreview: function(callback, previewElement)
{
- var contentHelper = new WebInspector.TimelinePresentationModel.PopupContentHelper(this.title);
+ var contentHelper = new WebInspector.PopoverContentHelper(this.title);
var text = WebInspector.UIString("%s (at %s)", Number.secondsToString(this._lastChildEndTime - this.startTime, true),
Number.secondsToString(this._startTimeOffset));
- contentHelper._appendTextRow(WebInspector.UIString("Duration"), text);
+ contentHelper.appendTextRow(WebInspector.UIString("Duration"), text);
if (this._children.length) {
- contentHelper._appendTextRow(WebInspector.UIString("Self Time"), Number.secondsToString(this._selfTime, true));
- contentHelper._appendTextRow(WebInspector.UIString("CPU Time"), Number.secondsToString(this._cpuTime, true));
- contentHelper._appendElementRow(WebInspector.UIString("Aggregated Time"),
+ contentHelper.appendTextRow(WebInspector.UIString("Self Time"), Number.secondsToString(this._selfTime, true));
+ contentHelper.appendTextRow(WebInspector.UIString("CPU Time"), Number.secondsToString(this._cpuTime, true));
+ contentHelper.appendElementRow(WebInspector.UIString("Aggregated Time"),
WebInspector.TimelinePresentationModel._generateAggregatedInfo(this._aggregatedStats));
}
const recordTypes = WebInspector.TimelineModel.RecordType;
@@ -891,47 +891,47 @@
switch (this.type) {
case recordTypes.GCEvent:
- contentHelper._appendTextRow(WebInspector.UIString("Collected"), Number.bytesToString(this.data["usedHeapSizeDelta"]));
+ contentHelper.appendTextRow(WebInspector.UIString("Collected"), Number.bytesToString(this.data["usedHeapSizeDelta"]));
break;
case recordTypes.TimerInstall:
case recordTypes.TimerFire:
case recordTypes.TimerRemove:
- contentHelper._appendTextRow(WebInspector.UIString("Timer ID"), this.data["timerId"]);
+ contentHelper.appendTextRow(WebInspector.UIString("Timer ID"), this.data["timerId"]);
if (typeof this.timeout === "number") {
- contentHelper._appendTextRow(WebInspector.UIString("Timeout"), Number.secondsToString(this.timeout / 1000));
- contentHelper._appendTextRow(WebInspector.UIString("Repeats"), !this.singleShot);
+ contentHelper.appendTextRow(WebInspector.UIString("Timeout"), Number.secondsToString(this.timeout / 1000));
+ contentHelper.appendTextRow(WebInspector.UIString("Repeats"), !this.singleShot);
}
break;
case recordTypes.FireAnimationFrame:
- contentHelper._appendTextRow(WebInspector.UIString("Callback ID"), this.data["id"]);
+ contentHelper.appendTextRow(WebInspector.UIString("Callback ID"), this.data["id"]);
break;
case recordTypes.FunctionCall:
- contentHelper._appendElementRow(WebInspector.UIString("Location"), this._linkifyScriptLocation());
+ contentHelper.appendElementRow(WebInspector.UIString("Location"), this._linkifyScriptLocation());
break;
case recordTypes.ScheduleResourceRequest:
case recordTypes.ResourceSendRequest:
case recordTypes.ResourceReceiveResponse:
case recordTypes.ResourceReceivedData:
case recordTypes.ResourceFinish:
- contentHelper._appendElementRow(WebInspector.UIString("Resource"), WebInspector.linkifyResourceAsNode(this.url));
+ contentHelper.appendElementRow(WebInspector.UIString("Resource"), WebInspector.linkifyResourceAsNode(this.url));
if (previewElement)
- contentHelper._appendElementRow(WebInspector.UIString("Preview"), previewElement);
+ contentHelper.appendElementRow(WebInspector.UIString("Preview"), previewElement);
if (this.data["requestMethod"])
- contentHelper._appendTextRow(WebInspector.UIString("Request Method"), this.data["requestMethod"]);
+ contentHelper.appendTextRow(WebInspector.UIString("Request Method"), this.data["requestMethod"]);
if (typeof this.data["statusCode"] === "number")
- contentHelper._appendTextRow(WebInspector.UIString("Status Code"), this.data["statusCode"]);
+ contentHelper.appendTextRow(WebInspector.UIString("Status Code"), this.data["statusCode"]);
if (this.data["mimeType"])
- contentHelper._appendTextRow(WebInspector.UIString("MIME Type"), this.data["mimeType"]);
+ contentHelper.appendTextRow(WebInspector.UIString("MIME Type"), this.data["mimeType"]);
if (this.data["encodedDataLength"])
- contentHelper._appendTextRow(WebInspector.UIString("Encoded Data Length"), WebInspector.UIString("%d Bytes", this.data["encodedDataLength"]));
+ contentHelper.appendTextRow(WebInspector.UIString("Encoded Data Length"), WebInspector.UIString("%d Bytes", this.data["encodedDataLength"]));
break;
case recordTypes.EvaluateScript:
if (this.data && this.url)
- contentHelper._appendElementRow(WebInspector.UIString("Script"), this._linkifyLocation(this.url, this.data["lineNumber"]));
+ contentHelper.appendElementRow(WebInspector.UIString("Script"), this._linkifyLocation(this.url, this.data["lineNumber"]));
break;
case recordTypes.Paint:
- contentHelper._appendTextRow(WebInspector.UIString("Location"), WebInspector.UIString("(%d, %d)", this.data["x"], this.data["y"]));
- contentHelper._appendTextRow(WebInspector.UIString("Dimensions"), WebInspector.UIString("%d × %d", this.data["width"], this.data["height"]));
+ contentHelper.appendTextRow(WebInspector.UIString("Location"), WebInspector.UIString("(%d, %d)", this.data["x"], this.data["y"]));
+ contentHelper.appendTextRow(WebInspector.UIString("Dimensions"), WebInspector.UIString("%d × %d", this.data["width"], this.data["height"]));
break;
case recordTypes.RecalculateStyles: // We don't want to see default details.
callSiteStackTraceLabel = WebInspector.UIString("Styles invalidated");
@@ -941,51 +941,51 @@
callSiteStackTraceLabel = WebInspector.UIString("Layout invalidated");
if (this.stackTrace) {
callStackLabel = WebInspector.UIString("Layout forced");
- contentHelper._appendTextRow(WebInspector.UIString("Note"), WebInspector.UIString("Forced synchronous layout is a possible performance bottleneck."));
+ contentHelper.appendTextRow(WebInspector.UIString("Note"), WebInspector.UIString("Forced synchronous layout is a possible performance bottleneck."));
}
break;
case recordTypes.Time:
case recordTypes.TimeEnd:
- contentHelper._appendTextRow(WebInspector.UIString("Message"), this.data["message"]);
+ contentHelper.appendTextRow(WebInspector.UIString("Message"), this.data["message"]);
if (typeof this.intervalDuration === "number")
- contentHelper._appendTextRow(WebInspector.UIString("Interval Duration"), Number.secondsToString(this.intervalDuration, true));
+ contentHelper.appendTextRow(WebInspector.UIString("Interval Duration"), Number.secondsToString(this.intervalDuration, true));
break;
case recordTypes.WebSocketCreate:
case recordTypes.WebSocketSendHandshakeRequest:
case recordTypes.WebSocketReceiveHandshakeResponse:
case recordTypes.WebSocketDestroy:
if (typeof this.webSocketURL !== "undefined")
- contentHelper._appendTextRow(WebInspector.UIString("URL"), this.webSocketURL);
+ contentHelper.appendTextRow(WebInspector.UIString("URL"), this.webSocketURL);
if (typeof this.webSocketProtocol !== "undefined")
- contentHelper._appendTextRow(WebInspector.UIString("WebSocket Protocol"), this.webSocketProtocol);
+ contentHelper.appendTextRow(WebInspector.UIString("WebSocket Protocol"), this.webSocketProtocol);
if (typeof this.data["message"] !== "undefined")
- contentHelper._appendTextRow(WebInspector.UIString("Message"), this.data["message"])
+ contentHelper.appendTextRow(WebInspector.UIString("Message"), this.data["message"])
break;
default:
if (this.detailsNode())
- contentHelper._appendElementRow(WebInspector.UIString("Details"), this.detailsNode().childNodes[1].cloneNode());
+ contentHelper.appendElementRow(WebInspector.UIString("Details"), this.detailsNode().childNodes[1].cloneNode());
break;
}
if (this.scriptName && this.type !== recordTypes.FunctionCall)
- contentHelper._appendElementRow(WebInspector.UIString("Function Call"), this._linkifyScriptLocation());
+ contentHelper.appendElementRow(WebInspector.UIString("Function Call"), this._linkifyScriptLocation());
if (this.usedHeapSize) {
if (this.usedHeapSizeDelta) {
var sign = this.usedHeapSizeDelta > 0 ? "+" : "-";
- contentHelper._appendTextRow(WebInspector.UIString("Used Heap Size"),
+ contentHelper.appendTextRow(WebInspector.UIString("Used Heap Size"),
WebInspector.UIString("%s (%s%s)", Number.bytesToString(this.usedHeapSize), sign, Number.bytesToString(this.usedHeapSizeDelta)));
} else if (this.category === WebInspector.TimelinePresentationModel.categories().scripting)
- contentHelper._appendTextRow(WebInspector.UIString("Used Heap Size"), Number.bytesToString(this.usedHeapSize));
+ contentHelper.appendTextRow(WebInspector.UIString("Used Heap Size"), Number.bytesToString(this.usedHeapSize));
}
if (this.callSiteStackTrace)
- contentHelper._appendStackTrace(callSiteStackTraceLabel || WebInspector.UIString("Call Site stack"), this.callSiteStackTrace, this._linkifyCallFrame.bind(this));
+ contentHelper.appendStackTrace(callSiteStackTraceLabel || WebInspector.UIString("Call Site stack"), this.callSiteStackTrace, this._linkifyCallFrame.bind(this));
if (this.stackTrace)
- contentHelper._appendStackTrace(callStackLabel || WebInspector.UIString("Call Stack"), this.stackTrace, this._linkifyCallFrame.bind(this));
+ contentHelper.appendStackTrace(callStackLabel || WebInspector.UIString("Call Stack"), this.stackTrace, this._linkifyCallFrame.bind(this));
- callback(contentHelper._contentTable);
+ callback(contentHelper.contentTable());
},
_refreshDetails: function()
@@ -1176,94 +1176,19 @@
return cell;
}
-/**
- * @constructor
- * @param {string} title
- */
-WebInspector.TimelinePresentationModel.PopupContentHelper = function(title)
-{
- this._contentTable = document.createElement("table");
- var titleCell = this._createCell(WebInspector.UIString("%s - Details", title), "timeline-details-title");
- titleCell.colSpan = 2;
- var titleRow = document.createElement("tr");
- titleRow.appendChild(titleCell);
- this._contentTable.appendChild(titleRow);
-}
-
-WebInspector.TimelinePresentationModel.PopupContentHelper.prototype = {
- /**
- * @param {string=} styleName
- */
- _createCell: function(content, styleName)
- {
- var text = document.createElement("label");
- text.appendChild(document.createTextNode(content));
- var cell = document.createElement("td");
- cell.className = "timeline-details";
- if (styleName)
- cell.className += " " + styleName;
- cell.textContent = content;
- return cell;
- },
-
- _appendTextRow: function(title, content)
- {
- var row = document.createElement("tr");
- row.appendChild(this._createCell(title, "timeline-details-row-title"));
- row.appendChild(this._createCell(content, "timeline-details-row-data"));
- this._contentTable.appendChild(row);
- },
-
- /**
- * @param {string=} titleStyle
- */
- _appendElementRow: function(title, content, titleStyle)
- {
- var row = document.createElement("tr");
- var titleCell = this._createCell(title, "timeline-details-row-title");
- if (titleStyle)
- titleCell.addStyleClass(titleStyle);
- row.appendChild(titleCell);
- var cell = document.createElement("td");
- cell.className = "timeline-details";
- cell.appendChild(content);
- row.appendChild(cell);
- this._contentTable.appendChild(row);
- },
-
- _appendStackTrace: function(title, stackTrace, callFrameLinkifier)
- {
- this._appendTextRow("", "");
- var framesTable = document.createElement("table");
- for (var i = 0; i < stackTrace.length; ++i) {
- var stackFrame = stackTrace[i];
- var row = document.createElement("tr");
- row.className = "timeline-details";
- row.appendChild(this._createCell(stackFrame.functionName ? stackFrame.functionName : WebInspector.UIString("(anonymous function)"), "timeline-function-name"));
- row.appendChild(this._createCell(" @ "));
- var linkCell = document.createElement("td");
- var urlElement = callFrameLinkifier(stackFrame);
- linkCell.appendChild(urlElement);
- row.appendChild(linkCell);
- framesTable.appendChild(row);
- }
- this._appendElementRow(title, framesTable, "timeline-stacktrace-title");
- }
-}
-
WebInspector.TimelinePresentationModel.generatePopupContentForFrame = function(frame)
{
- var contentHelper = new WebInspector.TimelinePresentationModel.PopupContentHelper(WebInspector.UIString("Frame"));
+ var contentHelper = new WebInspector.PopoverContentHelper(WebInspector.UIString("Frame"));
var durationInSeconds = frame.endTime - frame.startTime;
var durationText = WebInspector.UIString("%s (at %s)", Number.secondsToString(frame.endTime - frame.startTime, true),
Number.secondsToString(frame.startTimeOffset, true));
- contentHelper._appendTextRow(WebInspector.UIString("Duration"), durationText);
- contentHelper._appendTextRow(WebInspector.UIString("FPS"), Math.floor(1 / durationInSeconds));
- contentHelper._appendTextRow(WebInspector.UIString("CPU time"), Number.secondsToString(frame.cpuTime, true));
- contentHelper._appendElementRow(WebInspector.UIString("Aggregated Time"),
+ contentHelper.appendTextRow(WebInspector.UIString("Duration"), durationText);
+ contentHelper.appendTextRow(WebInspector.UIString("FPS"), Math.floor(1 / durationInSeconds));
+ contentHelper.appendTextRow(WebInspector.UIString("CPU time"), Number.secondsToString(frame.cpuTime, true));
+ contentHelper.appendElementRow(WebInspector.UIString("Aggregated Time"),
WebInspector.TimelinePresentationModel._generateAggregatedInfo(frame.timeByCategory));
- return contentHelper._contentTable;
+ return contentHelper.contentTable();
}
/**
@@ -1279,18 +1204,18 @@
return WebInspector.UIString("%s (%.0f FPS)", Number.secondsToString(time, true), 1 / time);
}
- var contentHelper = new WebInspector.TimelinePresentationModel.PopupContentHelper(WebInspector.UIString("Selected Range"));
+ var contentHelper = new WebInspector.PopoverContentHelper(WebInspector.UIString("Selected Range"));
- contentHelper._appendTextRow(WebInspector.UIString("Selected range"), WebInspector.UIString("%s\u2013%s (%d frames)",
+ contentHelper.appendTextRow(WebInspector.UIString("Selected range"), WebInspector.UIString("%s\u2013%s (%d frames)",
Number.secondsToString(statistics.startOffset, true), Number.secondsToString(statistics.endOffset, true), statistics.frameCount));
- contentHelper._appendTextRow(WebInspector.UIString("Minimum Time"), formatTimeAndFPS(statistics.minDuration));
- contentHelper._appendTextRow(WebInspector.UIString("Average Time"), formatTimeAndFPS(statistics.average));
- contentHelper._appendTextRow(WebInspector.UIString("Maximum Time"), formatTimeAndFPS(statistics.maxDuration));
- contentHelper._appendTextRow(WebInspector.UIString("Standard Deviation"), Number.secondsToString(statistics.stddev, true));
- contentHelper._appendElementRow(WebInspector.UIString("Time by category"),
+ contentHelper.appendTextRow(WebInspector.UIString("Minimum Time"), formatTimeAndFPS(statistics.minDuration));
+ contentHelper.appendTextRow(WebInspector.UIString("Average Time"), formatTimeAndFPS(statistics.average));
+ contentHelper.appendTextRow(WebInspector.UIString("Maximum Time"), formatTimeAndFPS(statistics.maxDuration));
+ contentHelper.appendTextRow(WebInspector.UIString("Standard Deviation"), Number.secondsToString(statistics.stddev, true));
+ contentHelper.appendElementRow(WebInspector.UIString("Time by category"),
WebInspector.TimelinePresentationModel._generateAggregatedInfo(statistics.timeByCategory));
- return contentHelper._contentTable;
+ return contentHelper.contentTable();
}
/**
@@ -1395,3 +1320,5 @@
__proto__: WebInspector.Object.prototype
}
+
+//@ sourceURL=http://localhost/inspector/front-end/TimelinePresentationModel.js