Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/source_frame/SourceFrame.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/source_frame/SourceFrame.js b/third_party/WebKit/Source/devtools/front_end/source_frame/SourceFrame.js |
| index 24a8c743245606e87946846046e50cc766a25751..ad9e3737987de616389e74ca9f410d42df089306 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/source_frame/SourceFrame.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/source_frame/SourceFrame.js |
| @@ -53,9 +53,12 @@ SourceFrame.SourceFrame = class extends UI.SimpleView { |
| SourceFrame.SourcesTextEditor.Events.EditorFocused, this._resetCurrentSearchResultIndex, this); |
| this._textEditor.addEventListener( |
| SourceFrame.SourcesTextEditor.Events.SelectionChanged, this._updateSourcePosition, this); |
| - this._textEditor.addEventListener( |
| - SourceFrame.SourcesTextEditor.Events.TextChanged, |
| - event => this.onTextChanged(event.data.oldRange, event.data.newRange)); |
| + this._textEditor.on(UI.TextEditor.TextChangedEvent, event => { |
| + if (!this._muteChangeEventsForSetContent) |
| + this.onTextChanged(event.oldRange, event.newRange); |
| + }); |
| + /** @type {boolean|undefined} */ |
| + this._muteChangeEventsForSetContent; |
|
luoe
2017/03/31 02:18:08
AFAICT, the reason why we had muteTextChangedEvent
pfeldman
2017/04/04 20:21:09
Makes sense to me.
|
| this._shortcuts = {}; |
| this.element.addEventListener('keydown', this._handleKeyDown.bind(this), false); |
| @@ -264,6 +267,7 @@ SourceFrame.SourceFrame = class extends UI.SimpleView { |
| * @param {?string} content |
| */ |
| setContent(content) { |
| + this._muteChangeEventsForSetContent = true; |
| if (!this._loaded) { |
| this._loaded = true; |
| this._textEditor.setText(content || ''); |
| @@ -284,6 +288,7 @@ SourceFrame.SourceFrame = class extends UI.SimpleView { |
| this._delayedFindSearchMatches(); |
| delete this._delayedFindSearchMatches; |
| } |
| + delete this._muteChangeEventsForSetContent; |
| this.onTextEditorContentSet(); |
| } |