OLD | NEW |
---|---|
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 Network.NetworkWaterfallColumn = class extends UI.VBox { | 4 Network.NetworkWaterfallColumn = class extends UI.VBox { |
5 /** | 5 /** |
6 * @param {number} rowHeight | |
7 * @param {!Network.NetworkTimeCalculator} calculator | 6 * @param {!Network.NetworkTimeCalculator} calculator |
8 */ | 7 */ |
9 constructor(rowHeight, calculator) { | 8 constructor(calculator) { |
10 // TODO(allada) Make this a shadowDOM when the NetworkWaterfallColumn gets m oved into NetworkLogViewColumns. | 9 // TODO(allada) Make this a shadowDOM when the NetworkWaterfallColumn gets m oved into NetworkLogViewColumns. |
11 super(false); | 10 super(false); |
12 this.registerRequiredCSS('network/networkWaterfallColumn.css'); | 11 this.registerRequiredCSS('network/networkWaterfallColumn.css'); |
13 | 12 |
14 this._canvas = this.contentElement.createChild('canvas'); | 13 this._canvas = this.contentElement.createChild('canvas'); |
15 this._canvas.tabIndex = 1; | 14 this._canvas.tabIndex = 1; |
16 this.setDefaultFocusedElement(this._canvas); | 15 this.setDefaultFocusedElement(this._canvas); |
17 this._canvasPosition = this._canvas.getBoundingClientRect(); | 16 this._canvasPosition = this._canvas.getBoundingClientRect(); |
18 | 17 |
19 /** @const */ | 18 /** @const */ |
20 this._leftPadding = 5; | 19 this._leftPadding = 5; |
21 /** @const */ | 20 /** @const */ |
22 this._fontSize = 10; | 21 this._fontSize = 10; |
23 | 22 |
24 this._rightPadding = 0; | 23 this._rightPadding = 0; |
25 this._scrollTop = 0; | 24 this._scrollTop = 0; |
26 | 25 |
27 this._rowHeight = rowHeight; | |
28 this._headerHeight = 0; | 26 this._headerHeight = 0; |
29 this._calculator = calculator; | 27 this._calculator = calculator; |
30 | 28 |
29 this._rawRowHeight = 0; | |
allada
2017/05/16 21:40:07
I think a short comment explaining the difference
pfeldman
2017/05/16 22:34:16
Done.
| |
30 this._rowHeight = 0; | |
31 | |
31 this._offsetWidth = 0; | 32 this._offsetWidth = 0; |
32 this._offsetHeight = 0; | 33 this._offsetHeight = 0; |
33 this._startTime = this._calculator.minimumBoundary(); | 34 this._startTime = this._calculator.minimumBoundary(); |
34 this._endTime = this._calculator.maximumBoundary(); | 35 this._endTime = this._calculator.maximumBoundary(); |
35 | 36 |
36 this._popoverHelper = new UI.PopoverHelper(this.element, this._getPopoverReq uest.bind(this)); | 37 this._popoverHelper = new UI.PopoverHelper(this.element, this._getPopoverReq uest.bind(this)); |
37 this._popoverHelper.setHasPadding(true); | 38 this._popoverHelper.setHasPadding(true); |
38 this._popoverHelper.setTimeout(300, 300); | 39 this._popoverHelper.setTimeout(300, 300); |
39 | 40 |
40 /** @type {!Array<!Network.NetworkNode>} */ | 41 /** @type {!Array<!Network.NetworkNode>} */ |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 this._hoveredNode.setHovered(false, false); | 242 this._hoveredNode.setHovered(false, false); |
242 this._hoveredNode = node; | 243 this._hoveredNode = node; |
243 if (this._hoveredNode) | 244 if (this._hoveredNode) |
244 this._hoveredNode.setHovered(true, highlightInitiatorChain); | 245 this._hoveredNode.setHovered(true, highlightInitiatorChain); |
245 } | 246 } |
246 | 247 |
247 /** | 248 /** |
248 * @param {number} height | 249 * @param {number} height |
249 */ | 250 */ |
250 setRowHeight(height) { | 251 setRowHeight(height) { |
251 this._rowHeight = height; | 252 this._rawRowHeight = height; |
253 this._updateRowHeight(); | |
254 } | |
255 | |
256 _updateRowHeight() { | |
257 this._rowHeight = Math.floor(this._rawRowHeight * window.devicePixelRatio) / window.devicePixelRatio; | |
252 } | 258 } |
253 | 259 |
254 /** | 260 /** |
255 * @param {number} height | 261 * @param {number} height |
256 */ | 262 */ |
257 setHeaderHeight(height) { | 263 setHeaderHeight(height) { |
258 this._headerHeight = height; | 264 this._headerHeight = height; |
259 } | 265 } |
260 | 266 |
261 /** | 267 /** |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
323 this._canvas.height = this._offsetHeight * ratio; | 329 this._canvas.height = this._offsetHeight * ratio; |
324 this._canvas.style.width = this._offsetWidth + 'px'; | 330 this._canvas.style.width = this._offsetWidth + 'px'; |
325 this._canvas.style.height = this._offsetHeight + 'px'; | 331 this._canvas.style.height = this._offsetHeight + 'px'; |
326 } | 332 } |
327 | 333 |
328 /** | 334 /** |
329 * @override | 335 * @override |
330 */ | 336 */ |
331 onResize() { | 337 onResize() { |
332 super.onResize(); | 338 super.onResize(); |
339 this._updateRowHeight(); | |
333 this._calculateCanvasSize(); | 340 this._calculateCanvasSize(); |
334 this.scheduleDraw(); | 341 this.scheduleDraw(); |
335 } | 342 } |
336 | 343 |
337 _calculateCanvasSize() { | 344 _calculateCanvasSize() { |
338 this._offsetWidth = this.contentElement.offsetWidth - this._rightPadding; | 345 this._offsetWidth = this.contentElement.offsetWidth - this._rightPadding; |
339 this._offsetHeight = this.contentElement.offsetHeight; | 346 this._offsetHeight = this.contentElement.offsetHeight; |
340 this._calculator.setDisplayWidth(this._offsetWidth); | 347 this._calculator.setDisplayWidth(this._offsetWidth); |
341 this._canvasPosition = this._canvas.getBoundingClientRect(); | 348 this._canvasPosition = this._canvas.getBoundingClientRect(); |
342 } | 349 } |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
592 context.fill(); | 599 context.fill(); |
593 context.restore(); | 600 context.restore(); |
594 } | 601 } |
595 }; | 602 }; |
596 | 603 |
597 /** @typedef {!{fillStyle: (string|undefined), lineWidth: (number|undefined), bo rderColor: (string|undefined)}} */ | 604 /** @typedef {!{fillStyle: (string|undefined), lineWidth: (number|undefined), bo rderColor: (string|undefined)}} */ |
598 Network.NetworkWaterfallColumn._LayerStyle; | 605 Network.NetworkWaterfallColumn._LayerStyle; |
599 | 606 |
600 /** @typedef {!{x: number, y: number, text: string}} */ | 607 /** @typedef {!{x: number, y: number, text: string}} */ |
601 Network.NetworkWaterfallColumn._TextLayer; | 608 Network.NetworkWaterfallColumn._TextLayer; |
OLD | NEW |