Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * | 10 * |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 */ | 31 */ |
| 32 SourceFrame.UISourceCodeFrame = class extends SourceFrame.SourceFrame { | 32 SourceFrame.UISourceCodeFrame = class extends SourceFrame.SourceFrame { |
| 33 /** | 33 /** |
| 34 * @param {!Workspace.UISourceCode} uiSourceCode | 34 * @param {!Workspace.UISourceCode} uiSourceCode |
| 35 */ | 35 */ |
| 36 constructor(uiSourceCode) { | 36 constructor(uiSourceCode) { |
| 37 super(uiSourceCode.contentURL(), workingCopy); | 37 super(uiSourceCode.contentURL(), workingCopy); |
| 38 this._uiSourceCode = uiSourceCode; | 38 this._uiSourceCode = uiSourceCode; |
| 39 this.setEditable(this._canEditSource()); | 39 this.setEditable(this._canEditSource()); |
| 40 | 40 |
| 41 if (Runtime.experiments.isEnabled('sourceDiff')) | 41 if (Runtime.experiments.isEnabled('sourceDiff')) { |
| 42 this._diff = new SourceFrame.SourceCodeDiff(uiSourceCode.requestOriginalCo ntent(), this.textEditor); | 42 this._diff = |
| 43 new SourceFrame.SourceCodeDiff(WorkspaceDiff.UISourceCodeDiff.forUISou rceCode(uiSourceCode), this.textEditor); | |
| 44 } | |
| 43 | 45 |
| 44 /** @type {?UI.AutocompleteConfig} */ | 46 /** @type {?UI.AutocompleteConfig} */ |
| 45 this._autocompleteConfig = {isWordChar: Common.TextUtils.isWordChar}; | 47 this._autocompleteConfig = {isWordChar: Common.TextUtils.isWordChar}; |
| 46 Common.moduleSetting('textEditorAutocompletion').addChangeListener(this._upd ateAutocomplete, this); | 48 Common.moduleSetting('textEditorAutocompletion').addChangeListener(this._upd ateAutocomplete, this); |
| 47 this._updateAutocomplete(); | 49 this._updateAutocomplete(); |
| 48 | 50 |
| 49 /** @type {?Persistence.PersistenceBinding} */ | 51 /** @type {?Persistence.PersistenceBinding} */ |
| 50 this._persistenceBinding = Persistence.persistence.binding(uiSourceCode); | 52 this._persistenceBinding = Persistence.persistence.binding(uiSourceCode); |
| 51 | 53 |
| 52 /** @type {!Map<number, !SourceFrame.UISourceCodeFrame.RowMessageBucket>} */ | 54 /** @type {!Map<number, !SourceFrame.UISourceCodeFrame.RowMessageBucket>} */ |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 | 161 |
| 160 this._muteSourceCodeEvents = true; | 162 this._muteSourceCodeEvents = true; |
| 161 this._uiSourceCode.commitWorkingCopy(); | 163 this._uiSourceCode.commitWorkingCopy(); |
| 162 delete this._muteSourceCodeEvents; | 164 delete this._muteSourceCodeEvents; |
| 163 } | 165 } |
| 164 | 166 |
| 165 /** | 167 /** |
| 166 * @override | 168 * @override |
| 167 */ | 169 */ |
| 168 onTextEditorContentSet() { | 170 onTextEditorContentSet() { |
| 169 if (this._diff) | |
| 170 this._diff.updateDiffMarkersImmediately(); | |
| 171 super.onTextEditorContentSet(); | 171 super.onTextEditorContentSet(); |
| 172 for (var message of this._allMessages()) | 172 for (var message of this._allMessages()) |
| 173 this._addMessageToSource(message); | 173 this._addMessageToSource(message); |
| 174 this._decorateAllTypes(); | 174 this._decorateAllTypes(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 /** | 177 /** |
| 178 * @return {!Array<!Workspace.UISourceCode.Message>} | 178 * @return {!Array<!Workspace.UISourceCode.Message>} |
| 179 */ | 179 */ |
| 180 _allMessages() { | 180 _allMessages() { |
| 181 return this._persistenceBinding ? | 181 return this._persistenceBinding ? |
| 182 this._persistenceBinding.network.messages().concat(this._persistenceBind ing.fileSystem.messages()) : | 182 this._persistenceBinding.network.messages().concat(this._persistenceBind ing.fileSystem.messages()) : |
| 183 this._uiSourceCode.messages(); | 183 this._uiSourceCode.messages(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 /** | 186 /** |
| 187 * @override | 187 * @override |
| 188 * @param {!Common.TextRange} oldRange | 188 * @param {!Common.TextRange} oldRange |
| 189 * @param {!Common.TextRange} newRange | 189 * @param {!Common.TextRange} newRange |
| 190 */ | 190 */ |
| 191 onTextChanged(oldRange, newRange) { | 191 onTextChanged(oldRange, newRange) { |
| 192 if (this._diff) | |
| 193 this._diff.updateDiffMarkersWhenPossible(); | |
|
lushnikov
2017/03/04 04:00:28
why did these go?
einbinder
2017/03/07 06:03:31
There is a DiffChanged event
| |
| 194 super.onTextChanged(oldRange, newRange); | 192 super.onTextChanged(oldRange, newRange); |
| 195 this._errorPopoverHelper.hidePopover(); | 193 this._errorPopoverHelper.hidePopover(); |
| 196 if (this._isSettingContent) | 194 if (this._isSettingContent) |
| 197 return; | 195 return; |
| 198 this._muteSourceCodeEvents = true; | 196 this._muteSourceCodeEvents = true; |
| 199 if (this.textEditor.isClean()) | 197 if (this.textEditor.isClean()) |
| 200 this._uiSourceCode.resetWorkingCopy(); | 198 this._uiSourceCode.resetWorkingCopy(); |
| 201 else | 199 else |
| 202 this._uiSourceCode.setWorkingCopyGetter(this.textEditor.text.bind(this.tex tEditor)); | 200 this._uiSourceCode.setWorkingCopyGetter(this.textEditor.text.bind(this.tex tEditor)); |
| 203 delete this._muteSourceCodeEvents; | 201 delete this._muteSourceCodeEvents; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 var infobar = infobars[i]; | 311 var infobar = infobars[i]; |
| 314 if (!infobar) | 312 if (!infobar) |
| 315 continue; | 313 continue; |
| 316 this.element.insertBefore(infobar.element, this.element.children[0]); | 314 this.element.insertBefore(infobar.element, this.element.children[0]); |
| 317 infobar.setParentView(this); | 315 infobar.setParentView(this); |
| 318 } | 316 } |
| 319 this.doResize(); | 317 this.doResize(); |
| 320 } | 318 } |
| 321 | 319 |
| 322 dispose() { | 320 dispose() { |
| 321 if (this._diff) | |
| 322 this._diff.dispose(); | |
| 323 this.textEditor.dispose(); | 323 this.textEditor.dispose(); |
| 324 Common.moduleSetting('textEditorAutocompletion').removeChangeListener(this._ updateAutocomplete, this); | 324 Common.moduleSetting('textEditorAutocompletion').removeChangeListener(this._ updateAutocomplete, this); |
| 325 this.detach(); | 325 this.detach(); |
| 326 } | 326 } |
| 327 | 327 |
| 328 /** | 328 /** |
| 329 * @param {!Common.Event} event | 329 * @param {!Common.Event} event |
| 330 */ | 330 */ |
| 331 _onMessageAdded(event) { | 331 _onMessageAdded(event) { |
| 332 var message = /** @type {!Workspace.UISourceCode.Message} */ (event.data); | 332 var message = /** @type {!Workspace.UISourceCode.Message} */ (event.data); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 678 | 678 |
| 679 /** | 679 /** |
| 680 * @param {!Workspace.UISourceCode.Message} a | 680 * @param {!Workspace.UISourceCode.Message} a |
| 681 * @param {!Workspace.UISourceCode.Message} b | 681 * @param {!Workspace.UISourceCode.Message} b |
| 682 * @return {number} | 682 * @return {number} |
| 683 */ | 683 */ |
| 684 Workspace.UISourceCode.Message.messageLevelComparator = function(a, b) { | 684 Workspace.UISourceCode.Message.messageLevelComparator = function(a, b) { |
| 685 return Workspace.UISourceCode.Message._messageLevelPriority[a.level()] - | 685 return Workspace.UISourceCode.Message._messageLevelPriority[a.level()] - |
| 686 Workspace.UISourceCode.Message._messageLevelPriority[b.level()]; | 686 Workspace.UISourceCode.Message._messageLevelPriority[b.level()]; |
| 687 }; | 687 }; |
| OLD | NEW |