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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/NetworkTimelineColumn.js

Issue 2466633002: [Devtools] Fixed scrollers for new timeline canvas on mac (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/network/networkTimelineColumn.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.VBox} 7 * @extends {WebInspector.VBox}
8 * @param {number} rowHeight 8 * @param {number} rowHeight
9 * @param {!WebInspector.NetworkTimeCalculator} calculator 9 * @param {!WebInspector.NetworkTimeCalculator} calculator
10 */ 10 */
11 WebInspector.NetworkTimelineColumn = function(rowHeight, calculator) 11 WebInspector.NetworkTimelineColumn = function(rowHeight, calculator)
12 { 12 {
13 // TODO(allada) Make this a shadowDOM when the NetworkTimelineColumn gets mo ved into NetworkLogViewColumns. 13 // TODO(allada) Make this a shadowDOM when the NetworkTimelineColumn gets mo ved into NetworkLogViewColumns.
14 WebInspector.VBox.call(this, false); 14 WebInspector.VBox.call(this, false);
15 this.registerRequiredCSS("network/networkTimelineColumn.css"); 15 this.registerRequiredCSS("network/networkTimelineColumn.css");
16 16
17 this._canvas = this.contentElement.createChild("canvas"); 17 this._canvas = this.contentElement.createChild("canvas");
18 this._canvas.tabIndex = 1; 18 this._canvas.tabIndex = 1;
19 this.setDefaultFocusedElement(this._canvas); 19 this.setDefaultFocusedElement(this._canvas);
20 this._canvasPosition = this._canvas.getBoundingClientRect();
20 21
21 /** @const */ 22 /** @const */
22 this._leftPadding = 5; 23 this._leftPadding = 5;
23 /** @const */ 24 /** @const */
24 this._fontSize = 10; 25 this._fontSize = 10;
25 26
26 this._rightPadding = 0; 27 this._rightPadding = 0;
27 28
28 this._rowHeight = rowHeight; 29 this._rowHeight = rowHeight;
29 this._headerHeight = 0; 30 this._headerHeight = 0;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 */ 94 */
94 _getPopoverAnchor: function(element, event) 95 _getPopoverAnchor: function(element, event)
95 { 96 {
96 if (!this._hoveredRequest) 97 if (!this._hoveredRequest)
97 return; 98 return;
98 99
99 var range = WebInspector.RequestTimingView.calculateRequestTimeRanges(th is._hoveredRequest, 0).find(data => data.name === "total"); 100 var range = WebInspector.RequestTimingView.calculateRequestTimeRanges(th is._hoveredRequest, 0).find(data => data.name === "total");
100 var start = this._timeToPosition(range.start); 101 var start = this._timeToPosition(range.start);
101 var end = this._timeToPosition(range.end); 102 var end = this._timeToPosition(range.end);
102 103
103 if (event.offsetX < start || event.offsetX > end) 104 if (event.clientX < this._canvasPosition.left + start || event.clientX > this._canvasPosition.left + end)
104 return; 105 return;
105 106
106 var rowIndex = this._requestData.findIndex(request => this._hoveredReque st === request); 107 var rowIndex = this._requestData.findIndex(request => this._hoveredReque st === request);
107 var barHeight = this._getBarHeight(range.name); 108 var barHeight = this._getBarHeight(range.name);
108 var y = this._headerHeight + (this._rowHeight * rowIndex - this._scrollT op) + ((this._rowHeight - barHeight) / 2); 109 var y = this._headerHeight + (this._rowHeight * rowIndex - this._scrollT op) + ((this._rowHeight - barHeight) / 2);
109 110
110 if (event.offsetY < y || event.offsetY > y + barHeight) 111 if (event.clientY < this._canvasPosition.top + y || event.clientY > this ._canvasPosition.top + y + barHeight)
111 return; 112 return;
112 113
113 var anchorBox = this.element.boxInWindow(); 114 var anchorBox = this.element.boxInWindow();
114 anchorBox.x += start; 115 anchorBox.x += start;
115 anchorBox.y += y; 116 anchorBox.y += y;
116 anchorBox.width = end - start; 117 anchorBox.width = end - start;
117 anchorBox.height = barHeight; 118 anchorBox.height = barHeight;
118 return anchorBox; 119 return anchorBox;
119 }, 120 },
120 121
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 { 231 {
231 WebInspector.VBox.prototype.onResize.call(this); 232 WebInspector.VBox.prototype.onResize.call(this);
232 this._calculateCanvasSize(); 233 this._calculateCanvasSize();
233 this.scheduleDraw(); 234 this.scheduleDraw();
234 }, 235 },
235 236
236 _calculateCanvasSize: function() 237 _calculateCanvasSize: function()
237 { 238 {
238 this._offsetWidth = this.contentElement.offsetWidth - this._rightPadding ; 239 this._offsetWidth = this.contentElement.offsetWidth - this._rightPadding ;
239 this._offsetHeight = this.contentElement.offsetHeight; 240 this._offsetHeight = this.contentElement.offsetHeight;
241 this._canvasPosition = this._canvas.getBoundingClientRect();
240 }, 242 },
241 243
242 /** 244 /**
243 * @param {!WebInspector.RequestTimeRangeNames} type 245 * @param {!WebInspector.RequestTimeRangeNames} type
244 * @return {string} 246 * @return {string}
245 */ 247 */
246 _colorForType: function(type) 248 _colorForType: function(type)
247 { 249 {
248 var types = WebInspector.RequestTimeRangeNames; 250 var types = WebInspector.RequestTimeRangeNames;
249 switch (type) { 251 switch (type) {
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 color = this._rowNavigationRequestColor; 613 color = this._rowNavigationRequestColor;
612 614
613 context.fillStyle = color; 615 context.fillStyle = color;
614 context.rect(0, y, this._offsetWidth, this._rowHeight); 616 context.rect(0, y, this._offsetWidth, this._rowHeight);
615 context.fill(); 617 context.fill();
616 context.restore(); 618 context.restore();
617 }, 619 },
618 620
619 __proto__: WebInspector.VBox.prototype 621 __proto__: WebInspector.VBox.prototype
620 }; 622 };
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/network/networkTimelineColumn.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698