Chromium Code Reviews| 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..ecbeeb3d6f5be376b66522cd15d46b251fbd4e29 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 {!Set<number>}} */ |
| + this._gutterMarkers = new Set(); |
| this.registerRequiredCSS("cm/codemirror.css"); |
| this.registerRequiredCSS("source_frame/cmdevtools.css"); |
| @@ -1118,6 +1120,46 @@ WebInspector.CodeMirrorTextEditor.prototype = { |
| /** |
| * @param {number} lineNumber |
| + * @param {string} type |
| + * @param {?Element} element |
| + */ |
| + setGutterMarker: function(lineNumber, type, element) |
|
pfeldman
2016/03/09 02:14:20
addGutterDecoration(line, type, element)
alph
2016/03/09 22:42:18
Done.
|
| + { |
| + if (!this._gutterMarkersToSet) |
| + this._gutterMarkersToSet = []; |
| + this._gutterMarkersToSet.push({line: lineNumber, type: type, element: element}); |
| + if (this._gutterMarkersToSet.length > 1) |
| + return; |
| + setImmediate(this.operation.bind(this, () => { |
| + this._gutterMarkersToSet.forEach(doSetGutterMarker.bind(this)); |
| + this._gutterMarkersToSet = null; |
| + })); |
| + |
| + /** |
| + * @param {!{line: number, type: string, element: ?Element}} marker |
| + * @this {WebInspector.CodeMirrorTextEditor} |
| + */ |
| + function doSetGutterMarker(marker) |
| + { |
| + if (marker.element) { |
| + if (!this._gutterMarkers.size) { |
| + this._codeMirror.setOption("gutters", ["CodeMirror-linenumbers", "CodeMirror-linemarkers-" + marker.type]); |
| + this._codeMirror.refresh(); |
| + } |
| + this._gutterMarkers.add(marker.line); |
| + } else { |
| + this._gutterMarkers.delete(marker.line); |
| + if (!this._gutterMarkers.size) { |
| + this._codeMirror.setOption("gutters", ["CodeMirror-linenumbers"]); |
| + this._codeMirror.refresh(); |
| + } |
| + } |
| + this._codeMirror.setGutterMarker(marker.line, "CodeMirror-linemarkers-" + marker.type, marker.element); |
| + } |
| + }, |
| + |
| + /** |
| + * @param {number} lineNumber |
| * @param {number} columnNumber |
| */ |
| setExecutionLocation: function(lineNumber, columnNumber) |