adobe/brackets — pull request #4300 by njx (2013-06-20 22:29:18+00:00)
Title: Initial implementation of incremental update

* `_updateDOM` now takes an optional CodeMirror change record. If specified, it tries to do an incremental update of just the range affected by the change.
* `DOMUpdater` takes that change record, and if it can determine that the affected range is a single subtree, it only rebuilds that subtree and substitutes it into the original tree, updating the id->node map and parent signatures.
* To make that easier, refactored out the signature computation into `_updateHash()`.
* Added a callback for `onopentagend` from the tokenizer so we can detect when an empty tag like `` is closed and set its end position properly (this fixes the problem Randy noted and is also necessary for some of the unit tests that edit empty tags to pass).
* Updated `SimpleDOMBuilder` to take a start offset, so that if it's only rebuilding a portion of the tree, the node start/end offsets it calculates are property relative to the full document rather than just the rebuilt portion.

I added some unit tests around these cases, but haven't added really granular unit tests to make sure that the new offsets are being properly calculated, etc. Manual testing also suggests that it's basically working, at least as long as you're only editing existing text or attributes rather than adding new things.