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

Unified Diff: third_party/WebKit/Source/devtools/front_end/source_frame/SourceFrame.js

Issue 1416793005: Devtools: API To set the red/yellow squiggles for a file via DI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update API with feedback from cl Created 5 years, 2 months 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 | third_party/WebKit/Source/devtools/front_end/sources/JavaScriptCompiler.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/source_frame/SourceFrame.js
diff --git a/third_party/WebKit/Source/devtools/front_end/source_frame/SourceFrame.js b/third_party/WebKit/Source/devtools/front_end/source_frame/SourceFrame.js
index 41f0c36a1617b36ac4c40ebb088ad0a310b3b9f5..89c3bd804369e7e2c4362450bea76e88620aa9ef 100644
--- a/third_party/WebKit/Source/devtools/front_end/source_frame/SourceFrame.js
+++ b/third_party/WebKit/Source/devtools/front_end/source_frame/SourceFrame.js
@@ -689,24 +689,14 @@ WebInspector.SourceFrame.prototype = {
/**
* @constructor
* @param {string} messageText
- * @param {!WebInspector.SourceFrameMessage.Level} level
- * @param {number} lineNumber
- * @param {number=} columnNumber
+ * @param {!WebInspector.UISourceCodeMessage.Level} level
+ * @param {!WebInspector.TextRange} range
*/
-WebInspector.SourceFrameMessage = function(messageText, level, lineNumber, columnNumber)
+WebInspector.SourceFrameMessage = function(messageText, level, range)
{
this._messageText = messageText;
this._level = level;
- this._lineNumber = lineNumber;
- this._columnNumber = columnNumber;
-}
-
-/**
- * @enum {string}
- */
-WebInspector.SourceFrameMessage.Level = {
- Error: "Error",
- Warning: "Warning"
+ this._range = range;
}
/**
@@ -718,8 +708,9 @@ WebInspector.SourceFrameMessage.Level = {
WebInspector.SourceFrameMessage.fromConsoleMessage = 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.SourceFrameMessage.Level.Error : WebInspector.SourceFrameMessage.Level.Warning;
- return new WebInspector.SourceFrameMessage(consoleMessage.messageText, level, lineNumber, columnNumber);
+ var level = consoleMessage.level === WebInspector.ConsoleMessage.MessageLevel.Error ? WebInspector.UISourceCodeMessage.Level.Error : WebInspector.UISourceCodeMessage.Level.Warning;
+ var location = new WebInspector.TextRange(lineNumber, columnNumber, lineNumber, columnNumber);
+ return new WebInspector.SourceFrameMessage(consoleMessage.messageText, level, location);
}
WebInspector.SourceFrameMessage.prototype = {
@@ -732,7 +723,7 @@ WebInspector.SourceFrameMessage.prototype = {
},
/**
- * @return {!WebInspector.SourceFrameMessage.Level}
+ * @return {!WebInspector.UISourceCodeMessage.Level}
*/
level: function()
{
@@ -740,11 +731,19 @@ WebInspector.SourceFrameMessage.prototype = {
},
/**
+ * @return {!WebInspector.TextRange}
+ */
+ range: function()
+ {
+ return this._range;
+ },
+
+ /**
* @return {number}
*/
lineNumber: function()
{
- return this._lineNumber;
+ return this._range.startLine;
},
/**
@@ -752,7 +751,7 @@ WebInspector.SourceFrameMessage.prototype = {
*/
columnNumber: function()
{
- return this._columnNumber;
+ return this._range.startColumn;
},
/**
@@ -761,17 +760,19 @@ WebInspector.SourceFrameMessage.prototype = {
*/
isEqual: function(another)
{
- return this.messageText() === another.messageText() && this.level() === another.level() && this.lineNumber() === another.lineNumber() && this.columnNumber() === another.columnNumber();
+ return this.messageText() === another.messageText() &&
+ this.level() === another.level() &&
+ this.range().equal(another.range());
}
}
WebInspector.SourceFrame._iconClassPerLevel = {};
-WebInspector.SourceFrame._iconClassPerLevel[WebInspector.SourceFrameMessage.Level.Error] = "error-icon";
-WebInspector.SourceFrame._iconClassPerLevel[WebInspector.SourceFrameMessage.Level.Warning] = "warning-icon";
+WebInspector.SourceFrame._iconClassPerLevel[WebInspector.UISourceCodeMessage.Level.Error] = "error-icon";
+WebInspector.SourceFrame._iconClassPerLevel[WebInspector.UISourceCodeMessage.Level.Warning] = "warning-icon";
WebInspector.SourceFrame._lineClassPerLevel = {};
-WebInspector.SourceFrame._lineClassPerLevel[WebInspector.SourceFrameMessage.Level.Error] = "text-editor-line-with-error";
-WebInspector.SourceFrame._lineClassPerLevel[WebInspector.SourceFrameMessage.Level.Warning] = "text-editor-line-with-warning";
+WebInspector.SourceFrame._lineClassPerLevel[WebInspector.UISourceCodeMessage.Level.Error] = "text-editor-line-with-error";
+WebInspector.SourceFrame._lineClassPerLevel[WebInspector.UISourceCodeMessage.Level.Warning] = "text-editor-line-with-warning";
/**
* @constructor
@@ -866,6 +867,8 @@ WebInspector.SourceFrame.RowMessageBucket.prototype = {
var base = this._textEditor.cursorPositionToCoordinates(lineNumber, 0);
var start = this._textEditor.cursorPositionToCoordinates(lineNumber, Math.max(columnNumber - 1, lineIndent));
+ if (!start)
+ return; //stale data - columnNumber is already gone, wait for future update and for UI to settle
var end = this._textEditor.cursorPositionToCoordinates(lineNumber, lineText.length);
/** @const */
var codeMirrorLinesLeftPadding = 4;
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/sources/JavaScriptCompiler.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698