| OLD | NEW |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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 Coverage.CoverageListView = class extends UI.VBox { | 5 Coverage.CoverageListView = class extends UI.VBox { |
| 6 constructor() { | 6 constructor() { |
| 7 super(true); | 7 super(true); |
| 8 /** @type {!Map<!Coverage.URLCoverageInfo, !Coverage.CoverageListView.GridNo
de>} */ | 8 /** @type {!Map<!Coverage.URLCoverageInfo, !Coverage.CoverageListView.GridNo
de>} */ |
| 9 this._nodeForCoverageInfo = new Map(); | 9 this._nodeForCoverageInfo = new Map(); |
| 10 this.registerRequiredCSS('coverage/coverageListView.css'); | 10 this.registerRequiredCSS('coverage/coverageListView.css'); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 /** | 133 /** |
| 134 * @param {!DataGrid.DataGridNode} a | 134 * @param {!DataGrid.DataGridNode} a |
| 135 * @param {!DataGrid.DataGridNode} b | 135 * @param {!DataGrid.DataGridNode} b |
| 136 * @return {number} | 136 * @return {number} |
| 137 */ | 137 */ |
| 138 function compareURL(a, b) { | 138 function compareURL(a, b) { |
| 139 var nodeA = /** @type {!Coverage.CoverageListView.GridNode} */ (a); | 139 var nodeA = /** @type {!Coverage.CoverageListView.GridNode} */ (a); |
| 140 var nodeB = /** @type {!Coverage.CoverageListView.GridNode} */ (b); | 140 var nodeB = /** @type {!Coverage.CoverageListView.GridNode} */ (b); |
| 141 | 141 |
| 142 return nodeA._displayURL.localeCompare(nodeB._displayURL); | 142 return nodeA._url.localeCompare(nodeB._url); |
| 143 } | 143 } |
| 144 | 144 |
| 145 /** | 145 /** |
| 146 * @param {string} fieldName | 146 * @param {string} fieldName |
| 147 * @param {!DataGrid.DataGridNode} a | 147 * @param {!DataGrid.DataGridNode} a |
| 148 * @param {!DataGrid.DataGridNode} b | 148 * @param {!DataGrid.DataGridNode} b |
| 149 * @return {number} | 149 * @return {number} |
| 150 */ | 150 */ |
| 151 function compareNumericField(fieldName, a, b) { | 151 function compareNumericField(fieldName, a, b) { |
| 152 var nodeA = /** @type {!Coverage.CoverageListView.GridNode} */ (a); | 152 var nodeA = /** @type {!Coverage.CoverageListView.GridNode} */ (a); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 /** | 186 /** |
| 187 * @param {!Coverage.URLCoverageInfo} coverageInfo | 187 * @param {!Coverage.URLCoverageInfo} coverageInfo |
| 188 * @param {number} maxSize | 188 * @param {number} maxSize |
| 189 */ | 189 */ |
| 190 constructor(coverageInfo, maxSize) { | 190 constructor(coverageInfo, maxSize) { |
| 191 super(); | 191 super(); |
| 192 this._coverageInfo = coverageInfo; | 192 this._coverageInfo = coverageInfo; |
| 193 /** @type {number|undefined} */ | 193 /** @type {number|undefined} */ |
| 194 this._lastUsedSize; | 194 this._lastUsedSize; |
| 195 this._url = coverageInfo.url(); | 195 this._url = coverageInfo.url(); |
| 196 this._displayURL = new Common.ParsedURL(this._url).displayName; | |
| 197 this._maxSize = maxSize; | 196 this._maxSize = maxSize; |
| 198 } | 197 } |
| 199 | 198 |
| 200 /** | 199 /** |
| 201 * @param {number} maxSize | 200 * @param {number} maxSize |
| 202 * @return {boolean} | 201 * @return {boolean} |
| 203 */ | 202 */ |
| 204 _refreshIfNeeded(maxSize) { | 203 _refreshIfNeeded(maxSize) { |
| 205 if (this._lastUsedSize === this._coverageInfo.usedSize() && maxSize === this
._maxSize) | 204 if (this._lastUsedSize === this._coverageInfo.usedSize() && maxSize === this
._maxSize) |
| 206 return false; | 205 return false; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 case 'bars': | 242 case 'bars': |
| 244 var barContainer = cell.createChild('div', 'bar-container'); | 243 var barContainer = cell.createChild('div', 'bar-container'); |
| 245 var unusedSizeBar = barContainer.createChild('div', 'bar bar-unused-size
'); | 244 var unusedSizeBar = barContainer.createChild('div', 'bar bar-unused-size
'); |
| 246 unusedSizeBar.style.width = (100 * this._coverageInfo.unusedSize() / thi
s._maxSize).toFixed(4) + '%'; | 245 unusedSizeBar.style.width = (100 * this._coverageInfo.unusedSize() / thi
s._maxSize).toFixed(4) + '%'; |
| 247 var usedSizeBar = barContainer.createChild('div', 'bar bar-used-size'); | 246 var usedSizeBar = barContainer.createChild('div', 'bar bar-used-size'); |
| 248 usedSizeBar.style.width = (100 * this._coverageInfo.usedSize() / this._m
axSize).toFixed(4) + '%'; | 247 usedSizeBar.style.width = (100 * this._coverageInfo.usedSize() / this._m
axSize).toFixed(4) + '%'; |
| 249 } | 248 } |
| 250 return cell; | 249 return cell; |
| 251 } | 250 } |
| 252 }; | 251 }; |
| OLD | NEW |