Index: third_party/WebKit/Source/devtools/front_end/network/NetworkWaterfallColumn.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/network/NetworkWaterfallColumn.js b/third_party/WebKit/Source/devtools/front_end/network/NetworkWaterfallColumn.js |
index 54af4f218bb43dbcd2d61fca7bf1a0f1ed234e0a..5ca15a5a14147efaf962297995fe0701ed45a4fc 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/network/NetworkWaterfallColumn.js |
+++ b/third_party/WebKit/Source/devtools/front_end/network/NetworkWaterfallColumn.js |
@@ -478,41 +478,34 @@ Network.NetworkWaterfallColumn = class extends UI.VBox { |
if (node.hovered()) { |
labels = this._calculator.computeBarGraphLabels(request); |
- // TODO(allada) This will be inlined in an immidate next patch. |
- const leftText = labels.left; |
- const rightText = labels.right; |
- const startX = ranges.start; |
- const midX = ranges.mid; |
- const endX = ranges.mid + barWidth + borderOffset; |
- const currentY = y; |
- |
const barDotLineLength = 10; |
context.save(); |
- var leftLabelWidth = context.measureText(leftText).width; |
- var rightLabelWidth = context.measureText(rightText).width; |
+ var leftLabelWidth = context.measureText(labels.left).width; |
+ var rightLabelWidth = context.measureText(labels.right).width; |
context.fillStyle = UI.themeSupport.patchColor('#888', UI.ThemeSupport.ColorUsage.Foreground); |
context.strokeStyle = UI.themeSupport.patchColor('#888', UI.ThemeSupport.ColorUsage.Foreground); |
- if (leftLabelWidth < midX - startX) { |
- const midBarX = startX + (midX - startX) / 2 - leftLabelWidth / 2; |
- this._textLayers.push({text: leftText, x: midBarX, y: currentY + this._fontSize}); |
- } else if (barDotLineLength + leftLabelWidth + this._leftPadding < startX) { |
+ if (leftLabelWidth < ranges.mid - ranges.start) { |
+ const midBarX = ranges.start + (ranges.mid - ranges.start) / 2 - leftLabelWidth / 2; |
caseq
2017/03/02 23:30:23
nit: this could really be
midBarX = (ranges.star
allada
2017/03/03 04:07:43
Done.
|
+ this._textLayers.push({text: labels.left, x: midBarX, y: y + this._fontSize}); |
+ } else if (barDotLineLength + leftLabelWidth + this._leftPadding < ranges.start) { |
this._textLayers.push( |
- {text: leftText, x: startX - leftLabelWidth - barDotLineLength - 1, y: currentY + this._fontSize}); |
+ {text: labels.left, x: ranges.start - leftLabelWidth - barDotLineLength - 1, y: y + this._fontSize}); |
context.beginPath(); |
- context.arc(startX, Math.floor(height / 2), 2, 0, 2 * Math.PI); |
+ context.arc(ranges.start, Math.floor(height / 2), 2, 0, 2 * Math.PI); |
context.fill(); |
context.beginPath(); |
context.lineWidth = 1; |
- context.moveTo(startX - barDotLineLength, Math.floor(height / 2)); |
- context.lineTo(startX, Math.floor(height / 2)); |
+ context.moveTo(ranges.start - barDotLineLength, Math.floor(height / 2)); |
+ context.lineTo(ranges.start, Math.floor(height / 2)); |
context.stroke(); |
} |
- if (rightLabelWidth < endX - midX) { |
- var midBarX = midX + (endX - midX) / 2 - rightLabelWidth / 2; |
- this._textLayers.push({text: rightText, x: midBarX, y: currentY + this._fontSize}); |
+ const endX = ranges.mid + barWidth + borderOffset; |
+ if (rightLabelWidth < endX - ranges.mid) { |
+ var midBarX = ranges.mid + (endX - ranges.mid) / 2 - rightLabelWidth / 2; |
+ this._textLayers.push({text: labels.right, x: midBarX, y: y + this._fontSize}); |
} else if (endX + barDotLineLength + rightLabelWidth < this._offsetWidth - this._leftPadding) { |
- this._textLayers.push({text: rightText, x: endX + barDotLineLength + 1, y: currentY + this._fontSize}); |
+ this._textLayers.push({text: labels.right, x: endX + barDotLineLength + 1, y: y + this._fontSize}); |
caseq
2017/03/02 23:30:23
ditto. actually, it would perhaps be nice to dedup
allada
2017/03/03 04:07:43
These branches do quite different things. They bot
|
context.beginPath(); |
context.arc(endX, Math.floor(height / 2), 2, 0, 2 * Math.PI); |
context.fill(); |