Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js

Issue 1456943003: Devtools: use TextRange in UISourceCode.Message, allow addMessage to take a TextRange (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: trim whitespace Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/sources/JavaScriptCompiler.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 return this._messages.slice(); 589 return this._messages.slice();
590 }, 590 },
591 591
592 /** 592 /**
593 * @param {!WebInspector.UISourceCode.Message.Level} level 593 * @param {!WebInspector.UISourceCode.Message.Level} level
594 * @param {string} text 594 * @param {string} text
595 * @param {number} lineNumber 595 * @param {number} lineNumber
596 * @param {number=} columnNumber 596 * @param {number=} columnNumber
597 * @return {!WebInspector.UISourceCode.Message} message 597 * @return {!WebInspector.UISourceCode.Message} message
598 */ 598 */
599 addMessage: function(level, text, lineNumber, columnNumber) 599 addLineMessage: function(level, text, lineNumber, columnNumber)
600 { 600 {
601 var message = new WebInspector.UISourceCode.Message(this, level, text, l ineNumber, columnNumber); 601 return this.addMessage(level, text, new WebInspector.TextRange(lineNumbe r, columnNumber || 0, lineNumber, columnNumber || 0));
602 },
603
604 /**
605 * @param {!WebInspector.UISourceCode.Message.Level} level
606 * @param {string} text
607 * @param {!WebInspector.TextRange} range
608 * @return {!WebInspector.UISourceCode.Message} message
609 */
610 addMessage: function(level, text, range)
611 {
612 var message = new WebInspector.UISourceCode.Message(this, level, text, r ange);
602 this._messages.push(message); 613 this._messages.push(message);
603 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.MessageAd ded, message); 614 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.MessageAd ded, message);
604 return message; 615 return message;
605 }, 616 },
606 617
607 /** 618 /**
608 * @param {!WebInspector.UISourceCode.Message} message 619 * @param {!WebInspector.UISourceCode.Message} message
609 */ 620 */
610 removeMessage: function(message) 621 removeMessage: function(message)
611 { 622 {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 { 769 {
759 callback([]); 770 callback([]);
760 } 771 }
761 } 772 }
762 773
763 /** 774 /**
764 * @constructor 775 * @constructor
765 * @param {!WebInspector.UISourceCode} uiSourceCode 776 * @param {!WebInspector.UISourceCode} uiSourceCode
766 * @param {!WebInspector.UISourceCode.Message.Level} level 777 * @param {!WebInspector.UISourceCode.Message.Level} level
767 * @param {string} text 778 * @param {string} text
768 * @param {number} lineNumber 779 * @param {!WebInspector.TextRange} range
769 * @param {number=} columnNumber
770 */ 780 */
771 WebInspector.UISourceCode.Message = function(uiSourceCode, level, text, lineNumb er, columnNumber) 781 WebInspector.UISourceCode.Message = function(uiSourceCode, level, text, range)
772 { 782 {
773 this._uiSourceCode = uiSourceCode; 783 this._uiSourceCode = uiSourceCode;
774 this._level = level; 784 this._level = level;
775 this._text = text; 785 this._text = text;
776 this._lineNumber = lineNumber; 786 this._range = range;
777 this._columnNumber = columnNumber;
778 } 787 }
779 788
780 /** 789 /**
781 * @enum {string} 790 * @enum {string}
782 */ 791 */
783 WebInspector.UISourceCode.Message.Level = { 792 WebInspector.UISourceCode.Message.Level = {
784 Error: "Error", 793 Error: "Error",
785 Warning: "Warning" 794 Warning: "Warning"
786 } 795 }
787 796
(...skipping 16 matching lines...) Expand all
804 813
805 /** 814 /**
806 * @return {string} 815 * @return {string}
807 */ 816 */
808 text: function() 817 text: function()
809 { 818 {
810 return this._text; 819 return this._text;
811 }, 820 },
812 821
813 /** 822 /**
823 * @return {!WebInspector.TextRange}
824 */
825 range: function() {
826 return this._range;
827 },
828
829 /**
814 * @return {number} 830 * @return {number}
815 */ 831 */
816 lineNumber: function() 832 lineNumber: function()
817 { 833 {
818 return this._lineNumber; 834 return this._range.startLine;
819 }, 835 },
820 836
821 /** 837 /**
822 * @return {(number|undefined)} 838 * @return {(number|undefined)}
823 */ 839 */
824 columnNumber: function() 840 columnNumber: function()
825 { 841 {
826 return this._columnNumber; 842 return this._range.startColumn;
827 }, 843 },
828 844
829 /** 845 /**
830 * @param {!WebInspector.UISourceCode.Message} another 846 * @param {!WebInspector.UISourceCode.Message} another
831 * @return {boolean} 847 * @return {boolean}
832 */ 848 */
833 isEqual: function(another) 849 isEqual: function(another)
834 { 850 {
835 return this._uiSourceCode === another._uiSourceCode && this.text() === a nother.text() && this.level() === another.level() && this.lineNumber() === anoth er.lineNumber() && this.columnNumber() === another.columnNumber(); 851 return this._uiSourceCode === another._uiSourceCode && this.text() === a nother.text() && this.level() === another.level() && this.range().equal(another. range());
836 }, 852 },
837 853
838 remove: function() 854 remove: function()
839 { 855 {
840 this._uiSourceCode.removeMessage(this); 856 this._uiSourceCode.removeMessage(this);
841 } 857 }
842 } 858 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/sources/JavaScriptCompiler.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698