| 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 /** | 4 /** |
| 5 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 SourceFrame.SourceCodeDiff = class { | 7 SourceFrame.SourceCodeDiff = class { |
| 8 /** | 8 /** |
| 9 * @param {!WorkspaceDiff.WorkspaceDiff} workspaceDiff | 9 * @param {!WorkspaceDiff.WorkspaceDiff} workspaceDiff |
| 10 * @param {!TextEditor.CodeMirrorTextEditor} textEditor | 10 * @param {!SourceFrame.SourcesTextEditor} textEditor |
| 11 */ | 11 */ |
| 12 constructor(workspaceDiff, textEditor) { | 12 constructor(workspaceDiff, textEditor) { |
| 13 this._textEditor = textEditor; | 13 this._textEditor = textEditor; |
| 14 this._decorations = []; | 14 this._decorations = []; |
| 15 this._textEditor.installGutter(SourceFrame.SourceCodeDiff.DiffGutterType, tr
ue); | 15 this._textEditor.installGutter(SourceFrame.SourceCodeDiff.DiffGutterType, tr
ue); |
| 16 this._uiSourceCode = null; | 16 this._uiSourceCode = null; |
| 17 this._workspaceDiff = workspaceDiff; | 17 this._workspaceDiff = workspaceDiff; |
| 18 /** @type {!Array<!TextEditor.TextEditorPositionHandle>}*/ | 18 /** @type {!Array<!TextEditor.TextEditorPositionHandle>}*/ |
| 19 this._animatedLines = []; | 19 this._animatedLines = []; |
| 20 | 20 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 Insert: Symbol('Insert'), | 232 Insert: Symbol('Insert'), |
| 233 Delete: Symbol('Delete'), | 233 Delete: Symbol('Delete'), |
| 234 Modify: Symbol('Modify'), | 234 Modify: Symbol('Modify'), |
| 235 }; | 235 }; |
| 236 | 236 |
| 237 /** | 237 /** |
| 238 * @unrestricted | 238 * @unrestricted |
| 239 */ | 239 */ |
| 240 SourceFrame.SourceCodeDiff.GutterDecoration = class { | 240 SourceFrame.SourceCodeDiff.GutterDecoration = class { |
| 241 /** | 241 /** |
| 242 * @param {!TextEditor.CodeMirrorTextEditor} textEditor | 242 * @param {!SourceFrame.SourcesTextEditor} textEditor |
| 243 * @param {number} lineNumber | 243 * @param {number} lineNumber |
| 244 * @param {!SourceFrame.SourceCodeDiff.GutterDecorationType} type | 244 * @param {!SourceFrame.SourceCodeDiff.GutterDecorationType} type |
| 245 */ | 245 */ |
| 246 constructor(textEditor, lineNumber, type) { | 246 constructor(textEditor, lineNumber, type) { |
| 247 this._textEditor = textEditor; | 247 this._textEditor = textEditor; |
| 248 this._position = this._textEditor.textEditorPositionHandle(lineNumber, 0); | 248 this._position = this._textEditor.textEditorPositionHandle(lineNumber, 0); |
| 249 this._className = ''; | 249 this._className = ''; |
| 250 if (type === SourceFrame.SourceCodeDiff.GutterDecorationType.Insert) | 250 if (type === SourceFrame.SourceCodeDiff.GutterDecorationType.Insert) |
| 251 this._className = 'diff-entry-insert'; | 251 this._className = 'diff-entry-insert'; |
| 252 else if (type === SourceFrame.SourceCodeDiff.GutterDecorationType.Delete) | 252 else if (type === SourceFrame.SourceCodeDiff.GutterDecorationType.Delete) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 277 } | 277 } |
| 278 | 278 |
| 279 remove() { | 279 remove() { |
| 280 var location = this._position.resolve(); | 280 var location = this._position.resolve(); |
| 281 if (!location) | 281 if (!location) |
| 282 return; | 282 return; |
| 283 this._textEditor.setGutterDecoration(location.lineNumber, SourceFrame.Source
CodeDiff.DiffGutterType, null); | 283 this._textEditor.setGutterDecoration(location.lineNumber, SourceFrame.Source
CodeDiff.DiffGutterType, null); |
| 284 this._textEditor.toggleLineClass(location.lineNumber, this._className, false
); | 284 this._textEditor.toggleLineClass(location.lineNumber, this._className, false
); |
| 285 } | 285 } |
| 286 }; | 286 }; |
| OLD | NEW |