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

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

Issue 1768183003: DevTools: Support line markers in UISourceCode and Code Mirror (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing comments. Created 4 years, 9 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 | « third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js ('k') | 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 e535581587b9244229274af30104a06f603a2453..5e78d0a3681a5a12860ad832a3ae49dff3c69d0f 100644
--- a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
+++ b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
@@ -52,6 +52,8 @@ WebInspector.UISourceCode = function(project, url, contentType)
this._requestContentCallback = null;
/** @type {?Promise<?string>} */
this._requestContentPromise = null;
+ /** @type {!Map<string, !Array<!WebInspector.UISourceCode.LineMarker>>} */
+ this._lineDecorations = new Map();
/** @type {!Array.<!WebInspector.Revision>} */
this.history = [];
@@ -71,6 +73,8 @@ WebInspector.UISourceCode.Events = {
SourceMappingChanged: "SourceMappingChanged",
MessageAdded: "MessageAdded",
MessageRemoved: "MessageRemoved",
+ LineDecorationAdded: "LineDecorationAdded",
+ LineDecorationRemoved: "LineDecorationRemoved"
}
WebInspector.UISourceCode.prototype = {
@@ -644,6 +648,42 @@ WebInspector.UISourceCode.prototype = {
this.dispatchEventToListeners(WebInspector.UISourceCode.Events.MessageRemoved, message);
},
+ /**
+ * @param {number} lineNumber
+ * @param {string} type
+ * @param {?} data
+ */
+ addLineDecoration: function(lineNumber, type, data)
+ {
+ var markers = this._lineDecorations.get(type);
+ if (!markers) {
+ markers = [];
+ this._lineDecorations.set(type, markers);
+ }
+ var marker = new WebInspector.UISourceCode.LineMarker(lineNumber, type, data);
+ markers.push(marker);
+ this.dispatchEventToListeners(WebInspector.UISourceCode.Events.LineDecorationAdded, marker);
+ },
+
+ /**
+ * @param {string} type
+ */
+ removeAllLineDecorations: function(type)
+ {
+ var markers = this._lineDecorations.get(type) || [];
+ markers.forEach(this.dispatchEventToListeners.bind(this, WebInspector.UISourceCode.Events.LineDecorationRemoved));
+ this._lineDecorations.delete(type);
+ },
+
+ /**
+ * @param {string} type
+ * @return {?Array<!WebInspector.UISourceCode.LineMarker>}
+ */
+ lineDecorations: function(type)
+ {
+ return this._lineDecorations.get(type) || null;
+ },
+
__proto__: WebInspector.Object.prototype
}
@@ -837,7 +877,8 @@ WebInspector.UISourceCode.Message.prototype = {
/**
* @return {!WebInspector.TextRange}
*/
- range: function() {
+ range: function()
+ {
return this._range;
},
@@ -871,3 +912,42 @@ WebInspector.UISourceCode.Message.prototype = {
this._uiSourceCode.removeMessage(this);
}
}
+
+/**
+ * @constructor
+ * @param {number} line
+ * @param {string} type
+ * @param {?} data
+ */
+WebInspector.UISourceCode.LineMarker = function(line, type, data)
+{
+ this._line = line;
+ this._type = type;
+ this._data = data;
+}
+
+WebInspector.UISourceCode.LineMarker.prototype = {
+ /**
+ * @return {number}
+ */
+ line: function()
+ {
+ return this._line;
+ },
+
+ /**
+ * @return {string}
+ */
+ type: function()
+ {
+ return this._type;
+ },
+
+ /**
+ * @return {*}
+ */
+ data: function()
+ {
+ return this._data;
+ }
+}
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698