Changeset 142621 in webkit
- Timestamp:
- Feb 12, 2013 7:18:20 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r142619 r142621 1 2013-02-12 Andrey Lushnikov <lushnikov@chromium.org> 2 3 Web Inspector: refactor some reusable functionality from BraceHighlighter 4 https://bugs.webkit.org/show_bug.cgi?id=109574 5 6 Reviewed by Pavel Feldman. 7 8 Add layout test to verify brace highlighter functionality. 9 10 * inspector/editor/text-editor-brace-highlighter-expected.txt: Added. 11 * inspector/editor/text-editor-brace-highlighter.html: Added. 12 1 13 2013-02-12 Andrew Wilson <atwilson@chromium.org> 2 14 -
trunk/Source/WebCore/ChangeLog
r142618 r142621 1 2013-02-12 Andrey Lushnikov <lushnikov@chromium.org> 2 3 Web Inspector: refactor some reusable functionality from BraceHighlighter 4 https://bugs.webkit.org/show_bug.cgi?id=109574 5 6 Reviewed by Pavel Feldman. 7 8 New test: inspector/editor/text-editor-brace-highlighter.html 9 10 Extract functionality which, for given line and cursor position, will 11 return position for a brace that should be highlighted. Add a layout 12 test to verify brace highlighter funcionality. 13 14 * inspector/front-end/DefaultTextEditor.js: 15 (WebInspector.TextEditorMainPanel.BraceHighlightController.prototype.activeBraceColumnForCursorPosition): 16 (WebInspector.TextEditorMainPanel.BraceHighlightController.prototype.handleSelectionChange): 17 * inspector/front-end/TextUtils.js: 18 (WebInspector.TextUtils.isOpeningBraceChar): 19 (WebInspector.TextUtils.isClosingBraceChar): 20 (WebInspector.TextUtils.isBraceChar): 21 1 22 2013-02-12 Ilya Tikhonovsky <loislo@chromium.org> 2 23 -
trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js
r142597 r142621 3405 3405 WebInspector.TextEditorMainPanel.BraceHighlightController.prototype = { 3406 3406 /** 3407 * @param {string} line 3408 * @param {number} column 3409 * @return {number} 3410 */ 3411 activeBraceColumnForCursorPosition: function(line, column) 3412 { 3413 var char = line.charAt(column); 3414 if (WebInspector.TextUtils.isOpeningBraceChar(char)) 3415 return column; 3416 3417 var previousChar = line.charAt(column - 1); 3418 if (WebInspector.TextUtils.isBraceChar(previousChar)) 3419 return column - 1; 3420 3421 if (WebInspector.TextUtils.isBraceChar(char)) 3422 return column; 3423 else 3424 return -1; 3425 }, 3426 3427 /** 3407 3428 * @param {WebInspector.TextRange} selectionRange 3408 3429 */ … … 3421 3442 var column = selectionRange.startColumn; 3422 3443 var line = this._textModel.line(lineNumber); 3423 if (column > 0 && WebInspector.TextUtils.isBraceChar(line.charAt(column - 1))) 3424 --column; 3444 column = this.activeBraceColumnForCursorPosition(line, column); 3445 if (column < 0) 3446 return; 3425 3447 3426 3448 var enclosingBraces = this._braceMatcher.enclosingBraces(lineNumber, column); -
trunk/Source/WebCore/inspector/front-end/TextUtils.js
r142471 r142621 78 78 * @return {boolean} 79 79 */ 80 isOpeningBraceChar: function(char) 81 { 82 return char === "(" || char === "{"; 83 }, 84 85 /** 86 * @param {string} char 87 * @return {boolean} 88 */ 89 isClosingBraceChar: function(char) 90 { 91 return char === ")" || char === "}"; 92 }, 93 94 /** 95 * @param {string} char 96 * @return {boolean} 97 */ 80 98 isBraceChar: function(char) 81 99 { 82 return char === "(" || char === ")" || 83 char === "{" || char === "}"; 100 return WebInspector.TextUtils.isOpeningBraceChar(char) || WebInspector.TextUtils.isClosingBraceChar(char); 84 101 } 85 102 }
Note: See TracChangeset
for help on using the changeset viewer.