| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 e.consume(true); | 683 e.consume(true); |
| 684 }, | 684 }, |
| 685 | 685 |
| 686 __proto__: WebInspector.VBox.prototype | 686 __proto__: WebInspector.VBox.prototype |
| 687 } | 687 } |
| 688 | 688 |
| 689 /** | 689 /** |
| 690 * @constructor | 690 * @constructor |
| 691 * @param {string} messageText | 691 * @param {string} messageText |
| 692 * @param {!WebInspector.SourceFrameMessage.Level} level | 692 * @param {!WebInspector.SourceFrameMessage.Level} level |
| 693 * @param {number} lineNumber | 693 * @param {!WebInspector.TextRange} range |
| 694 * @param {number=} columnNumber | |
| 695 */ | 694 */ |
| 696 WebInspector.SourceFrameMessage = function(messageText, level, lineNumber, colum
nNumber) | 695 WebInspector.SourceFrameMessage = function(messageText, level, range) |
| 697 { | 696 { |
| 698 this._messageText = messageText; | 697 this._messageText = messageText; |
| 699 this._level = level; | 698 this._level = level; |
| 700 this._lineNumber = lineNumber; | 699 this._range = range; |
| 701 this._columnNumber = columnNumber; | |
| 702 } | 700 } |
| 703 | 701 |
| 704 /** | 702 /** |
| 705 * @enum {string} | 703 * @enum {string} |
| 706 */ | 704 */ |
| 707 WebInspector.SourceFrameMessage.Level = { | 705 WebInspector.SourceFrameMessage.Level = { |
| 708 Error: "Error", | 706 Error: "Error", |
| 709 Warning: "Warning" | 707 Warning: "Warning" |
| 710 } | 708 } |
| 711 | 709 |
| 712 /** | 710 /** |
| 713 * @param {!WebInspector.ConsoleMessage} consoleMessage | 711 * @param {!WebInspector.ConsoleMessage} consoleMessage |
| 714 * @param {number} lineNumber | 712 * @param {number} lineNumber |
| 715 * @param {number} columnNumber | 713 * @param {number} columnNumber |
| 716 * @return {!WebInspector.SourceFrameMessage} | 714 * @return {!WebInspector.SourceFrameMessage} |
| 717 */ | 715 */ |
| 718 WebInspector.SourceFrameMessage.fromConsoleMessage = function(consoleMessage, li
neNumber, columnNumber) | 716 WebInspector.SourceFrameMessage.fromConsoleMessage = function(consoleMessage, li
neNumber, columnNumber) |
| 719 { | 717 { |
| 720 console.assert(consoleMessage.level === WebInspector.ConsoleMessage.MessageL
evel.Error || consoleMessage.level === WebInspector.ConsoleMessage.MessageLevel.
Warning); | 718 console.assert(consoleMessage.level === WebInspector.ConsoleMessage.MessageL
evel.Error || consoleMessage.level === WebInspector.ConsoleMessage.MessageLevel.
Warning); |
| 721 var level = consoleMessage.level === WebInspector.ConsoleMessage.MessageLeve
l.Error ? WebInspector.SourceFrameMessage.Level.Error : WebInspector.SourceFrame
Message.Level.Warning; | 719 var level = consoleMessage.level === WebInspector.ConsoleMessage.MessageLeve
l.Error ? WebInspector.SourceFrameMessage.Level.Error : WebInspector.SourceFrame
Message.Level.Warning; |
| 722 return new WebInspector.SourceFrameMessage(consoleMessage.messageText, level
, lineNumber, columnNumber); | 720 var location = new WebInspector.TextRange(lineNumber, columnNumber, lineNumb
er, columnNumber); |
| 721 return new WebInspector.SourceFrameMessage(consoleMessage.messageText, level
, location); |
| 723 } | 722 } |
| 724 | 723 |
| 725 WebInspector.SourceFrameMessage.prototype = { | 724 WebInspector.SourceFrameMessage.prototype = { |
| 726 /** | 725 /** |
| 727 * @return {string} | 726 * @return {string} |
| 728 */ | 727 */ |
| 729 messageText: function() | 728 messageText: function() |
| 730 { | 729 { |
| 731 return this._messageText; | 730 return this._messageText; |
| 732 }, | 731 }, |
| 733 | 732 |
| 734 /** | 733 /** |
| 735 * @return {!WebInspector.SourceFrameMessage.Level} | 734 * @return {!WebInspector.SourceFrameMessage.Level} |
| 736 */ | 735 */ |
| 737 level: function() | 736 level: function() |
| 738 { | 737 { |
| 739 return this._level; | 738 return this._level; |
| 740 }, | 739 }, |
| 741 | 740 |
| 742 /** | 741 /** |
| 742 * @return {!WebInspector.TextRange} |
| 743 */ |
| 744 range: function() |
| 745 { |
| 746 return this._range; |
| 747 }, |
| 748 |
| 749 /** |
| 743 * @return {number} | 750 * @return {number} |
| 744 */ | 751 */ |
| 745 lineNumber: function() | 752 lineNumber: function() |
| 746 { | 753 { |
| 747 return this._lineNumber; | 754 return this._range.startLine; |
| 748 }, | 755 }, |
| 749 | 756 |
| 750 /** | 757 /** |
| 751 * @return {(number|undefined)} | 758 * @return {(number|undefined)} |
| 752 */ | 759 */ |
| 753 columnNumber: function() | 760 columnNumber: function() |
| 754 { | 761 { |
| 755 return this._columnNumber; | 762 return this._range.startColumn; |
| 756 }, | 763 }, |
| 757 | 764 |
| 758 /** | 765 /** |
| 759 * @param {!WebInspector.SourceFrameMessage} another | 766 * @param {!WebInspector.SourceFrameMessage} another |
| 760 * @return {boolean} | 767 * @return {boolean} |
| 761 */ | 768 */ |
| 762 isEqual: function(another) | 769 isEqual: function(another) |
| 763 { | 770 { |
| 764 return this.messageText() === another.messageText() && this.level() ===
another.level() && this.lineNumber() === another.lineNumber() && this.columnNumb
er() === another.columnNumber(); | 771 return this.messageText() === another.messageText() && |
| 772 this.level() === another.level() && |
| 773 this.range().equal(another.range()); |
| 765 } | 774 } |
| 766 } | 775 } |
| 767 | 776 |
| 768 WebInspector.SourceFrame._iconClassPerLevel = {}; | 777 WebInspector.SourceFrame._iconClassPerLevel = {}; |
| 769 WebInspector.SourceFrame._iconClassPerLevel[WebInspector.SourceFrameMessage.Leve
l.Error] = "error-icon"; | 778 WebInspector.SourceFrame._iconClassPerLevel[WebInspector.SourceFrameMessage.Leve
l.Error] = "error-icon"; |
| 770 WebInspector.SourceFrame._iconClassPerLevel[WebInspector.SourceFrameMessage.Leve
l.Warning] = "warning-icon"; | 779 WebInspector.SourceFrame._iconClassPerLevel[WebInspector.SourceFrameMessage.Leve
l.Warning] = "warning-icon"; |
| 771 | 780 |
| 772 WebInspector.SourceFrame._lineClassPerLevel = {}; | 781 WebInspector.SourceFrame._lineClassPerLevel = {}; |
| 773 WebInspector.SourceFrame._lineClassPerLevel[WebInspector.SourceFrameMessage.Leve
l.Error] = "text-editor-line-with-error"; | 782 WebInspector.SourceFrame._lineClassPerLevel[WebInspector.SourceFrameMessage.Leve
l.Error] = "text-editor-line-with-error"; |
| 774 WebInspector.SourceFrame._lineClassPerLevel[WebInspector.SourceFrameMessage.Leve
l.Warning] = "text-editor-line-with-warning"; | 783 WebInspector.SourceFrame._lineClassPerLevel[WebInspector.SourceFrameMessage.Leve
l.Warning] = "text-editor-line-with-warning"; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 */ | 868 */ |
| 860 _updateWavePosition: function(lineNumber, columnNumber) | 869 _updateWavePosition: function(lineNumber, columnNumber) |
| 861 { | 870 { |
| 862 lineNumber = Math.min(lineNumber, this._textEditor.linesCount - 1); | 871 lineNumber = Math.min(lineNumber, this._textEditor.linesCount - 1); |
| 863 var lineText = this._textEditor.line(lineNumber); | 872 var lineText = this._textEditor.line(lineNumber); |
| 864 columnNumber = Math.min(columnNumber, lineText.length); | 873 columnNumber = Math.min(columnNumber, lineText.length); |
| 865 var lineIndent = WebInspector.TextUtils.lineIndent(lineText).length; | 874 var lineIndent = WebInspector.TextUtils.lineIndent(lineText).length; |
| 866 var base = this._textEditor.cursorPositionToCoordinates(lineNumber, 0); | 875 var base = this._textEditor.cursorPositionToCoordinates(lineNumber, 0); |
| 867 | 876 |
| 868 var start = this._textEditor.cursorPositionToCoordinates(lineNumber, Mat
h.max(columnNumber - 1, lineIndent)); | 877 var start = this._textEditor.cursorPositionToCoordinates(lineNumber, Mat
h.max(columnNumber - 1, lineIndent)); |
| 878 if (!start) |
| 879 return; //stale data - columnNumber is already gone, wait for future
update and for UI to settle |
| 869 var end = this._textEditor.cursorPositionToCoordinates(lineNumber, lineT
ext.length); | 880 var end = this._textEditor.cursorPositionToCoordinates(lineNumber, lineT
ext.length); |
| 870 /** @const */ | 881 /** @const */ |
| 871 var codeMirrorLinesLeftPadding = 4; | 882 var codeMirrorLinesLeftPadding = 4; |
| 872 this._wave.style.left = (start.x - base.x + codeMirrorLinesLeftPadding)
+ "px"; | 883 this._wave.style.left = (start.x - base.x + codeMirrorLinesLeftPadding)
+ "px"; |
| 873 this._wave.style.width = (end.x - start.x) + "px"; | 884 this._wave.style.width = (end.x - start.x) + "px"; |
| 874 }, | 885 }, |
| 875 | 886 |
| 876 /** | 887 /** |
| 877 * @return {!Element} | 888 * @return {!Element} |
| 878 */ | 889 */ |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 | 1061 |
| 1051 /** | 1062 /** |
| 1052 * @param {!WebInspector.SourceFrameMessage} a | 1063 * @param {!WebInspector.SourceFrameMessage} a |
| 1053 * @param {!WebInspector.SourceFrameMessage} b | 1064 * @param {!WebInspector.SourceFrameMessage} b |
| 1054 * @return {number} | 1065 * @return {number} |
| 1055 */ | 1066 */ |
| 1056 WebInspector.SourceFrameMessage.messageLevelComparator = function(a, b) | 1067 WebInspector.SourceFrameMessage.messageLevelComparator = function(a, b) |
| 1057 { | 1068 { |
| 1058 return WebInspector.SourceFrameMessage._messageLevelPriority[a.level()] - We
bInspector.SourceFrameMessage._messageLevelPriority[b.level()]; | 1069 return WebInspector.SourceFrameMessage._messageLevelPriority[a.level()] - We
bInspector.SourceFrameMessage._messageLevelPriority[b.level()]; |
| 1059 } | 1070 } |
| OLD | NEW |