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

Unified Diff: third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.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 | « no previous file | third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.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/CodeMirrorTextEditor.js
diff --git a/third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js b/third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
index 8b6730246bfd24ec7e530708cf48f232c02e88e4..3373f6d4d3542419cdb0df8a0b792757d612df2b 100644
--- a/third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
+++ b/third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
@@ -39,6 +39,8 @@ WebInspector.CodeMirrorTextEditor = function(url, delegate)
WebInspector.VBox.call(this);
this._delegate = delegate;
this._url = url;
+ /** @type {!Map<string, !Set<number>>}} */
+ this._decoratedGutterLines = new Map();
this.registerRequiredCSS("cm/codemirror.css");
this.registerRequiredCSS("source_frame/cmdevtools.css");
@@ -1118,6 +1120,42 @@ WebInspector.CodeMirrorTextEditor.prototype = {
/**
* @param {number} lineNumber
+ * @param {string} type
+ * @param {!Element} element
+ */
+ setGutterDecoration: function(lineNumber, type, element)
+ {
+ var lines = this._decoratedGutterLines.get(type);
+ if (!lines) {
+ lines = new Set();
+ this._decoratedGutterLines.set(type, lines);
+ var gutters = this._codeMirror.getOption("gutters");
+ var gutterType = "CodeMirror-gutter-" + type;
+ if (gutters.indexOf(gutterType) === -1) {
+ gutters = gutters.concat([gutterType]);
+ this._codeMirror.setOption("gutters", gutters);
+ this._codeMirror.refresh();
+ }
+ }
+ lines.add(lineNumber);
+ this._codeMirror.setGutterMarker(lineNumber, "CodeMirror-gutter-" + type, element);
+ },
+
+ /**
+ * @param {string} type
+ */
+ resetGutterDecorations: function(type)
+ {
+ this._decoratedGutterLines.delete(type);
+ var gutters = this._codeMirror.getOption("gutters").slice();
+ if (!gutters.remove("CodeMirror-gutter-" + type))
+ return;
+ this._codeMirror.setOption("gutters", gutters);
+ this._codeMirror.refresh();
+ },
+
+ /**
+ * @param {number} lineNumber
* @param {number} columnNumber
*/
setExecutionLocation: function(lineNumber, columnNumber)
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698