Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js b/third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js |
| index e1cced3f650dd1e229f51f9e39b5e55e8053a778..0a51dc5b53f90be82ed342373a3fc782255114be 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js |
| @@ -39,6 +39,8 @@ WebInspector.UISourceCodeFrame = function(uiSourceCode) |
| this._rowMessageBuckets = {}; |
| this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._onWorkingCopyChanged, this); |
| this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._onWorkingCopyCommitted, this); |
| + this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.MessageAdded, this._onMessageAdded, this); |
| + this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.MessageRemoved, this._onMessageRemoved, this); |
| this._updateStyle(); |
| this._errorPopoverHelper = new WebInspector.PopoverHelper(this.element, this._getErrorAnchor.bind(this), this._showErrorPopover.bind(this)); |
| @@ -108,10 +110,18 @@ WebInspector.UISourceCodeFrame.prototype = { |
| delete this._muteSourceCodeEvents; |
| }, |
| + onTextEditorContentLoaded: function() |
|
dgozman
2015/10/27 21:43:49
@override
pfeldman
2015/10/27 22:35:17
Done.
|
| + { |
| + WebInspector.SourceFrame.prototype.onTextEditorContentLoaded.call(this); |
| + this._clearMessages(); |
| + for (var message of this._uiSourceCode.messages()) |
| + this._addMessageToSource(message); |
| + }, |
| + |
| onTextChanged: function(oldRange, newRange) |
|
dgozman
2015/10/27 21:43:49
mind adding JSDoc?
pfeldman
2015/10/27 22:35:17
Done.
|
| { |
| WebInspector.SourceFrame.prototype.onTextChanged.call(this, oldRange, newRange); |
| - this.clearMessages(); |
| + this._clearMessages(); |
|
dgozman
2015/10/27 21:43:49
Do we abandon old messages? If so, who will clear
pfeldman
2015/10/27 22:35:17
Good call. Let me erase all messages from uiSource
|
| if (this._isSettingContent) |
| return; |
| this._muteSourceCodeEvents = true; |
| @@ -122,12 +132,6 @@ WebInspector.UISourceCodeFrame.prototype = { |
| delete this._muteSourceCodeEvents; |
| }, |
| - onTextEditorContentLoaded: function() |
| - { |
| - WebInspector.SourceFrame.prototype.onTextEditorContentLoaded.call(this); |
| - this.clearMessages(); |
| - }, |
| - |
| /** |
| * @param {!WebInspector.Event} event |
| */ |
| @@ -201,9 +205,18 @@ WebInspector.UISourceCodeFrame.prototype = { |
| }, |
| /** |
| + * @param {!WebInspector.Event} event |
| + */ |
| + _onMessageAdded: function(event) |
| + { |
| + var message = /** @type {!WebInspector.UISourceCode.Message} */ (event.data); |
| + this._addMessageToSource(message); |
| + }, |
| + |
| + /** |
| * @param {!WebInspector.UISourceCode.Message} message |
| */ |
| - addMessageToSource: function(message) |
| + _addMessageToSource: function(message) |
| { |
| var lineNumber = message.lineNumber(); |
| if (lineNumber >= this._textEditor.linesCount) |
| @@ -218,9 +231,18 @@ WebInspector.UISourceCodeFrame.prototype = { |
| }, |
| /** |
| + * @param {!WebInspector.Event} event |
| + */ |
| + _onMessageRemoved: function(event) |
| + { |
| + var message = /** @type {!WebInspector.UISourceCode.Message} */ (event.data); |
| + this._removeMessageFromSource(message); |
| + }, |
| + |
| + /** |
| * @param {!WebInspector.UISourceCode.Message} message |
| */ |
| - removeMessageFromSource: function(message) |
| + _removeMessageFromSource: function(message) |
| { |
| var lineNumber = message.lineNumber(); |
| if (lineNumber >= this._textEditor.linesCount) |
| @@ -238,7 +260,7 @@ WebInspector.UISourceCodeFrame.prototype = { |
| } |
| }, |
| - clearMessages: function() |
| + _clearMessages: function() |
| { |
| for (var line in this._rowMessageBuckets) { |
| var bubble = this._rowMessageBuckets[line]; |
| @@ -361,19 +383,6 @@ WebInspector.UISourceCodeFrame.Infobar.prototype = { |
| __proto__: WebInspector.Infobar.prototype |
| } |
| -/** |
| - * @param {!WebInspector.ConsoleMessage} consoleMessage |
| - * @param {number} lineNumber |
| - * @param {number} columnNumber |
| - * @return {!WebInspector.UISourceCode.Message} |
| - */ |
| -WebInspector.UISourceCodeFrame.uiMessageFromConsoleMessage = function(consoleMessage, lineNumber, columnNumber) |
| -{ |
| - console.assert(consoleMessage.level === WebInspector.ConsoleMessage.MessageLevel.Error || consoleMessage.level === WebInspector.ConsoleMessage.MessageLevel.Warning); |
| - var level = consoleMessage.level === WebInspector.ConsoleMessage.MessageLevel.Error ? WebInspector.UISourceCode.Message.Level.Error : WebInspector.UISourceCode.Message.Level.Warning; |
| - return new WebInspector.UISourceCode.Message(level, consoleMessage.messageText, lineNumber, columnNumber); |
| -} |
| - |
| WebInspector.UISourceCodeFrame._iconClassPerLevel = {}; |
| WebInspector.UISourceCodeFrame._iconClassPerLevel[WebInspector.UISourceCode.Message.Level.Error] = "error-icon"; |
| WebInspector.UISourceCodeFrame._iconClassPerLevel[WebInspector.UISourceCode.Message.Level.Warning] = "warning-icon"; |