Refactor html syntax highlighting and implement profiling
Edit Book: 2x speedup for inline spell checking. Useful if you are editing large HTML files (over 100KB in size).

Qt's text layout engine becomes very slow if we store arbitrary python
objects in QTextCharFormat classes. So refactor to not do that.
...
A small speedup by using QTextCharFormat instead of SyntaxCharFormat when cloning formats
Another small speedup
Another small speedup
30% speed up on html syntax highlighting by using a C implementation for the Tag and State classes
...
...
...
Edit Book: Fix non-BMP unicode characters causing matching tag highlighting to be slightly off on linux
MOBI Input: Preserve the dc:rights metadata during conversion. Fixes #1333468 [dc:rights element removed from opf](https://bugs.launchpad.net/calibre/+bug/1333468)
Fix #1333459 [Edit Book: Starting mdash breaks spellchecking](https://bugs.launchpad.net/calibre/+bug/1333459)

(regression introduced by performance optimizations from yesterday)
...
Use a C implementation for int he inline spell check inner loop. Speeds it up by about 30% again.
...
Economic and Political Weekly by Krittika Goyal
Edit Book: Run syntax highlighting in the background so that it does not affect responsiveness of the user interface

Technically, the syntax highlighting now does idle processing, that is
it yields after every line of text is highlighted to allow the rest of
the UI to respond to user interaction. This gives an excellent
illusion of running int he background, except for pathological files
with very long lines (such as those that have all their markup on a
single line).
Fix #1333932 [Edit Book: Double-click on a file category raises a error](https://bugs.launchpad.net/calibre/+bug/1333932)
Fix #1333944 [Edit Book: Strange error when deleting style](https://bugs.launchpad.net/calibre/+bug/1333944)