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

Unified Diff: third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js

Issue 2524583002: DevTools: Sources: Remove unused properties on CMTE (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | 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/text_editor/CodeMirrorTextEditor.js
diff --git a/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js b/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js
index db077fbe060113505cf4b31cb4cbccc564676ecd..4748d71140121439320b5d6222ca89648eed43c9 100644
--- a/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js
+++ b/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js
@@ -141,7 +141,8 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
this._shouldClearHistory = true;
this._lineSeparator = '\n';
- this._fixWordMovement = new TextEditor.CodeMirrorTextEditor.FixWordMovement(this._codeMirror);
+ TextEditor.CodeMirrorTextEditor._fixWordMovement(this._codeMirror);
+
this._selectNextOccurrenceController =
new TextEditor.CodeMirrorTextEditor.SelectNextOccurrenceController(this, this._codeMirror);
@@ -155,7 +156,6 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
/** @type {!Multimap<number, !TextEditor.CodeMirrorTextEditor.Decoration>} */
this._decorations = new Multimap();
- this._nestedUpdatesCounter = 0;
this.element.addEventListener('focus', this._handleElementFocus.bind(this), false);
this.element.addEventListener('keydown', this._handleKeyDown.bind(this), true);
@@ -314,6 +314,53 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
}
/**
+ * @param {!CodeMirror} codeMirror
+ */
+ static _fixWordMovement(codeMirror) {
+ function moveLeft(shift, codeMirror) {
+ codeMirror.setExtending(shift);
+ var cursor = codeMirror.getCursor('head');
+ codeMirror.execCommand('goGroupLeft');
+ var newCursor = codeMirror.getCursor('head');
+ if (newCursor.ch === 0 && newCursor.line !== 0) {
+ codeMirror.setExtending(false);
+ return;
+ }
+
+ var skippedText = codeMirror.getRange(newCursor, cursor, '#');
+ if (/^\s+$/.test(skippedText))
+ codeMirror.execCommand('goGroupLeft');
+ codeMirror.setExtending(false);
+ }
+
+ function moveRight(shift, codeMirror) {
+ codeMirror.setExtending(shift);
+ var cursor = codeMirror.getCursor('head');
+ codeMirror.execCommand('goGroupRight');
+ var newCursor = codeMirror.getCursor('head');
+ if (newCursor.ch === 0 && newCursor.line !== 0) {
+ codeMirror.setExtending(false);
+ return;
+ }
+
+ var skippedText = codeMirror.getRange(cursor, newCursor, '#');
+ if (/^\s+$/.test(skippedText))
+ codeMirror.execCommand('goGroupRight');
+ codeMirror.setExtending(false);
+ }
+
+ var modifierKey = Host.isMac() ? 'Alt' : 'Ctrl';
+ var leftKey = modifierKey + '-Left';
+ var rightKey = modifierKey + '-Right';
+ var keyMap = {};
+ keyMap[leftKey] = moveLeft.bind(null, false);
+ keyMap[rightKey] = moveRight.bind(null, false);
+ keyMap['Shift-' + leftKey] = moveLeft.bind(null, true);
+ keyMap['Shift-' + rightKey] = moveRight.bind(null, true);
+ codeMirror.addKeyMap(keyMap);
+ }
+
+ /**
* @protected
* @return {!CodeMirror}
*/
@@ -1323,58 +1370,6 @@ TextEditor.CodeMirrorPositionHandle = class {
/**
* @unrestricted
*/
-TextEditor.CodeMirrorTextEditor.FixWordMovement = class {
- /**
- * @param {!CodeMirror} codeMirror
- */
- constructor(codeMirror) {
- function moveLeft(shift, codeMirror) {
- codeMirror.setExtending(shift);
- var cursor = codeMirror.getCursor('head');
- codeMirror.execCommand('goGroupLeft');
- var newCursor = codeMirror.getCursor('head');
- if (newCursor.ch === 0 && newCursor.line !== 0) {
- codeMirror.setExtending(false);
- return;
- }
-
- var skippedText = codeMirror.getRange(newCursor, cursor, '#');
- if (/^\s+$/.test(skippedText))
- codeMirror.execCommand('goGroupLeft');
- codeMirror.setExtending(false);
- }
-
- function moveRight(shift, codeMirror) {
- codeMirror.setExtending(shift);
- var cursor = codeMirror.getCursor('head');
- codeMirror.execCommand('goGroupRight');
- var newCursor = codeMirror.getCursor('head');
- if (newCursor.ch === 0 && newCursor.line !== 0) {
- codeMirror.setExtending(false);
- return;
- }
-
- var skippedText = codeMirror.getRange(cursor, newCursor, '#');
- if (/^\s+$/.test(skippedText))
- codeMirror.execCommand('goGroupRight');
- codeMirror.setExtending(false);
- }
-
- var modifierKey = Host.isMac() ? 'Alt' : 'Ctrl';
- var leftKey = modifierKey + '-Left';
- var rightKey = modifierKey + '-Right';
- var keyMap = {};
- keyMap[leftKey] = moveLeft.bind(null, false);
- keyMap[rightKey] = moveRight.bind(null, false);
- keyMap['Shift-' + leftKey] = moveLeft.bind(null, true);
- keyMap['Shift-' + rightKey] = moveRight.bind(null, true);
- codeMirror.addKeyMap(keyMap);
- }
-};
-
-/**
- * @unrestricted
- */
TextEditor.CodeMirrorTextEditor.SelectNextOccurrenceController = class {
/**
* @param {!TextEditor.CodeMirrorTextEditor} textEditor
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698