Index: tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_view.html |
diff --git a/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_view.html b/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_view.html |
index 870e8a800edfb126f4f99ea70ca4e5d97a6e86fa..2f59a26039828d2a39c0ec0b95ceb1ed535fdc8a 100644 |
--- a/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_view.html |
+++ b/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_view.html |
@@ -119,8 +119,7 @@ tr.exportTo('tr.ui.e.chrome.cc', function() { |
}, |
processPictureData_: function() { |
- if (this.pictureOps_ === undefined) |
- return; |
+ if (this.pictureOps_ === undefined) return; |
var totalOpCost = 0; |
@@ -144,8 +143,9 @@ tr.exportTo('tr.ui.e.chrome.cc', function() { |
var index = undefined; |
if (this.pictureOps_ === undefined || |
- this.pictureOps_.length === 0) |
+ this.pictureOps_.length === 0) { |
return index; |
+ } |
var x = e.offsetX; |
var y = e.offsetY; |
@@ -157,8 +157,9 @@ tr.exportTo('tr.ui.e.chrome.cc', function() { |
var chartBottom = this.chartHeight_ - CHART_PADDING_BOTTOM; |
var chartRight = chartLeft + totalBarWidth; |
- if (x < chartLeft || x > chartRight || y < chartTop || y > chartBottom) |
+ if (x < chartLeft || x > chartRight || y < chartTop || y > chartBottom) { |
return index; |
+ } |
index = Math.floor((x - chartLeft) / totalBarWidth * |
this.pictureOps_.length); |
@@ -171,14 +172,14 @@ tr.exportTo('tr.ui.e.chrome.cc', function() { |
onClick_: function(e) { |
var barClicked = this.extractBarIndex_(e); |
- if (barClicked === undefined) |
- return; |
+ if (barClicked === undefined) return; |
// If we click on the already selected item we should deselect. |
- if (barClicked === this.selectedOpIndex) |
+ if (barClicked === this.selectedOpIndex) { |
this.selectedOpIndex = undefined; |
- else |
+ } else { |
this.selectedOpIndex = barClicked; |
+ } |
e.preventDefault(); |
@@ -189,15 +190,17 @@ tr.exportTo('tr.ui.e.chrome.cc', function() { |
var lastBarMouseOverTarget = this.currentBarMouseOverTarget_; |
this.currentBarMouseOverTarget_ = this.extractBarIndex_(e); |
- if (this.currentBarMouseOverTarget_ === lastBarMouseOverTarget) |
+ if (this.currentBarMouseOverTarget_ === lastBarMouseOverTarget) { |
return; |
+ } |
this.drawChartContents_(); |
}, |
scrollSelectedItemIntoViewIfNecessary: function() { |
- if (this.selectedOpIndex === undefined) |
+ if (this.selectedOpIndex === undefined) { |
return; |
+ } |
var width = this.offsetWidth; |
var left = this.scrollLeft; |
@@ -205,28 +208,30 @@ tr.exportTo('tr.ui.e.chrome.cc', function() { |
var targetLeft = CHART_PADDING_LEFT + |
(BAR_WIDTH + BAR_PADDING) * this.selectedOpIndex; |
- if (targetLeft > left && targetLeft < right) |
+ if (targetLeft > left && targetLeft < right) { |
return; |
+ } |
this.scrollLeft = (targetLeft - width * 0.5); |
}, |
updateChartContents: function() { |
- if (this.dimensionsHaveChanged) |
+ if (this.dimensionsHaveChanged) { |
this.updateChartDimensions_(); |
+ } |
this.drawChartContents_(); |
}, |
updateChartDimensions_: function() { |
- if (!this.pictureOps_) |
- return; |
+ if (!this.pictureOps_) return; |
var width = CHART_PADDING_LEFT + CHART_PADDING_RIGHT + |
((BAR_WIDTH + BAR_PADDING) * this.pictureOps_.length); |
- if (width < this.offsetWidth) |
+ if (width < this.offsetWidth) { |
width = this.offsetWidth; |
+ } |
// Allow the element to be its natural size as set by flexbox, then lock |
// the width in before we set the width of the canvas. |
@@ -263,15 +268,17 @@ tr.exportTo('tr.ui.e.chrome.cc', function() { |
this.drawLinesAtTickMarks_(); |
this.drawLineAtBottomOfChart_(); |
- if (this.currentBarMouseOverTarget_ === undefined) |
+ if (this.currentBarMouseOverTarget_ === undefined) { |
return; |
+ } |
this.drawTooltip_(); |
}, |
drawSelection_: function() { |
- if (this.selectedOpIndex === undefined) |
+ if (this.selectedOpIndex === undefined) { |
return; |
+ } |
var width = (BAR_WIDTH + BAR_PADDING) * this.selectedOpIndex; |
this.chartCtx_.fillStyle = 'rgb(223, 235, 230)'; |
@@ -422,10 +429,11 @@ tr.exportTo('tr.ui.e.chrome.cc', function() { |
CHART_PADDING_TOP; |
var maxValue; |
- if (this.usePercentileScale) |
+ if (this.usePercentileScale) { |
maxValue = this.ninetyFifthPercentileCost_; |
- else |
+ } else { |
maxValue = this.maxCost_; |
+ } |
for (var b = 0; b < this.pictureOps_.length; b++) { |
op = this.pictureOps_[b]; |
@@ -435,10 +443,11 @@ tr.exportTo('tr.ui.e.chrome.cc', function() { |
opHover = (b === this.currentBarMouseOverTarget_); |
opColor = this.getOpColor_(op.cmd_string, opHover); |
- if (b === this.selectedOpIndex) |
+ if (b === this.selectedOpIndex) { |
this.chartCtx_.fillStyle = '#FFFF00'; |
- else |
+ } else { |
this.chartCtx_.fillStyle = opColor; |
+ } |
this.chartCtx_.fillRect(CHART_PADDING_LEFT + b * opWidth, |
bottom - opHeight, BAR_WIDTH, opHeight); |