Web Inspector: highlight matching braces in DTE.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2013 11:51:08 +0000 (11:51 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2013 11:51:08 +0000 (11:51 +0000)
commit69120b88ddc8390d1ce7c81ee69c523050e141ac
tree26d1eb42099c36ab7ef7f0e5e015f23201c1a7e2
parentde16c43e94648252cbd4cbc75e7d7393a96a5069
Web Inspector: highlight matching braces in DTE.
https://bugs.webkit.org/show_bug.cgi?id=108697

Patch by Andrey Lushnikov <lushnikov@chromium.org> on 2013-02-07
Reviewed by Pavel Feldman.

Source/WebCore:

Implement BraceMatcher class which for given position in textModel
will respond with enclosing brace pair for that position.
Make use of this class in DefaultTextEditor by handling
selectionChange event. Make use of this class in "_closingBlockOffset"
method of TextEditorMainPanel as this method implements similar
functionality.

New test: inspector/editor/brace-matcher.html

* inspector/front-end/DefaultTextEditor.js:
(WebInspector.TextEditorMainPanel):
(WebInspector.TextEditorMainPanel.prototype._applyDomUpdates):
(WebInspector.TextEditorMainPanel.prototype._closingBlockOffset):
(WebInspector.TextEditorMainPanel.prototype._handleSelectionChange):
(WebInspector.TextEditorMainPanel.BraceHighlightController):
(WebInspector.TextEditorMainPanel.BraceHighlightController.prototype.handleSelectionChange):
* inspector/front-end/TextEditorHighlighter.js:
(WebInspector.TextEditorHighlighter.prototype._highlightLines):
* inspector/front-end/TextEditorModel.js:
(WebInspector.TextEditorModel.endsWithBracketRegex):
(WebInspector.TextEditorModel.endsWithBracketRegex.):
* inspector/front-end/textEditor.css:
(.text-editor-brace-match):

LayoutTests:

New layout test to verify brace matching functionality. Fix some
layout test expectations as the patch removes braces from highlight
ranges.

* inspector/editor/brace-matcher-expected.txt: Added.
* inspector/editor/brace-matcher.html: Added.
* inspector/editor/highlighter-basics-expected.txt:
* inspector/editor/text-editor-long-line-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142091 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/inspector/editor/brace-matcher-expected.txt [new file with mode: 0644]
LayoutTests/inspector/editor/brace-matcher.html [new file with mode: 0644]
LayoutTests/inspector/editor/highlighter-basics-expected.txt
LayoutTests/inspector/editor/text-editor-long-line-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/DefaultTextEditor.js
Source/WebCore/inspector/front-end/TextEditorHighlighter.js
Source/WebCore/inspector/front-end/TextEditorModel.js
Source/WebCore/inspector/front-end/textEditor.css