Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(637)

Unified Diff: third_party/WebKit/Source/devtools/front_end/network/NetworkWaterfallColumn.js

Issue 2726183004: [Devtools] Finished inlining function for _drawSimplifiedBars (Closed)
Patch Set: Merge branch 'z-round1-commitable-4-split' into z-round1-commitable-5-split Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 70322a5fb0ec2ecb06442896649e0f8bacbc6a4b..ec6d1156ca41ef1627e2ab7314949d4305ef1ed9 100644
--- a/third_party/WebKit/Source/devtools/front_end/network/NetworkWaterfallColumn.js
+++ b/third_party/WebKit/Source/devtools/front_end/network/NetworkWaterfallColumn.js
@@ -475,41 +475,34 @@ Network.NetworkWaterfallColumn = class extends UI.VBox {
var labels = null;
if (node.hovered()) {
labels = this._calculator.computeBarGraphLabels(request);
- // TODO(allada) This will be inlined in an immidate next patch.
- var leftText = labels.left;
- var rightText = labels.right;
- var startX = ranges.start;
- var midX = ranges.mid;
- var endX = ranges.mid + barWidth + borderOffset;
- var currentY = y;
-
- var barDotLineLength = 10;
+ 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) {
- var 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) {
+ var midBarX = ranges.start + (ranges.mid - ranges.start - leftLabelWidth) / 2;
+ 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});
+ var endX = ranges.mid + barWidth + borderOffset;
+ if (rightLabelWidth < endX - ranges.mid) {
+ var midBarX = ranges.mid + (endX - ranges.mid - 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});
context.beginPath();
context.arc(endX, Math.floor(height / 2), 2, 0, 2 * Math.PI);
context.fill();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698