| 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 41d0d9ba36d49fce89744efb2f175f76520b572d..da03942a6645ddb0340008fe9676c491489820cd 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
|
| @@ -438,8 +438,8 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
|
| var position = charNumber;
|
| var nextPosition = charNumber + 1;
|
| return valid(position, text.length) && valid(nextPosition, text.length) &&
|
| - Common.TextUtils.isWordChar(text[position]) && Common.TextUtils.isWordChar(text[nextPosition]) &&
|
| - Common.TextUtils.isUpperCase(text[position]) && Common.TextUtils.isLowerCase(text[nextPosition]);
|
| + TextUtils.TextUtils.isWordChar(text[position]) && TextUtils.TextUtils.isWordChar(text[nextPosition]) &&
|
| + TextUtils.TextUtils.isUpperCase(text[position]) && TextUtils.TextUtils.isLowerCase(text[nextPosition]);
|
| }
|
|
|
| /**
|
| @@ -451,8 +451,8 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
|
| var position = charNumber;
|
| var prevPosition = charNumber - 1;
|
| return valid(position, text.length) && valid(prevPosition, text.length) &&
|
| - Common.TextUtils.isWordChar(text[position]) && Common.TextUtils.isWordChar(text[prevPosition]) &&
|
| - Common.TextUtils.isUpperCase(text[position]) && Common.TextUtils.isLowerCase(text[prevPosition]);
|
| + TextUtils.TextUtils.isWordChar(text[position]) && TextUtils.TextUtils.isWordChar(text[prevPosition]) &&
|
| + TextUtils.TextUtils.isUpperCase(text[position]) && TextUtils.TextUtils.isLowerCase(text[prevPosition]);
|
| }
|
|
|
| /**
|
| @@ -474,13 +474,13 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
|
| var charNumber = direction === 1 ? columnNumber : columnNumber - 1;
|
|
|
| // Move through initial spaces if any.
|
| - while (valid(charNumber, length) && Common.TextUtils.isSpaceChar(text[charNumber]))
|
| + while (valid(charNumber, length) && TextUtils.TextUtils.isSpaceChar(text[charNumber]))
|
| charNumber += direction;
|
| if (!valid(charNumber, length))
|
| return constrainPosition(lineNumber, length, charNumber);
|
|
|
| - if (Common.TextUtils.isStopChar(text[charNumber])) {
|
| - while (valid(charNumber, length) && Common.TextUtils.isStopChar(text[charNumber]))
|
| + if (TextUtils.TextUtils.isStopChar(text[charNumber])) {
|
| + while (valid(charNumber, length) && TextUtils.TextUtils.isStopChar(text[charNumber]))
|
| charNumber += direction;
|
| if (!valid(charNumber, length))
|
| return constrainPosition(lineNumber, length, charNumber);
|
| @@ -489,7 +489,7 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
|
|
|
| charNumber += direction;
|
| while (valid(charNumber, length) && !isWordStart(text, charNumber) && !isWordEnd(text, charNumber) &&
|
| - Common.TextUtils.isWordChar(text[charNumber]))
|
| + TextUtils.TextUtils.isWordChar(text[charNumber]))
|
| charNumber += direction;
|
|
|
| if (!valid(charNumber, length))
|
| @@ -611,7 +611,7 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
|
| /**
|
| * @param {number} x
|
| * @param {number} y
|
| - * @return {?Common.TextRange}
|
| + * @return {?TextUtils.TextRange}
|
| */
|
| coordinatesToCursorPosition(x, y) {
|
| var element = this.element.ownerDocument.elementFromPoint(x, y);
|
| @@ -756,7 +756,7 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
|
| }
|
|
|
| /**
|
| - * @param {!Common.TextRange} range
|
| + * @param {!TextUtils.TextRange} range
|
| * @param {symbol=} type
|
| * @return {!Array.<!TextEditor.TextEditorBookMark>}
|
| */
|
| @@ -916,7 +916,7 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
|
| if (!this._readOnly)
|
| this._clearHighlightTimeout = setTimeout(this.clearPositionHighlight.bind(this), 2000);
|
| }
|
| - this.setSelection(Common.TextRange.createFromLocation(lineNumber, columnNumber));
|
| + this.setSelection(TextUtils.TextRange.createFromLocation(lineNumber, columnNumber));
|
| }
|
|
|
| clearPositionHighlight() {
|
| @@ -995,10 +995,10 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
|
| }
|
|
|
| /**
|
| - * @param {!Common.TextRange} range
|
| + * @param {!TextUtils.TextRange} range
|
| * @param {string} text
|
| * @param {string=} origin
|
| - * @return {!Common.TextRange}
|
| + * @return {!TextUtils.TextRange}
|
| */
|
| editRange(range, text, origin) {
|
| var pos = TextEditor.CodeMirrorUtils.toPos(range);
|
| @@ -1019,7 +1019,7 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
|
| * @param {number} lineNumber
|
| * @param {number} column
|
| * @param {function(string):boolean} isWordChar
|
| - * @return {!Common.TextRange}
|
| + * @return {!TextUtils.TextRange}
|
| */
|
| wordRangeForCursorPosition(lineNumber, column, isWordChar) {
|
| var line = this.line(lineNumber);
|
| @@ -1032,7 +1032,7 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
|
| var wordEnd = column;
|
| while (wordEnd < line.length && isWordChar(line.charAt(wordEnd)))
|
| ++wordEnd;
|
| - return new Common.TextRange(lineNumber, wordStart, lineNumber, wordEnd);
|
| + return new TextUtils.TextRange(lineNumber, wordStart, lineNumber, wordEnd);
|
| }
|
|
|
| /**
|
| @@ -1100,7 +1100,7 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
|
|
|
| /**
|
| * @override
|
| - * @return {!Common.TextRange}
|
| + * @return {!TextUtils.TextRange}
|
| */
|
| selection() {
|
| var start = this._codeMirror.getCursor('anchor');
|
| @@ -1110,7 +1110,7 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
|
| }
|
|
|
| /**
|
| - * @return {!Array.<!Common.TextRange>}
|
| + * @return {!Array.<!TextUtils.TextRange>}
|
| */
|
| selections() {
|
| var selectionList = this._codeMirror.listSelections();
|
| @@ -1123,7 +1123,7 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
|
| }
|
|
|
| /**
|
| - * @return {?Common.TextRange}
|
| + * @return {?TextUtils.TextRange}
|
| */
|
| lastSelection() {
|
| return this._lastSelection;
|
| @@ -1131,7 +1131,7 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
|
|
|
| /**
|
| * @override
|
| - * @param {!Common.TextRange} textRange
|
| + * @param {!TextUtils.TextRange} textRange
|
| */
|
| setSelection(textRange) {
|
| this._lastSelection = textRange;
|
| @@ -1144,7 +1144,7 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
|
| }
|
|
|
| /**
|
| - * @param {!Array.<!Common.TextRange>} ranges
|
| + * @param {!Array.<!TextUtils.TextRange>} ranges
|
| * @param {number=} primarySelectionIndex
|
| */
|
| setSelections(ranges, primarySelectionIndex) {
|
| @@ -1188,7 +1188,7 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
|
|
|
| /**
|
| * @override
|
| - * @param {!Common.TextRange=} textRange
|
| + * @param {!TextUtils.TextRange=} textRange
|
| * @return {string}
|
| */
|
| text(textRange) {
|
| @@ -1200,7 +1200,7 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
|
|
|
| /**
|
| * @override
|
| - * @return {!Common.TextRange}
|
| + * @return {!TextUtils.TextRange}
|
| */
|
| fullRange() {
|
| var lineCount = this.linesCount;
|
| @@ -1329,7 +1329,7 @@ CodeMirror.commands.dismiss = function(codemirror) {
|
| * @return {!Object|undefined}
|
| */
|
| CodeMirror.commands.goSmartPageUp = function(codemirror) {
|
| - if (codemirror._codeMirrorTextEditor.selection().equal(Common.TextRange.createFromLocation(0, 0)))
|
| + if (codemirror._codeMirrorTextEditor.selection().equal(TextUtils.TextRange.createFromLocation(0, 0)))
|
| return CodeMirror.Pass;
|
| codemirror.execCommand('goPageUp');
|
| };
|
| @@ -1408,8 +1408,8 @@ TextEditor.CodeMirrorTextEditor.SelectNextOccurrenceController = class {
|
| }
|
|
|
| /**
|
| - * @param {!Array.<!Common.TextRange>} selections
|
| - * @param {!Common.TextRange} range
|
| + * @param {!Array.<!TextUtils.TextRange>} selections
|
| + * @param {!TextUtils.TextRange} range
|
| * @return {boolean}
|
| */
|
| _findRange(selections, range) {
|
| @@ -1458,19 +1458,19 @@ TextEditor.CodeMirrorTextEditor.SelectNextOccurrenceController = class {
|
| }
|
|
|
| /**
|
| - * @param {!Array.<!Common.TextRange>} selections
|
| + * @param {!Array.<!TextUtils.TextRange>} selections
|
| */
|
| _expandSelectionsToWords(selections) {
|
| var newSelections = [];
|
| for (var i = 0; i < selections.length; ++i) {
|
| var selection = selections[i];
|
| var startRangeWord = this._textEditor.wordRangeForCursorPosition(
|
| - selection.startLine, selection.startColumn, Common.TextUtils.isWordChar) ||
|
| - Common.TextRange.createFromLocation(selection.startLine, selection.startColumn);
|
| + selection.startLine, selection.startColumn, TextUtils.TextUtils.isWordChar) ||
|
| + TextUtils.TextRange.createFromLocation(selection.startLine, selection.startColumn);
|
| var endRangeWord = this._textEditor.wordRangeForCursorPosition(
|
| - selection.endLine, selection.endColumn, Common.TextUtils.isWordChar) ||
|
| - Common.TextRange.createFromLocation(selection.endLine, selection.endColumn);
|
| - var newSelection = new Common.TextRange(
|
| + selection.endLine, selection.endColumn, TextUtils.TextUtils.isWordChar) ||
|
| + TextUtils.TextRange.createFromLocation(selection.endLine, selection.endColumn);
|
| + var newSelection = new TextUtils.TextRange(
|
| startRangeWord.startLine, startRangeWord.startColumn, endRangeWord.endLine, endRangeWord.endColumn);
|
| newSelections.push(newSelection);
|
| }
|
| @@ -1479,9 +1479,9 @@ TextEditor.CodeMirrorTextEditor.SelectNextOccurrenceController = class {
|
| }
|
|
|
| /**
|
| - * @param {!Common.TextRange} range
|
| + * @param {!TextUtils.TextRange} range
|
| * @param {boolean} fullWord
|
| - * @return {?Common.TextRange}
|
| + * @return {?TextUtils.TextRange}
|
| */
|
| _findNextOccurrence(range, fullWord) {
|
| range = range.normalize();
|
| @@ -1521,7 +1521,7 @@ TextEditor.CodeMirrorTextEditor.SelectNextOccurrenceController = class {
|
|
|
| if (typeof matchedLineNumber !== 'number')
|
| return null;
|
| - return new Common.TextRange(
|
| + return new TextUtils.TextRange(
|
| matchedLineNumber, matchedColumnNumber, matchedLineNumber, matchedColumnNumber + textToFind.length);
|
| }
|
| };
|
| @@ -1604,11 +1604,11 @@ TextEditor.TextEditorBookMark = class {
|
| }
|
|
|
| /**
|
| - * @return {?Common.TextRange}
|
| + * @return {?TextUtils.TextRange}
|
| */
|
| position() {
|
| var pos = this._marker.find();
|
| - return pos ? Common.TextRange.createFromLocation(pos.line, pos.ch) : null;
|
| + return pos ? TextUtils.TextRange.createFromLocation(pos.line, pos.ch) : null;
|
| }
|
| };
|
|
|
|
|