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 23 matching lines...) Expand all Loading... | |
| 34 WebInspector.UISourceCodeFrame = function(uiSourceCode) | 34 WebInspector.UISourceCodeFrame = function(uiSourceCode) |
| 35 { | 35 { |
| 36 this._uiSourceCode = uiSourceCode; | 36 this._uiSourceCode = uiSourceCode; |
| 37 WebInspector.SourceFrame.call(this, this._uiSourceCode); | 37 WebInspector.SourceFrame.call(this, this._uiSourceCode); |
| 38 this.textEditor.setAutocompleteDelegate(new WebInspector.SimpleAutocompleteD elegate()); | 38 this.textEditor.setAutocompleteDelegate(new WebInspector.SimpleAutocompleteD elegate()); |
| 39 this._rowMessageBuckets = {}; | 39 this._rowMessageBuckets = {}; |
| 40 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working CopyChanged, this._onWorkingCopyChanged, this); | 40 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working CopyChanged, this._onWorkingCopyChanged, this); |
| 41 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working CopyCommitted, this._onWorkingCopyCommitted, this); | 41 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working CopyCommitted, this._onWorkingCopyCommitted, this); |
| 42 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Message Added, this._onMessageAdded, this); | 42 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Message Added, this._onMessageAdded, this); |
| 43 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Message Removed, this._onMessageRemoved, this); | 43 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Message Removed, this._onMessageRemoved, this); |
| 44 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.LineMar kerAdded, this._onLineMarkerAdded, this); | |
| 45 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.LineMar kerRemoved, this._onLineMarkerRemoved, this); | |
| 44 this._updateStyle(); | 46 this._updateStyle(); |
| 45 | 47 |
| 46 this._errorPopoverHelper = new WebInspector.PopoverHelper(this.element, this ._getErrorAnchor.bind(this), this._showErrorPopover.bind(this)); | 48 this._errorPopoverHelper = new WebInspector.PopoverHelper(this.element, this ._getErrorAnchor.bind(this), this._showErrorPopover.bind(this)); |
| 47 this._errorPopoverHelper.setTimeout(100, 100); | 49 this._errorPopoverHelper.setTimeout(100, 100); |
| 48 } | 50 } |
| 49 | 51 |
| 50 WebInspector.UISourceCodeFrame.prototype = { | 52 WebInspector.UISourceCodeFrame.prototype = { |
| 51 /** | 53 /** |
| 52 * @return {!WebInspector.UISourceCode} | 54 * @return {!WebInspector.UISourceCode} |
| 53 */ | 55 */ |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 }, | 113 }, |
| 112 | 114 |
| 113 /** | 115 /** |
| 114 * @override | 116 * @override |
| 115 */ | 117 */ |
| 116 onTextEditorContentLoaded: function() | 118 onTextEditorContentLoaded: function() |
| 117 { | 119 { |
| 118 WebInspector.SourceFrame.prototype.onTextEditorContentLoaded.call(this); | 120 WebInspector.SourceFrame.prototype.onTextEditorContentLoaded.call(this); |
| 119 for (var message of this._uiSourceCode.messages()) | 121 for (var message of this._uiSourceCode.messages()) |
| 120 this._addMessageToSource(message); | 122 this._addMessageToSource(message); |
| 123 this._populateLineMarkers(); | |
|
pfeldman
2016/03/07 19:57:50
_decorateLineMarkers?
alph
2016/03/08 00:57:43
Done.
| |
| 121 }, | 124 }, |
| 122 | 125 |
| 123 /** | 126 /** |
| 124 * @override | 127 * @override |
| 125 * @param {!WebInspector.TextRange} oldRange | 128 * @param {!WebInspector.TextRange} oldRange |
| 126 * @param {!WebInspector.TextRange} newRange | 129 * @param {!WebInspector.TextRange} newRange |
| 127 */ | 130 */ |
| 128 onTextChanged: function(oldRange, newRange) | 131 onTextChanged: function(oldRange, newRange) |
| 129 { | 132 { |
| 130 WebInspector.SourceFrame.prototype.onTextChanged.call(this, oldRange, ne wRange); | 133 WebInspector.SourceFrame.prototype.onTextChanged.call(this, oldRange, ne wRange); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 323 }, | 326 }, |
| 324 | 327 |
| 325 _updateBucketDecorations: function() | 328 _updateBucketDecorations: function() |
| 326 { | 329 { |
| 327 for (var line in this._rowMessageBuckets) { | 330 for (var line in this._rowMessageBuckets) { |
| 328 var bucket = this._rowMessageBuckets[line]; | 331 var bucket = this._rowMessageBuckets[line]; |
| 329 bucket._updateDecoration(); | 332 bucket._updateDecoration(); |
| 330 } | 333 } |
| 331 }, | 334 }, |
| 332 | 335 |
| 336 /** | |
| 337 * @param {!WebInspector.Event} event | |
| 338 */ | |
| 339 _onLineMarkerAdded: function(event) | |
| 340 { | |
| 341 var marker = /** @type {!WebInspector.UISourceCode.LineMarker} */ (event .data); | |
| 342 this._decorateLineMarker(marker); | |
|
pfeldman
2016/03/07 19:57:50
Didn't you want to throttle these in a single CM o
alph
2016/03/08 00:57:42
Done.
| |
| 343 }, | |
| 344 | |
| 345 /** | |
| 346 * @param {!WebInspector.Event} event | |
| 347 */ | |
| 348 _onLineMarkerRemoved: function(event) | |
| 349 { | |
| 350 var marker = /** @type {!WebInspector.UISourceCode.LineMarker} */ (event .data); | |
| 351 this._textEditor.setGutterMarker(marker.line(), marker.type(), null); | |
| 352 }, | |
| 353 | |
| 354 _populateLineMarkers: function() | |
| 355 { | |
| 356 for (var markers of this.uiSourceCode().lineMarkers().values()) | |
| 357 markers.forEach(this._decorateLineMarker.bind(this)); | |
| 358 }, | |
| 359 | |
| 360 _decorateLineMarker: function(marker) | |
|
pfeldman
2016/03/07 19:57:50
JSDocs are missing.
alph
2016/03/08 00:57:43
Done.
| |
| 361 { | |
| 362 this._lineMarkerDecorator(marker.type()).then(decorator => this._textEdi tor.setGutterMarker(marker.line(), marker.type(), decorator.decorate(marker.data ()))); | |
| 363 }, | |
| 364 | |
| 365 _lineMarkerDecorator: function(type) | |
|
pfeldman
2016/03/07 19:57:50
ditto
alph
2016/03/08 00:57:42
Done.
| |
| 366 { | |
| 367 return self.runtime.instancePromise("line-marker-decorator-" + type); | |
|
pfeldman
2016/03/07 19:57:50
Decorator should be named after interface it imple
alph
2016/03/08 00:57:42
Done.
| |
| 368 }, | |
| 369 | |
| 333 __proto__: WebInspector.SourceFrame.prototype | 370 __proto__: WebInspector.SourceFrame.prototype |
| 334 } | 371 } |
| 335 | 372 |
| 336 WebInspector.UISourceCodeFrame._iconClassPerLevel = {}; | 373 WebInspector.UISourceCodeFrame._iconClassPerLevel = {}; |
| 337 WebInspector.UISourceCodeFrame._iconClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Error] = "error-icon"; | 374 WebInspector.UISourceCodeFrame._iconClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Error] = "error-icon"; |
| 338 WebInspector.UISourceCodeFrame._iconClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Warning] = "warning-icon"; | 375 WebInspector.UISourceCodeFrame._iconClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Warning] = "warning-icon"; |
| 339 | 376 |
| 340 WebInspector.UISourceCodeFrame._lineClassPerLevel = {}; | 377 WebInspector.UISourceCodeFrame._lineClassPerLevel = {}; |
| 341 WebInspector.UISourceCodeFrame._lineClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Error] = "text-editor-line-with-error"; | 378 WebInspector.UISourceCodeFrame._lineClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Error] = "text-editor-line-with-error"; |
| 342 WebInspector.UISourceCodeFrame._lineClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Warning] = "text-editor-line-with-warning"; | 379 WebInspector.UISourceCodeFrame._lineClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Warning] = "text-editor-line-with-warning"; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 547 | 584 |
| 548 /** | 585 /** |
| 549 * @param {!WebInspector.UISourceCode.Message} a | 586 * @param {!WebInspector.UISourceCode.Message} a |
| 550 * @param {!WebInspector.UISourceCode.Message} b | 587 * @param {!WebInspector.UISourceCode.Message} b |
| 551 * @return {number} | 588 * @return {number} |
| 552 */ | 589 */ |
| 553 WebInspector.UISourceCode.Message.messageLevelComparator = function(a, b) | 590 WebInspector.UISourceCode.Message.messageLevelComparator = function(a, b) |
| 554 { | 591 { |
| 555 return WebInspector.UISourceCode.Message._messageLevelPriority[a.level()] - WebInspector.UISourceCode.Message._messageLevelPriority[b.level()]; | 592 return WebInspector.UISourceCode.Message._messageLevelPriority[a.level()] - WebInspector.UISourceCode.Message._messageLevelPriority[b.level()]; |
| 556 } | 593 } |
| OLD | NEW |