Chromium Code Reviews| 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 /** @type {?RegExp} */ | 10 /** @type {?RegExp} */ |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 hadTreeUpdates = true; | 88 hadTreeUpdates = true; |
| 89 if (!shouldBeVisible) | 89 if (!shouldBeVisible) |
| 90 node.remove(); | 90 node.remove(); |
| 91 else | 91 else |
| 92 this._dataGrid.rootNode().appendChild(node); | 92 this._dataGrid.rootNode().appendChild(node); |
| 93 } | 93 } |
| 94 if (hadTreeUpdates) | 94 if (hadTreeUpdates) |
| 95 this._sortingChanged(); | 95 this._sortingChanged(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 /** | 98 _onOpenedNode() { |
| 99 * @param {!Common.Event} event | 99 this._revealSourceForSelectedNode(); |
| 100 */ | |
| 101 _onOpenedNode(event) { | |
| 102 var node = /** @type Coverage.CoverageListView.GridNode */ (event.data); | |
| 103 this._revealSourceForNode(node); | |
| 104 } | 100 } |
| 105 | 101 |
| 106 /** | 102 /** |
| 107 * @param {!Coverage.CoverageListView.GridNode} node | 103 * @param {!Coverage.CoverageListView.GridNode} node |
| 108 * @return {boolean} | 104 * @return {boolean} |
| 109 */ | 105 */ |
| 110 _isVisible(node) { | 106 _isVisible(node) { |
| 111 return !this._filterRegExp || this._filterRegExp.test(node._url); | 107 return !this._filterRegExp || this._filterRegExp.test(node._url); |
| 112 } | 108 } |
| 113 | 109 |
| 114 /** | 110 /** |
| 115 * @param {!Event} event | 111 * @param {!Event} event |
| 116 */ | 112 */ |
| 117 _onKeyDown(event) { | 113 _onKeyDown(event) { |
| 118 if (!isEnterKey(event)) | 114 if (!isEnterKey(event)) |
| 119 return; | 115 return; |
| 120 event.consume(true); | 116 event.consume(true); |
| 121 this._revealSourceForNode(this._dataGrid.selectedNode); | 117 this._revealSourceForSelectedNode(); |
| 122 } | 118 } |
| 123 | 119 |
| 124 /** | 120 async _revealSourceForSelectedNode() { |
|
lushnikov
2017/05/17 23:39:08
is this change necessary?
caseq
2017/05/18 02:04:37
This is not directly related, but seems like a rea
| |
| 125 * @param {?DataGrid.DataGridNode} node | 121 var node = this._dataGrid.selectedNode; |
| 126 */ | |
| 127 async _revealSourceForNode(node) { | |
| 128 if (!node) | 122 if (!node) |
| 129 return; | 123 return; |
| 130 var coverageInfo = /** @type {!Coverage.CoverageListView.GridNode} */ (node) ._coverageInfo; | 124 var coverageInfo = /** @type {!Coverage.CoverageListView.GridNode} */ (node) ._coverageInfo; |
| 131 var sourceCode = Workspace.workspace.uiSourceCodeForURL(coverageInfo.url()); | 125 var sourceCode = Workspace.workspace.uiSourceCodeForURL(coverageInfo.url()); |
| 132 if (!sourceCode) | 126 if (!sourceCode) |
| 133 return; | 127 return; |
| 134 var content = await sourceCode.requestContent(); | 128 var content = await sourceCode.requestContent(); |
| 135 if (TextUtils.isMinified(content)) { | 129 if (TextUtils.isMinified(content)) { |
| 136 var formatData = await Sources.sourceFormatter.format(sourceCode); | 130 var formatData = await Sources.sourceFormatter.format(sourceCode); |
|
lushnikov
2017/05/17 23:39:08
not: as per decision taken in performance-room, we
caseq
2017/05/18 02:04:37
Done.
| |
| 137 Common.Revealer.reveal(formatData.formattedSourceCode); | 131 sourceCode = formatData.formattedSourceCode; |
| 138 } else { | |
| 139 Common.Revealer.reveal(sourceCode); | |
| 140 } | 132 } |
| 133 if (this._dataGrid.selectedNode !== node) | |
| 134 return; | |
| 135 Common.Revealer.reveal(sourceCode); | |
| 141 } | 136 } |
| 142 | 137 |
| 143 _sortingChanged() { | 138 _sortingChanged() { |
| 144 var columnId = this._dataGrid.sortColumnId(); | 139 var columnId = this._dataGrid.sortColumnId(); |
| 145 if (!columnId) | 140 if (!columnId) |
| 146 return; | 141 return; |
| 147 var sortFunction; | 142 var sortFunction; |
| 148 switch (columnId) { | 143 switch (columnId) { |
| 149 case 'url': | 144 case 'url': |
| 150 sortFunction = compareURL; | 145 sortFunction = compareURL; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 305 * @param {string} textContent | 300 * @param {string} textContent |
| 306 */ | 301 */ |
| 307 _highlight(element, textContent) { | 302 _highlight(element, textContent) { |
| 308 var matches = this._highlightRegExp.exec(textContent); | 303 var matches = this._highlightRegExp.exec(textContent); |
| 309 if (!matches || !matches.length) | 304 if (!matches || !matches.length) |
| 310 return; | 305 return; |
| 311 var range = new TextUtils.SourceRange(matches.index, matches[0].length); | 306 var range = new TextUtils.SourceRange(matches.index, matches[0].length); |
| 312 UI.highlightRangesWithStyleClass(element, [range], 'filter-highlight'); | 307 UI.highlightRangesWithStyleClass(element, [range], 'filter-highlight'); |
| 313 } | 308 } |
| 314 }; | 309 }; |
| OLD | NEW |