OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 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 Changes.ChangesView = class extends UI.VBox { | 5 Changes.ChangesView = class extends UI.VBox { |
6 constructor() { | 6 constructor() { |
7 super(true); | 7 super(true); |
8 this.registerRequiredCSS('changes/changesView.css'); | 8 this.registerRequiredCSS('changes/changesView.css'); |
9 var splitWidget = new UI.SplitWidget(true /* vertical */, false /* sidebar o
n left */); | 9 var splitWidget = new UI.SplitWidget(true /* vertical */, false /* sidebar o
n left */); |
10 var mainWidget = new UI.Widget(); | 10 var mainWidget = new UI.Widget(); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 '%d insertion%s (+), %d deletion%s (-)', insertions, insertions !== 1 ?
's' : '', deletions, | 171 '%d insertion%s (+), %d deletion%s (-)', insertions, insertions !== 1 ?
's' : '', deletions, |
172 deletions !== 1 ? 's' : '')); | 172 deletions !== 1 ? 's' : '')); |
173 this._toolbar.setEnabled(true); | 173 this._toolbar.setEnabled(true); |
174 this._emptyWidget.hideWidget(); | 174 this._emptyWidget.hideWidget(); |
175 | 175 |
176 this._editor.operation(() => { | 176 this._editor.operation(() => { |
177 this._editor.showWidget(); | 177 this._editor.showWidget(); |
178 this._editor.setHighlightMode({ | 178 this._editor.setHighlightMode({ |
179 name: 'devtools-diff', | 179 name: 'devtools-diff', |
180 diffRows: this._diffRows, | 180 diffRows: this._diffRows, |
181 mimeType: Bindings.NetworkProject.uiSourceCodeMimeType( | 181 mimeType: /** @type {!Workspace.UISourceCode} */ (this._selectedUISource
Code).mimeType(), |
182 /** @type {!Workspace.UISourceCode} */ (this._selectedUISourceCode))
, | |
183 baselineLines: originalLines, | 182 baselineLines: originalLines, |
184 currentLines: currentLines | 183 currentLines: currentLines |
185 }); | 184 }); |
186 this._editor.setText(this._diffRows.map(row => row.tokens.map(t => t.text)
.join('')).join('\n')); | 185 this._editor.setText(this._diffRows.map(row => row.tokens.map(t => t.text)
.join('')).join('\n')); |
187 this._editor.setLineNumberFormatter(this._lineFormatter.bind(this)); | 186 this._editor.setLineNumberFormatter(this._lineFormatter.bind(this)); |
188 }); | 187 }); |
189 | 188 |
190 /** | 189 /** |
191 * @param {!Array<string>} lines | 190 * @param {!Array<string>} lines |
192 * @param {boolean} atStart | 191 * @param {boolean} atStart |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 */ | 300 */ |
302 Changes.ChangesView.Row; | 301 Changes.ChangesView.Row; |
303 | 302 |
304 /** @enum {string} */ | 303 /** @enum {string} */ |
305 Changes.ChangesView.RowType = { | 304 Changes.ChangesView.RowType = { |
306 Deletion: 'deletion', | 305 Deletion: 'deletion', |
307 Addition: 'addition', | 306 Addition: 'addition', |
308 Equal: 'equal', | 307 Equal: 'equal', |
309 Spacer: 'spacer' | 308 Spacer: 'spacer' |
310 }; | 309 }; |
OLD | NEW |