Refactoring text layer builder

This work is needed to clean up the text layer and for separating the text layer builder from the PDF find controller. This PR:

- fixes code style;
- moves constants to the top of the file;
- reduces unnecessary `typeof` usage;
- caches loop variables;
- reduces unnecessary `in` usage;
- uses strict equalities where possible;
- removes an old TODO;
- uses more describing variable names;
- removes `highlightDiv` and `appendText` function as `appendText` was just a direct call to `appendTextToDiv` and `highlightDiv` has been inlined because in code it is clear what is does, so this saves some function calls;