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

Unified 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: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
diff --git a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
index 5e5889ba8db58c499a0f74f5860f50f8724b9388..b6f7da957948f8ccc10850a92467405fb9a277e5 100644
--- a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
+++ b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
@@ -597,13 +597,20 @@ WebInspector.UISourceCode.prototype = {
/**
* @param {!WebInspector.UISourceCode.Message.Level} level
* @param {string} text
- * @param {number} lineNumber
+ * @param {number|!WebInspector.TextRange} lineNumberOrRange
pfeldman 2015/11/19 19:18:25 Lets always use the range - we try to not do insta
wes 2015/11/19 22:11:25 Acknowledged.
* @param {number=} columnNumber
* @return {!WebInspector.UISourceCode.Message} message
*/
- addMessage: function(level, text, lineNumber, columnNumber)
+ addMessage: function(level, text, lineNumberOrRange, columnNumber)
{
- var message = new WebInspector.UISourceCode.Message(this, level, text, lineNumber, columnNumber);
+ /** @type {!WebInspector.TextRange} */
+ var textRange;
+ if (lineNumberOrRange instanceof WebInspector.TextRange) {
+ textRange = lineNumberOrRange;
+ } else {
+ textRange = new WebInspector.TextRange(lineNumberOrRange, columnNumber || 0, lineNumberOrRange, columnNumber || 0);
+ }
+ var message = new WebInspector.UISourceCode.Message(this, level, text, textRange);
this._messages.push(message);
this.dispatchEventToListeners(WebInspector.UISourceCode.Events.MessageAdded, message);
return message;
@@ -770,16 +777,14 @@ WebInspector.Revision.prototype = {
* @param {!WebInspector.UISourceCode} uiSourceCode
* @param {!WebInspector.UISourceCode.Message.Level} level
* @param {string} text
- * @param {number} lineNumber
- * @param {number=} columnNumber
+ * @param {!WebInspector.TextRange} range
*/
-WebInspector.UISourceCode.Message = function(uiSourceCode, level, text, lineNumber, columnNumber)
+WebInspector.UISourceCode.Message = function(uiSourceCode, level, text, range)
{
this._uiSourceCode = uiSourceCode;
this._level = level;
this._text = text;
- this._lineNumber = lineNumber;
- this._columnNumber = columnNumber;
+ this._range = range;
}
/**
@@ -816,11 +821,18 @@ WebInspector.UISourceCode.Message.prototype = {
},
/**
+ * @return {!WebInspector.TextRange}
+ */
+ range: function() {
+ return this._range;
+ },
+
+ /**
* @return {number}
*/
lineNumber: function()
{
- return this._lineNumber;
+ return this._range.startLine;
},
/**
@@ -828,7 +840,7 @@ WebInspector.UISourceCode.Message.prototype = {
*/
columnNumber: function()
{
- return this._columnNumber;
+ return this._range.startColumn;
},
/**
@@ -837,7 +849,7 @@ WebInspector.UISourceCode.Message.prototype = {
*/
isEqual: function(another)
{
- return this._uiSourceCode === another._uiSourceCode && this.text() === another.text() && this.level() === another.level() && this.lineNumber() === another.lineNumber() && this.columnNumber() === another.columnNumber();
+ return this._uiSourceCode === another._uiSourceCode && this.text() === another.text() && this.level() === another.level() && this.range().equal(another.range());
},
remove: function()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698