Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/source_frame/SourcesTextEditor.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/source_frame/SourcesTextEditor.js b/third_party/WebKit/Source/devtools/front_end/source_frame/SourcesTextEditor.js |
| index af8f11d6aa1d9a2fabaa259efeb4436dcabbf06e..6d1e3910dd28b4bb626ca72f3a1299c79c282292 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/source_frame/SourcesTextEditor.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/source_frame/SourcesTextEditor.js |
| @@ -20,7 +20,6 @@ SourceFrame.SourcesTextEditor = class extends TextEditor.CodeMirrorTextEditor { |
| this._delegate = delegate; |
| - this.codeMirror().on('changes', this._fireTextChanged.bind(this)); |
| this.codeMirror().on('cursorActivity', this._cursorActivity.bind(this)); |
| this.codeMirror().on('gutterClick', this._gutterClick.bind(this)); |
| this.codeMirror().on('scroll', this._scroll.bind(this)); |
| @@ -306,8 +305,7 @@ SourceFrame.SourcesTextEditor = class extends TextEditor.CodeMirrorTextEditor { |
| */ |
| editRange(range, text, origin) { |
| var newRange = super.editRange(range, text, origin); |
| - this.dispatchEventToListeners( |
| - SourceFrame.SourcesTextEditor.Events.TextChanged, {oldRange: range, newRange: newRange}); |
| + this.emit(new UI.TextEditor.TextChangedEvent(range, newRange)); |
|
pfeldman
2017/04/04 20:21:09
You should not emit text editor's events on source
luoe
2017/04/04 21:08:59
Done.
|
| if (Common.moduleSetting('textEditorAutoDetectIndent').get()) |
| this._onUpdateEditorIndentation(); |
| @@ -377,31 +375,6 @@ SourceFrame.SourcesTextEditor = class extends TextEditor.CodeMirrorTextEditor { |
| } |
| } |
| - /** |
| - * @param {!CodeMirror} codeMirror |
| - * @param {!Array.<!CodeMirror.ChangeObject>} changes |
| - */ |
| - _fireTextChanged(codeMirror, changes) { |
| - if (!changes.length || this._muteTextChangedEvent) |
| - return; |
| - var edits = []; |
| - var currentEdit; |
| - |
| - for (var changeIndex = 0; changeIndex < changes.length; ++changeIndex) { |
| - var changeObject = changes[changeIndex]; |
| - var edit = TextEditor.CodeMirrorUtils.changeObjectToEditOperation(changeObject); |
| - if (currentEdit && edit.oldRange.equal(currentEdit.newRange)) { |
| - currentEdit.newRange = edit.newRange; |
| - } else { |
| - currentEdit = edit; |
| - edits.push(currentEdit); |
| - } |
| - } |
| - |
| - for (var i = 0; i < edits.length; ++i) |
| - this.dispatchEventToListeners(SourceFrame.SourcesTextEditor.Events.TextChanged, edits[i]); |
| - } |
| - |
| _cursorActivity() { |
| if (!this._isSearchActive()) |
| this.codeMirror().operation(this._tokenHighlighter.highlightSelectedTokens.bind(this._tokenHighlighter)); |
| @@ -465,11 +438,9 @@ SourceFrame.SourcesTextEditor = class extends TextEditor.CodeMirrorTextEditor { |
| * @param {string} text |
| */ |
| setText(text) { |
| - this._muteTextChangedEvent = true; |
| this._setEditorIndentation( |
| text.split('\n').slice(0, SourceFrame.SourcesTextEditor.LinesToScanForIndentationGuessing)); |
| super.setText(text); |
| - delete this._muteTextChangedEvent; |
| } |
| _updateWhitespace() { |
| @@ -582,7 +553,6 @@ SourceFrame.SourcesTextEditor.GutterClickEventData; |
| /** @enum {symbol} */ |
| SourceFrame.SourcesTextEditor.Events = { |
| GutterClick: Symbol('GutterClick'), |
| - TextChanged: Symbol('TextChanged'), |
| SelectionChanged: Symbol('SelectionChanged'), |
| ScrollChanged: Symbol('ScrollChanged'), |
| EditorFocused: Symbol('EditorFocused'), |