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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/source_frame/SourcesTextEditor.js

Issue 2505413002: [DevTools] Prepare JavaScriptSourceFrame for multiple breakpoints per line (Closed)
Patch Set: addressed comments Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 SourceFrame.SourcesTextEditor = class extends TextEditor.CodeMirrorTextEditor { 7 SourceFrame.SourcesTextEditor = class extends TextEditor.CodeMirrorTextEditor {
8 /** 8 /**
9 * @param {!SourceFrame.SourcesTextEditorDelegate} delegate 9 * @param {!SourceFrame.SourcesTextEditorDelegate} delegate
10 */ 10 */
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 */ 158 */
159 highlightRange(range, cssClass) { 159 highlightRange(range, cssClass) {
160 cssClass = 'CodeMirror-persist-highlight ' + cssClass; 160 cssClass = 'CodeMirror-persist-highlight ' + cssClass;
161 var pos = TextEditor.CodeMirrorUtils.toPos(range); 161 var pos = TextEditor.CodeMirrorUtils.toPos(range);
162 ++pos.end.ch; 162 ++pos.end.ch;
163 return this.codeMirror().markText( 163 return this.codeMirror().markText(
164 pos.start, pos.end, {className: cssClass, startStyle: cssClass + '-start ', endStyle: cssClass + '-end'}); 164 pos.start, pos.end, {className: cssClass, startStyle: cssClass + '-start ', endStyle: cssClass + '-end'});
165 } 165 }
166 166
167 /** 167 /**
168 * @param {number} lineNumber
169 * @param {boolean} disabled
170 * @param {boolean} conditional
171 */
172 addBreakpoint(lineNumber, disabled, conditional) {
173 if (lineNumber < 0 || lineNumber >= this.codeMirror().lineCount())
174 return;
175
176 var className = 'cm-breakpoint' + (conditional ? ' cm-breakpoint-conditional ' : '') +
177 (disabled ? ' cm-breakpoint-disabled' : '');
178 this.codeMirror().addLineClass(lineNumber, 'wrap', className);
179 }
180
181 /**
182 * @param {number} lineNumber
183 */
184 removeBreakpoint(lineNumber) {
185 if (lineNumber < 0 || lineNumber >= this.codeMirror().lineCount())
186 return;
187
188 var wrapClasses = this.codeMirror().getLineHandle(lineNumber).wrapClass;
189 if (!wrapClasses)
190 return;
191
192 var classes = wrapClasses.split(' ');
193 for (var i = 0; i < classes.length; ++i) {
194 if (classes[i].startsWith('cm-breakpoint'))
195 this.codeMirror().removeLineClass(lineNumber, 'wrap', classes[i]);
196 }
197 }
198
199 /**
200 * @param {string} type 168 * @param {string} type
201 * @param {boolean} leftToNumbers 169 * @param {boolean} leftToNumbers
202 */ 170 */
203 installGutter(type, leftToNumbers) { 171 installGutter(type, leftToNumbers) {
204 if (this._gutters.indexOf(type) !== -1) 172 if (this._gutters.indexOf(type) !== -1)
205 return; 173 return;
206 174
207 if (leftToNumbers) 175 if (leftToNumbers)
208 this._gutters.unshift(type); 176 this._gutters.unshift(type);
209 else 177 else
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 */ 870 */
903 _setHighlighter(highlighter, selectionStart) { 871 _setHighlighter(highlighter, selectionStart) {
904 var overlayMode = {token: highlighter}; 872 var overlayMode = {token: highlighter};
905 this._codeMirror.addOverlay(overlayMode); 873 this._codeMirror.addOverlay(overlayMode);
906 this._highlightDescriptor = {overlay: overlayMode, selectionStart: selection Start}; 874 this._highlightDescriptor = {overlay: overlayMode, selectionStart: selection Start};
907 } 875 }
908 }; 876 };
909 877
910 SourceFrame.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000; 878 SourceFrame.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000;
911 SourceFrame.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16; 879 SourceFrame.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698