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

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: 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
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..d3fe3e48389e80f7a9c2b0747f2bce2673d082f1 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
@@ -606,6 +606,18 @@ WebInspector.SourceFrame.prototype = {
}
},
+ /**
+ * @param {!Array<!WebInspector.SourceFrameMessage>} messages
+ */
+ setMessagesForSource: function(messages)
+ {
+ this.clearMessages();
pfeldman 2015/10/26 18:08:49 We should allow for concurrent error messages, you
wes 2015/10/26 22:16:32 Acknowledged.
+ for (var index = 0; index < messages.length; index++) {
+ var message = messages[index];
+ this.addMessageToSource(message);
+ }
+ },
+
populateLineGutterContextMenu: function(contextMenu, lineNumber)
{
},
@@ -690,15 +702,13 @@ WebInspector.SourceFrame.prototype = {
* @constructor
* @param {string} messageText
* @param {!WebInspector.SourceFrameMessage.Level} level
- * @param {number} lineNumber
- * @param {number=} columnNumber
+ * @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;
+ this._range = range;
}
/**
@@ -719,7 +729,8 @@ WebInspector.SourceFrameMessage.fromConsoleMessage = function(consoleMessage, li
{
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 location = new WebInspector.TextRange(lineNumber, columnNumber, lineNumber, columnNumber);
+ return new WebInspector.SourceFrameMessage(consoleMessage.messageText, level, location);
}
WebInspector.SourceFrameMessage.prototype = {
@@ -740,11 +751,19 @@ WebInspector.SourceFrameMessage.prototype = {
},
/**
+ * @return {!WebInspector.TextRange}
+ */
+ range: function()
+ {
+ return this._range;
+ },
+
+ /**
* @return {number}
*/
lineNumber: function()
pfeldman 2015/10/26 18:08:49 We can not remove these in favor of the one above.
wes 2015/10/26 22:16:32 Is there an action for me on this comment, or is t
{
- return this._lineNumber;
+ return this._range.startLine;
},
/**
@@ -752,7 +771,7 @@ WebInspector.SourceFrameMessage.prototype = {
*/
columnNumber: function()
pfeldman 2015/10/26 18:08:49 We can not remove these in favor of the one above.
wes 2015/10/26 22:16:32 Same as above?
{
- return this._columnNumber;
+ return this._range.startColumn;
},
/**
@@ -761,7 +780,9 @@ 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() &&
pfeldman 2015/10/26 18:08:49 poor formatting.
wes 2015/10/26 22:16:32 Acknowledged.
+ this.level() === another.level() &&
+ this.range().equal(another.range());
}
}
@@ -866,6 +887,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;

Powered by Google App Engine
This is Rietveld 408576698