| 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 captures model height (41 or 21px), |
| 30 // this._rowHeight is computed height of the row in CSS pixels, can be 20.8
for zoomed-in content. |
| 31 this._rawRowHeight = 0; |
| 32 this._rowHeight = 0; |
| 33 |
| 31 this._offsetWidth = 0; | 34 this._offsetWidth = 0; |
| 32 this._offsetHeight = 0; | 35 this._offsetHeight = 0; |
| 33 this._startTime = this._calculator.minimumBoundary(); | 36 this._startTime = this._calculator.minimumBoundary(); |
| 34 this._endTime = this._calculator.maximumBoundary(); | 37 this._endTime = this._calculator.maximumBoundary(); |
| 35 | 38 |
| 36 this._popoverHelper = new UI.PopoverHelper(this.element, this._getPopoverReq
uest.bind(this)); | 39 this._popoverHelper = new UI.PopoverHelper(this.element, this._getPopoverReq
uest.bind(this)); |
| 37 this._popoverHelper.setHasPadding(true); | 40 this._popoverHelper.setHasPadding(true); |
| 38 this._popoverHelper.setTimeout(300, 300); | 41 this._popoverHelper.setTimeout(300, 300); |
| 39 | 42 |
| 40 /** @type {!Array<!Network.NetworkNode>} */ | 43 /** @type {!Array<!Network.NetworkNode>} */ |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 this._hoveredNode.setHovered(false, false); | 244 this._hoveredNode.setHovered(false, false); |
| 242 this._hoveredNode = node; | 245 this._hoveredNode = node; |
| 243 if (this._hoveredNode) | 246 if (this._hoveredNode) |
| 244 this._hoveredNode.setHovered(true, highlightInitiatorChain); | 247 this._hoveredNode.setHovered(true, highlightInitiatorChain); |
| 245 } | 248 } |
| 246 | 249 |
| 247 /** | 250 /** |
| 248 * @param {number} height | 251 * @param {number} height |
| 249 */ | 252 */ |
| 250 setRowHeight(height) { | 253 setRowHeight(height) { |
| 251 this._rowHeight = height; | 254 this._rawRowHeight = height; |
| 255 this._updateRowHeight(); |
| 256 } |
| 257 |
| 258 _updateRowHeight() { |
| 259 this._rowHeight = Math.floor(this._rawRowHeight * window.devicePixelRatio) /
window.devicePixelRatio; |
| 252 } | 260 } |
| 253 | 261 |
| 254 /** | 262 /** |
| 255 * @param {number} height | 263 * @param {number} height |
| 256 */ | 264 */ |
| 257 setHeaderHeight(height) { | 265 setHeaderHeight(height) { |
| 258 this._headerHeight = height; | 266 this._headerHeight = height; |
| 259 } | 267 } |
| 260 | 268 |
| 261 /** | 269 /** |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 this._canvas.height = this._offsetHeight * ratio; | 331 this._canvas.height = this._offsetHeight * ratio; |
| 324 this._canvas.style.width = this._offsetWidth + 'px'; | 332 this._canvas.style.width = this._offsetWidth + 'px'; |
| 325 this._canvas.style.height = this._offsetHeight + 'px'; | 333 this._canvas.style.height = this._offsetHeight + 'px'; |
| 326 } | 334 } |
| 327 | 335 |
| 328 /** | 336 /** |
| 329 * @override | 337 * @override |
| 330 */ | 338 */ |
| 331 onResize() { | 339 onResize() { |
| 332 super.onResize(); | 340 super.onResize(); |
| 341 this._updateRowHeight(); |
| 333 this._calculateCanvasSize(); | 342 this._calculateCanvasSize(); |
| 334 this.scheduleDraw(); | 343 this.scheduleDraw(); |
| 335 } | 344 } |
| 336 | 345 |
| 337 _calculateCanvasSize() { | 346 _calculateCanvasSize() { |
| 338 this._offsetWidth = this.contentElement.offsetWidth - this._rightPadding; | 347 this._offsetWidth = this.contentElement.offsetWidth - this._rightPadding; |
| 339 this._offsetHeight = this.contentElement.offsetHeight; | 348 this._offsetHeight = this.contentElement.offsetHeight; |
| 340 this._calculator.setDisplayWidth(this._offsetWidth); | 349 this._calculator.setDisplayWidth(this._offsetWidth); |
| 341 this._canvasPosition = this._canvas.getBoundingClientRect(); | 350 this._canvasPosition = this._canvas.getBoundingClientRect(); |
| 342 } | 351 } |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 context.fill(); | 601 context.fill(); |
| 593 context.restore(); | 602 context.restore(); |
| 594 } | 603 } |
| 595 }; | 604 }; |
| 596 | 605 |
| 597 /** @typedef {!{fillStyle: (string|undefined), lineWidth: (number|undefined), bo
rderColor: (string|undefined)}} */ | 606 /** @typedef {!{fillStyle: (string|undefined), lineWidth: (number|undefined), bo
rderColor: (string|undefined)}} */ |
| 598 Network.NetworkWaterfallColumn._LayerStyle; | 607 Network.NetworkWaterfallColumn._LayerStyle; |
| 599 | 608 |
| 600 /** @typedef {!{x: number, y: number, text: string}} */ | 609 /** @typedef {!{x: number, y: number, text: string}} */ |
| 601 Network.NetworkWaterfallColumn._TextLayer; | 610 Network.NetworkWaterfallColumn._TextLayer; |
| OLD | NEW |