Index: third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js |
index 63529f44c6e61e41fed52b44b6669ef31b9ca78f..f7764ac425e9cb7b7c9b974a543bee22bda59627 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js |
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js |
@@ -65,6 +65,14 @@ WebInspector.TimelineTreeView.prototype = { |
}, |
/** |
+ * @return {boolean} |
+ */ |
+ _exposePercentages: function() |
+ { |
+ return false; |
+ }, |
+ |
+ /** |
* @param {!Element} parent |
*/ |
_populateToolbar: function(parent) { }, |
@@ -333,25 +341,9 @@ WebInspector.TimelineTreeView.GridNode.prototype = { |
{ |
if (columnIdentifier !== "self" && columnIdentifier !== "total" && columnIdentifier !== "startTime") |
return null; |
- /** |
- * @param {number} time |
- * @return {string} |
- */ |
- function formatMilliseconds(time) |
- { |
- return WebInspector.UIString("%.1f\u2009ms", time); |
- } |
- /** |
- * @param {number} value |
- * @return {string} |
- */ |
- function formatPercent(value) |
- { |
- return WebInspector.UIString("%.1f\u2009%%", value); |
- } |
+ var showPercents = false; |
var value; |
- var percentText; |
var maxTime; |
switch (columnIdentifier) { |
case "startTime": |
@@ -359,13 +351,13 @@ WebInspector.TimelineTreeView.GridNode.prototype = { |
break; |
case "self": |
value = this._profileNode.selfTime; |
- percentText = formatPercent(this._profileNode.selfTime / this._grandTotalTime * 100); |
maxTime = this._maxSelfTime; |
+ showPercents = true; |
break; |
case "total": |
value = this._profileNode.totalTime; |
- percentText = formatPercent(this._profileNode.totalTime / this._grandTotalTime * 100); |
maxTime = this._maxTotalTime; |
+ showPercents = true; |
break; |
default: |
return null; |
@@ -373,13 +365,14 @@ WebInspector.TimelineTreeView.GridNode.prototype = { |
var cell = this.createTD(columnIdentifier); |
cell.className = "numeric-column"; |
var textDiv = cell.createChild("div"); |
- textDiv.createChild("span").textContent = formatMilliseconds(value); |
- if (percentText) { |
- textDiv.createChild("span", "percent-column").textContent = percentText; |
- textDiv.classList.add("profile-multiple-values"); |
- } |
- if (maxTime) |
+ textDiv.createChild("span").textContent = WebInspector.UIString("%.1f\u2009ms", value); |
+ |
+ if (showPercents && this._treeView._exposePercentages()) |
+ textDiv.createChild("span", "percent-column").textContent = WebInspector.UIString("%.1f\u2009%%", value / this._grandTotalTime * 100); |
+ if (maxTime) { |
+ textDiv.classList.add("background-percent-bar"); |
cell.createChild("div", "background-bar-container").createChild("div", "background-bar").style.width = (value * 100 / maxTime).toFixed(1) + "%"; |
+ } |
return cell; |
}, |
@@ -472,6 +465,15 @@ WebInspector.AggregatedTimelineTreeView.prototype = { |
panelToolbar.appendToolbarItem(this._groupByCombobox); |
}, |
+ /** |
+ * @override |
+ * @return {boolean} |
+ */ |
+ _exposePercentages: function() |
+ { |
+ return true; |
+ }, |
+ |
_onGroupByChanged: function() |
{ |
this._groupBySetting.set(this._groupByCombobox.selectedOption().value); |