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

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

Issue 2314503005: DevTools: remove UISourceCodeFrame from context when switching panels. (Closed)
Patch Set: Created 4 years, 3 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 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 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.CodeMirrorTextEditor} 7 * @extends {WebInspector.CodeMirrorTextEditor}
8 * @param {!WebInspector.SourcesTextEditorDelegate} delegate 8 * @param {!WebInspector.SourcesTextEditorDelegate} delegate
9 */ 9 */
10 WebInspector.SourcesTextEditor = function(delegate) 10 WebInspector.SourcesTextEditor = function(delegate)
11 { 11 {
12 WebInspector.CodeMirrorTextEditor.call(this); 12 WebInspector.CodeMirrorTextEditor.call(this);
13 13
14 this.codeMirror().addKeyMap({ 14 this.codeMirror().addKeyMap({
15 "Enter": "smartNewlineAndIndent", 15 "Enter": "smartNewlineAndIndent",
16 "Esc": "sourcesDismiss" 16 "Esc": "sourcesDismiss"
17 }); 17 });
18 18
19 this._delegate = delegate; 19 this._delegate = delegate;
20 20
21 this.codeMirror().on("changes", this._changesForDelegate.bind(this)); 21 this.codeMirror().on("changes", this._changesForDelegate.bind(this));
22 this.codeMirror().on("cursorActivity", this._cursorActivity.bind(this)); 22 this.codeMirror().on("cursorActivity", this._cursorActivity.bind(this));
23 this.codeMirror().on("gutterClick", this._gutterClick.bind(this)); 23 this.codeMirror().on("gutterClick", this._gutterClick.bind(this));
24 this.codeMirror().on("scroll", this._scroll.bind(this)); 24 this.codeMirror().on("scroll", this._scroll.bind(this));
25 this.codeMirror().on("focus", this._focus.bind(this)); 25 this.codeMirror().on("focus", this._focus.bind(this));
26 this.codeMirror().on("blur", this._blur.bind(this));
26 this.codeMirror().on("beforeSelectionChange", this._beforeSelectionChangeFor Delegate.bind(this)); 27 this.codeMirror().on("beforeSelectionChange", this._beforeSelectionChangeFor Delegate.bind(this));
27 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f alse); 28 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f alse);
28 29
29 this._blockIndentController = new WebInspector.SourcesTextEditor.BlockIndent Controller(this.codeMirror()); 30 this._blockIndentController = new WebInspector.SourcesTextEditor.BlockIndent Controller(this.codeMirror());
30 this._tokenHighlighter = new WebInspector.SourcesTextEditor.TokenHighlighter (this, this.codeMirror()); 31 this._tokenHighlighter = new WebInspector.SourcesTextEditor.TokenHighlighter (this, this.codeMirror());
31 32
32 /** @type {!Array<string>} */ 33 /** @type {!Array<string>} */
33 this._gutters = ["CodeMirror-linenumbers"]; 34 this._gutters = ["CodeMirror-linenumbers"];
34 35
35 /** 36 /**
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 { 421 {
421 var topmostLineNumber = this.codeMirror().lineAtHeight(this.codeMirror() .getScrollInfo().top, "local"); 422 var topmostLineNumber = this.codeMirror().lineAtHeight(this.codeMirror() .getScrollInfo().top, "local");
422 this._delegate.scrollChanged(topmostLineNumber); 423 this._delegate.scrollChanged(topmostLineNumber);
423 }, 424 },
424 425
425 _focus: function() 426 _focus: function()
426 { 427 {
427 this._delegate.editorFocused(); 428 this._delegate.editorFocused();
428 }, 429 },
429 430
431 _blur: function()
432 {
433 this._delegate.editorBlurred();
434 },
435
430 /** 436 /**
431 * @param {!CodeMirror} codeMirror 437 * @param {!CodeMirror} codeMirror
432 * @param {{ranges: !Array.<{head: !CodeMirror.Pos, anchor: !CodeMirror.Pos} >}} selection 438 * @param {{ranges: !Array.<{head: !CodeMirror.Pos, anchor: !CodeMirror.Pos} >}} selection
433 */ 439 */
434 _beforeSelectionChangeForDelegate: function(codeMirror, selection) 440 _beforeSelectionChangeForDelegate: function(codeMirror, selection)
435 { 441 {
436 if (!this._isHandlingMouseDownEvent) 442 if (!this._isHandlingMouseDownEvent)
437 return; 443 return;
438 if (!selection.ranges.length) 444 if (!selection.ranges.length)
439 return; 445 return;
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 */ 621 */
616 selectionChanged: function(textRange) { }, 622 selectionChanged: function(textRange) { },
617 623
618 /** 624 /**
619 * @param {number} lineNumber 625 * @param {number} lineNumber
620 */ 626 */
621 scrollChanged: function(lineNumber) { }, 627 scrollChanged: function(lineNumber) { },
622 628
623 editorFocused: function() { }, 629 editorFocused: function() { },
624 630
631 editorBlurred: function() { },
632
625 /** 633 /**
626 * @param {!WebInspector.ContextMenu} contextMenu 634 * @param {!WebInspector.ContextMenu} contextMenu
627 * @param {number} lineNumber 635 * @param {number} lineNumber
628 * @return {!Promise} 636 * @return {!Promise}
629 */ 637 */
630 populateLineGutterContextMenu: function(contextMenu, lineNumber) { }, 638 populateLineGutterContextMenu: function(contextMenu, lineNumber) { },
631 639
632 /** 640 /**
633 * @param {!WebInspector.ContextMenu} contextMenu 641 * @param {!WebInspector.ContextMenu} contextMenu
634 * @param {number} lineNumber 642 * @param {number} lineNumber
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 this._codeMirror.addOverlay(overlayMode); 980 this._codeMirror.addOverlay(overlayMode);
973 this._highlightDescriptor = { 981 this._highlightDescriptor = {
974 overlay: overlayMode, 982 overlay: overlayMode,
975 selectionStart: selectionStart 983 selectionStart: selectionStart
976 }; 984 };
977 } 985 }
978 } 986 }
979 987
980 WebInspector.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000; 988 WebInspector.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000;
981 WebInspector.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16; 989 WebInspector.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698